This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Forbid watchpoint on a constant value
Hi Jan,
On Tuesday 18 May 2010 19:31:06, Jan Kratochvil wrote:
> On Tue, 18 May 2010 19:18:22 +0200, Sergio Durigan Junior wrote:
> > I have also included a testcase which is precompiled using -O2 on GCC.
> > This test reproduces a problem that we were facing because of
> > optimizations, so I thought it would be a good idea to include it. The
> > problem is already solved, FWIW.
>
> The problem was that for some .debug_loc range is can be constant but it
> does not mean the whole expression is constant. The attached testcase
> contains:
>
> Contents of the .debug_loc section:
> Offset Begin End Expression
> 00000000 08048400 08048416 (DW_OP_lit5; DW_OP_stack_value)
> 00000000 08048416 0804841e (DW_OP_reg3)
> 00000000 <End of list>
>
> The former patch had a bug for such -O2 -g code that at the first range it
> rejects watching the variable claiming it is constant.
> http://cvs.fedoraproject.org/viewvc/rpms/gdb/F-13/gdb-6.8-constant-watchpo
> ints.patch?content-type=text%2Fplain&view=co
Thanks for making it clearer :-).
> > gdb/ChangeLog:
> >
> > 2010-05-18 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> I would change the name order but I do not mind either way.
Alphabetical order seemed the right choice to me :-).
> > --- a/gdb/breakpoint.c
> > +++ b/gdb/breakpoint.c
> > @@ -1214,7 +1217,15 @@ is_watchpoint (const struct breakpoint *bpt)
> >
> > If VAL_CHAIN is non-NULL, *VAL_CHAIN will be released from the
> > value chain. The caller must free the values individually. If
> > VAL_CHAIN is NULL, all generated values will be left on the value
> >
> > - chain. */
> > + chain.
> > +
> > + Inferior unreachable values return:
> > + Inferior `int *intp = NULL;' with `watch *intp':
> > + *VALP is NULL, *RESULTP contains lazy LVAL_MEMORY address 0,
> > *VAL_CHAIN + contains the *RESULTP element and also INTP as
> > LVAL_MEMORY. + Inferior `int **intpp = NULL;' with `watch **intpp':
> > + *VALP is NULL, *RESULTP is NULL, *VAL_CHAIN contains lazy
> > LVAL_MEMORY + address 0 and also INTPP as LVAL_MEMORY. */
>
> This comment extension is not relevant for this patch. It could be posted
> separately. Former patch was using `struct value' for the evaluation but
> your patch is using `struct expression'.
Ops, sorry, that sneaked in... Will remove it, thanks.
> > +/* This checks if each element of EXP is not a
> > + constant expression for a watchpoint.
> > +
> > + Returns 1 if EXP is constant, 0 otherwise. */
> > +static int
> > +watchpoint_exp_is_const (struct expression *exp)
> > +{
> > + int i = 0;
> > +
> > + while (i < exp->nelts)
> > + {
> > + int oplenp, argsp;
> > +
> > + switch (exp->elts[i].opcode)
> > + {
> > + /* The user could provide something like:
> > +
> > + `watch *0xdeadbeef + 4'
> > +
> > + In this case, we need to check the remaining elements
> > + of this expression. */
> > + case BINOP_ADD:
> > + case BINOP_SUB:
> > + case BINOP_MUL:
>
> > + case BINOP_DIV:
> Many other math operations could be included (like BINOP_REM for one of the
> many). One can check evaluate_subexp_standard to verify which of the ops
> are really constant. OTOH I understand omitting them is not a regression
> and their later inclusion would be possible by an incremental patch.
Well, maybe it's a bad decision of mine, but I explicitly decided not to
include the other types because I cannot see why the user would use it, i.e.,
the following command:
(gdb) watch 5 % 2
doesn't make sense to me.
> > + /* We are only interested in the descriptor of each element. */
> > + operator_length (exp, i + 1, &oplenp, &argsp);
> > + i += oplenp;
>
> You must iterate backwards. When you check operator_length_standard it
> uses expressions like `expr->elts[endpos - 2].longconst' expecting you
> have given it index after the ending OP_* delimiter, not after the
> starting OP_* delimiter.
:-/
Fixed, thanks!
> > --- /dev/null
> > +++ b/gdb/testsuite/gdb.base/watch-notconst.c
> > @@ -0,0 +1,23 @@
> > +/* The original program corresponding to watch-notconst.S.
> > +
> > + This program is not compiled; the .S version is used instead.
> > +
> > + The purpose of this test is to see if GDB can still watch the
> > + variable `x' even when we compile the program using -O2
> > + optimization. */
>
> Missing FSF copyleft header.
Thanks.
> > --- /dev/null
> > +++ b/gdb/testsuite/gdb.base/watch-notconst.exp
> > @@ -0,0 +1,43 @@
> > +# This test can only be run on x86 targets.
> > +if {![istarget i?86-*]
> > + && ![istarget "x86_64-*-*"]} {
> > + return 0
> > +}
>
> Currently the .S files are i386-dependent and you do not provide
> `additional_flags=-m32' to make it compatible with x86_64 hosts.
> On x86_64 host it currently prints:
> Running ./gdb.base/watch-notconst.exp ...
> gdb compile failed, watch-notconst.c: Assembler messages:
> watch-notconst.c:46: Error: suffix or operands invalid for `push'
> watch-notconst.c:56: Error: suffix or operands invalid for `pop'
> watch-notconst.c:78: Error: suffix or operands invalid for `push'
>
> Unfortunately `additional_flags=-m32' was rejected before:
> Re: [patch] 3/3: New testcase on DW_OP_fbreg
> From: Daniel Jacobowitz <drow at false dot org>
> http://sourceware.org/ml/gdb-patches/2008-05/msg00043.html
>
> Therefore suggesting to remove the "x86_64-*-*" possibility to make it
> common with existing FSF GDB testcases. One has to always run the
> testsuite also with `--target_board unix/-m32' to get its complete
> results.
Sorry, I put the "x86_64-*-*-*" check there in order to run the tests locally
here, but I forgot to remove.
By the way, for the testsuite-experts: is there any way to run the testcase
on my machine (x86_64) without having to add `additional_flags=-m32' and the
check for x86_64? I was trying to pass --target_board=unix/-m32 but that
obviously didn't work...
> > --- /dev/null
> > +++ b/gdb/testsuite/gdb.base/watch-notconst2.c
> > @@ -0,0 +1,18 @@
> > +/* The original program corresponding to watch-notconst2.S.
> > +
> > + This program is not compiled; the .S version is used instead.
> > +
> > + The purpose of this test is to see if GDB can still watch the
> > + variable `x' even when we compile the program using -O2
> > + optimization. */
>
> Missing FSF copyleft header.
Thanks.
--
Sergio Durigan Junior
Red Hat
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0ee2258..d5a234d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -61,6 +61,7 @@
#include "valprint.h"
#include "jit.h"
#include "xml-syscall.h"
+#include "parser-defs.h"
/* readline include files */
#include "readline/readline.h"
@@ -186,6 +187,8 @@ static void stopin_command (char *arg, int from_tty);
static void stopat_command (char *arg, int from_tty);
+static int watchpoint_exp_is_const (struct expression *exp);
+
static char *ep_parse_optional_if_clause (char **arg);
static void catch_exception_command_1 (enum exception_event_kind ex_event,
@@ -7700,6 +7703,68 @@ stopat_command (char *arg, int from_tty)
break_command_1 (arg, 0, from_tty);
}
+/* This checks if each element of EXP is not a
+ constant expression for a watchpoint.
+
+ Returns 1 if EXP is constant, 0 otherwise. */
+static int
+watchpoint_exp_is_const (struct expression *exp)
+{
+ int i = exp->nelts;
+
+ while (i > 0)
+ {
+ int oplenp, argsp;
+
+ /* We are only interested in the descriptor of each element. */
+ operator_length (exp, i, &oplenp, &argsp);
+ i -= oplenp;
+
+ switch (exp->elts[i].opcode)
+ {
+ /* The user could provide something like:
+
+ `watch *0xdeadbeef + 4'
+
+ In this case, we need to check the remaining elements
+ of this expression. */
+ case BINOP_ADD:
+ case BINOP_SUB:
+ case BINOP_MUL:
+ case BINOP_DIV:
+
+ case OP_LONG:
+ case OP_DOUBLE:
+ case OP_DECFLOAT:
+
+ case UNOP_NEG:
+ case UNOP_PLUS:
+ break;
+
+ /* If it's an OP_VAR_VALUE, then we must check if the `symbol'
+ element does not correspond to a function or to a constant
+ value. If it does, then it is a constant address. */
+ case OP_VAR_VALUE:
+ {
+ struct symbol *s = exp->elts[i + 2].symbol;
+
+ if (TYPE_CODE (SYMBOL_TYPE (s)) != TYPE_CODE_FUNC
+ && !TYPE_CONST (SYMBOL_TYPE (s)))
+ return 0;
+ break;
+ }
+
+ /* The default action is to return 0 because we are using
+ the optimistic approach here: anything we don't know
+ is not a constant. */
+ default:
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
/* accessflag: hw_write: watch write,
hw_read: watch read,
hw_access: watch access (read or write) */
@@ -7797,6 +7862,18 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
exp_valid_block = innermost_block;
mark = value_mark ();
fetch_watchpoint_value (exp, &val, NULL, NULL);
+
+ /* Checking if the expression is not constant. */
+ if (watchpoint_exp_is_const (exp))
+ {
+ int len;
+
+ len = exp_end - exp_start;
+ while (len > 0 && isspace (exp_start[len - 1]))
+ len--;
+ error (_("Cannot watch constant value %.*s."), len, exp_start);
+ }
+
if (val != NULL)
release_value (val);
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e929481..5d2d5f8 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -3725,6 +3725,18 @@ This command prints a list of watchpoints, using the same format as
@code{info break} (@pxref{Set Breaks}).
@end table
+If you watch for a change in a numerically entered address you need to
+dereference it, as the address itself is just a constant number which will
+never change. @value{GDBN} refuses to create a watchpoint that watches
+a never-changing value:
+
+@smallexample
+(@value{GDBP}) watch 0x600850
+Cannot watch constant value 0x600850.
+(@value{GDBP}) watch *(int *) 0x600850
+Watchpoint 1: *(int *) 6293584
+@end smallexample
+
@value{GDBN} sets a @dfn{hardware watchpoint} if possible. Hardware
watchpoints execute very quickly, and the debugger reports a change in
value at the exact instruction where the change occurs. If @value{GDBN}
diff --git a/gdb/testsuite/gdb.base/watch-notconst.S b/gdb/testsuite/gdb.base/watch-notconst.S
new file mode 100644
index 0000000..968b27b
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watch-notconst.S
@@ -0,0 +1,366 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This source file was generated from watch-notconst.c using the following
+ command line:
+
+ gcc -m32 -dA -S -g -O2 watch-notconst.c -o watch-notconst.S
+
+*/
+
+ .file "watch-notconst.c"
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .text
+.Ltext0:
+ .cfi_sections .debug_frame
+ .p2align 4,,15
+.globl g
+ .type g, @function
+g:
+.LFB0:
+ .file 1 "watch-notconst.c"
+ # watch-notconst.c:11
+ .loc 1 11 0
+ .cfi_startproc
+.LVL0:
+ # basic block 2
+ pushl %ebp
+ .cfi_def_cfa_offset 8
+ movl %esp, %ebp
+ .cfi_offset 5, -8
+ .cfi_def_cfa_register 5
+ # watch-notconst.c:11
+ .loc 1 11 0
+ movl 8(%ebp), %eax
+ # watch-notconst.c:14
+ .loc 1 14 0
+ popl %ebp
+ .cfi_restore 5
+ .cfi_def_cfa 4, 4
+ # watch-notconst.c:11
+ .loc 1 11 0
+ addl $2, %eax
+ # watch-notconst.c:14
+ .loc 1 14 0
+ ret
+ .cfi_endproc
+.LFE0:
+ .size g, .-g
+ .p2align 4,,15
+.globl main
+ .type main, @function
+main:
+.LFB1:
+ # watch-notconst.c:20
+ .loc 1 20 0
+ .cfi_startproc
+.LVL1:
+ # basic block 2
+ pushl %ebp
+ .cfi_def_cfa_offset 8
+ movl %esp, %ebp
+ .cfi_offset 5, -8
+ .cfi_def_cfa_register 5
+ andl $-16, %esp
+ subl $16, %esp
+ # watch-notconst.c:21
+ .loc 1 21 0
+ movl $1, (%esp)
+ call f
+ # watch-notconst.c:23
+ .loc 1 23 0
+ xorl %eax, %eax
+ leave
+ .cfi_restore 5
+ .cfi_def_cfa 4, 4
+ ret
+ .cfi_endproc
+.LFE1:
+ .size main, .-main
+.Letext0:
+ .section .debug_info
+ .long 0xa3 # Length of Compilation Unit Info
+ .value 0x3 # DWARF version number
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
+ .byte 0x4 # Pointer Size (in bytes)
+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
+ .long .LASF4 # DW_AT_producer: "GNU C 4.4.3 20100127 (Red Hat 4.4.3-4)"
+ .byte 0x1 # DW_AT_language
+ .long .LASF5 # DW_AT_name: "watch-notconst.c"
+ .long .LASF6 # DW_AT_comp_dir: "/home/sergio/work/src/git/gdb-src/gdb/testsuite/gdb.base"
+ .long .Ltext0 # DW_AT_low_pc
+ .long .Letext0 # DW_AT_high_pc
+ .long .Ldebug_line0 # DW_AT_stmt_list
+ .uleb128 0x2 # (DIE (0x25) DW_TAG_subprogram)
+ .byte 0x1 # DW_AT_external
+ .ascii "g\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (watch-notconst.c)
+ .byte 0xa # DW_AT_decl_line
+ .byte 0x1 # DW_AT_prototyped
+ .long 0x54 # DW_AT_type
+ .long .LFB0 # DW_AT_low_pc
+ .long .LFE0 # DW_AT_high_pc
+ .byte 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ .long 0x54 # DW_AT_sibling
+ .uleb128 0x3 # (DIE (0x3e) DW_TAG_formal_parameter)
+ .ascii "j\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (watch-notconst.c)
+ .byte 0xa # DW_AT_decl_line
+ .long 0x54 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 0
+ .uleb128 0x4 # (DIE (0x4a) DW_TAG_variable)
+ .ascii "l\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (watch-notconst.c)
+ .byte 0xc # DW_AT_decl_line
+ .long 0x54 # DW_AT_type
+ .byte 0x0 # end of children of DIE 0x25
+ .uleb128 0x5 # (DIE (0x54) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x5 # DW_AT_encoding
+ .ascii "int\0" # DW_AT_name
+ .uleb128 0x6 # (DIE (0x5b) DW_TAG_subprogram)
+ .byte 0x1 # DW_AT_external
+ .long .LASF0 # DW_AT_name: "main"
+ .byte 0x1 # DW_AT_decl_file (watch-notconst.c)
+ .byte 0x13 # DW_AT_decl_line
+ .byte 0x1 # DW_AT_prototyped
+ .long 0x54 # DW_AT_type
+ .long .LFB1 # DW_AT_low_pc
+ .long .LFE1 # DW_AT_high_pc
+ .byte 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ .long 0x93 # DW_AT_sibling
+ .uleb128 0x7 # (DIE (0x76) DW_TAG_formal_parameter)
+ .long .LASF1 # DW_AT_name: "argc"
+ .byte 0x1 # DW_AT_decl_file (watch-notconst.c)
+ .byte 0x13 # DW_AT_decl_line
+ .long 0x54 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 0
+ .uleb128 0x7 # (DIE (0x84) DW_TAG_formal_parameter)
+ .long .LASF2 # DW_AT_name: "argv"
+ .byte 0x1 # DW_AT_decl_file (watch-notconst.c)
+ .byte 0x13 # DW_AT_decl_line
+ .long 0x93 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 4
+ .byte 0x0 # end of children of DIE 0x5b
+ .uleb128 0x8 # (DIE (0x93) DW_TAG_pointer_type)
+ .byte 0x4 # DW_AT_byte_size
+ .long 0x99 # DW_AT_type
+ .uleb128 0x8 # (DIE (0x99) DW_TAG_pointer_type)
+ .byte 0x4 # DW_AT_byte_size
+ .long 0x9f # DW_AT_type
+ .uleb128 0x9 # (DIE (0x9f) DW_TAG_base_type)
+ .byte 0x1 # DW_AT_byte_size
+ .byte 0x6 # DW_AT_encoding
+ .long .LASF3 # DW_AT_name: "char"
+ .byte 0x0 # end of children of DIE 0xb
+ .section .debug_abbrev
+ .uleb128 0x1 # (abbrev code)
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x25 # (DW_AT_producer)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x13 # (DW_AT_language)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x1b # (DW_AT_comp_dir)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x10 # (DW_AT_stmt_list)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x2 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0xa # (DW_FORM_block1)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x3 # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0x0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x4 # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0x0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x5 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0x0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x6 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0xa # (DW_FORM_block1)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x7 # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0x0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x8 # (abbrev code)
+ .uleb128 0xf # (TAG: DW_TAG_pointer_type)
+ .byte 0x0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x9 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0x0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .section .debug_pubnames,"",@progbits
+ .long 0x1d # Length of Public Names Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .long 0xa7 # Compilation Unit Length
+ .long 0x25 # DIE offset
+ .ascii "g\0" # external name
+ .long 0x5b # DIE offset
+ .ascii "main\0" # external name
+ .long 0x0
+ .section .debug_aranges,"",@progbits
+ .long 0x1c # Length of Address Ranges Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .byte 0x4 # Size of Address
+ .byte 0x0 # Size of Segment Descriptor
+ .value 0x0 # Pad to 8 byte boundary
+ .value 0x0
+ .long .Ltext0 # Address
+ .long .Letext0-.Ltext0 # Length
+ .long 0x0
+ .long 0x0
+ .section .debug_str,"MS",@progbits,1
+.LASF2:
+ .string "argv"
+.LASF5:
+ .string "watch-notconst.c"
+.LASF4:
+ .string "GNU C 4.4.3 20100127 (Red Hat 4.4.3-4)"
+.LASF6:
+ .string "/home/sergio/work/src/git/gdb-src/gdb/testsuite/gdb.base"
+.LASF1:
+ .string "argc"
+.LASF0:
+ .string "main"
+.LASF3:
+ .string "char"
+ .ident "GCC: (GNU) 4.4.3 20100127 (Red Hat 4.4.3-4)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.base/watch-notconst.c b/gdb/testsuite/gdb.base/watch-notconst.c
new file mode 100644
index 0000000..621ca1e
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watch-notconst.c
@@ -0,0 +1,40 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* The original program corresponding to watch-notconst.S.
+
+ This program is not compiled; the .S version is used instead.
+
+ The purpose of this test is to see if GDB can still watch the
+ variable `x' even when we compile the program using -O2
+ optimization. */
+
+int
+g (int j)
+{
+ int l = j + 2;
+ return l;
+}
+
+extern int f (int i);
+
+int
+main (int argc, char **argv)
+{
+ f (1);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/watch-notconst.exp b/gdb/testsuite/gdb.base/watch-notconst.exp
new file mode 100644
index 0000000..fd9ee02
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watch-notconst.exp
@@ -0,0 +1,42 @@
+# Copyright 2010 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set test "watch-notconst"
+
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+# This test can only be run on x86 targets.
+if { ![istarget i?86-*] } {
+ return 0
+}
+
+if { [prepare_for_testing "${test}.exp" "${test}" \
+ {watch-notconst.S watch-notconst2.S} {nodebug}] } {
+ return -1
+}
+
+if { ![runto f] } {
+ perror "Could not run to breakpoint `f'."
+ continue
+}
+
+gdb_test "watch x" ".*\[Ww\]atchpoint 2: x" "watch x"
diff --git a/gdb/testsuite/gdb.base/watch-notconst2.S b/gdb/testsuite/gdb.base/watch-notconst2.S
new file mode 100644
index 0000000..a85fc2c
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watch-notconst2.S
@@ -0,0 +1,256 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This source file was generated from watch-notconst2.c using the following
+ command line:
+
+ gcc -m32 -dA -S -g -O2 watch-notconst2.c -o watch-notconst2.S
+
+*/
+
+
+ .file "watch-notconst2.c"
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .text
+.Ltext0:
+ .cfi_sections .debug_frame
+ .p2align 4,,15
+.globl f
+ .type f, @function
+f:
+.LFB0:
+ .file 1 "watch-notconst2.c"
+ # watch-notconst2.c:13
+ .loc 1 13 0
+ .cfi_startproc
+.LVL0:
+ # basic block 2
+ pushl %ebp
+ .cfi_def_cfa_offset 8
+ movl %esp, %ebp
+ .cfi_offset 5, -8
+ .cfi_def_cfa_register 5
+ pushl %ebx
+ subl $20, %esp
+ # watch-notconst2.c:13
+ .loc 1 13 0
+ movl 8(%ebp), %ebx
+ .cfi_offset 3, -12
+ # watch-notconst2.c:15
+ .loc 1 15 0
+ movl $2, (%esp)
+ call g
+.LVL1:
+ # watch-notconst2.c:17
+ .loc 1 17 0
+ movl %ebx, 8(%ebp)
+ # watch-notconst2.c:18
+ .loc 1 18 0
+ addl $20, %esp
+ popl %ebx
+ .cfi_restore 3
+ popl %ebp
+ .cfi_restore 5
+ .cfi_def_cfa 4, 4
+.LVL2:
+ # watch-notconst2.c:17
+ .loc 1 17 0
+ jmp g
+ .cfi_endproc
+.LFE0:
+ .size f, .-f
+.Letext0:
+ .section .debug_loc,"",@progbits
+.Ldebug_loc0:
+.LLST0:
+ .long .LVL0-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LVL1-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x35 # DW_OP_lit5
+ .byte 0x9f # DW_OP_stack_value
+ .long .LVL1-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LVL2-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x1 # Location expression size
+ .byte 0x53 # DW_OP_reg3
+ .long 0x0 # Location list terminator begin (*.LLST0)
+ .long 0x0 # Location list terminator end (*.LLST0)
+ .section .debug_info
+ .long 0x5c # Length of Compilation Unit Info
+ .value 0x3 # DWARF version number
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
+ .byte 0x4 # Pointer Size (in bytes)
+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
+ .long .LASF0 # DW_AT_producer: "GNU C 4.4.3 20100127 (Red Hat 4.4.3-4)"
+ .byte 0x1 # DW_AT_language
+ .long .LASF1 # DW_AT_name: "watch-notconst2.c"
+ .long .LASF2 # DW_AT_comp_dir: "/home/sergio/work/src/git/gdb-src/gdb/testsuite/gdb.base"
+ .long .Ltext0 # DW_AT_low_pc
+ .long .Letext0 # DW_AT_high_pc
+ .long .Ldebug_line0 # DW_AT_stmt_list
+ .uleb128 0x2 # (DIE (0x25) DW_TAG_subprogram)
+ .byte 0x1 # DW_AT_external
+ .ascii "f\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (watch-notconst2.c)
+ .byte 0xc # DW_AT_decl_line
+ .byte 0x1 # DW_AT_prototyped
+ .long 0x58 # DW_AT_type
+ .long .LFB0 # DW_AT_low_pc
+ .long .LFE0 # DW_AT_high_pc
+ .byte 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ .long 0x58 # DW_AT_sibling
+ .uleb128 0x3 # (DIE (0x3e) DW_TAG_formal_parameter)
+ .ascii "i\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (watch-notconst2.c)
+ .byte 0xc # DW_AT_decl_line
+ .long 0x58 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 0
+ .uleb128 0x4 # (DIE (0x4a) DW_TAG_variable)
+ .ascii "x\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (watch-notconst2.c)
+ .byte 0xe # DW_AT_decl_line
+ .long 0x58 # DW_AT_type
+ .long .LLST0 # DW_AT_location
+ .byte 0x0 # end of children of DIE 0x25
+ .uleb128 0x5 # (DIE (0x58) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x5 # DW_AT_encoding
+ .ascii "int\0" # DW_AT_name
+ .byte 0x0 # end of children of DIE 0xb
+ .section .debug_abbrev
+ .uleb128 0x1 # (abbrev code)
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x25 # (DW_AT_producer)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x13 # (DW_AT_language)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x1b # (DW_AT_comp_dir)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x10 # (DW_AT_stmt_list)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x2 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0xa # (DW_FORM_block1)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x3 # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0x0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x4 # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0x0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x5 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0x0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .section .debug_pubnames,"",@progbits
+ .long 0x14 # Length of Public Names Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .long 0x60 # Compilation Unit Length
+ .long 0x25 # DIE offset
+ .ascii "f\0" # external name
+ .long 0x0
+ .section .debug_aranges,"",@progbits
+ .long 0x1c # Length of Address Ranges Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .byte 0x4 # Size of Address
+ .byte 0x0 # Size of Segment Descriptor
+ .value 0x0 # Pad to 8 byte boundary
+ .value 0x0
+ .long .Ltext0 # Address
+ .long .Letext0-.Ltext0 # Length
+ .long 0x0
+ .long 0x0
+ .section .debug_str,"MS",@progbits,1
+.LASF1:
+ .string "watch-notconst2.c"
+.LASF2:
+ .string "/home/sergio/work/src/git/gdb-src/gdb/testsuite/gdb.base"
+.LASF0:
+ .string "GNU C 4.4.3 20100127 (Red Hat 4.4.3-4)"
+ .ident "GCC: (GNU) 4.4.3 20100127 (Red Hat 4.4.3-4)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.base/watch-notconst2.c b/gdb/testsuite/gdb.base/watch-notconst2.c
new file mode 100644
index 0000000..4a70f8d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watch-notconst2.c
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* The original program corresponding to watch-notconst2.S.
+
+ This program is not compiled; the .S version is used instead.
+
+ The purpose of this test is to see if GDB can still watch the
+ variable `x' even when we compile the program using -O2
+ optimization. */
+
+extern int g (int j);
+
+int
+f (int i)
+{
+ int x = 5;
+ g (2);
+ x = i;
+ return g (x);
+}
diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c
index 9275d88..8c212c1 100644
--- a/gdb/testsuite/gdb.base/watchpoint.c
+++ b/gdb/testsuite/gdb.base/watchpoint.c
@@ -40,6 +40,7 @@ struct foo struct1, struct2, *ptr1, *ptr2;
int doread = 0;
char *global_ptr;
+char **global_ptr_ptr;
void marker1 ()
{
@@ -119,6 +120,10 @@ func4 ()
buf[0] = 3;
global_ptr = buf;
buf[0] = 7;
+ buf[1] = 5;
+ global_ptr_ptr = &global_ptr;
+ buf[0] = 9;
+ global_ptr++;
}
int main ()
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index b53faef..c7d5c6b 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -635,7 +635,21 @@ proc test_watchpoint_and_breakpoint {} {
}
}
}
-
+
+proc test_constant_watchpoint {} {
+ global gdb_prompt
+
+ gdb_test "watch 5" "Cannot watch constant value 5." "number is constant"
+ gdb_test "watch marker1" "Cannot watch constant value marker1." \
+ "marker1 is constant"
+ gdb_test "watch count + 6" ".*atchpoint \[0-9\]+: count \\+ 6"
+ gdb_test "set \$expr_breakpoint_number = \$bpnum" ""
+ gdb_test "delete \$expr_breakpoint_number" ""
+ gdb_test "watch 7 + count" ".*atchpoint \[0-9\]+: 7 \\+ count"
+ gdb_test "set \$expr_breakpoint_number = \$bpnum" ""
+ gdb_test "delete \$expr_breakpoint_number" ""
+}
+
proc test_inaccessible_watchpoint {} {
global gdb_prompt
@@ -656,7 +670,8 @@ proc test_inaccessible_watchpoint {} {
}
gdb_test "watch *global_ptr" ".*atchpoint \[0-9\]+: \\*global_ptr"
- gdb_test "next" ".*global_ptr = buf.*"
+ gdb_test "set \$global_ptr_breakpoint_number = \$bpnum" ""
+ gdb_test "next" ".*global_ptr = buf.*" "global_ptr next"
gdb_test_multiple "next" "next over ptr init" {
-re ".*atchpoint \[0-9\]+: \\*global_ptr\r\n\r\nOld value = .*\r\nNew value = 3 .*\r\n.*$gdb_prompt $" {
# We can not test for <unknown> here because NULL may be readable.
@@ -669,6 +684,28 @@ proc test_inaccessible_watchpoint {} {
pass "next over buffer set"
}
}
+ gdb_test "delete \$global_ptr_breakpoint_number" ""
+ gdb_test "watch **global_ptr_ptr" ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr"
+ gdb_test "set \$global_ptr_ptr_breakpoint_number = \$bpnum" ""
+ gdb_test "next" ".*global_ptr_ptr = &global_ptr.*" "gloabl_ptr_ptr next"
+ gdb_test_multiple "next" "next over global_ptr_ptr init" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = .*\r\nNew value = 7 .*\r\n.*$gdb_prompt $" {
+ # We can not test for <unknown> here because NULL may be readable.
+ # This test does rely on *NULL != 7.
+ pass "next over global_ptr_ptr init"
+ }
+ }
+ gdb_test_multiple "next" "next over global_ptr_ptr buffer set" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = 7 .*\r\nNew value = 9 .*\r\n.*$gdb_prompt $" {
+ pass "next over global_ptr_ptr buffer set"
+ }
+ }
+ gdb_test_multiple "next" "next over global_ptr_ptr pointer advance" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = 9 .*\r\nNew value = 5 .*\r\n.*$gdb_prompt $" {
+ pass "next over global_ptr_ptr pointer advance"
+ }
+ }
+ gdb_test "delete \$global_ptr_ptr_breakpoint_number" ""
}
}
@@ -845,6 +882,17 @@ if [initialize] then {
test_watchpoint_and_breakpoint
test_watchpoint_in_big_blob
+
+ # See above.
+ if [istarget "mips-idt-*"] then {
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+ initialize
+ }
+
+ test_constant_watchpoint
}
# Restore old timeout