aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-07-07 11:48:27 +0000
committerAlan Modra <amodra@gmail.com>2008-07-07 11:48:27 +0000
commitc29aae594a3a7cd5c12dea0901ad516c1c759a75 (patch)
treebb58833dd478084b32fa230bf39916fcb99d1690 /bfd
parent2b4590fb4681a245f4b28c5b6121e0982a0c404a (diff)
downloadgdb-c29aae594a3a7cd5c12dea0901ad516c1c759a75.zip
gdb-c29aae594a3a7cd5c12dea0901ad516c1c759a75.tar.gz
gdb-c29aae594a3a7cd5c12dea0901ad516c1c759a75.tar.bz2
* bfd.c (bfd_demangle): Always trim off bfd_get_symbol_leading_char.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/bfd.c21
2 files changed, 21 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index abadb37..ef2ac33 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-07 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (bfd_demangle): Always trim off bfd_get_symbol_leading_char.
+
2008-07-02 Alan Modra <amodra@bigpond.net.au>
* elf32-ppc.c (is_pic_glink_stub): New function.
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 7e6e872..ed89e66 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1829,10 +1829,12 @@ bfd_demangle (bfd *abfd, const char *name, int options)
char *res, *alloc;
const char *pre, *suf;
size_t pre_len;
+ bfd_boolean skip_lead;
- if (abfd != NULL
- && *name != '\0'
- && bfd_get_symbol_leading_char (abfd) == *name)
+ skip_lead = (abfd != NULL
+ && *name != '\0'
+ && bfd_get_symbol_leading_char (abfd) == *name);
+ if (skip_lead)
++name;
/* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
@@ -1863,7 +1865,18 @@ bfd_demangle (bfd *abfd, const char *name, int options)
free (alloc);
if (res == NULL)
- return NULL;
+ {
+ if (skip_lead)
+ {
+ size_t len = strlen (pre) + 1;
+ alloc = bfd_malloc (len);
+ if (alloc == NULL)
+ return NULL;
+ memcpy (alloc, pre, len);
+ return alloc;
+ }
+ return NULL;
+ }
/* Put back any prefix or suffix. */
if (pre_len != 0 || suf != NULL)