Limit objdump -S context lines
Showing context lines is confusing in many cases, an obvious example being loops. * objdump.c (struct print_file_list): Add "max_printed". (try_print_file_open): Init new field. (show_line): Don't show 5 context lines when redisplaying source.
This commit is contained in:
parent
da4463c7d7
commit
43339b1d1c
|
@ -1,3 +1,9 @@
|
||||||
|
2016-06-24 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* objdump.c (struct print_file_list): Add "max_printed".
|
||||||
|
(try_print_file_open): Init new field.
|
||||||
|
(show_line): Don't show 5 context lines when redisplaying source.
|
||||||
|
|
||||||
2016-06-22 Nick Clifton <nickc@redhat.com>
|
2016-06-22 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* testsuite/binutils-all/ar.exp: Skip tests for Alpha target.
|
* testsuite/binutils-all/ar.exp: Skip tests for Alpha target.
|
||||||
|
|
|
@ -1135,6 +1135,7 @@ struct print_file_list
|
||||||
const char **linemap;
|
const char **linemap;
|
||||||
unsigned maxline;
|
unsigned maxline;
|
||||||
unsigned last_line;
|
unsigned last_line;
|
||||||
|
unsigned max_printed;
|
||||||
int first;
|
int first;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1260,6 +1261,7 @@ try_print_file_open (const char *origname, const char *modname)
|
||||||
|
|
||||||
p->linemap = index_file (p->map, p->mapsize, &p->maxline);
|
p->linemap = index_file (p->map, p->mapsize, &p->maxline);
|
||||||
p->last_line = 0;
|
p->last_line = 0;
|
||||||
|
p->max_printed = 0;
|
||||||
p->filename = origname;
|
p->filename = origname;
|
||||||
p->modname = modname;
|
p->modname = modname;
|
||||||
p->next = print_files;
|
p->next = print_files;
|
||||||
|
@ -1447,10 +1449,17 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
||||||
l = linenumber - SHOW_PRECEDING_CONTEXT_LINES;
|
l = linenumber - SHOW_PRECEDING_CONTEXT_LINES;
|
||||||
if (l >= linenumber)
|
if (l >= linenumber)
|
||||||
l = 1;
|
l = 1;
|
||||||
if (p->last_line >= l && p->last_line <= linenumber)
|
if (p->max_printed >= l)
|
||||||
l = p->last_line + 1;
|
{
|
||||||
|
if (p->max_printed < linenumber)
|
||||||
|
l = p->max_printed + 1;
|
||||||
|
else
|
||||||
|
l = linenumber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dump_lines (p, l, linenumber);
|
dump_lines (p, l, linenumber);
|
||||||
|
if (p->max_printed < linenumber)
|
||||||
|
p->max_printed = linenumber;
|
||||||
p->last_line = linenumber;
|
p->last_line = linenumber;
|
||||||
p->first = 0;
|
p->first = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue