From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117933 invoked by alias); 20 Sep 2019 19:20:27 -0000 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 Received: (qmail 117880 invoked by uid 89); 20 Sep 2019 19:20:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=linking, specially X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Sep 2019 19:20:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3330E5607F; Fri, 20 Sep 2019 15:20:22 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id syVywTFDbGpK; Fri, 20 Sep 2019 15:20:22 -0400 (EDT) Received: from murgatroyd.Home (71-218-73-27.hlrn.qwest.net [71.218.73.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id D233D56079; Fri, 20 Sep 2019 15:20:21 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 7/8] Back out earlier Ada exception change Date: Fri, 20 Sep 2019 19:20:00 -0000 Message-Id: <20190920192017.15293-8-tromey@adacore.com> In-Reply-To: <20190920192017.15293-1-tromey@adacore.com> References: <20190920192017.15293-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-09/txt/msg00407.txt.bz2 commit 2ff0a9473 (Fix "catch exception" with dynamic linking) changed how ada-lang.c creates expressions to determine if an exception catchpoint should stop. That patch is no longer needed now that copy relocations are handled more directly. 2019-08-21 Tom Tromey * ada-lang.c (ada_lookup_simple_minsyms): Remove. (create_excep_cond_exprs): Simplify exception string computation. (ada_exception_catchpoint_cond_string): Likewise. --- gdb/ChangeLog | 6 +++ gdb/ada-lang.c | 107 ++++++++++++------------------------------------- 2 files changed, 31 insertions(+), 82 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2c8be4de857..e4702b96876 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4845,36 +4845,6 @@ ada_lookup_simple_minsym (const char *name) return result; } -/* Return all the bound minimal symbols matching NAME according to Ada - decoding rules. Returns an empty vector if there is no such - minimal symbol. Names prefixed with "standard__" are handled - specially: "standard__" is first stripped off, and only static and - global symbols are searched. */ - -static std::vector -ada_lookup_simple_minsyms (const char *name) -{ - std::vector result; - - symbol_name_match_type match_type = name_match_type_from_name (name); - lookup_name_info lookup_name (name, match_type); - - symbol_name_matcher_ftype *match_name - = ada_get_symbol_name_matcher (lookup_name); - - for (objfile *objfile : current_program_space->objfiles ()) - { - for (minimal_symbol *msymbol : objfile->msymbols ()) - { - if (match_name (MSYMBOL_LINKAGE_NAME (msymbol), lookup_name, NULL) - && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline) - result.push_back ({msymbol, objfile}); - } - } - - return result; -} - /* For all subprograms that statically enclose the subprogram of the selected frame, add symbols matching identifier NAME in DOMAIN and their blocks to the list of data in OBSTACKP, as for @@ -12367,6 +12337,8 @@ static void create_excep_cond_exprs (struct ada_catchpoint *c, enum ada_exception_catchpoint_kind ex) { + struct bp_location *bl; + /* Nothing to do if there's no specific exception to catch. */ if (c->excep_string.empty ()) return; @@ -12375,45 +12347,28 @@ create_excep_cond_exprs (struct ada_catchpoint *c, if (c->loc == NULL) return; - /* We have to compute the expression once for each program space, - because the expression may hold the addresses of multiple symbols - in some cases. */ - std::multimap loc_map; - for (bp_location *bl = c->loc; bl != NULL; bl = bl->next) - loc_map.emplace (bl->pspace, bl); - - scoped_restore_current_program_space save_pspace; + /* Compute the condition expression in text form, from the specific + expection we want to catch. */ + std::string cond_string + = ada_exception_catchpoint_cond_string (c->excep_string.c_str (), ex); - std::string cond_string; - program_space *last_ps = nullptr; - for (auto iter : loc_map) + /* Iterate over all the catchpoint's locations, and parse an + expression for each. */ + for (bl = c->loc; bl != NULL; bl = bl->next) { struct ada_catchpoint_location *ada_loc - = (struct ada_catchpoint_location *) iter.second; - - if (ada_loc->pspace != last_ps) - { - last_ps = ada_loc->pspace; - set_current_program_space (last_ps); - - /* Compute the condition expression in text form, from the - specific expection we want to catch. */ - cond_string - = ada_exception_catchpoint_cond_string (c->excep_string.c_str (), - ex); - } - + = (struct ada_catchpoint_location *) bl; expression_up exp; - if (!ada_loc->shlib_disabled) + if (!bl->shlib_disabled) { const char *s; s = cond_string.c_str (); try { - exp = parse_exp_1 (&s, ada_loc->address, - block_for_pc (ada_loc->address), + exp = parse_exp_1 (&s, bl->address, + block_for_pc (bl->address), 0); } catch (const gdb_exception_error &e) @@ -13083,18 +13038,18 @@ ada_exception_catchpoint_cond_string (const char *excep_string, enum ada_exception_catchpoint_kind ex) { int i; + bool is_standard_exc = false; std::string result; - const char *name; if (ex == ada_catch_handlers) { /* For exception handlers catchpoints, the condition string does not use the same parameter as for the other exceptions. */ - name = ("long_integer (GNAT_GCC_exception_Access" - "(gcc_exception).all.occurrence.id)"); + result = ("long_integer (GNAT_GCC_exception_Access" + "(gcc_exception).all.occurrence.id)"); } else - name = "long_integer (e)"; + result = "long_integer (e)"; /* The standard exceptions are a special case. They are defined in runtime units that have been compiled without debugging info; if @@ -13113,35 +13068,23 @@ ada_exception_catchpoint_cond_string (const char *excep_string, If an exception named contraint_error is defined in another package of the inferior program, then the only way to specify this exception as a breakpoint condition is to use its fully-qualified named: - e.g. my_package.constraint_error. - - Furthermore, in some situations a standard exception's symbol may - be present in more than one objfile, because the compiler may - choose to emit copy relocations for them. So, we have to compare - against all the possible addresses. */ + e.g. my_package.constraint_error. */ - /* Storage for a rewritten symbol name. */ - std::string std_name; for (i = 0; i < sizeof (standard_exc) / sizeof (char *); i++) { if (strcmp (standard_exc [i], excep_string) == 0) { - std_name = std::string ("standard.") + excep_string; - excep_string = std_name.c_str (); + is_standard_exc = true; break; } } - excep_string = ada_encode (excep_string); - std::vector symbols - = ada_lookup_simple_minsyms (excep_string); - for (const bound_minimal_symbol &msym : symbols) - { - if (!result.empty ()) - result += " or "; - string_appendf (result, "%s = %s", name, - pulongest (BMSYMBOL_VALUE_ADDRESS (msym))); - } + result += " = "; + + if (is_standard_exc) + string_appendf (result, "long_integer (&standard.%s)", excep_string); + else + string_appendf (result, "long_integer (&%s)", excep_string); return result; } -- 2.20.1