aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/annota1.exp
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-04-22 15:35:07 +0100
committerYao Qi <yao.qi@linaro.org>2016-04-22 15:35:07 +0100
commit495346f6f07ea711662106f0e6f8d684fe489cd8 (patch)
tree98ff10b144c3c84a5e142c434f2200702a18a797 /gdb/testsuite/gdb.base/annota1.exp
parent0f60e29b5a13066f7625dfeadcc329aeefd9d5a5 (diff)
downloadgdb-495346f6f07ea711662106f0e6f8d684fe489cd8.zip
gdb-495346f6f07ea711662106f0e6f8d684fe489cd8.tar.gz
gdb-495346f6f07ea711662106f0e6f8d684fe489cd8.tar.bz2
Fix fail in gdb.base/annota1.exp and gdb.base/annota3.exp
Hi, I am seeing the fail below on aarch64-linux with gcc 4.9.2, break main Breakpoint 1 at 0x4006e8: file binutils-gdb/gdb/testsuite/gdb.base/annota1.c, line 14.^M (gdb) FAIL: gdb.base/annota1.exp: breakpoint main the test expects the breakpoint is set on line 15. Let us look at the main function, 12 int 13 main (void) 14 { 15 int my_array[3] = { 1, 2, 3 }; /* break main */ 16 17 value = 7; 18 19 #ifdef SIGUSR1 20 signal (SIGUSR1, handle_USR1); 21 #endif (gdb) disassemble main Dump of assembler code for function main: 0x00000000004006e0 <+0>: stp x29, x30, [sp,#-48]! 0x00000000004006e4 <+4>: mov x29, sp 0x00000000004006e8 <+8>: adrp x0, 0x411000 <signal@got.plt> 0x00000000004006ec <+12>: add x0, x0, #0x40 the breakpoint is set on the right address after skipping prologue, but 0x00000000004006e8 is mapped to the line 14, as shown below, (gdb) maintenance info line-table objfile: /home/yao.qi/source/build-aarch64/gdb/testsuite/outputs/gdb.base/annota1/annota1 ((struct objfile *) 0x2b0e1850) compunit_symtab: ((struct compunit_symtab *) 0x2b0ded50) symtab: /home/yao.qi/source/binutils-gdb/gdb/testsuite/gdb.base/annota1.c ((struct symtab *) 0x2b0dedd0) linetable: ((struct linetable *) 0x2b12c8b0): INDEX LINE ADDRESS 0 7 0x00000000004006d0 1 8 0x00000000004006d8 2 14 0x00000000004006e0 3 14 0x00000000004006e8 4 15 0x00000000004006fc so GDB does nothing wrong. Program hits breakpoint on either line 14 or line 15 is right to me. With anther gcc (4.9.3), the line-table looks correct, and no test fail. Instead of setting breakpoint on main and assuming the line is what we get from the source, we can set breakpoint on that line. On the other hand, the test prints the values of the array and check, so we need to set breakpoint on the line setting the values of array and "next", rather than setting the breakpoint on main. gdb/testsuite: 2016-04-22 Yao Qi <yao.qi@linaro.org> * gdb.base/annota1.exp: Set breakpoint on line $main_line. * gdb.base/annota3.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.base/annota1.exp')
-rw-r--r--gdb/testsuite/gdb.base/annota1.exp13
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 36de636..38b594c 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -46,12 +46,12 @@ clean_restart ${binfile}
gdb_test_no_output "set height 0"
#
-# break at main
+# break in main
#
set main_line [gdb_get_line_number "break main"]
-gdb_test "break main" \
+gdb_test "break ${srcfile}:${main_line}" \
"Breakpoint.*at.* file .*$srcfile, line $main_line\\." \
"breakpoint main"
@@ -293,16 +293,17 @@ gdb_test_multiple "delete 3" "delete bp 3" {
}
#
-# break at main, after value is initialized. This is in preparation
+# break in main, after value is initialized. This is in preparation
# to test the annotate output for the display command.
#
-gdb_test_multiple "break main" "break at main" {
+set test "break in main"
+gdb_test_multiple "break ${srcfile}:${main_line}" $test {
-re "post-prompt.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
- pass "break at main"
+ pass $test
}
-re "post-prompt.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
setup_xfail "*-*-*" 1270
- fail "break at main"
+ fail $test
}
}