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]

[03/19] set_longjmp_breakpoint


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


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