From: sami wagiaalla <swagiaal@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [patch 2/3] Change cplus_specific to an alocated struct
Date: Fri, 16 Jul 2010 14:15:00 -0000 [thread overview]
Message-ID: <4C406959.2090605@redhat.com> (raw)
In-Reply-To: <m3pqyrthve.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 24 bytes --]
Update patch attached.
[-- Attachment #2: dynamic-cplus_specific_2.patch --]
[-- Type: text/plain, Size: 5292 bytes --]
Use setter and getter for demangled_name.
2010-07-15 Sami Wagiaalla <swagiaal@redhat.com>
* symtab.h (symbol_set_demangled_name): New function.
(symbol_get_demangled_name): New function.
* symtab.c (symbol_set_demangled_name): New function.
(symbol_get_demangled_name): New function.
(symbol_init_language_specific): Use demangled_name setter and getter.
(symbol_set_names): Ditto.
(symbol_natural_name): Ditto.
(symbol_demangled_name): Ditto.
* dwarf2read.c (new_symbol): Ditto.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8dd239d..4510ccd 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8673,9 +8673,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
/* Fortran does not have mangling standard and the mangling does differ
between gfortran, iFort etc. */
if (cu->language == language_fortran
- && sym->ginfo.language_specific.mangled_lang.demangled_name == NULL)
- sym->ginfo.language_specific.mangled_lang.demangled_name
- = (char *) dwarf2_full_name (name, die, cu);
+ && symbol_get_demangled_name (&(sym->ginfo)) == NULL)
+ symbol_set_demangled_name (&(sym->ginfo), (char *) dwarf2_full_name (name, die, cu));
/* Default assumptions.
Use the passed type or decode it from the die. */
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 7e9873e..2ed1bad 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -340,6 +340,22 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
return (mangled_name);
}
+/* Set the demangled name of GSYMBOL to NAME. NAME must be already
+ correctly allocated. */
+void
+symbol_set_demangled_name (struct general_symbol_info *gsymbol,
+ char *name)
+{
+ gsymbol->language_specific.mangled_lang.demangled_name = name;
+}
+
+/* Return the demangled name of GSYMBOL. */
+char *
+symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
+{
+ return gsymbol->language_specific.mangled_lang.demangled_name;
+}
+
\f
/* Initialize the language dependent portion of a symbol
depending upon the language for the symbol. */
@@ -354,7 +370,7 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol,
|| gsymbol->language == language_objc
|| gsymbol->language == language_fortran)
{
- gsymbol->language_specific.mangled_lang.demangled_name = NULL;
+ symbol_set_demangled_name (gsymbol, NULL);
}
else
{
@@ -537,7 +553,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
memcpy (gsymbol->name, linkage_name, len);
gsymbol->name[len] = '\0';
}
- gsymbol->language_specific.mangled_lang.demangled_name = NULL;
+ symbol_set_demangled_name (gsymbol, NULL);
return;
}
@@ -633,10 +649,9 @@ symbol_set_names (struct general_symbol_info *gsymbol,
gsymbol->name = (*slot)->mangled + lookup_len - len;
if ((*slot)->demangled[0] != '\0')
- gsymbol->language_specific.mangled_lang.demangled_name
- = (*slot)->demangled;
+ symbol_set_demangled_name (gsymbol, (*slot)->demangled);
else
- gsymbol->language_specific.mangled_lang.demangled_name = NULL;
+ symbol_set_demangled_name (gsymbol, NULL);
}
/* Return the source code name of a symbol. In languages where
@@ -652,12 +667,12 @@ symbol_natural_name (const struct general_symbol_info *gsymbol)
case language_java:
case language_objc:
case language_fortran:
- if (gsymbol->language_specific.mangled_lang.demangled_name != NULL)
- return gsymbol->language_specific.mangled_lang.demangled_name;
+ if (symbol_get_demangled_name (gsymbol) != NULL)
+ return symbol_get_demangled_name (gsymbol);
break;
case language_ada:
- if (gsymbol->language_specific.mangled_lang.demangled_name != NULL)
- return gsymbol->language_specific.mangled_lang.demangled_name;
+ if (symbol_get_demangled_name (gsymbol) != NULL)
+ return symbol_get_demangled_name (gsymbol);
else
return ada_decode_symbol (gsymbol);
break;
@@ -679,12 +694,12 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol)
case language_java:
case language_objc:
case language_fortran:
- if (gsymbol->language_specific.mangled_lang.demangled_name != NULL)
- return gsymbol->language_specific.mangled_lang.demangled_name;
+ if (symbol_get_demangled_name (gsymbol) != NULL)
+ return symbol_get_demangled_name (gsymbol);
break;
case language_ada:
- if (gsymbol->language_specific.mangled_lang.demangled_name != NULL)
- return gsymbol->language_specific.mangled_lang.demangled_name;
+ if (symbol_get_demangled_name (gsymbol) != NULL)
+ return symbol_get_demangled_name (gsymbol);
else
return ada_decode_symbol (gsymbol);
break;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index bad76dd..ceffe2b 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -154,6 +154,10 @@ struct general_symbol_info
struct obj_section *obj_section;
};
+extern void symbol_set_demangled_name (struct general_symbol_info *, char *);
+
+extern char *symbol_get_demangled_name (const struct general_symbol_info *);
+
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
/* Note that all the following SYMBOL_* macros are used with the
next prev parent reply other threads:[~2010-07-16 14:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-26 16:05 [patch] " sami wagiaalla
2010-05-26 16:55 ` sami wagiaalla
2010-06-08 17:02 ` Tom Tromey
2010-06-14 19:29 ` sami wagiaalla
2010-06-15 22:56 ` Tom Tromey
2010-07-12 18:03 ` [patch 1/3] " sami wagiaalla
2010-07-13 17:16 ` Tom Tromey
2010-07-16 14:15 ` sami wagiaalla
2010-07-16 15:24 ` Tom Tromey
2010-07-12 18:06 ` [patch 2/3] " sami wagiaalla
2010-07-13 17:24 ` Tom Tromey
2010-07-16 14:15 ` sami wagiaalla [this message]
2010-07-12 18:08 ` [patch 3/3] " sami wagiaalla
2010-07-13 17:38 ` Tom Tromey
2010-07-16 14:15 ` sami wagiaalla
2010-07-16 15:29 ` Tom Tromey
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=4C406959.2090605@redhat.com \
--to=swagiaal@redhat.com \
--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