From: Thiago Jung Bauermann Date: Mon, 3 Apr 2023 22:39:46 +0000 (+0000) Subject: gdb: Fix reading of partial symtabs in dbxread.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=03e323abf479e9ee3ebd38c4077a8da7fa1efe0c;p=binutils-gdb.git gdb: Fix reading of partial symtabs in dbxread.c After commit 9675da25357c ("Use unrelocated_addr in minimal symbols"), aarch64-linux started failing gdb.asm/asm-source.exp: Running /home/thiago.bauermann/src/binutils-gdb/gdb/testsuite/gdb.asm/asm-source.exp ... PASS: gdb.asm/asm-source.exp: f at main PASS: gdb.asm/asm-source.exp: n at main PASS: gdb.asm/asm-source.exp: next over macro FAIL: gdb.asm/asm-source.exp: step into foo2 PASS: gdb.asm/asm-source.exp: info target PASS: gdb.asm/asm-source.exp: info symbol PASS: gdb.asm/asm-source.exp: list PASS: gdb.asm/asm-source.exp: search FAIL: gdb.asm/asm-source.exp: f in foo2 FAIL: gdb.asm/asm-source.exp: n in foo2 (the program exited) FAIL: gdb.asm/asm-source.exp: bt ALL in foo2 FAIL: gdb.asm/asm-source.exp: bt 2 in foo2 PASS: gdb.asm/asm-source.exp: s 2 PASS: gdb.asm/asm-source.exp: n 2 FAIL: gdb.asm/asm-source.exp: bt 3 in foo3 PASS: gdb.asm/asm-source.exp: info source asmsrc1.s FAIL: gdb.asm/asm-source.exp: finish from foo3 (the program is no longer running) FAIL: gdb.asm/asm-source.exp: info source asmsrc2.s PASS: gdb.asm/asm-source.exp: info sources FAIL: gdb.asm/asm-source.exp: info line FAIL: gdb.asm/asm-source.exp: next over foo3 (the program is no longer running) FAIL: gdb.asm/asm-source.exp: return from foo2 PASS: gdb.asm/asm-source.exp: look at global variable PASS: gdb.asm/asm-source.exp: x/i &globalvar PASS: gdb.asm/asm-source.exp: disassem &globalvar, (int *) &globalvar+1 PASS: gdb.asm/asm-source.exp: look at static variable PASS: gdb.asm/asm-source.exp: x/i &staticvar PASS: gdb.asm/asm-source.exp: disassem &staticvar, (int *) &staticvar+1 PASS: gdb.asm/asm-source.exp: look at static function The problem is simple: a pair of parentheses was removed from the expression calculating text_end and thus text_size was only added if lowest_text_address wasn't equal to -1. This patch restores the previous behaviour and fixes the testcase. Tested on native aarch64-linux. Reviewed-By: Tom Tromey --- diff --git a/gdb/dbxread.c b/gdb/dbxread.c index f7c44c14ae2..73371edd841 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1950,9 +1950,9 @@ read_dbx_symtab (minimal_symbol_reader &reader, is. */ unrelocated_addr text_end = (unrelocated_addr - (lowest_text_address == (unrelocated_addr) -1 - ? text_addr - : CORE_ADDR (lowest_text_address) + ((lowest_text_address == (unrelocated_addr) -1 + ? text_addr + : CORE_ADDR (lowest_text_address)) + text_size)); dbx_end_psymtab (objfile, partial_symtabs,