From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10817 invoked by alias); 5 Jun 2009 21:15:13 -0000 Received: (qmail 10805 invoked by uid 22791); 5 Jun 2009 21:15:13 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_05,KAM_STOCKGEN,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.17.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Jun 2009 21:15:06 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id n55LF42o019300 for ; Fri, 5 Jun 2009 21:15:04 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n55LF3Nk3002574 for ; Fri, 5 Jun 2009 23:15:03 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n55LF3hI027210 for ; Fri, 5 Jun 2009 23:15:03 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n55LF2H7027202 for ; Fri, 5 Jun 2009 23:15:02 +0200 Message-Id: <200906052115.n55LF2H7027202@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 05 Jun 2009 23:15:02 +0200 Subject: [03/19] set_longjmp_breakpoint To: gdb-patches@sourceware.org Date: Fri, 05 Jun 2009 21:15:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00120.txt.bz2 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