RFC: hacky fix for PR 12406

Joel Brobecker brobecker@adacore.com
Thu Jan 12 05:59:00 GMT 2012


> This patch changes the output to:
> 
>     (gdb) set stop-on-solib-events 1
>     (gdb) r
>     Starting program: /tmp/q 
>     [Inferior loaded library /lib64/ld-linux-x86-64.so.2]
>     Stopped due to shared library event
> 
> I could not find a good way to get the information about what library
> was loaded from the library-loading code to the bpstat_print code.  This
> approach seems like a hack to me -- so I was wondering if anyone has a
> better suggestion.

Yeah, it doesn't look super great, but it is better than nothing, IMO.

It looks a lot easier to implement this on platforms that use
TARGET_WAITKIND_LOADED events, because we could associate the library
name to the target_waitstatus value. For other platforms where this
is based on a breakpoint rather than a kernel event, on the other
hand... I'm not even convinced that we'll get one breakpoint per
shared library being mapped. Particularly at startup time, I can
see us hitting one breakpoint once all SOs have been mapped, and
not before. If it were the case, attaching one shared-library event
per breakpoint event does not seem to make sense.

An idea that crossed my mind: Add a flag to each entry in our SO
list. Everytime we stop, we use that flag to determine which entries
are new. We can probably use something like the normal-stop hook to
set the flag just before giving the prompt back to the user. Would
that work? It would support the situation I mentioned above where
we get one breakpoint event for multiple shared libraries...

-- 
Joel



More information about the Gdb-patches mailing list