mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 22:48:57 +08:00
[gdb/testsuite] Compile varval twice, once without bad DWARF
When we run gdb.dwarf2/varval.exp with board cc-with-dwz, we run into: ... gdb compile failed, dwz: varval: Couldn't find DIE referenced by \ DW_OP_GNU_variable_value cc-with-tweaks.sh: dwz did not modify varval. UNTESTED: gdb.dwarf2/varval.exp: failed to prepare ... The problem is that varval contains some bad DWARF, which has been added intentionally to test GDB, but that bad DWARF causes dwz to error out, which has the consequence that the test-case remains untested with cc-with-dwz, while the test-case contains also correct DWARF that does not occur in any other test, and which we would really like to test with board cc-with-dwz. Fix this by compiling varval twice, once without and once with the bad DWARF, such that we have at least: ... PASS: gdb.dwarf2/varval.exp: print varval PASS: gdb.dwarf2/varval.exp: print varval2 PASS: gdb.dwarf2/varval.exp: print constval PASS: gdb.dwarf2/varval.exp: print mixedval PASS: gdb.dwarf2/varval.exp: print pointerval PASS: gdb.dwarf2/varval.exp: print *pointerval PASS: gdb.dwarf2/varval.exp: print structval PASS: gdb.dwarf2/varval.exp: print untypedval gdb compile failed, dwz: varval: Couldn't find DIE referenced by \ DW_OP_GNU_variable_value cc-with-tweaks.sh: dwz did not modify varval. UNTESTED: gdb.dwarf2/varval.exp: failed to prepare ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-06-26 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/varval.exp: Compile twice, once without bad DWARF.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
2019-06-26 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* gdb.dwarf2/varval.exp: Compile twice, once without bad DWARF.
|
||||
|
||||
2019-06-26 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* gdb.base/index-cache.exp: Add back missing debug option.
|
||||
|
@ -39,9 +39,13 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
|
||||
return -1
|
||||
}
|
||||
|
||||
proc setup_exec { arg_bad } {
|
||||
global asm_file executable srcfile bad
|
||||
set bad ${arg_bad}
|
||||
|
||||
# Create the DWARF.
|
||||
Dwarf::assemble ${asm_file} {
|
||||
global srcdir subdir srcfile
|
||||
global srcdir subdir srcfile bad
|
||||
|
||||
cu {} {
|
||||
DW_TAG_compile_unit {
|
||||
@ -101,11 +105,13 @@ Dwarf::assemble ${asm_file} {
|
||||
{DW_AT_location {DW_OP_addr [gdb_target_symbol "var_p"]} SPECIAL_expr}
|
||||
}
|
||||
|
||||
if { $bad } {
|
||||
var_bad_label: DW_TAG_variable {
|
||||
{DW_AT_name "var_bad"}
|
||||
{DW_AT_type :${int_label}}
|
||||
{DW_AT_external 1 DW_FORM_flag}
|
||||
}
|
||||
}
|
||||
|
||||
struct_label: DW_TAG_structure_type {
|
||||
{DW_AT_byte_size 8*$int_size DW_FORM_sdata}
|
||||
@ -222,6 +228,7 @@ Dwarf::assemble ${asm_file} {
|
||||
DW_OP_stack_value
|
||||
} SPECIAL_expr}
|
||||
}
|
||||
if { $bad } {
|
||||
DW_TAG_variable {
|
||||
{DW_AT_name "badval"}
|
||||
{DW_AT_type :${int_label}}
|
||||
@ -230,6 +237,7 @@ Dwarf::assemble ${asm_file} {
|
||||
DW_OP_stack_value
|
||||
} SPECIAL_expr}
|
||||
}
|
||||
}
|
||||
DW_TAG_variable {
|
||||
{DW_AT_name "structval"}
|
||||
{DW_AT_type :${struct_label}}
|
||||
@ -245,6 +253,7 @@ Dwarf::assemble ${asm_file} {
|
||||
DW_OP_stack_value
|
||||
} SPECIAL_expr}
|
||||
}
|
||||
if { $bad } {
|
||||
DW_TAG_variable {
|
||||
{DW_AT_name "bad_die_val1"}
|
||||
{DW_AT_location {
|
||||
@ -263,6 +272,7 @@ Dwarf::assemble ${asm_file} {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
|
||||
return -1
|
||||
@ -272,6 +282,11 @@ if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${sr
|
||||
if ![runto_main] {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
if { [setup_exec 0] == -1 } {
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_test "print varval" "= 8"
|
||||
gdb_test "print varval2" "= 8"
|
||||
@ -279,7 +294,6 @@ gdb_test "print constval" "= 53"
|
||||
gdb_test "print mixedval" "= 42"
|
||||
gdb_test "print pointerval" "= \\(int \\*\\) $hex <var_b>"
|
||||
gdb_test "print *pointerval" "= 3"
|
||||
gdb_test "print badval" "value has been optimized out"
|
||||
|
||||
# Jakub says: "The intended behavior is that the debug info consumer
|
||||
# computes the value of that referenced variable at the current PC,
|
||||
@ -293,6 +307,11 @@ gdb_test "print structval" \
|
||||
gdb_test "print untypedval" \
|
||||
"Type of DW_OP_GNU_variable_value DIE must be an integer or pointer\\."
|
||||
|
||||
if { [setup_exec 1] == -1 } {
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_test "print badval" "value has been optimized out"
|
||||
gdb_test "print bad_die_val1" \
|
||||
"invalid dwarf2 offset 0xabcdef11"
|
||||
gdb_test "print bad_die_val2" \
|
||||
|
Reference in New Issue
Block a user