diff options
author | Tom de Vries <tdevries@suse.de> | 2020-02-28 16:14:53 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-02-28 16:14:53 +0100 |
commit | 658dadf0b02b618fe81e7b09ad930479941f2236 (patch) | |
tree | 6fdba5fa83955292a2978bcfa8d0604638ed9332 /makefile.vms | |
parent | 4ebe487749c5a3bac19ccaf36fc734a0d29a990e (diff) | |
download | gdb-658dadf0b02b618fe81e7b09ad930479941f2236.zip gdb-658dadf0b02b618fe81e7b09ad930479941f2236.tar.gz gdb-658dadf0b02b618fe81e7b09ad930479941f2236.tar.bz2 |
[gdb] Don't set initial language using previous language
When language is set to auto, part of loading an executable is to update the
language accordingly. This is implemented by set_initial_language.
In case of a c++ executable without DW_AT_main_subprogram,
set_initial_language finds "main" in the minimal symbols, and does a lookup of
"main" in the symbol tables to determine the language of the symbol, and uses
that as initial language.
The symbol lookup is done using lookup_symbol which is a wrapper around
lookup_symbol_in_language, using the current language.
So, consider two c++ executables a.out and b.out, which we'll load one after
another. If we track the resulting lookup_symbol_in_language calls:
...
$ gdb -batch \
-ex "b lookup_symbol_in_language" \
-ex r -ex c -ex c \
--args gdb
...
we find that indeed lookup_symbol_in_language is called once using language_c, and
once using language_c_plus:
...
(gdb) file a.out
Reading symbols from a.out...
Breakpoint 1, lookup_symbol_in_language (name=0x5555568c2050 "main", \
block=0x0, domain=VAR_DOMAIN, lang=language_c, is_a_field_of_this=0x0) \
at ../../gdb/symtab.c:1905
1905 {
(gdb) file b.out
Load new symbol table from "b.out"? (y or n) y
Reading symbols from b.out...
Breakpoint 1, lookup_symbol_in_language (name=0x5555568c2030 "main", \
block=0x0, domain=VAR_DOMAIN, lang=language_cplus, is_a_field_of_this=0x0) \
at ../../gdb/symtab.c:1905
1905 {
(gdb)
...
It seems like a bad idea to have the previous language play a role
in determining the executable language.
Fix this by using lookup_symbol_in_language in set_initial_language with the
default language c as argument.
Tested on x86_64-linux.
gdb/ChangeLog:
2020-02-28 Tom de Vries <tdevries@suse.de>
* symfile.c (set_initial_language): Use default language for lookup.
Diffstat (limited to 'makefile.vms')
0 files changed, 0 insertions, 0 deletions