OSDN Git Service

Fix bug in interlisting option, added --file-start-context option.
authorTimothy Wall <twall@alum.mit.edu>
Tue, 8 Feb 2000 18:38:13 +0000 (18:38 +0000)
committerTimothy Wall <twall@alum.mit.edu>
Tue, 8 Feb 2000 18:38:13 +0000 (18:38 +0000)
binutils/ChangeLog
binutils/NEWS
binutils/binutils.texi
binutils/objdump.c

index 7256abd..e15ee8b 100644 (file)
@@ -1,3 +1,10 @@
+2000-02-08  Timothy Wall  <twall@redhat.com>
+
+       * objdump.c (show_line): Fix bug preventing printing of the very
+       first line (line zero) of a file when interlisting source and
+       assembly.  Added option to print entire context from start of file
+       when the first line from that file is encountered.
+
 2000-02-03  Timothy Wall <twall@redhat.com>
 
        * binutils/objdump.c (dump_section_header, find_symbol_for_address,
index eb27ad5..8d24ccd 100644 (file)
@@ -2,6 +2,10 @@
 
 Changes in binutils 2.10:
 
+* New command line switch to objdump --file-start-context which shows the
+  entire file contents up to the source line first encountered for a given
+  file. 
+
 * New command line switch to objdump -M (or --disassembler-options) which takes
   a parameter which can then be interpreted on a per-target basis by the
   disassembler.  Used by ARM targets to select register name sets, ISA, APCS or
index 95c684a..ee603b7 100644 (file)
@@ -1171,6 +1171,7 @@ objdump [ -a | --archive-headers ]
         [ -z | --disassemble-zeroes ]
         [ -EB | -EL | --endian=@{big | little @} ]
         [ -f | --file-headers ]
+        [ --file-start-context ]
         [ -g | --debugging ]
         [ -h | --section-headers | --headers ]
         [ -i | --info ]
@@ -1299,6 +1300,12 @@ does not describe endianness information, such as S-records.
 Display summary information from the overall header of
 each of the @var{objfile} files.
 
+@item --file-start-context
+@cindex source code context
+Specify that when displaying interlisted source code/disassembly
+(assumes '-S') from a file that has not yet been displayed, extend the
+context to the start of the file.
+
 @item -h
 @itemx --section-header
 @itemx --header
index 97dcc8c..deaf991 100644 (file)
@@ -75,6 +75,7 @@ static bfd_vma start_address = (bfd_vma) -1; /* --start-address */
 static bfd_vma stop_address = (bfd_vma) -1;  /* --stop-address */
 static int dump_debugging;             /* --debugging */
 static bfd_vma adjust_section_vma = 0; /* --adjust-vma */
+static int file_start_context = 0;      /* --file-start-context */
 
 /* Extra info to pass to the disassembler address printing function.  */
 struct objdump_disasm_info {
@@ -257,6 +258,7 @@ usage (stream, status)
   -M  --disassembler-options <o> Pass text <o> on to the disassembler\n\
   -EB --endian=big               Assume big endian format when disassembling\n\
   -EL --endian=little            Assume little endian format when disassembling\n\
+      --file-start-context       Include context from start of file (with -S)\n\
   -l  --line-numbers             Include line numbers and filenames in output\n\
   -C  --demangle                 Decode mangled/processed symbol names\n\
   -w  --wide                     Format output for more than 80 columns\n\
@@ -300,6 +302,7 @@ static struct option long_options[]=
   {"dynamic-syms", no_argument, NULL, 'T'},
   {"endian", required_argument, NULL, OPTION_ENDIAN},
   {"file-headers", no_argument, NULL, 'f'},
+  {"file-start-context", no_argument, &file_start_context, 1},
   {"full-contents", no_argument, NULL, 's'},
   {"headers", no_argument, NULL, 'h'},
   {"help", no_argument, NULL, 'H'},
@@ -1076,8 +1079,8 @@ show_line (abfd, section, addr_offset)
              else
                {
                  l = line - SHOW_PRECEDING_CONTEXT_LINES;
-                 if (l <= 0)
-                   l = 1;
+                 if (l < 0)
+                   l = 0;
                }
 
              if (p->f == NULL)
@@ -1127,9 +1130,12 @@ show_line (abfd, section, addr_offset)
              p->next = print_files;
              print_files = p;
 
-             l = line - SHOW_PRECEDING_CONTEXT_LINES;
-             if (l <= 0)
-               l = 1;
+              if (file_start_context)
+                l = 0;
+              else
+                l = line - SHOW_PRECEDING_CONTEXT_LINES;
+             if (l < 0)
+               l = 0;
              skip_to_line (p, l, false);
              if (p->f != NULL)
                skip_to_line (p, line, true);