summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.mi/mi-watch.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.mi/mi-watch.exp')
-rw-r--r--gdb/testsuite/gdb.mi/mi-watch.exp32
1 files changed, 21 insertions, 11 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index ba243999d19..8fe9173f1bc 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 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
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -52,6 +49,9 @@ proc test_watchpoint_creation_and_listing {} {
global srcfile
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+
# Insert a watchpoint and list
# Tests:
# -break-watch C
@@ -62,7 +62,7 @@ proc test_watchpoint_creation_and_listing {} {
"break-watch operation"
mi_gdb_test "222-break-list" \
- "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
+ "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
"list of watchpoints"
}
@@ -73,17 +73,20 @@ proc test_awatch_creation_and_listing {} {
global srcfile
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert an access watchpoint and list it
# Tests:
# -break-watch -a A
# -break-list
mi_gdb_test "333-break-watch -a A" \
- "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
+ "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
"break-watch -a operation"
mi_gdb_test "444-break-list" \
- "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+ "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of watchpoints awatch"
mi_gdb_test "777-break-delete 3" \
@@ -97,17 +100,20 @@ proc test_rwatch_creation_and_listing {} {
global srcfile
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert a read watchpoint and list it.
# Tests:
# -break-insert -r B
# -break-list
mi_gdb_test "200-break-watch -r C" \
- "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+ "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
"break-insert -r operation"
mi_gdb_test "300-break-list" \
- "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\}\}" \
+ "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \
"list of breakpoints"
mi_gdb_test "177-break-delete 4" \
@@ -119,6 +125,10 @@ proc test_watchpoint_triggering {} {
global mi_gdb_prompt
global hex
+ set line_callee4_return_0 [gdb_get_line_number "return 0;"]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+
# Continue execution until the watchpoint is reached, continue again,
# to see the watchpoint go out of scope.
# Does:
@@ -129,7 +139,7 @@ proc test_watchpoint_triggering {} {
gdb_expect {
-re "222\\^running\r\n$mi_gdb_prompt" {
gdb_expect {
- -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+ -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
pass "watchpoint trigger"
}
-re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"}
@@ -144,7 +154,7 @@ proc test_watchpoint_triggering {} {
gdb_expect {
-re "223\\^running\r\n$mi_gdb_prompt" {
gdb_expect {
- -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {
+ -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {
pass "wp out of scope"
}
-re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"}