aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
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/objdump.c
parentf2c4d933e69aa357518329d9dd3641fb5d05e28c (diff)
downloadgdb-f15632584b5f2c0355fcc0f354da079b240aedf2.zip
gdb-f15632584b5f2c0355fcc0f354da079b240aedf2.tar.gz
gdb-f15632584b5f2c0355fcc0f354da079b240aedf2.tar.bz2
Fix bug in interlisting option, added --file-start-context option.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c16
1 files changed, 11 insertions, 5 deletions
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);