aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-09-14 18:29:06 +0000
committerIan Lance Taylor <ian@airs.com>1994-09-14 18:29:06 +0000
commit31c271643b80533476db741341322a96b003417d (patch)
tree3d3250bf8420199818a62b3770590db655ce8813 /ld
parentcc23cc69c56ce199eb6505c8b3e5e704f3795d04 (diff)
downloadfsf-binutils-gdb-31c271643b80533476db741341322a96b003417d.zip
fsf-binutils-gdb-31c271643b80533476db741341322a96b003417d.tar.gz
fsf-binutils-gdb-31c271643b80533476db741341322a96b003417d.tar.bz2
Tweak the new handling of function names.
Diffstat (limited to 'ld')
-rw-r--r--ld/ldmisc.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 9b3047b..9c5b3e5 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -214,6 +214,8 @@ vfinfo(fp, fmt, arg)
or section name as a last resort. The arguments are a BFD,
a section, and an offset. */
{
+ static char *last_file = NULL;
+ static char *last_function = NULL;
bfd *abfd;
asection *section;
bfd_vma offset;
@@ -222,6 +224,7 @@ vfinfo(fp, fmt, arg)
const char *filename;
const char *functionname;
unsigned int linenumber;
+ boolean discard_last;
abfd = va_arg (arg, bfd *);
section = va_arg (arg, asection *);
@@ -250,6 +253,7 @@ vfinfo(fp, fmt, arg)
}
}
+ discard_last = true;
if (bfd_find_nearest_line (abfd, section, asymbols, offset,
&filename, &functionname, &linenumber))
{
@@ -258,18 +262,44 @@ vfinfo(fp, fmt, arg)
if (functionname != NULL && fmt[-1] == 'C')
{
- fprintf (fp, "%s: In function `%s':\n", filename,
- demangle (functionname, 1));
+ if (last_file == NULL
+ || last_function == NULL
+ || strcmp (last_file, filename) != 0
+ || strcmp (last_function, functionname) != 0)
+ {
+ fprintf (fp, "%s: In function `%s':\n", filename,
+ demangle (functionname, 1));
+ if (last_file != NULL)
+ free (last_file);
+ last_file = buystring (filename);
+ if (last_function != NULL)
+ free (last_function);
+ last_function = buystring (functionname);
+ }
+ discard_last = false;
fprintf (fp, "%s:%u", filename, linenumber);
}
else if (linenumber != 0)
fprintf (fp, "%s:%u", filename, linenumber);
else
finfo (fp, "%s(%s+0x%v)", filename, section->name, offset);
-
}
else
finfo (fp, "%s(%s+0x%v)", abfd->filename, section->name, offset);
+
+ if (discard_last)
+ {
+ if (last_file != NULL)
+ {
+ free (last_file);
+ last_file = NULL;
+ }
+ if (last_function != NULL)
+ {
+ free (last_function);
+ last_function = NULL;
+ }
+ }
}
break;