aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorTimothy Wall <twall@alum.mit.edu>2000-02-08 18:38:13 +0000
committerTimothy Wall <twall@alum.mit.edu>2000-02-08 18:38:13 +0000
commitf15632584b5f2c0355fcc0f354da079b240aedf2 (patch)
treefb68f5bfafca1216514941397635a6238aebd08b /binutils
parentf2c4d933e69aa357518329d9dd3641fb5d05e28c (diff)
downloadfsf-binutils-gdb-f15632584b5f2c0355fcc0f354da079b240aedf2.zip
fsf-binutils-gdb-f15632584b5f2c0355fcc0f354da079b240aedf2.tar.gz
fsf-binutils-gdb-f15632584b5f2c0355fcc0f354da079b240aedf2.tar.bz2
Fix bug in interlisting option, added --file-start-context option.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/NEWS4
-rw-r--r--binutils/binutils.texi7
-rw-r--r--binutils/objdump.c16
4 files changed, 29 insertions, 5 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 7256abd..e15ee8b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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,
diff --git a/binutils/NEWS b/binutils/NEWS
index eb27ad5..8d24ccd 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -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
diff --git a/binutils/binutils.texi b/binutils/binutils.texi
index 95c684a..ee603b7 100644
--- a/binutils/binutils.texi
+++ b/binutils/binutils.texi
@@ -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
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 97dcc8c..deaf991 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -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);