aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-09-30 08:20:08 +0930
committerAlan Modra <amodra@gmail.com>2017-09-30 12:01:43 +0930
commit8b5b25295998e10723bd51d127c87249a779f628 (patch)
tree34da82fbfc96b10db142db972e19d84c4256bcb7 /binutils
parent1755697b1df1286cbee20dc487d656025964a7a9 (diff)
downloadgdb-8b5b25295998e10723bd51d127c87249a779f628.zip
gdb-8b5b25295998e10723bd51d127c87249a779f628.tar.gz
gdb-8b5b25295998e10723bd51d127c87249a779f628.tar.bz2
PR21978, objdump does not display line numbers in certain cases
Same line but different file ought to display file and line. PR 21978 * objdump.c: Formatting. (show_line): Reset prev_line when function name changes.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objdump.c30
2 files changed, 24 insertions, 12 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 333ad86..d9f0899 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-30 Alan Modra <amodra@gmail.com>
+
+ PR 21978
+ * objdump.c: Formatting.
+ (show_line): Reset prev_line when function name changes.
+
2017-09-27 Nick Clifton <nickc@redhat.com>
PR 22219
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 3c5defa..3b2c7a3 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1484,8 +1484,8 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
return;
if (! bfd_find_nearest_line_discriminator (abfd, section, syms, addr_offset,
- &filename, &functionname,
- &linenumber, &discriminator))
+ &filename, &functionname,
+ &linenumber, &discriminator))
return;
if (filename != NULL && *filename == '\0')
@@ -1537,16 +1537,22 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
if (functionname != NULL
&& (prev_functionname == NULL
|| strcmp (functionname, prev_functionname) != 0))
- printf ("%s():\n", functionname);
- if (linenumber > 0 && (linenumber != prev_line ||
- (discriminator != prev_discriminator)))
- {
- if (discriminator > 0)
- printf ("%s:%u (discriminator %u)\n", filename == NULL ? "???" : filename,
- linenumber, discriminator);
- else
- printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber);
- }
+ {
+ printf ("%s():\n", functionname);
+ prev_line = -1;
+ }
+ if (linenumber > 0
+ && (linenumber != prev_line
+ || discriminator != prev_discriminator))
+ {
+ if (discriminator > 0)
+ printf ("%s:%u (discriminator %u)\n",
+ filename == NULL ? "???" : filename,
+ linenumber, discriminator);
+ else
+ printf ("%s:%u\n", filename == NULL ? "???" : filename,
+ linenumber);
+ }
if (unwind_inlines)
{
const char *filename2;