[gdb/testsuite] Fix psymtab expansion postponement in c-linkage-name.exp
The test-case gdb.base/c-linkage-name.exp starts with the following test:
...
gdb_test "print symada__cS" \
" = {a =
100829103}" \
"print symada__cS before partial symtab expansion"
...
However, printing the state of the partial symtabs using maint info psymtabs
shows that in fact the symtab has already been expanded:
...
{ psymtab c-linkage-name.c ((struct partial_symtab *) 0x1e27b40)^M
readin yes^M
...
This is due to set_initial_language, which looks up the main symbol, which
expands the psymtab containing main.
Fix this by moving all but main into a separate source file c-linkage-name-2.c.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-02-28 Tom de Vries <tdevries@suse.de>
* gdb.base/c-linkage-name.c (main): Call do_something_other_cu.
(struct wrapper, do_something, mundane/symada__cS): Move ...
* gdb.base/c-linkage-name-2.c: ... here. New source file.
* gdb.base/c-linkage-name.exp: Add verification of psymtab expansion.
Update "print symada__cS before partial symtab expansion" regexp.
Update breakpoint location. Flush symbol cache after expansion.