* RFC: hacky fix for PR 12406
@ 2012-01-11 19:25 Tom Tromey
2012-01-12 0:12 ` Jan Kratochvil
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Tom Tromey @ 2012-01-11 19:25 UTC (permalink / raw)
To: gdb-patches
I would like to get some feedback on this.
PR 12406 concerns what is printed when stop-on-solib-events is set:
(gdb) set stop-on-solib-events 1
(gdb) r
Starting program: /tmp/q
Stopped due to shared library event
What is missing here is any indication of what library was loaded.
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.
This regtests fine on x86-64 F15.
Tom
2012-01-11 Tom Tromey <tromey@redhat.com>
PR symtab/12406:
* solib.c (update_solib_list): Print message if
stop_on_solib_events is set.
diff --git a/gdb/solib.c b/gdb/solib.c
index f591785..66e2f94 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -810,6 +810,11 @@ update_solib_list (int from_tty, struct target_ops *target)
_("Error while mapping shared "
"library sections:\n"));
+ if (stop_on_solib_events)
+ ui_out_message (current_uiout, 0,
+ _("[Inferior loaded library %s]\n"),
+ i->so_name);
+
/* Notify any observer that the shared object has been
loaded now that we've added it to GDB's tables. */
observer_notify_solib_loaded (i);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: hacky fix for PR 12406
2012-01-11 19:25 RFC: hacky fix for PR 12406 Tom Tromey
@ 2012-01-12 0:12 ` Jan Kratochvil
2012-01-12 5:59 ` Joel Brobecker
2012-01-12 11:40 ` Gary Benson
2 siblings, 0 replies; 6+ messages in thread
From: Jan Kratochvil @ 2012-01-12 0:12 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, Gary Benson
On Wed, 11 Jan 2012 19:55:30 +0100, Tom Tromey wrote:
> 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 find it OK, also an unload would be good to notify there. There will still
be some no-operations stops without Gary's STAP-probe-in-ld.so.
Thanks,
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: hacky fix for PR 12406
2012-01-11 19:25 RFC: hacky fix for PR 12406 Tom Tromey
2012-01-12 0:12 ` Jan Kratochvil
@ 2012-01-12 5:59 ` Joel Brobecker
2012-01-12 21:41 ` Tom Tromey
2012-01-12 11:40 ` Gary Benson
2 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2012-01-12 5:59 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: hacky fix for PR 12406
2012-01-11 19:25 RFC: hacky fix for PR 12406 Tom Tromey
2012-01-12 0:12 ` Jan Kratochvil
2012-01-12 5:59 ` Joel Brobecker
@ 2012-01-12 11:40 ` Gary Benson
2 siblings, 0 replies; 6+ messages in thread
From: Gary Benson @ 2012-01-12 11:40 UTC (permalink / raw)
To: gdb-patches
Tom Tromey wrote:
> I would like to get some feedback on this.
>
> PR 12406 concerns what is printed when stop-on-solib-events is set:
>
> (gdb) set stop-on-solib-events 1
> (gdb) r
> Starting program: /tmp/q
> Stopped due to shared library event
>
> What is missing here is any indication of what library was loaded.
>
> 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
Could this be a separate option, trace-solib-events maybe? It seems
like this printing might also be useful when stop-on-solib-events is
off.
Also, as Jan said, it would be nice to have unload notifications too.
> 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.
I like Joel's idea of a flag, it's what I'd try. You would probably
need to do something like that for unload notifications anyway.
Cheers,
Gary
--
http://gbenson.net/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: hacky fix for PR 12406
2012-01-12 5:59 ` Joel Brobecker
@ 2012-01-12 21:41 ` Tom Tromey
2012-01-13 15:48 ` Gary Benson
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2012-01-12 21:41 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> An idea that crossed my mind: Add a flag to each entry in our SO
Joel> list. Everytime we stop, we use that flag to determine which entries
Joel> are new. We can probably use something like the normal-stop hook to
Joel> set the flag just before giving the prompt back to the user. Would
Joel> that work? It would support the situation I mentioned above where
Joel> we get one breakpoint event for multiple shared libraries...
Thanks for the idea. I will give it a try.
Tom> [Inferior loaded library /lib64/ld-linux-x86-64.so.2]
Tom> Stopped due to shared library event
Gary> Could this be a separate option, trace-solib-events maybe? It seems
Gary> like this printing might also be useful when stop-on-solib-events is
Gary> off.
Gary> Also, as Jan said, it would be nice to have unload notifications too.
This comment inspired me to take another look at the whole problem.
I actually do not much like stop-on-solib-events. I think 'catch'
commands are better, because they offer the user more control: commands
at the stop point, "silent", conditions.
So now I am thinking that, while I may still add the notification in
some form, I will also resurrect "catch load" and "catch unload",
something like "catch load [REGEX] [if ...]"
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: hacky fix for PR 12406
2012-01-12 21:41 ` Tom Tromey
@ 2012-01-13 15:48 ` Gary Benson
0 siblings, 0 replies; 6+ messages in thread
From: Gary Benson @ 2012-01-13 15:48 UTC (permalink / raw)
To: gdb-patches
Tom Tromey wrote:
> >>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
>
> Joel> An idea that crossed my mind: Add a flag to each entry in our
> Joel> SO list. Everytime we stop, we use that flag to determine
> Joel> which entries are new. We can probably use something like the
> Joel> normal-stop hook to set the flag just before giving the prompt
> Joel> back to the user. Would that work? It would support the
> Joel> situation I mentioned above where we get one breakpoint event
> Joel> for multiple shared libraries...
>
> Thanks for the idea. I will give it a try.
>
> Tom> [Inferior loaded library /lib64/ld-linux-x86-64.so.2]
> Tom> Stopped due to shared library event
>
> Gary> Could this be a separate option, trace-solib-events maybe?
> Gary> It seems like this printing might also be useful when
> Gary> stop-on-solib-events is off.
>
> Gary> Also, as Jan said, it would be nice to have unload
> Gary> notifications too.
>
> This comment inspired me to take another look at the whole problem.
>
> I actually do not much like stop-on-solib-events. I think 'catch'
> commands are better, because they offer the user more control:
> commands at the stop point, "silent", conditions.
>
> So now I am thinking that, while I may still add the notification in
> some form, I will also resurrect "catch load" and "catch unload",
> something like "catch load [REGEX] [if ...]"
Sounds nice!
Cheers,
Gary
--
http://gbenson.net/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-13 15:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-11 19:25 RFC: hacky fix for PR 12406 Tom Tromey
2012-01-12 0:12 ` Jan Kratochvil
2012-01-12 5:59 ` Joel Brobecker
2012-01-12 21:41 ` Tom Tromey
2012-01-13 15:48 ` Gary Benson
2012-01-12 11:40 ` Gary Benson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).