mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
621eacdfb4
Consider a gdb_load patch to call the gdb_file_cmd twice: ... proc gdb_load { arg } { if { $arg != "" } { + set res [gdb_file_cmd $arg] + if { $res != 0 } { + return $res + } return [gdb_file_cmd $arg] } return 0 } ... With this patch, I run into: ... (gdb) kill^M The program is not being run.^M (gdb) ^M</outputs/gdb.dwarf2/multidictionary/multidictionary^M <.dwarf2/multidictionary/multidictionary"? (y or n) ERROR: Couldn't load outputs/gdb.dwarf2/multidictionary/multidictionary \ into gdb (timeout). p 1^M Please answer y or n.^M <.dwarf2/multidictionary/multidictionary"? (y or n) n^M Not confirmed.^M (gdb) UNRESOLVED: gdb.dwarf2/multidictionary.exp: GDB is alive \ (got interactive prompt) ... The problem is that the second file command results in a prompt, which is normally handled by gdb_file_cmd, but not recognized because the initial part of the prompt is scrolled out. This in turn is caused by using gdb_spawn_with_cmdline_opts without a subsequent "set width 0". Fix this by avoiding gdb_spawn_with_cmdline_opts, and forcing -readline by temporarily modifying GDBFLAGS instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-06-02 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/multidictionary.exp: Don't use gdb_spawn_with_cmdline_opts.
161 lines
3.7 KiB
Plaintext
161 lines
3.7 KiB
Plaintext
# Copyright 2019-2020 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# A test of multi-language dictionaries, a solution to symtab/23010 et al.
|
|
|
|
load_lib dwarf.exp
|
|
|
|
# This test can only be run on targets which support DWARF.
|
|
if {![dwarf2_support]} {
|
|
return 0
|
|
}
|
|
|
|
standard_testfile main.c .S
|
|
|
|
# Create the DWARF. This is derived from the reproducer in the bug
|
|
# mentioned above. This DIE tree is typical of compilations wtih
|
|
# LTO enabled.
|
|
|
|
set asm_file [standard_output_file $srcfile2]
|
|
Dwarf::assemble $asm_file {
|
|
declare_labels D45d9 D5079 D5080 D50a9 D50af D5ab2 D5ac2 D5ace D5acf
|
|
declare_labels D2135f D2216a D22171 D226c4 D226ca D244ca \
|
|
D245da D245e6
|
|
declare_labels D41c21 D42025 D42045 D42038 D42045 D420b5
|
|
|
|
cu {} {
|
|
D45d9: compile_unit {
|
|
{language @DW_LANG_C_plus_plus}
|
|
{name "SerialPortUtils.cpp"}
|
|
} {
|
|
D5079: base_type {
|
|
{byte_size 1 sdata}
|
|
{encoding @DW_ATE_unsigned}
|
|
{name "char"}
|
|
}
|
|
|
|
D5080: const_type {
|
|
{type :$D5079}
|
|
}
|
|
|
|
D50a9: pointer_type {
|
|
{byte_size 4 sdata}
|
|
{type :$D5080}
|
|
}
|
|
|
|
D50af: const_type {
|
|
{type :$D50a9}
|
|
}
|
|
|
|
D5ab2: subprogram {
|
|
{external 1 flag}
|
|
{linkage_name "_Z18SerialSyncWriteStrPKc"}
|
|
} {
|
|
D5ac2: formal_parameter {
|
|
{name "msg"}
|
|
{type :$D50af}
|
|
}
|
|
D5ace: lexical_block {} {
|
|
D5acf: DW_TAG_variable {
|
|
{name "p"}
|
|
{type :$D50a9}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
cu {} {
|
|
D2135f: compile_unit {
|
|
{language @DW_LANG_C_plus_plus}
|
|
{name "Main.cpp"}
|
|
} {
|
|
D2216a: base_type {
|
|
{byte_size 1 sdata}
|
|
{encoding @DW_ATE_unsigned_char}
|
|
{name "char"}
|
|
}
|
|
|
|
D22171: const_type {
|
|
{type :$D2216a}
|
|
}
|
|
|
|
D226c4: pointer_type {
|
|
{byte_size 4 sdata}
|
|
{type :$D22171}
|
|
}
|
|
|
|
D226ca: const_type {
|
|
{type :$D226c4}
|
|
}
|
|
|
|
D245da: subprogram {
|
|
{name "PrintPanicMsg"}
|
|
} {
|
|
D245e6: formal_parameter {
|
|
{name "msg"}
|
|
{type :$D226ca}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
cu {} {
|
|
D41c21: compile_unit {
|
|
{language @DW_LANG_C99}
|
|
{name "<artificial>"}
|
|
} {
|
|
D42025: subprogram {
|
|
{abstract_origin %$D245da}
|
|
{low_pc 0x80b60 addr}
|
|
{high_pc 0x6c data4}
|
|
} {
|
|
D42038: formal_parameter {
|
|
{abstract_origin %$D245e6}
|
|
}
|
|
|
|
D42045: inlined_subroutine {
|
|
{abstract_origin %$D5ab2}
|
|
{low_pc 0x8060 addr}
|
|
{high_pc 0xc data4}
|
|
} {
|
|
D420b5: formal_parameter {
|
|
{abstract_origin %$D5ac2}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# Build the test executable.
|
|
if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
|
|
== -1} {
|
|
return -1
|
|
}
|
|
|
|
# We force the DIEs above to be read in via "-readnow".
|
|
save_vars { GDBFLAGS } {
|
|
set GDBFLAGS "$GDBFLAGS -readnow"
|
|
clean_restart
|
|
}
|
|
gdb_load $binfile
|
|
|
|
# All we need to do is check whether GDB is alive. Without
|
|
# multidictionaries, it will either crash, assert, or throw an
|
|
# internal_error.
|
|
gdb_test "p 1" "= 1" "GDB is alive"
|
|
|