* [03/19] set_longjmp_breakpoint
@ 2009-06-05 21:15 Ulrich Weigand
2009-06-05 22:00 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Weigand @ 2009-06-05 21:15 UTC (permalink / raw)
To: gdb-patches
Hello,
set_longjmp_breakpoint uses
if (gdbarch_get_longjmp_target_p (current_gdbarch))
to determine whether to install a longjmp breakpoint.
This patch uses the objfile architecture of the file defining the
longjmp entry point to find the gdbarch_get_longjmp_target routine.
As a side effect, if multiple objfiles provide longjmp, *all*
instances will now get the breakpoint installed -- this may actually
be useful in some circumstances (e.g. multiple SPE images in a Cell/B.E.
application).
Bye,
Ulrich
ChangeLog:
* breakpoint.c (create_longjmp_breakpoint): Add OBJFILE parameter.
Only create breakpoint in given objfile.
(set_longjmp_breakpoint): Loop over all objfiles, set longjmp
breakpoints in each file. Use objfile architecture instead of
current_gdbarch.
Index: gdb-head/gdb/breakpoint.c
===================================================================
--- gdb-head.orig/gdb/breakpoint.c
+++ gdb-head/gdb/breakpoint.c
@@ -4423,11 +4423,11 @@ make_breakpoint_permanent (struct breakp
}
static void
-create_longjmp_breakpoint (char *func_name)
+create_longjmp_breakpoint (char *func_name, struct objfile *objfile)
{
struct minimal_symbol *m;
- if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL)
+ if ((m = lookup_minimal_symbol_text (func_name, objfile)) == NULL)
return;
set_momentary_breakpoint_at_pc (SYMBOL_VALUE_ADDRESS (m), bp_longjmp);
update_global_location_list (1);
@@ -4440,12 +4440,17 @@ create_longjmp_breakpoint (char *func_na
void
set_longjmp_breakpoint (void)
{
- if (gdbarch_get_longjmp_target_p (current_gdbarch))
+ struct objfile *objfile;
+ ALL_OBJFILES (objfile)
{
- create_longjmp_breakpoint ("longjmp");
- create_longjmp_breakpoint ("_longjmp");
- create_longjmp_breakpoint ("siglongjmp");
- create_longjmp_breakpoint ("_siglongjmp");
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ if (!gdbarch_get_longjmp_target_p (gdbarch))
+ continue;
+
+ create_longjmp_breakpoint ("longjmp", objfile);
+ create_longjmp_breakpoint ("_longjmp", objfile);
+ create_longjmp_breakpoint ("siglongjmp", objfile);
+ create_longjmp_breakpoint ("_siglongjmp", objfile);
}
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [03/19] set_longjmp_breakpoint
2009-06-05 21:15 [03/19] set_longjmp_breakpoint Ulrich Weigand
@ 2009-06-05 22:00 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2009-06-05 22:00 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:
Ulrich> As a side effect, if multiple objfiles provide longjmp, *all*
Ulrich> instances will now get the breakpoint installed -- this may actually
Ulrich> be useful in some circumstances (e.g. multiple SPE images in a Cell/B.E.
Ulrich> application).
This seems reasonable to me, but I am somewhat concerned about
performance. I think this patch means that every "next" will involve
looking up four symbols in every objfile.
Do you know how big an effect this has? Or maybe Paul could try it
on his famous kilo-.so program.
I suppose if that is very slow we could add some kind of per-inferior
cache.. ?
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-05 22:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-05 21:15 [03/19] set_longjmp_breakpoint Ulrich Weigand
2009-06-05 22:00 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox