From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id 180083851C11 for ; Thu, 25 Jun 2020 12:07:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 180083851C11 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=none smtp.mailfrom=ro@cebitec.uni-bielefeld.de Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 1F6B6A7673; Thu, 25 Jun 2020 14:07:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0hu9sODH4QmR; Thu, 25 Jun 2020 14:07:39 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p4fddbb33.dip0.t-ipconnect.de [79.221.187.51]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 4F1A2A8008; Thu, 25 Jun 2020 14:07:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=CeBiTec.Uni-Bielefeld.DE; s=20200306; t=1593086859; bh=bIyK94/8F7tQHNxQ3KnB1Q57i8T/ODISsmQWYgxy7T4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=kgIs2AoGf9c3JRlbfWog9lMe7l9B+DyWg7zj3AhS73b3FTNht5h772a3I2UreQDhw QGRAX6S9Qr5JUV88fDlHQz5SZLa2tMMflijasuzoi6q9/9Jbyc+RQCFjqUScnYSDMb BhejgN2jV1jindzP5dIPF2qHwJMbXyM0LQ4A/OXspzSus3J4cCAKqMJ0HUEu4n30vC fU8QQl+LD91LuOwxdNCKZk2JgbCmX5NlPCvKg4cF4bELbPU7hMMm6Hn3VUmRhl1LoK SDQgFhO37g0pnJlHaNCs3P4USVugVWJrx4J5ZYfwSKXTHbbmpp0z4IhoC4Kw00QLYc toCSVvroqryvQ== From: Rainer Orth To: Pedro Alves Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] Remove obsolete gdbarch_static_transform_name References: <00d11a67-fb37-52de-859d-f8055c841668@simark.ca> <503ab954-fc05-ba9b-6418-32ca92e466bb@redhat.com> Date: Thu, 25 Jun 2020 14:07:38 +0200 In-Reply-To: <503ab954-fc05-ba9b-6418-32ca92e466bb@redhat.com> (Pedro Alves's message of "Thu, 25 Jun 2020 10:18:00 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Status: No, score=-3795.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_STOCKGEN, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2020 12:07:46 -0000 --=-=-= Content-Type: text/plain Hi Pedro, > On 6/25/20 9:26 AM, Rainer Orth wrote: >> case 'X': >> - /* SunPRO (3.0 at least) static variable encoding. */ >> - if (gdbarch_static_transform_name_p (gdbarch)) >> - goto normal; >> /* fall through */ >> > > If you're leaving the > > case 'X': > > then I think you should leave a comment in place about that > is about. I thought about that, but I strongly suspect that the comment only applies to the gdbarch_static_transform_name_p call that is gone now, not the case as a whole. I meant to check "Stabs Interface" included with the Studio compilers (READMEs/stabs.pdf, a quite extensive 170-page document), but forgot. > But I'd just remove that case X line, since the fallthrough > is to the default case anyway. Right, that's certainly clearer. Here's the revised version. Ok now? Thanks. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2020-06-24 Rainer Orth gdb: * sol2-tdep.c (sol2_static_transform_name): Remove. (sol2_init_abi): Don't register it. * gdbarch.sh (static_transform_name): Remove. * gdbarch.c, gdbarch.h: Regenerate. * dbxread.c (read_dbx_symtab) <'S'>: Remove call to gdbarch_static_transform_name. * mdebugread.c (parse_partial_symbols) <'S'>: Likewise. * stabsread.c (define_symbol) <'X'>: Remove. (define_symbol) <'S'>: Remove gdbarch_static_transform_name handling. <'V'>: Likewise. * xcoffread.c (scan_xcoff_symtab): Remove gdbarch. <'S'>: Remove call to gdbarch_static_transform_name. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol2-rm-static_transform_name.patch # HG changeset patch # Parent cc44512d0e8fabbf4adab517c02f762a26156bd5 Remove obsolete gdbarch_static_transform_name diff --git a/gdb/dbxread.c b/gdb/dbxread.c --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1460,9 +1460,6 @@ read_dbx_symtab (minimal_symbol_reader & switch (p[1]) { case 'S': - if (gdbarch_static_transform_name_p (gdbarch)) - gdbarch_static_transform_name (gdbarch, namestring); - add_psymbol_to_list (gdb::string_view (sym_name, sym_len), true, VAR_DOMAIN, LOC_STATIC, data_sect_index, diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -292,7 +292,6 @@ struct gdbarch gdbarch_relocate_instruction_ftype *relocate_instruction; gdbarch_overlay_update_ftype *overlay_update; gdbarch_core_read_description_ftype *core_read_description; - gdbarch_static_transform_name_ftype *static_transform_name; int sofun_address_maybe_missing; gdbarch_process_record_ftype *process_record; gdbarch_process_record_signal_ftype *process_record_signal; @@ -658,7 +657,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of relocate_instruction, has predicate. */ /* Skip verify of overlay_update, has predicate. */ /* Skip verify of core_read_description, has predicate. */ - /* Skip verify of static_transform_name, has predicate. */ /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */ /* Skip verify of process_record, has predicate. */ /* Skip verify of process_record_signal, has predicate. */ @@ -1437,12 +1435,6 @@ gdbarch_dump (struct gdbarch *gdbarch, s "gdbarch_dump: stap_register_suffixes = %s\n", pstring_list (gdbarch->stap_register_suffixes)); fprintf_unfiltered (file, - "gdbarch_dump: gdbarch_static_transform_name_p() = %d\n", - gdbarch_static_transform_name_p (gdbarch)); - fprintf_unfiltered (file, - "gdbarch_dump: static_transform_name = <%s>\n", - host_address_to_string (gdbarch->static_transform_name)); - fprintf_unfiltered (file, "gdbarch_dump: sw_breakpoint_from_kind = <%s>\n", host_address_to_string (gdbarch->sw_breakpoint_from_kind)); fprintf_unfiltered (file, @@ -4076,30 +4068,6 @@ set_gdbarch_core_read_description (struc } int -gdbarch_static_transform_name_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - return gdbarch->static_transform_name != NULL; -} - -const char * -gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->static_transform_name != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_static_transform_name called\n"); - return gdbarch->static_transform_name (name); -} - -void -set_gdbarch_static_transform_name (struct gdbarch *gdbarch, - gdbarch_static_transform_name_ftype static_transform_name) -{ - gdbarch->static_transform_name = static_transform_name; -} - -int gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1112,14 +1112,6 @@ typedef const struct target_desc * (gdba extern const struct target_desc * gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd); extern void set_gdbarch_core_read_description (struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description); -/* Handle special encoding of static variables in stabs debug info. */ - -extern int gdbarch_static_transform_name_p (struct gdbarch *gdbarch); - -typedef const char * (gdbarch_static_transform_name_ftype) (const char *name); -extern const char * gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name); -extern void set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch_static_transform_name_ftype *static_transform_name); - /* Set if the address in N_SO or N_FUN stabs may be zero. */ extern int gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -842,8 +842,6 @@ F;void;overlay_update;struct obj_section M;const struct target_desc *;core_read_description;struct target_ops *target, bfd *abfd;target, abfd -# Handle special encoding of static variables in stabs debug info. -F;const char *;static_transform_name;const char *name;name # Set if the address in N_SO or N_FUN stabs may be zero. v;int;sofun_address_maybe_missing;;;0;0;;0 diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -3029,10 +3029,6 @@ parse_partial_symbols (minimal_symbol_re switch (p[1]) { case 'S': - if (gdbarch_static_transform_name_p (gdbarch)) - namestring = gdbarch_static_transform_name - (gdbarch, namestring); - add_psymbol_to_list (gdb::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_STATIC, diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c --- a/gdb/sol2-tdep.c +++ b/gdb/sol2-tdep.c @@ -61,52 +61,6 @@ sol2_sigtramp_p (struct frame_info *this return sol2_pc_in_sigtramp (pc, name); } -/* Unglobalize NAME. */ - -static const char * -sol2_static_transform_name (const char *name) -{ - /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, - SunPRO) convert file static variables into global values, a - process known as globalization. In order to do this, the - compiler will create a unique prefix and prepend it to each file - static variable. For static variables within a function, this - globalization prefix is followed by the function name (nested - static variables within a function are supposed to generate a - warning message, and are left alone). The procedure is - documented in the Stabs Interface Manual, which is distributed - with the compilers, although version 4.0 of the manual seems to - be incorrect in some places, at least for SPARC. The - globalization prefix is encoded into an N_OPT stab, with the form - "G=". The globalization prefix always seems to start - with a dollar sign '$' (sparc) resp. a dot '.' (x86); a dot '.' - is used as a separator. So we simply strip everything up until - the last dot. */ - int prefix; - - switch (gdbarch_bfd_arch_info (target_gdbarch ())->arch) - { - case bfd_arch_i386: - prefix = '.'; - break; - case bfd_arch_sparc: - prefix = '$'; - break; - default: - internal_error (__FILE__, __LINE__, "Unexpected arch"); - break; - } - - if (name[0] == prefix) - { - const char *p = strrchr (name, '.'); - if (p) - return p + 1; - } - - return name; -} - static CORE_ADDR sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { @@ -155,10 +109,6 @@ sol2_init_abi (struct gdbarch_info info, SunPRO 3.0, the compiler does this for N_FUN stabs too. */ set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); - /* The Sun compilers also do "globalization"; see the comment in - sol2_static_transform_name for more information. */ - set_gdbarch_static_transform_name (gdbarch, sol2_static_transform_name); - /* Solaris uses SVR4-style shared libraries. */ set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver); diff --git a/gdb/stabsread.c b/gdb/stabsread.c --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -723,12 +723,6 @@ define_symbol (CORE_ADDR valu, const cha /* This was an anonymous type that was never fixed up. */ goto normal; - case 'X': - /* SunPRO (3.0 at least) static variable encoding. */ - if (gdbarch_static_transform_name_p (gdbarch)) - goto normal; - /* fall through */ - default: complaint (_("Unknown C++ symbol name `%s'"), string); @@ -1186,23 +1180,6 @@ define_symbol (CORE_ADDR valu, const cha SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; SET_SYMBOL_VALUE_ADDRESS (sym, valu); - if (gdbarch_static_transform_name_p (gdbarch) - && gdbarch_static_transform_name (gdbarch, sym->linkage_name ()) - != sym->linkage_name ()) - { - struct bound_minimal_symbol msym; - - msym = lookup_minimal_symbol (sym->linkage_name (), NULL, objfile); - if (msym.minsym != NULL) - { - const char *new_name = gdbarch_static_transform_name - (gdbarch, sym->linkage_name ()); - - sym->set_linkage_name (new_name); - SET_SYMBOL_VALUE_ADDRESS (sym, - BMSYMBOL_VALUE_ADDRESS (msym)); - } - } SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_file_symbols ()); break; @@ -1367,24 +1344,8 @@ define_symbol (CORE_ADDR valu, const cha SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; SET_SYMBOL_VALUE_ADDRESS (sym, valu); - if (gdbarch_static_transform_name_p (gdbarch) - && gdbarch_static_transform_name (gdbarch, sym->linkage_name ()) - != sym->linkage_name ()) - { - struct bound_minimal_symbol msym; - - msym = lookup_minimal_symbol (sym->linkage_name (), NULL, objfile); - if (msym.minsym != NULL) - { - const char *new_name = gdbarch_static_transform_name - (gdbarch, sym->linkage_name ()); - - sym->set_linkage_name (new_name); - SET_SYMBOL_VALUE_ADDRESS (sym, BMSYMBOL_VALUE_ADDRESS (msym)); - } - } SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - add_symbol_to_list (sym, get_local_symbols ()); + add_symbol_to_list (sym, get_local_symbols ()); break; case 'v': diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2114,7 +2114,6 @@ static void scan_xcoff_symtab (minimal_symbol_reader &reader, struct objfile *objfile) { - struct gdbarch *gdbarch = objfile->arch (); CORE_ADDR toc_offset = 0; /* toc offset value in data section. */ const char *filestring = NULL; @@ -2577,10 +2576,6 @@ scan_xcoff_symtab (minimal_symbol_reader switch (p[1]) { case 'S': - if (gdbarch_static_transform_name_p (gdbarch)) - namestring = gdbarch_static_transform_name - (gdbarch, namestring); - add_psymbol_to_list (gdb::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_STATIC, --=-=-=--