This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb.dwarf2: Define and use gdb_target_symbol_prefix for symbol prefixes
- From: Pedro Alves <palves at redhat dot com>
- To: Kevin Buettner <kevinb at redhat dot com>, gdb-patches at sourceware dot org
- Date: Thu, 05 Nov 2015 10:14:09 +0000
- Subject: Re: [PATCH] gdb.dwarf2: Define and use gdb_target_symbol_prefix for symbol prefixes
- Authentication-results: sourceware.org; auth=none
- References: <20151029212509 dot 438b5642 at pinnacle dot lan> <56334F21 dot 1020205 at redhat dot com> <20151104144908 dot 320110e1 at pinnacle dot lan>
On 11/04/2015 09:49 PM, Kevin Buettner wrote:
> On Fri, 30 Oct 2015 11:06:09 +0000
> Pedro Alves <palves@redhat.com> wrote:
>
>> On 10/30/2015 04:25 AM, Kevin Buettner wrote:
>>
>>> +# gdb_target_symbol_prefix compiles a test program and uses readelf
>>> +# to determine the prefix (such as underscore) for linker symbol
>>> +# prefixes.
>>> +
>>> +proc gdb_target_symbol_prefix {} {
>>
>> Shouldn't this be gdb_caching_proc ?
>
> Yes, it should. I've fixed this in my new patch.
Thanks Kevin. This version generally looks good to me. Some comments
below.
>
>> Then T wonder whether something like:
>>
>> - DW_OP_addr table_2_ptr
>> + DW_OP_addr [gdb_symbol table_2_ptr]
>>
>> instead of prepending the $prefix variable results in clearer
>> test code.
>
> I like this idea too. I used the name 'gdb_target_symbol' for this.
>
> Defining the obvious proc (for gdb_target_symbol) worked out of the
> box for all cases except gdb.dwarf2/atomic-type.exp. For that I
> needed to make a change to lib/dwarf.exp (and learned a bit more about
> tcl in the process). If you know of a cleaner way to code it, let me
> know - I couldn't think of a way to do it without adding the if-else
> statement.
Not sure I see what makes gdb.dwarf2/atomic-type.exp different?
E.g., the gdb.dwarf2/dw2-bad-mips-linkage-name.exp hunk looks quite
similar. What makes gdb.dwarf2/atomic-type.exp special?
> With regard to gdb_target_symbol_prefix_flags, I think I'll change
> it to call the new gdb_target_symbol_prefix. That seems preferable
> to hardcoding a bunch of targets. If it all works out, I'll submit a
> separate patch.
Yes, please, that's the idea. :-)
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 048070b..e1c9839 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5521,6 +5521,54 @@ proc core_find {binfile {deletefiles {}} {arg ""}} {
> return $destcore
> }
>
> +# gdb_target_symbol_prefix compiles a test program and uses readelf to
s/readelf/objdump/
> +# determine the prefix (such as underscore) for linker symbol
> +# prefixes.
> +
> +gdb_caching_proc gdb_target_symbol_prefix {
> + # Set up and compile a simple test program...
Thanks,
Pedro Alves