From: Daniel Jacobowitz Date: Thu, 11 Oct 2007 17:38:59 +0000 (+0000) Subject: * buildsym.c (record_line): Remove empty lines followed by X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=607ae575a784d7d02956031883ae407faf06fd89;p=binutils-gdb.git * buildsym.c (record_line): Remove empty lines followed by end-of-sequence markers. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2da3edaa5e3..6482dc03651 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2007-10-11 Daniel Jacobowitz + + * buildsym.c (record_line): Remove empty lines followed by + end-of-sequence markers. + 2007-10-11 Kazu Hirata * configure.tgt: Recognize fido-*-elf. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index d3af35e1d51..f6406794a31 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -752,9 +752,34 @@ record_line (struct subfile *subfile, int line, CORE_ADDR pc) * sizeof (struct linetable_entry)))); } + pc = gdbarch_addr_bits_remove (current_gdbarch, pc); + + /* Normally, we treat lines as unsorted. But the end of sequence + marker is special. We sort line markers at the same PC by line + number, so end of sequence markers (which have line == 0) appear + first. This is right if the marker ends the previous function, + and there is no padding before the next function. But it is + wrong if the previous line was empty and we are now marking a + switch to a different subfile. We must leave the end of sequence + marker at the end of this group of lines, not sort the empty line + to after the marker. The easiest way to accomplish this is to + delete any empty lines from our table, if they are followed by + end of sequence markers. All we lose is the ability to set + breakpoints at some lines which contain no instructions + anyway. */ + if (line == 0 && subfile->line_vector->nitems > 0) + { + e = subfile->line_vector->item + subfile->line_vector->nitems - 1; + while (subfile->line_vector->nitems > 0 && e->pc == pc) + { + e--; + subfile->line_vector->nitems--; + } + } + e = subfile->line_vector->item + subfile->line_vector->nitems++; e->line = line; - e->pc = gdbarch_addr_bits_remove (current_gdbarch, pc); + e->pc = pc; } /* Needed in order to sort line tables from IBM xcoff files. Sigh! */