This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Support exec tracing on GNU/Linux and HP-UX


Hi Daniel,

> > Actually, not so simple, because the EXEC event counts as
> > one of the 2 events we expect during the startup phase. So the EXEC
> > events must be activated at startup-time. The only option I can see
> > at this point is to add a static global that is set during the startup
> > phase, and would then cause the EXEC event to be translated into a
> > SIGTRAP vulgaris when set.  Another approach would be to have infrun
> > treat EXEC events as SIGTRAPs during the startup phase. I don't think
> > the second option is easier to implement (infrun needs to find out
> > whether we're in the middle of startup or not, and then we need to
> > redirect EXEC events into SIGTRAP events). What do you think of
> > option 1?
> 
> Actually, I like option 2 better.  Maybe we can push pending_execs
> into a global similar to the (slightly different, though unused at
> present) inferior_ignoring_leading_exec_events?

You may not remember as this was a couple of months ago (already!),
but we had determined at the time that we could not easily disable
exec events during inferior startup on HP/UX.  So we decided to find
a way to treat these exec events as SIGTRAPs.

Here is a possible solution that does not involve the use of a global.
It involves the addition of a new parameter to wait_for_inferior. Most
of the time, we will set it so that events are not handled as is. But
during the inferior startup sequence, we  tell it to translate EXEC
events into SIGTRAPs.  I should probably add a comment at the beginning
of wait_for_inferior explaining the intent of that new parameter -
I will do that if you like the idea.

2007-12-21  Joel Brobecker  <brobecker@adacore.com>

        * infrun.c (wait_for_inferior): Add treat_exec_as_sigtrap parameter
        and use it.
        (proceed, start_remote): Update call to wait_for_inferior.
        * inferior.h (wait_for_inferior): Update declaration.
        * fork-child.c, infcmd.c, solib-irix.c, solib-osf.c, solib-sunos.c,
        solib-svr4.c, win32-nat.c: Update calls to wait_for_inferior.
        * inf-ttrace.c (inf_ttrace_wait): Report TTEVT_EXEC events as
        TARGET_WAITKIND_EXECD instead of TARGET_WAITKIND_STOPPED.

Tested on hppa-hpux, no regression.

Another option along these lines that would avoid touching most of
the files is to renaming wait_for_inferior into wait_for_inferior_1,
and then have two new routines: wait_for_inferior that would call
wait_for_inferior_1 with treat_exec_as_sigtrap=0, and then
wait_for_inferior_during_startup that would call wait_for_inferior_1
with treat_exec_as_sigtrap=1. I don't think that the change is large
enough to be worth it. I don't think I've missed any call to
wfi(), and the change itself is completely straightforward.

What do you think of the approach? I'll re-apply your patch on top
of mine, and see what we get now.

Thanks,
-- 
Joel

Attachment: wfi.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]