From: Tom Tromey <tom@tromey.com>
To: Tom de Vries <tdevries@suse.de>
Cc: Andrew Burgess <aburgess@redhat.com>,
gdb-patches@sourceware.org, Abhay Kandpal <abhay@linux.ibm.com>,
Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH 2/2] gdb: catch some exceptions in find_function_in_inferior
Date: Fri, 11 Sep 2026 08:42:57 -0600 [thread overview]
Message-ID: <87ld97zw5q.fsf@tromey.com> (raw)
In-Reply-To: <5424362d-623e-459a-b06f-a0d9530c83dc@suse.de> (Tom de Vries's message of "Fri, 11 Sep 2026 13:07:36 +0200")
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> The first thing I found was that the alias system.crtl.malloc ==
Tom> malloc is present due to extra debug info in the executable. FWIW, it
Tom> comes from ./gcc/ada/libgnat/s-crtl.ads:
Tom> ...
Tom> function malloc (Size : size_t) return System.Address;
Tom> pragma Import (C, malloc, "malloc");
Tom> ...
FWIW doing name lookups in Ada is weird, because Ada defaults to wild
matching. If you want to just find the C malloc, you have to look for
"<malloc>".
So, if the code is going via any language-specific lookup route (I
didn't dig in but it probably is), then you can easily find the wrong
function.
It would be nice to fix this, but it's complicated.
Alternatively some kind of language-neutral or "force it to use C"
approach could be implemented.
Tom> In case the c function
Tom> is represented in the debug info, the alias target is found.
Tom> Otherwise, not. This seems incorrect to me, so I filed a PR for this
Tom> ( https://sourceware.org/bugzilla/show_bug.cgi?id=34627 ).
I commented in the bug, but this is unavoidable. The error is thrown
because gdb wants to find a function block -- but if the alias target
doesn't have debug info, no such block is available.
Tom> Looking at ada_alias_get_block_value, ISTM that using
Tom> lookup_global_symbol means that it doesn't look beyond the exec
Tom> containing the alias. So in conclusion, I'd say the debug information
Tom> is present, but ignored.
This part seems strange in that lookup_global_symbol should search all
objfiles. But I wonder if instead it's finding the wrong symbol due to
wild matching. Anyway I suspect something else weird is going on.
Tom> This might be due to a gdb bug, so I filed a PR (
Tom> https://sourceware.org/bugzilla/show_bug.cgi?id=34628 ).
Tom
next prev parent reply other threads:[~2026-09-11 14:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 13:13 [PATCH 0/2] Fix regressions after find_function_in_inferior changes Andrew Burgess
2026-09-10 13:13 ` [PATCH 1/2] gdb: fill in default return types for some inferior function calls Andrew Burgess
2026-09-11 14:38 ` Tom Tromey
2026-09-10 13:13 ` [PATCH 2/2] gdb: catch some exceptions in find_function_in_inferior Andrew Burgess
2026-09-11 11:07 ` Tom de Vries
2026-09-11 14:42 ` Tom Tromey [this message]
2026-09-11 14:43 ` [PATCH 0/2] Fix regressions after find_function_in_inferior changes Tom Tromey
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=87ld97zw5q.fsf@tromey.com \
--to=tom@tromey.com \
--cc=abhay@linux.ibm.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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