diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2010-06-16 18:30:34 +0000 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2010-06-16 18:30:34 +0000 |
commit | 65d79d4b97a28b720c44e26571170a3af5d300f6 (patch) | |
tree | b77afb71ac6b18133c28dfe87c7820bf7ddb3420 /gdb/testsuite/gdb.dwarf2 | |
parent | 3e23530232f272b7a55c6492948bdd76f65e7334 (diff) | |
download | gdb-65d79d4b97a28b720c44e26571170a3af5d300f6.zip gdb-65d79d4b97a28b720c44e26571170a3af5d300f6.tar.gz gdb-65d79d4b97a28b720c44e26571170a3af5d300f6.tar.bz2 |
gdb/ChangeLog:
2010-06-16 Sergio Durigan Junior <sergiodj@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c: Include parser-defs.h.
(watchpoint_exp_is_const): New function.
(watch_command_1): Call watchpoint_exp_is_const to check
if the expression is constant.
gdb/doc/ChangeLog:
2010-06-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo: Include information about the correct use
of addresses in the `watch' command.
gdb/testsuite/ChangeLog:
2010-06-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/watch-notconst.c: New file.
* gdb.base/watch-notconst.S: New file.
* gdb.base/watch-notconst2.c: New file.
* gdb.base/watch-notconst2.S: New file.
* gdb.base/watch-notconst.exp: New file.
* gdb.base/watchpoint.c (global_ptr_ptr): New variable.
(func4): Add operations on `global_ptr_ptr'.
* gdb.base/watchpoint.exp (test_constant_watchpoint): New
routine to test watchpoints created with a constant expression.
(test_inaccessible_watchpoint): Include tests for watchpoints
created with a constant expression.
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2')
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/watch-notconst.c | 39 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/watch-notconst.exp | 44 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/watch-notconst2.S | 256 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/watch-notconst2.c | 35 |
4 files changed, 374 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/watch-notconst.c b/gdb/testsuite/gdb.dwarf2/watch-notconst.c new file mode 100644 index 0000000..b500fc4 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/watch-notconst.c @@ -0,0 +1,39 @@ +/* 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 program will be compiled with watch-notconst2.S in order to generate a + single binary. + + The purpose of this test is to see if GDB can still watch the + variable `x' (define in watch-notconst2.c:f) 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.dwarf2/watch-notconst.exp b/gdb/testsuite/gdb.dwarf2/watch-notconst.exp new file mode 100644 index 0000000..e0b3d33 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/watch-notconst.exp @@ -0,0 +1,44 @@ +# 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" + +# This test can only be run on targets which support DWARF-2 and use gas. +# For now pick a sampling of likely targets. +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.c 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.dwarf2/watch-notconst2.S b/gdb/testsuite/gdb.dwarf2/watch-notconst2.S new file mode 100644 index 0000000..137b701 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/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:30 + .loc 1 30 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:30 + .loc 1 30 0 + movl 8(%ebp), %ebx + .cfi_offset 3, -12 + # watch-notconst2.c:32 + .loc 1 32 0 + movl $2, (%esp) + call g +.LVL1: + # watch-notconst2.c:34 + .loc 1 34 0 + movl %ebx, 8(%ebp) + # watch-notconst2.c:35 + .loc 1 35 0 + addl $20, %esp + popl %ebx + .cfi_restore 3 + popl %ebp + .cfi_restore 5 + .cfi_def_cfa 4, 4 +.LVL2: + # watch-notconst2.c:34 + .loc 1 34 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: "" + .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 0x1d # 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 0x1d # 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 0x1f # 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 "" +.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.dwarf2/watch-notconst2.c b/gdb/testsuite/gdb.dwarf2/watch-notconst2.c new file mode 100644 index 0000000..4a70f8d --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/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); +} |