From: Alan Modra Date: Fri, 29 Sep 2017 22:50:08 +0000 (+0930) Subject: PR21978, objdump does not display line numbers in certain cases X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b5b25295998e10723bd51d127c87249a779f628;p=binutils-gdb.git 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. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 333ad86a62a..d9f08991f90 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2017-09-30 Alan Modra + + PR 21978 + * objdump.c: Formatting. + (show_line): Reset prev_line when function name changes. + 2017-09-27 Nick Clifton PR 22219 diff --git a/binutils/objdump.c b/binutils/objdump.c index 3c5defabf74..3b2c7a38788 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;