From 48e0f38c30a153855e1adc9dc76614f3f88d686a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 16 Mar 2023 14:41:31 -0600 Subject: Fix line table regression Simon pointed out a line table regression, and after a couple of false starts, I was able to reproduce it by hand using his instructions. The bug is that most of the code in do_mixed_source_and_assembly uses unrelocated addresses, but one spot does: pc = low; ... after the text offset has been removed. This patch fixes the problem by introducing a new type to represent unrelocated addresses in the line table. This prevents this sort of bug to some degree (it's still possible to manipulate a CORE_ADDR in a bad way, this is unavoidable). However, this did let the compiler flag a few spots in that function, and now it's not possible to compare an unrelocated address from a line table with an ordinary CORE_ADDR. Regression tested on x86-64 Fedora 36, though note this setup never reproduced the bug in the first place. I also tested it by hand on the disasm-optim test program. --- gdb/xcoffread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gdb/xcoffread.c') diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 72c0a0d..ab76376 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -795,11 +795,12 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, if (int_lnno.l_lnno == 0) { *firstLine = read_symbol_lineno (int_lnno.l_addr.l_symndx); - record_line (subfile, 0, record_addr); + record_line (subfile, 0, unrelocated_addr (record_addr)); --(*firstLine); } else - record_line (subfile, *firstLine + int_lnno.l_lnno, record_addr); + record_line (subfile, *firstLine + int_lnno.l_lnno, + unrelocated_addr (record_addr)); curoffset += linesz; } } -- cgit v1.1