Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Post Hooks Broken!!! Fix Attached.
@ 2001-02-22 22:02 Steven Johnson
  2001-02-23  5:45 ` Fernando Nasser
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Johnson @ 2001-02-22 22:02 UTC (permalink / raw)
  To: gdb; +Cc: Fernando Nasser

Hi,

I Tried to use a late CVS snapshot of GDB/Insight and found my Post Hook
was broken.

It seems that it has been broken since the CLI sub-directory was
created, it was a simple problem and the patch to fix it is attached. 
Defining a Post-Hook currently overwrites the standard pre command hook,
In the definition code, I had to fix the setting of the pointers to the
hook code which were erroneously setting the pre pointers instead of the
post pointers.

Steven.

Patch Follows:
diff -C2 -r -b ../gdb_cvs/src/gdb/cli/cli-script.c src/gdb/cli/cli-script.c
*** ../gdb_cvs/src/gdb/cli/cli-script.c	Thu Feb 15 08:50:31 2001
--- src/gdb/cli/cli-script.c	Fri Feb 23 14:55:49 2001
***************
*** 1166,1171 ****
            break;
          case CMD_POST_HOOK:
!           hookc->hook_pre  = newc;  /* Target gets hooked.  */
!           newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */
            break;
          default:
--- 1166,1171 ----
            break;
          case CMD_POST_HOOK:
!           hookc->hook_post  = newc;  /* Target gets hooked.  */
!           newc->hookee_post = hookc; /* We are marked as hooking target cmd. */
            break;
          default:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Post Hooks Broken!!! Fix Attached.
  2001-02-22 22:02 Post Hooks Broken!!! Fix Attached Steven Johnson
@ 2001-02-23  5:45 ` Fernando Nasser
  2001-02-25 21:11   ` Steven Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Nasser @ 2001-02-23  5:45 UTC (permalink / raw)
  To: Steven Johnson; +Cc: gdb

Steven Johnson wrote:
> 
> Hi,
> 
> I Tried to use a late CVS snapshot of GDB/Insight and found my Post Hook
> was broken.
> 
> It seems that it has been broken since the CLI sub-directory was
> created,

Hi Steven,

It was before that.  I went through the archives and it seems that it
was broken when the the 'if' statement that referred to PRE_HOOK was
changed to a 'switch' on "hook_type", with the CMD_{PRE,POST}_HOOK
enums.

I will check the patch in latter today, but this shows that we need a
test for this.

Can you send me a sequence of commands and expected responses that would
test if the post hook has been correctly installed and another one
showing that the pre hook has not been clobbered?  I can use it to
create a dejagnu test for it.

Regards,
Fernando


 it was a simple problem and the patch to fix it is attached.
> Defining a Post-Hook currently overwrites the standard pre command hook,
> In the definition code, I had to fix the setting of the pointers to the
> hook code which were erroneously setting the pre pointers instead of the
> post pointers.
> 
> Steven.
> 
> Patch Follows:
> 
>   ------------------------------------------------------------------------
> diff -C2 -r -b ../gdb_cvs/src/gdb/cli/cli-script.c src/gdb/cli/cli-script.c
> *** ../gdb_cvs/src/gdb/cli/cli-script.c Thu Feb 15 08:50:31 2001
> --- src/gdb/cli/cli-script.c    Fri Feb 23 14:55:49 2001
> ***************
> *** 1166,1171 ****
>             break;
>           case CMD_POST_HOOK:
> !           hookc->hook_pre  = newc;  /* Target gets hooked.  */
> !           newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */
>             break;
>           default:
> --- 1166,1171 ----
>             break;
>           case CMD_POST_HOOK:
> !           hookc->hook_post  = newc;  /* Target gets hooked.  */
> !           newc->hookee_post = hookc; /* We are marked as hooking target cmd. */
>             break;
>           default:

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Post Hooks Broken!!! Fix Attached.
  2001-02-23  5:45 ` Fernando Nasser
@ 2001-02-25 21:11   ` Steven Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Johnson @ 2001-02-25 21:11 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: gdb

Hi Fernando,

Fernando Nasser wrote:
> 
> Hi Steven,
> 
> It was before that.  I went through the archives and it seems that it
> was broken when the the 'if' statement that referred to PRE_HOOK was
> changed to a 'switch' on "hook_type", with the CMD_{PRE,POST}_HOOK
> enums.
> 
> I will check the patch in latter today, but this shows that we need a
> test for this.
> 

Doesn't surprise me, I hadn't done anything with GDB for a while.

> Can you send me a sequence of commands and expected responses that would
> test if the post hook has been correctly installed and another one
> showing that the pre hook has not been clobbered?  I can use it to
> create a dejagnu test for it.

Here it is:

(gdb)echo hooked
hooked
(gdb)define hook-echo
>echo before
>end
(gdb)echo hooked
beforehooked
(gdb)define hookpost-echo
>echo after
>end
(gdb)echo hooked
beforehookedafter
(gdb)define hook-echo
>end
(gdb)echo hooked
hookedafter
(gdb)define hookpost-echo
>end
(gdb)echo hooked
hooked
(gdb)

I hope this is what you were looking for?  I used echo, because I
thought it would be easy to test with it on every platform.  Obviously
there are a few permutations of this but Im not sure they are worth
checking individually.

Regards,
Steven Johnson


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-02-25 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-22 22:02 Post Hooks Broken!!! Fix Attached Steven Johnson
2001-02-23  5:45 ` Fernando Nasser
2001-02-25 21:11   ` Steven Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox