Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: [03/19] set_longjmp_breakpoint
Date: Fri, 05 Jun 2009 21:15:00 -0000	[thread overview]
Message-ID: <200906052115.n55LF2H7027202@d12av02.megacenter.de.ibm.com> (raw)

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


             reply	other threads:[~2009-06-05 21:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-05 21:15 Ulrich Weigand [this message]
2009-06-05 22:00 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200906052115.n55LF2H7027202@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox