bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/24931] New: objdump: print source code as comments


From: trass3r at gmail dot com
Subject: [Bug binutils/24931] New: objdump: print source code as comments
Date: Thu, 22 Aug 2019 12:52:34 +0000

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]