From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFC] pascal: Add lowercase copy of symbol name
Date: Thu, 29 Apr 2010 22:18:00 -0000 [thread overview]
Message-ID: <002101cae7e9$e7229540$b567bfc0$@muller@ics-cnrs.unistra.fr> (raw)
Pascal language is supposed to be
case insensitive, but until now it is
not true inside GDB.
There are several reasons, but some
would like to get better support for this
feature.
Here is a step in that direction:
adding a new pascal_specific field for
general_symbol_info structure,
fill it with a lowercase copy of the symbol name
and use that lowercase copy for searches
if case_sensitivityy is off.
I did not yet really decide
exactly how I am going to use this inside that pascal
expression parser.
One idea would be to first try an exact match,
and if that fails, try again forcing case_sensitivity to off
temporarily.
Comments?
Pierre Muller
Pascal language support maintainer for GDB
2010-04-29 Pierre Muller <muller@ics.u-strasbg.fr>
* symtab.h (general_symbol_info): Add pascal_specific field with
lowercase_name subfield.
* symtab.c (symbol_init_language_specific): Initialize
pascal_specific.lowercase_name to NULL.
(symbol_set_names): Construct lowercase_name string.
(symbol_search_name): Return LOWERCASE_NAME for pascal language
if CASE_SENSITIVITY is off.
Index: src/gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.234
diff -u -p -r1.234 symtab.c
--- src/gdb/symtab.c 29 Apr 2010 14:45:38 -0000 1.234
+++ src/gdb/symtab.c 29 Apr 2010 21:51:42 -0000
@@ -353,6 +353,10 @@ symbol_init_language_specific (struct ge
{
gsymbol->language_specific.cplus_specific.demangled_name = NULL;
}
+ else if (gsymbol->language == language_pascal)
+ {
+ gsymbol->language_specific.pascal_specific.lowercase_name = NULL;
+ }
else
{
memset (&gsymbol->language_specific, 0,
@@ -532,6 +536,28 @@ symbol_set_names (struct general_symbol_
return;
}
+ if (gsymbol->language == language_pascal)
+ {
+ int i;
+ char *lc_name;
+ /* In pascal, we do the symbol lookups using the lowercase name. */
+ if (!copy_name)
+ gsymbol->name = (char *) linkage_name;
+ else
+ {
+ gsymbol->name = obstack_alloc (&objfile->objfile_obstack, len +
1);
+ memcpy (gsymbol->name, linkage_name, len);
+ gsymbol->name[len] = '\0';
+ }
+ lc_name = obstack_alloc (&objfile->objfile_obstack, len + 1);
+ for (i = 0; i < len; i++)
+ lc_name[i] = tolower (linkage_name[i]);
+ lc_name[len] = '\0';
+ gsymbol->language_specific.pascal_specific.lowercase_name = lc_name;
+ return;
+ }
+
+
if (objfile->demangled_names_hash == NULL)
create_demangled_names_hash (objfile);
@@ -691,6 +717,10 @@ symbol_search_name (const struct general
{
if (gsymbol->language == language_ada)
return gsymbol->name;
+ else if (gsymbol->language == language_pascal
+ && case_sensitivity == case_sensitive_off
+ && gsymbol->language_specific.pascal_specific.lowercase_name !=
NULL)
+ return gsymbol->language_specific.pascal_specific.lowercase_name;
else
return symbol_natural_name (gsymbol);
}
Index: src/gdb/symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.152
diff -u -p -r1.152 symtab.h
--- src/gdb/symtab.h 22 Apr 2010 23:15:42 -0000 1.152
+++ src/gdb/symtab.h 29 Apr 2010 21:51:45 -0000
@@ -130,6 +130,12 @@ struct general_symbol_info
char *demangled_name;
}
cplus_specific;
+ struct pascal_specific
+ {
+ /* This is used for case insensitive searching. */
+ char *lowercase_name;
+ }
+ pascal_specific;
}
language_specific;
next reply other threads:[~2010-04-29 22:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-29 22:18 Pierre Muller [this message]
2010-04-29 22:32 ` Joel Brobecker
2010-04-29 22:54 ` Pierre Muller
2010-04-29 23:09 ` Joel Brobecker
2010-04-30 7:27 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002101cae7e9$e7229540$b567bfc0$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox