This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH][PR symtab/18148] Properly intern constants into psymtab
- From: Doug Evans <dje at google dot com>
- To: Andy Wingo <wingo at igalia dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 26 Mar 2015 10:05:39 -0700
- Subject: Re: [PATCH][PR symtab/18148] Properly intern constants into psymtab
- Authentication-results: sourceware.org; auth=none
- References: <87sicz6gv2 dot fsf at igalia dot com>
Andy Wingo writes:
> >From 16de9f67e56b5b58ff7923db0d6505d61c766124 Mon Sep 17 00:00:00 2001
> From: Andy Wingo <wingo@igalia.com>
> Date: Fri, 20 Mar 2015 11:50:00 +0100
> Subject: [PATCH] Properly intern constants into psymtab
>
> Variables with a DW_AT_const_value but without a DW_AT_location were not
> getting added to the partial symbol table. They are added to the full
> symbol table, however, when the compilation unit's psymtabs are
> expanded.
>
> Before:
>
> (gdb) p one
> No symbol "one" in current context.
> (gdb) mt flush-symbol-cache
> (gdb) mt expand one.c
> (gdb) p one
> $1 = 1
>
> After:
>
> (gdb) p one
> $1 = 1
>
> To the user it's pretty strange, as depending on whether tab completion
> has forced expansion of all CUs or not the lookup might succeed, or not
> if the failure was already added to the symbol cache.
>
> This commit simply makes sure to add constants to the partial symbol
> tables.
>
> gdb/testsuite/ChangeLog:
>
> PR symtab/18148
> * gdb.dwarf2/dw2-intercu.S (one, two): Add variables that have a
> const_value but not a location.
> * gdb.dwarf2/dw2-intercu.exp: Add tests that constants without
> location defined in non-main CUs are visible.
>
> gdb/ChangeLog:
>
> PR symtab/18148
> * dwarf2read.c (struct partial_die_info): Add has_const_value
> member.
> (add_partial_symbol): Don't punt on symbols that have const_value
> attributes.
> (read_partial_die): Detect DW_AT_const_value.
LGTM.
Thanks!