View | Details | Raw Unified | Return to bug 10645 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-2 / +83 lines)
Line  Link Here
0
-- /dev/null
0
++ b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c
Line 0 Link Here
0
-- /dev/null
1
/* This testcase is part of GDB, the GNU debugger.
2
3
   Copyright 2009 Free Software Foundation, Inc.
4
5
   This program is free software; you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 3 of the License, or
8
   (at your option) any later version.
9
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
15
   You should have received a copy of the GNU General Public License
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18
static int dummy, *p, **pp;
19
20
int
21
main (void)
22
{
23
  dummy = 1;
24
  dummy = 2;
25
  p = &dummy;
26
  dummy = 3;
27
  dummy = 4;
28
  pp = &p;
29
  dummy = 5;
30
  return 0;
31
}
32
++ b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp
Line 0 Link Here
1
# Copyright 2009 Free Software Foundation, Inc.
2
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16
# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
17
if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
18
     && ![istarget "ia64-*-*"] && ![istarget "s390*-*-*"])
19
    || [target_info exists gdb,no_hardware_watchpoints]} then {
20
    verbose "Skipping watchpoint-hw test."
21
    return
22
}
23
24
set testfile watchpoint-hw-unreadable
25
if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
26
    return -1
27
}
28
29
if ![runto_main] {
30
    return -1
31
}
32
33
# The test below would get false FAIL as the first breakpoint left by
34
# runto_main must be singlestepped over while this testfile tries to ensure no
35
# singlestepping occurs for the watchpoints.
36
delete_breakpoints
37
38
gdb_test "set debug infrun 1"
39
gdb_test "show debug infrun" "Inferior debugging is 1\\."
40
41
gdb_test "watch *p" "ardware watchpoint 2: \\\*p"
42
set test "catch *p"
43
gdb_test_multiple "continue" $test {
44
    -re "\r\ninfrun: no stepping, continue\r\n.*$gdb_prompt $" {
45
	fail $test
46
    }
47
    -re "\r\ninfrun: stopped by watchpoint\r\n.*\r\nHardware watchpoint 2: \\\*p\[\r\n\]+Old value = <unreadable>\r\nNew value = 2\r\n.*$gdb_prompt $" {
48
	pass $test
49
    }
50
}

Return to bug 10645