aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-08-06 16:07:27 -0600
committerTom Tromey <tom@tromey.com>2021-08-23 14:14:20 -0600
commitd30c6bef12b2021211054f8a1672bc675a5cecb5 (patch)
treeeff39c72319ad8b3314998bc25a42a00d2f77945 /gdb
parenta9680e0e54cfd8a12ddb1a583b4acb96dc2bbdbd (diff)
downloadbinutils-d30c6bef12b2021211054f8a1672bc675a5cecb5.zip
binutils-d30c6bef12b2021211054f8a1672bc675a5cecb5.tar.gz
binutils-d30c6bef12b2021211054f8a1672bc675a5cecb5.tar.bz2
Fix a latent bug in dw2-ranges-overlap.exp
dw2-ranges-overlap.exp creates a program where a psymtab has two address ranges, and a function without debug info whose address is between these two ranges. Then it sets a breakpoint on this function and runs to it, expecting that the language should remain "auto; c" when stopped. However, this test case also has a "main" function described (briefly) in the DWARF, and this function is given language C++. Also, a breakpoint stop sets the current language to the language that was used when setting the breakpoint. My new DWARF scanner decides that this "main" is the main program and sets the current language to C++ at startup, causing this test to fail. This patch fixes the test in a simple way, by introducing a new function that takes the place of "main" in the DWARF. I think this still exercises the original problem, but also avoids problems with my branch. It seemed safe to me to submit this separately.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c9
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp10
2 files changed, 13 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c
index 5e69e4a..e3d70f4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c
@@ -29,8 +29,15 @@ foo (int a)
}
int
+quux (int a)
+{
+ asm ("quux_label: .globl quux_label");
+ return foo (a);
+}
+
+int
main (void)
{
asm ("main_label: .globl main_label");
- return foo (5) + 1;
+ return quux (5) + 1;
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
index 972ab76..5da60bf 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
@@ -44,10 +44,10 @@ Dwarf::assemble $asm_file {
declare_labels ranges_label
# Find start address and length for our functions.
- set main_func \
- [function_range main [list ${srcdir}/${subdir}/$srcfile]]
set foo_func \
[function_range foo [list ${srcdir}/${subdir}/$srcfile]]
+ set quux_func \
+ [function_range quux [list ${srcdir}/${subdir}/$srcfile]]
set bar_func \
[function_range bar [list ${srcdir}/${subdir}/$srcfile]]
@@ -59,15 +59,15 @@ Dwarf::assemble $asm_file {
} {
subprogram {
{external 1 flag}
- {name main}
+ {name quux}
}
}
}
ranges {is_64 [is_64_target]} {
ranges_label: sequence {
- base [lindex $main_func 0]
- range 0 [lindex $main_func 1]
+ base [lindex $quux_func 0]
+ range 0 [lindex $quux_func 1]
base [lindex $bar_func 0]
range 0 [lindex $bar_func 1]
}