From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32576 invoked by alias); 15 Nov 2011 07:30:15 -0000 Received: (qmail 32559 invoked by uid 22791); 15 Nov 2011 07:30:11 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Nov 2011 07:29:58 +0000 Received: from nat-jpt.mentorg.com ([192.94.33.2] helo=PR1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RQDSv-0001ZW-R7 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 14 Nov 2011 23:29:58 -0800 Received: from [127.0.0.1] ([172.16.63.104]) by PR1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 15 Nov 2011 16:29:55 +0900 Message-ID: <4EC214F0.4070104@codesourcery.com> Date: Tue, 15 Nov 2011 07:30:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch 1/5] Call update_global_location_list conditionally in install_breakpoint References: <4EC20E2E.6010402@codesourcery.com> In-Reply-To: <4EC20E2E.6010402@codesourcery.com> Content-Type: multipart/mixed; boundary="------------070002030402060901000001" X-IsSubscribed: yes 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: 2011-11/txt/msg00375.txt.bz2 This is a multi-part message in MIME format. --------------070002030402060901000001 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 882 During `pending tracepoint' work, we find install_breakpoint calls update_global_location_list(1), which may throw error, and we have (at the end of create_break() ): /* That's it. Discard the cleanups for data inserted into the breakpoint. */ discard_cleanups (bkpt_chain); /* But cleanup everything else. */ do_cleanups (old_chain); /* error call may happen here - have BKPT_CHAIN already discarded. */ update_global_location_list (1); return 1; So, we should make sure that install_breakpoint called in create_breakpoint doesn't call update_global_location_list(1), so that update_global_location_list can be deferred to call at the end of create_breakpoint. In this patch, we add a new parameter to determine to call update_global_location_list. We pass 0 to install_breakpoint when it is used in create_breakpoint and its callee. -- Yao (齐尧) --------------070002030402060901000001 Content-Type: text/x-patch; name="0001-refactor-add-one-more-param-in-install_breakpoint.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-refactor-add-one-more-param-in-install_breakpoint.patch" Content-length: 4054 * ada-lang.c (create_ada_exception_catchpoint): * breakpoint.c (install_breakpoint): Add one more parameter so that update_global_location_list is called conditionally. (create_fork_vfork_event_catchpoint): Update. (create_syscall_event_catchpoint): Update. (create_breakpoint_sal): Update. (create_breakpoint_sal): Update. Call do_cleanups before install_breakpoint. * breakpoint.h (install_breakpoint): Update declaration. --- gdb/ada-lang.c | 2 +- gdb/breakpoint.c | 18 ++++++++++-------- gdb/breakpoint.h | 6 ++++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 1dabd0f..2edbe7f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11705,7 +11705,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch, ops, tempflag, from_tty); c->excep_string = excep_string; create_excep_cond_exprs (c); - install_breakpoint (0, &c->base); + install_breakpoint (0, &c->base, 1); } /* Implement the "catch exception" command. */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8f09296..2554337 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6680,14 +6680,16 @@ init_catchpoint (struct breakpoint *b, } void -install_breakpoint (int internal, struct breakpoint *b) +install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (!internal) mention (b); observer_notify_breakpoint_created (b); - update_global_location_list (1); + + if (update_gll) + update_global_location_list (1); } static void @@ -6701,7 +6703,7 @@ create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch, c->forked_inferior_pid = null_ptid; - install_breakpoint (0, &c->base); + install_breakpoint (0, &c->base, 1); } /* Exec catchpoints. */ @@ -6822,7 +6824,7 @@ create_syscall_event_catchpoint (int tempflag, VEC(int) *filter, init_catchpoint (&c->base, gdbarch, tempflag, NULL, ops); c->syscalls_to_be_caught = filter; - install_breakpoint (0, &c->base); + install_breakpoint (0, &c->base, 1); } static int @@ -7331,7 +7333,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch, enabled, internal, display_canonical); discard_cleanups (old_chain); - install_breakpoint (internal, b); + install_breakpoint (internal, b, 0); } /* Remove element at INDEX_TO_REMOVE from SAL, shifting other @@ -7961,7 +7963,7 @@ create_breakpoint (struct gdbarch *gdbarch, corresponds to this one */ tp->static_trace_marker_id_idx = i; - install_breakpoint (internal, &tp->base); + install_breakpoint (internal, &tp->base, 0); do_cleanups (old_chain); } @@ -9397,7 +9399,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty, throw_exception (e); } - install_breakpoint (internal, b); + install_breakpoint (internal, b, 1); } /* Return count of debug registers needed to watch the given expression. @@ -9795,7 +9797,7 @@ catch_exec_command_1 (char *arg, int from_tty, &catch_exec_breakpoint_ops); c->exec_pathname = NULL; - install_breakpoint (0, &c->base); + install_breakpoint (0, &c->base, 1); } static enum print_stop_action diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 506ae80..8e03264 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1098,9 +1098,11 @@ extern void /* Add breakpoint B on the breakpoint list, and notify the user, the target and breakpoint_created observers of its existence. If INTERNAL is non-zero, the breakpoint number will be allocated from - the internal breakpoint count. */ + the internal breakpoint count. If UPDATE_GLL is non-zero, + update_global_location_list will be called. */ -extern void install_breakpoint (int internal, struct breakpoint *b); +extern void install_breakpoint (int internal, struct breakpoint *b, + int update_gll); extern int create_breakpoint (struct gdbarch *gdbarch, char *arg, char *cond_string, int thread, -- 1.7.0.4 --------------070002030402060901000001--