From 9011945e46bf8ba4722de6cac73711863dc58b39 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 3 Feb 2011 14:45:37 +0000 Subject: 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. --- gdb/disasm.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'gdb/disasm.c') 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 -- cgit v1.1