From patchwork Fri Mar 4 16:41:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 345 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:41:51 -0000 Delivered-To: patches@linaro.org Received: by 10.224.60.68 with SMTP id o4cs20892qah; Fri, 4 Mar 2011 08:41:15 -0800 (PST) Received: by 10.213.24.10 with SMTP id t10mr578495ebb.26.1299256874940; Fri, 04 Mar 2011 08:41:14 -0800 (PST) Received: from mtagate6.uk.ibm.com (mtagate6.uk.ibm.com [194.196.100.166]) by mx.google.com with ESMTPS id y6si38999eeh.82.2011.03.04.08.41.13 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 08:41:13 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning uweigand@de.ibm.com does not designate 194.196.100.166 as permitted sender) client-ip=194.196.100.166; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning uweigand@de.ibm.com does not designate 194.196.100.166 as permitted sender) smtp.mail=uweigand@de.ibm.com Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate6.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p24GfCT0030904 for ; Fri, 4 Mar 2011 16:41:12 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p24GfP8o1970344 for ; Fri, 4 Mar 2011 16:41:25 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p24GfCa6009383 for ; Fri, 4 Mar 2011 09:41:12 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p24GfBAD009375 for ; Fri, 4 Mar 2011 09:41:11 -0700 Message-Id: <201103041641.p24GfBAD009375@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 04 Mar 2011 17:41:11 +0100 Subject: [rfc] Work around function epilogues in update_watchpoint To: patches@linaro.org Date: Fri, 4 Mar 2011 17:41:11 +0100 (CET) From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 http://sourceware.org/ml/gdb-patches/2011-02/msg00424.html ChangeLog: * breakpoint.c (update_watchpoint): Do not attempt to recreate per-frame locations while within a function epilogue. Index: gdb/breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.536 diff -u -p -r1.536 breakpoint.c --- gdb/breakpoint.c 15 Feb 2011 21:43:25 -0000 1.536 +++ gdb/breakpoint.c 17 Feb 2011 16:07:53 -0000 @@ -1374,11 +1374,6 @@ update_watchpoint (struct breakpoint *b, if (!watchpoint_in_thread_scope (b)) return; - /* We don't free locations. They are stored in the bp_location array - and update_global_location_list will eventually delete them and - remove breakpoints if needed. */ - b->loc = NULL; - if (b->disposition == disp_del_at_next_stop) return; @@ -1389,7 +1384,15 @@ update_watchpoint (struct breakpoint *b, within_current_scope = 1; else { - struct frame_info *fi; + struct frame_info *fi = get_current_frame (); + struct gdbarch *frame_arch = get_frame_arch (fi); + CORE_ADDR frame_pc = get_frame_pc (fi); + + /* If we're in a function epilogue, unwinding may not work + properly, so do not attempt to recreate locations at this + point. See similar comments in watchpoint_check. */ + if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc)) + return; /* Save the current frame's ID so we can restore it after evaluating the watchpoint expression on its own frame. */ @@ -1405,6 +1408,11 @@ update_watchpoint (struct breakpoint *b, select_frame (fi); } + /* We don't free locations. They are stored in the bp_location array + and update_global_location_list will eventually delete them and + remove breakpoints if needed. */ + b->loc = NULL; + if (within_current_scope && reparse) { char *s;