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: Fri, 30 Oct 2015 11:06: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>
On 10/30/2015 04:25 AM, Kevin Buettner wrote:
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 048070b..f8e35ac 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5521,6 +5521,45 @@ proc core_find {binfile {deletefiles {}} {arg ""}} {
> return $destcore
> }
>
> +# 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 ?
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.
> + set readelf_program [gdb_find_readelf]
> + set result [catch "exec $readelf_program --syms $exe" output]
> +
> + if { $result == 0 \
> + && ![regexp { ([^ a-zA-Z0-9]*)main$} $output dummy prefix] } {
> + verbose "gdb_target_symbol_prefix: Could not find main in readelf output; returning null prefix" 2
> + }
I'm wondering about using a method that would work for mingw/cygwin
as well. The only existing use of the target symbol prefix in the
tree is for those targets, which are coff/pe, not elf. See
gdb_target_symbol_prefix_flags. Maybe just use objdump instead?
Thanks,
Pedro Alves