Re: [PATCH] Simplify ada_parse_renaming
Andrew Burgess <[email protected]> Fri, 24 Jul 2026 11:11:46 +0100
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
Tom Tromey <[email protected]> writes: > While working on gnat-llvm, I found that ada_parse_renaming checks the > "loc_class" of the symbol. This caused a problem with my WIP > gnat-llvm patch, which emitted a renaming symbol as LOC_CONST. > > I've since fixed my gnat-llvm patch; but nevertheless it seems to me > that there's no need to check this. In Ada, no user-provided symbol > will have an "___XR" substring, as such symbols are all lower-cased. > > This patch removes the check, simplifying ada_parse_renaming. I cannot claim to know if your claims about Ada itself are correct or not, but if you're wrong you'll be the one fixing it! The change itself is as described, and clear, so: Approved-By: Andrew Burgess <[email protected]> Thanks, Andrew > --- > gdb/ada-lang.c | 50 ++++++++++++++++++++------------------------------ > 1 file changed, 20 insertions(+), 30 deletions(-) > > diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c > index a7019a4522c..d948c68a012 100644 > --- a/gdb/ada-lang.c > +++ b/gdb/ada-lang.c > @@ -4400,43 +4400,33 @@ ada_parse_renaming (struct symbol *sym, > const char **renaming_expr) > { > enum ada_renaming_category kind; > - const char *info; > const char *suffix; > > if (sym == NULL) > return ADA_NOT_RENAMING; > - switch (sym->loc_class ()) > + const char *info = strstr (sym->linkage_name (), "___XR"); > + if (info == nullptr) > + return ADA_NOT_RENAMING; > + switch (info[5]) > { > + case '_': > + kind = ADA_OBJECT_RENAMING; > + info += 6; > + break; > + case 'E': > + kind = ADA_EXCEPTION_RENAMING; > + info += 7; > + break; > + case 'P': > + kind = ADA_PACKAGE_RENAMING; > + info += 7; > + break; > + case 'S': > + kind = ADA_SUBPROGRAM_RENAMING; > + info += 7; > + break; > default: > return ADA_NOT_RENAMING; > - case LOC_LOCAL: > - case LOC_STATIC: > - case LOC_COMPUTED: > - case LOC_OPTIMIZED_OUT: > - info = strstr (sym->linkage_name (), "___XR"); > - if (info == NULL) > - return ADA_NOT_RENAMING; > - switch (info[5]) > - { > - case '_': > - kind = ADA_OBJECT_RENAMING; > - info += 6; > - break; > - case 'E': > - kind = ADA_EXCEPTION_RENAMING; > - info += 7; > - break; > - case 'P': > - kind = ADA_PACKAGE_RENAMING; > - info += 7; > - break; > - case 'S': > - kind = ADA_SUBPROGRAM_RENAMING; > - info += 7; > - break; > - default: > - return ADA_NOT_RENAMING; > - } > } > > if (renamed_entity != NULL) > > base-commit: 39fc0cc4aa6f82a73b9eac6b8739895484ab269f > -- > 2.55.0