[PATCH] Check for null result from gdb_demangle
Pedro Alves
palves@redhat.com
Thu Feb 13 18:48:00 GMT 2020
On 2/13/20 6:31 AM, Ali Tamur via gdb-patches wrote:
> I am sending this patch on behalf of kmoy@google.com, who discovered the bug
> and wrote the fix.
Please make sure that his name is used in the ChangeLog entry as well
as git authorship. (When the latter is done, git format-patch/send-email
put a "From: ..." as the first line of the email, which is missing here, which
makes me suspect authorship isn't correct.)
Thanks,
Pedro Alves
>
> gdb_demangle can return null for strings that don't properly demangle. The null
> check was mistakenly removed in commit 43816ebc335. Without this check, GDB
> aborts when loading symbols from some binaries.
>
> gdb/ChangeLog:
>
> * dwarf2/read.c (dwarf2_name): Add null check.
> ---
> gdb/dwarf2/read.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index 7edbd9d7df..2f37c8a496 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -21770,6 +21770,8 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
> {
> gdb::unique_xmalloc_ptr<char> demangled
> (gdb_demangle (DW_STRING (attr), DMGL_TYPES));
> + if (demangled == nullptr)
> + return nullptr;
>
> const char *base;
>
>
More information about the Gdb-patches
mailing list