Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* behavior of hook-stop command
@ 2011-08-02  2:44 Amker.Cheng
  2011-08-02 22:58 ` Sergio Durigan Junior
  0 siblings, 1 reply; 3+ messages in thread
From: Amker.Cheng @ 2011-08-02  2:44 UTC (permalink / raw)
  To: gdb; +Cc: hellogcc

Hi,
In gdb document, it is said hook-stop makes the associated commands
execute every time execution stops in your program.

while for cases where continue command included in hook-stop, it's not true.
for example:
define hook-stop
  p /x $pc
  continue
end

User defined hook-stop command is executed by codes:

void execute_cmd_pre_hook (struct cmd_list_element *c)
{
  if ((c->hook_pre) && (!c->hook_in))
    {
      struct cleanup *cleanups = make_cleanup (clear_hook_in_cleanup, c);
      c->hook_in = 1; /* Prevent recursive hooking.  */
      execute_user_command (c->hook_pre, (char *) 0);
      do_cleanups (cleanups);
    }
}
Since hook_in is set to 1, the (!c->hook_in) is false next time
breakpoint is hit, resulting in
hook-stop will be executed at the first breakpoint.

I understand hook_in is essential to prevent gdb from possible
recursion and seems hard
to change the behavior within current infrastructure.
Is this a bug? Should we state this in GDB document?

Any suggestion? Thanks.
-- 
Best Regards.


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

* Re: behavior of hook-stop command
  2011-08-02  2:44 behavior of hook-stop command Amker.Cheng
@ 2011-08-02 22:58 ` Sergio Durigan Junior
  2011-08-03  6:58   ` Amker.Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: Sergio Durigan Junior @ 2011-08-02 22:58 UTC (permalink / raw)
  To: Amker.Cheng; +Cc: gdb, hellogcc

Hi Amker,

"Amker.Cheng" <amker.cheng@gmail.com> writes:

> In gdb document, it is said hook-stop makes the associated commands
> execute every time execution stops in your program.
>
> while for cases where continue command included in hook-stop, it's not true.

[...]

> I understand hook_in is essential to prevent gdb from possible
> recursion and seems hard
> to change the behavior within current infrastructure.
> Is this a bug? Should we state this in GDB document?

I believe it could be treated as a bug.  I'm not sure if this will be
fixed on the code, or on the documentation, but either way I suggest you
to open a bug in GDB bugzilla, please:

   http://sourceware.org/bugzilla/

Thanks,

Sergio.


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

* Re: behavior of hook-stop command
  2011-08-02 22:58 ` Sergio Durigan Junior
@ 2011-08-03  6:58   ` Amker.Cheng
  0 siblings, 0 replies; 3+ messages in thread
From: Amker.Cheng @ 2011-08-03  6:58 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: gdb, hellogcc

> I believe it could be treated as a bug.  I'm not sure if this will be
> fixed on the code, or on the documentation, but either way I suggest you
> to open a bug in GDB bugzilla, please:
>
>   http://sourceware.org/bugzilla/

Hi,

bug filed at http://sourceware.org/bugzilla/show_bug.cgi?id=13052

-- 
Best Regards.


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

end of thread, other threads:[~2011-08-03  6:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02  2:44 behavior of hook-stop command Amker.Cheng
2011-08-02 22:58 ` Sergio Durigan Junior
2011-08-03  6:58   ` Amker.Cheng

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