https://sourceware.org/bugzilla/show_bug.cgi?id=24931

            Bug ID: 24931
           Summary: objdump: print source code as comments
           Product: binutils
           Version: 2.33 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: trass3r at gmail dot com
  Target Milestone: ---

When using objdump -dS it's really hard to distinguish between assembly code
and printed source lines. Printing them as comments helps a lot and also
reduces confusion for editor parsers.

PoC:

--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1596,7 +1596,7 @@ print_line (struct print_file_list *p, unsigned int
linenum)
   l = p->linemap [linenum];
   /* Test fwrite return value to quiet glibc warning.  */
   len = strcspn (l, "\n\r");
-  if (len == 0 || fwrite (l, len, 1, stdout) == 1)
+  if (len == 0 || (fwrite ("# ", 2, 1, stdout), fwrite (l, len, 1, stdout) ==
1))
     putchar ('\n');
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to