aboutsummaryrefslogtreecommitdiff
path: root/gdb/disasm.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@broadcom.com>2011-02-03 14:45:37 +0000
committerAndrew Burgess <aburgess@broadcom.com>2011-02-03 14:45:37 +0000
commit9011945e46bf8ba4722de6cac73711863dc58b39 (patch)
tree832ae3076f6fb38a0f7112142743733cbbc82037 /gdb/disasm.c
parentd4d868a28076273e828f299e896dbc1af827208a (diff)
downloadgdb-9011945e46bf8ba4722de6cac73711863dc58b39.zip
gdb-9011945e46bf8ba4722de6cac73711863dc58b39.tar.gz
gdb-9011945e46bf8ba4722de6cac73711863dc58b39.tar.bz2
http://sourceware.org/ml/gdb-patches/2010-12/msg00300.html
Improve the ordering of line table entries when dealing with the end of sequence markers. This will allow us to disassemble over the border between two compile units while also displaying source code information.
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r--gdb/disasm.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 9180bc5..ee19f70 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -77,12 +77,21 @@ compare_lines (const void *mle1p, const void *mle2p)
mle1 = (struct dis_line_entry *) mle1p;
mle2 = (struct dis_line_entry *) mle2p;
- val = mle1->line - mle2->line;
-
- if (val != 0)
- return val;
-
- return mle1->start_pc - mle2->start_pc;
+ /* End of sequence markers have a line number of 0 but don't want to
+ be sorted to the head of the list, instead sort by PC. */
+ if (mle1->line == 0 || mle2->line == 0)
+ {
+ val = mle1->start_pc - mle2->start_pc;
+ if (val == 0)
+ val = mle1->line - mle2->line;
+ }
+ else
+ {
+ val = mle1->line - mle2->line;
+ if (val == 0)
+ val = mle1->start_pc - mle2->start_pc;
+ }
+ return val;
}
static int