diff options
author | Tom Tromey <tromey@redhat.com> | 2013-08-07 20:03:52 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-08-07 20:03:52 +0000 |
commit | bf6d8a91eac025c21b03d604bdb2e4b901c4c6bc (patch) | |
tree | 1917c00119029aac713cbfef834ba7ee6966ec18 /gdb/testsuite | |
parent | f9125b6c6c523dc3f0191fdb5b9551c6f5d70c61 (diff) | |
download | gdb-bf6d8a91eac025c21b03d604bdb2e4b901c4c6bc.zip gdb-bf6d8a91eac025c21b03d604bdb2e4b901c4c6bc.tar.gz gdb-bf6d8a91eac025c21b03d604bdb2e4b901c4c6bc.tar.bz2 |
use language of the main symbol
With "dwz -m", "main" appears in both the PU and the importing CU when
running anon-struct.exp. However, the PU does not have a file name.
So, find_main_filename returns the empty string, making
deduce_language_from_filename return language_unknown.
This patch fixes this problem by changing gdb to use the ordinary
symbol-lookup functions to find "main"'s symbol. Then, it examines the
symbol's language.
I think this is cleaner than the current approach. For one thing it
avoids trying to guess the language based on the source file name,
instead deferring to the presumably more reliable debuginfo.
Another possible fix would have been to change how the file name is
found via the "qf" methods. However, I think the approach given is
preferable for the reason outlined above.
This required a minor test suite change, as now a symtab is expanded
during the search for "main".
Built and regtested (both ways) on x86-64 Fedora 18.
* symfile.c (set_initial_language): Look up "main" symbol
and use its language.
* symtab.c (find_main_filename): Remove.
* symtab.h (find_main_filename): Remove.
* gdb.base/maint.exp: Allow zero symtabs to be expanded.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/maint.exp | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 160a27a..fb21761 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2013-08-07 Tom Tromey <tromey@redhat.com> + * gdb.base/maint.exp: Allow zero symtabs to be expanded. + +2013-08-07 Tom Tromey <tromey@redhat.com> + * gdb.dwarf2/dwz.exp: New file. 2013-08-02 Tom Tromey <tromey@redhat.com> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 7057ac7..3093aae 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -72,9 +72,10 @@ gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*" gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs" gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \ "mt expand-symtabs" { - -re "#primary symtabs: (1|2) \\(\[+\](1|2)\\),.*$gdb_prompt $" { - # This should expand one or at most two primary symtabs. - # "Normally" it will expand just the one for break.c, but if the + -re "#primary symtabs: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" { + # This should expand at most two primary symtabs. + # "Normally" it will not expand any, because the symtab + # holding "main" will already have been expanded, but if the # file is compiled with -fdebug-types-section then a second primary # symtab for break.c will be created for any types. pass "mt expand-symtabs" |