public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: gdb-patches@sourceware.org
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Subject: [PATCH 1/2] gdb: Fix reading of partial symtabs in dbxread.c
Date: Tue,  4 Apr 2023 17:59:14 +0000	[thread overview]
Message-ID: <20230404175915.288558-2-thiago.bauermann@linaro.org> (raw)
In-Reply-To: <20230404175915.288558-1-thiago.bauermann@linaro.org>

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.
---
 gdb/dbxread.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index f7c44c14ae2e..73371edd8412 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,

  reply	other threads:[~2023-04-04 17:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 17:59 [PATCH 0/2] Fix regression in stabs debug info Thiago Jung Bauermann
2023-04-04 17:59 ` Thiago Jung Bauermann [this message]
2023-04-04 17:59 ` [PATCH 2/2] gdb/testsuite: Default to assembler's preferred debug format in asm-source.exp Thiago Jung Bauermann
2023-04-04 18:32 ` [PATCH 0/2] Fix regression in stabs debug info Tom Tromey
2023-04-05 20:32   ` Thiago Jung Bauermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230404175915.288558-2-thiago.bauermann@linaro.org \
    --to=thiago.bauermann@linaro.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).