From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23727 invoked by alias); 8 Nov 2011 20:23:37 -0000 Received: (qmail 23717 invoked by uid 22791); 8 Nov 2011 20:23:35 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Nov 2011 20:23:21 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA8KNGa0017209 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Nov 2011 15:23:16 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pA8KNGle013867; Tue, 8 Nov 2011 15:23:16 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id pA8KNDf6001375; Tue, 8 Nov 2011 15:23:14 -0500 From: Tom Tromey To: Pedro Alves Cc: gdb-patches@sourceware.org, Ulrich Weigand Subject: Re: RFC: don't set the pspace on ordinary breakpoints References: <201111022021.03286.pedro@codesourcery.com> <201111031601.51221.pedro@codesourcery.com> Date: Tue, 08 Nov 2011 20:23:00 -0000 In-Reply-To: (Tom Tromey's message of "Tue, 08 Nov 2011 12:31:37 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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/msg00207.txt.bz2 >>>>> "Tom" == Tom Tromey writes: Tom> I think I will change linespec to ignore program spaces in this state. The appended has two parts: the linespec.c change, relative to the big patch I posted, and the breakpoint.c change I think is needed too. Only the latter makes sense in the context of this thread. I *think* the should_be_inserted change is all that was really needed, after re-reading all the messages in this thread. Let me know what you think. The addr_string_to_sals change is there to handle the case where a breakpoint has hits in just the program space that is in the executing_startup state. In this situation, linespec can throw an exception, and if we do not take the "not_found_and_ok" branch, then we will proceed to disable the breakpoint... which is wrong, we want to re-set again when the program space is done with startup. Tom diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 610aece..dd1f935 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1578,7 +1578,7 @@ should_be_inserted (struct bp_location *bl) if (!bl->enabled || bl->shlib_disabled || bl->duplicate) return 0; - if (bl->pspace->executing_startup) + if (user_breakpoint_p (bl->owner) && bl->pspace->executing_startup) return 0; /* This is set for example, when we're attached to the parent of a @@ -11725,6 +11725,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found) if (e.error == NOT_FOUND_ERROR && (b->condition_not_parsed || (b->loc && b->loc->shlib_disabled) + || (b->loc && b->loc->pspace->executing_startup) || b->enable_state == bp_disabled)) not_found_and_ok = 1; diff --git a/gdb/linespec.c b/gdb/linespec.c index 21189d3..c24a7a0 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -351,6 +351,8 @@ iterate_over_all_matching_symtabs (const char *name, { if (search_pspace != NULL && search_pspace != pspace) continue; + if (pspace->executing_startup) + continue; set_current_program_space (pspace); @@ -1327,6 +1329,12 @@ decode_indirect (struct linespec_state *self, char **argptr) CORE_ADDR pc; char *initial = *argptr; + if (current_program_space->executing_startup) + /* The error message doesn't really matter, because this case + should only hit during breakpoint reset. */ + throw_error (NOT_FOUND_ERROR, _("cannot evaluate expressions while " + "program space is in startup")); + (*argptr)++; pc = value_as_address (parse_to_comma_and_eval (argptr)); @@ -1872,6 +1880,9 @@ lookup_prefix_sym (char **argptr, char *p, VEC (symtab_p) *file_symtabs, { struct block *search_block; + /* Program spaces that are executing startup should have + been filtered out earlier. */ + gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup); set_current_program_space (SYMTAB_PSPACE (elt)); search_block = get_search_block (elt); iterate_over_symbols (search_block, copy, STRUCT_DOMAIN, @@ -2020,6 +2031,9 @@ find_method (struct linespec_state *self, char *saved_arg, struct type *t; struct program_space *pspace; + /* Program spaces that are executing startup should have + been filtered out earlier. */ + gdb_assert (!SYMTAB_PSPACE (SYMBOL_SYMTAB (sym))->executing_startup); pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym)); set_current_program_space (pspace); t = check_typedef (SYMBOL_TYPE (sym)); @@ -2122,6 +2136,9 @@ collect_symtabs_from_filename (const char *file) /* Find that file's data. */ ALL_PSPACES (pspace) { + if (pspace->executing_startup) + continue; + set_current_program_space (pspace); iterate_over_symtabs (file, add_symtabs_to_list, &collector); } @@ -2698,6 +2715,8 @@ search_minsyms_for_name (struct collect_info *info, const char *name, { if (search_pspace != NULL && search_pspace != pspace) continue; + if (pspace->executing_startup) + continue; set_current_program_space (pspace); @@ -2734,6 +2753,9 @@ add_matching_symbols_to_info (const char *name, } else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt)) { + /* Program spaces that are executing startup should have + been filtered out earlier. */ + gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup); set_current_program_space (SYMTAB_PSPACE (elt)); iterate_over_symbols (get_search_block (elt), name, VAR_DOMAIN, collect_symbols,