This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: iam ahal <hal9000ed2k at gmail dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, Doug Evans <dje at google dot com>, gdb-patches at sourceware dot org, eliz at gnu dot org, pmuldoon at redhat dot com, brobecker at adacore dot com, pedro at codesourcery dot com, drow at false dot org
- Date: Wed, 7 Dec 2011 00:00:45 +0100
- Subject: Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
- References: <CAA18ubJAvwHt-sq8XN98PhC=LSFXPbcy4P1+AVic-G=MNE7R2A@mail.gmail.com> <CAA18ubLBZseSxqjWSk1jH7OeZi06K_o75HKc0CN-_iCAjQ5boA@mail.gmail.com> <83bowq6x7f.fsf@gnu.org> <CAA18ub+ox5kmHu=1qvMkwNfzbCxMdy3M4Z8eKuheaiqyjxJvEg@mail.gmail.com> <m3d3gu77uk.fsf@fleche.redhat.com> <CAA18ubL6ofB9X+2nJC3jUCTEqZBbWL4=wXHgBkOFKJaAOXsiow@mail.gmail.com> <m3vcue1jal.fsf@fleche.redhat.com> <CAA18ubL9TG7we7bi3U_0DQw8KLXNaYCfGa91KQrvC2jM=6DsBw@mail.gmail.com> <CADPb22TT2eP+pkdTu50EyTsctzWskDz=oShoTDTsrtzF0Qdnzw@mail.gmail.com> <CAA18ubLKqCCsH6H7mj-nK3cjWKS1g_rbJr9EbG8COY3S+GChxQ@mail.gmail.com>
Hi Eldar,
I really miss a testcase here as I had no clue what the settings print in
fact. Also I expect you have a compiler producing:
<11> DW_AT_name : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c
<15> DW_AT_comp_dir : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb
in some case but I do not see how to get such DWARF from Fedora 16 GCC.
Therefore to test all the DWARF cases one needs a gdb.dwarf2/ testcase for it.
I will write one if you do not want to. One may easily break the behavior with
future changes otherwise.
The doc should also IMO contain some samples, what is "full filename".
I would assume it means /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c but
apparently it does not.
Test commands expects ./gdb-clean to be FSF GDB HEAD and ./gdb patched gdb.
for d in "" $PWD/;do rm -rf 35 35.c 35d 35l.so;mkdir 35d;echo 'extern void f (void); int main (void) { f (); return 0; }' >35.c;echo 'void f (void) {}' >35d/35l.c;gcc -o 35l.so -Wl,-soname,./35l.so -shared -fPIC -Wall -g ${d}35d/35l.c; gcc -o 35 35.c -Wall -g ./35l.so;./gdb-clean -ex 'set break pend on' -q -nx ./35 -ex 'b f' -ex r -ex 'bt' -ex c -ex q | grep ' f ';for i in basename full without-compilation-directory;do echo ---$i;./gdb -ex "set backtrace filename-display $i" -ex 'set break pend on' -q -nx ./35 -ex 'b f' -ex r -ex 'bt' -ex c -ex q | grep ' f ';done;readelf -wi 35l.so|grep -E 'DW_AT_(producer|name|comp_dir)';done
gcc 35d/35l.c ...
<c> DW_AT_producer : (indirect string, offset: 0x0): GNU C 4.6.2 20111027 (Red Hat 4.6.2-1) -mtune=generic -march=x86-64 -g -fPIC
<11> DW_AT_name : (indirect string, offset: 0x71): 35d/35l.c
<15> DW_AT_comp_dir : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb
- FSF GDB HEAD:
#0 f () at 35d/35l.c:1
- set backtrace filename-display basename
#0 f () at 35l.c:1
- set backtrace filename-display full
#0 f () at 35d/35l.c:1
- set backtrace filename-display without-compilation-directory
#0 f () at 35d/35l.c:1
gcc $PWD/35d/35l.c ...
<c> DW_AT_producer : (indirect string, offset: 0x0): GNU C 4.6.2 20111027 (Red Hat 4.6.2-1) -mtune=generic -march=x86-64 -g -fPIC
<11> DW_AT_name : (indirect string, offset: 0x4d): /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c
- FSF GDB HEAD
#0 f () at /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c:1
- set backtrace filename-display basename
#0 f () at 35l.c:1
- set backtrace filename-display full
#0 f () at /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c:1
- set backtrace filename-display without-compilation-directory
#0 f () at 35l.c:1
I miss there an option to print the output of symtab_to_fullname which was
requested by Red Hat desktop developers, therefore to print:
#0 f () at /home/jkratoch/redhat/gdb-clean/gdb/35d/35l.c:1
even if it was compiled as 35d/35l.c and not $PWD/35d/35l.c.
Thanks,
Jan