diff options
author | Tom Tromey <tromey@redhat.com> | 2010-11-29 21:18:16 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-11-29 21:18:16 +0000 |
commit | 8cf6f0b103e62f41f7cebe50f959a8c15986bd8e (patch) | |
tree | b1eb46a9debe1fb20a6a9dd47d7873edc0f8b68d /gdb/testsuite | |
parent | 531ff9fd96ea76a508d7351f5bd9130cdb7a4f13 (diff) | |
download | gdb-8cf6f0b103e62f41f7cebe50f959a8c15986bd8e.zip gdb-8cf6f0b103e62f41f7cebe50f959a8c15986bd8e.tar.gz gdb-8cf6f0b103e62f41f7cebe50f959a8c15986bd8e.tar.bz2 |
gdb
* opencl-lang.c (lval_func_check_synthetic_pointer): New
function.
* value.h (struct lval_funcs) <indirect, check_synthetic_pointer>:
New fields.
(value_bits_synthetic_pointer): Declare.
* value.c (value_bits_synthetic_pointer): New function.
* valprint.c (valprint_check_validity): Handle synthetic
pointers.
* valops.c (value_ind): Use new 'indirect' lval_funcs method.
* valarith.c (value_ptradd): Use set_value_component_location.
* p-valprint.c (pascal_object_print_value_fields): Handle
synthetic pointers.
* jv-valprint.c (java_print_value_fields): Handle synthetic
pointers.
* dwarf2read.c (dwarf_stack_op_name): Add
DW_OP_GNU_implicit_pointer.
(dwarf2_fetch_die_location_block): Add get_frame_pc, baton
arguments. Handle location lists.
(fill_in_loclist_baton): New function.
(dwarf2_symbol_mark_computed): Use it.
* dwarf2loc.h (dwarf2_find_location_expression): Declare.
(dwarf2_fetch_die_location_block): Add get_frame_pc, baton
arguments.
* dwarf2loc.c (dwarf2_find_location_expression): Rename from
find_location_expression. No longer static. Update all callers.
(dwarf_expr_frame_pc): New function.
(per_cu_dwarf_call): Add get_frame_pc, baton arguments. Update
all callers.
(struct piece_closure) <per_cu>: New field.
(allocate_piece_closure): Add per_cu argument.
(read_pieced_value): Handle DWARF_VALUE_IMPLICIT_POINTER.
(check_pieced_value_bits): Remove validity argument, add check_for
argument. Handle DWARF_VALUE_IMPLICIT_POINTER.
(check_pieced_value_validity, check_pieced_value_invalid):
Update.
(check_pieced_synthetic_pointer): New function.
(get_frame_address_in_block_wrapper): New function.
(indirect_pieced_value): New function.
(pieced_value_funcs): Update.
(invalid_synthetic_pointer): New function.
(dwarf2_evaluate_loc_desc_full): Rename from
dwarf2_evaluate_loc_desc. Add byte_offset argument.
(dwarf2_evaluate_loc_desc): Rewrite.
(dwarf2_loc_desc_needs_frame): Set new field on context.
(get_ax_pc): New function.
(disassemble_dwarf_expression): Handle
DW_OP_GNU_implicit_pointer.
* dwarf2expr.h (enum dwarf_value_location)
<DWARF_VALUE_IMPLICIT_POINTER>: New constant.
(struct dwarf_expr_context) <get_frame_pc>: New field.
(struct dwarf_expr_piece) <v.ptr>: New field.
* dwarf2expr.c (add_piece): Handle DWARF_VALUE_IMPLICIT_POINTER.
(execute_stack_op): Handle DW_OP_GNU_implicit_pointer.
* dwarf2-frame.c (no_get_frame_pc): New function.
(execute_stack_op): Set new field on context.
* cp-valprint.c (cp_print_value_fields): Handle synthetic
pointers.
gdb/testsuite
* gdb.dwarf2/implptr.exp: New file.
* gdb.dwarf2/implptr.c: New file.
* gdb.dwarf2/implptr.S: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/implptr.S | 882 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/implptr.c | 68 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/implptr.exp | 80 |
4 files changed, 1036 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 22c3476..3564704 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-11-29 Tom Tromey <tromey@redhat.com> + + * gdb.dwarf2/implptr.exp: New file. + * gdb.dwarf2/implptr.c: New file. + * gdb.dwarf2/implptr.S: New file. + 2010-11-29 Phil Muldoon <pmuldoon@redhat.com> PR python/12199 diff --git a/gdb/testsuite/gdb.dwarf2/implptr.S b/gdb/testsuite/gdb.dwarf2/implptr.S new file mode 100644 index 0000000..8ea793c --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/implptr.S @@ -0,0 +1,882 @@ + .file "implptr.c" + .text +.Ltext0: + .p2align 4,,15 + .globl foo + .type foo, @function +foo: +.LFB1: + .file 1 "implptr.c" + .loc 1 45 0 + .cfi_startproc +.LVL0: + .loc 1 45 0 + movl 4(%esp), %eax +.LVL1: +.LBB6: +.LBB7: + .loc 1 36 0 + addl $1, u +.LVL2: + .loc 1 38 0 + addl $1, u+4 +.LVL3: + .loc 1 40 0 + addl $1, u+8 +.LVL4: +.LBE7: +.LBE6: +.LBB8: +.LBB9: + .loc 1 36 0 + addl $1, u+12 +.LVL5: + .loc 1 38 0 + addl $1, u+16 +.LVL6: + .loc 1 40 0 + addl $1, u+20 +.LBE9: +.LBE8: + .loc 1 52 0 + leal (%eax,%eax,4), %eax + .loc 1 53 0 + ret + .cfi_endproc +.LFE1: + .size foo, .-foo + .p2align 4,,15 + .globl bar + .type bar, @function +bar: +.LFB2: + .loc 1 57 0 + .cfi_startproc +.LVL7: + .loc 1 61 0 + movl 4(%esp), %eax + addl $1, %eax + .loc 1 63 0 + ret + .cfi_endproc +.LFE2: + .size bar, .-bar + .p2align 4,,15 + .globl main + .type main, @function +main: +.LFB3: + .loc 1 66 0 + .cfi_startproc + pushl %ebx + .cfi_def_cfa_offset 8 + .cfi_offset 3, -8 + subl $4, %esp + .cfi_def_cfa_offset 12 + .loc 1 67 0 + movl $5, (%esp) + call bar + movl $23, (%esp) + movl %eax, %ebx + call foo + .loc 1 68 0 + addl $4, %esp + .cfi_def_cfa_offset 8 + .loc 1 67 0 + addl %ebx, %eax + .loc 1 68 0 + popl %ebx + .cfi_def_cfa_offset 4 + .cfi_restore 3 + ret + .cfi_endproc +.LFE3: + .size main, .-main + .comm u,24,4 +.Letext0: + .section .debug_types,"G",@progbits,wt.ade46b36db7edab6,comdat + .long 0x46 + .value 0x4 + .long .Ldebug_abbrev0 + .byte 0x4 + .byte 0xad + .byte 0xe4 + .byte 0x6b + .byte 0x36 + .byte 0xdb + .byte 0x7e + .byte 0xda + .byte 0xb6 + .long 0x1d + .uleb128 0x1 + .byte 0x1 + .long .Ldebug_line0 + .uleb128 0x2 + .string "S" + .byte 0x8 + .byte 0x1 + .byte 0x18 + .long 0x3c + .uleb128 0x3 + .string "x" + .byte 0x1 + .byte 0x1a + .long 0x3c + .byte 0 + .uleb128 0x3 + .string "y" + .byte 0x1 + .byte 0x1a + .long 0x42 + .byte 0x4 + .byte 0 + .uleb128 0x4 + .byte 0x4 + .long 0x42 + .uleb128 0x5 + .byte 0x4 + .byte 0x5 + .string "int" + .byte 0 + .section .debug_info,"",@progbits +.Ldebug_info0: + .long 0x1b6 + .value 0x4 + .long .Ldebug_abbrev0 + .byte 0x4 + .uleb128 0x6 + .long .LASF1 + .byte 0x1 + .long .LASF2 + .long .LASF3 + .long .Ltext0 + .long .Letext0 + .long .Ldebug_line0 + .uleb128 0x4 + .byte 0x4 + .long 0x2b + .uleb128 0x5 + .byte 0x4 + .byte 0x5 + .string "int" + .uleb128 0x7 + .string "add" + .byte 0x1 + .byte 0x20 + .byte 0x3 + .long 0x5a + .uleb128 0x8 + .string "a" + .byte 0x1 + .byte 0x20 + .long 0x5a + .uleb128 0x8 + .string "b" + .byte 0x1 + .byte 0x20 + .long 0x5a + .uleb128 0x8 + .string "c" + .byte 0x1 + .byte 0x20 + .long 0x2b + .byte 0 + .uleb128 0x9 + .byte 0x4 + .byte 0xad + .byte 0xe4 + .byte 0x6b + .byte 0x36 + .byte 0xdb + .byte 0x7e + .byte 0xda + .byte 0xb6 + .uleb128 0xa + .string "foo" + .byte 0x1 + .byte 0x2c + .long 0x2b + .long .LFB1 + .long .LFE1 + .uleb128 0x1 + .byte 0x9c + .long 0xff + .uleb128 0xb + .string "i" + .byte 0x1 + .byte 0x2c + .long 0x2b + .long .LLST0 + .uleb128 0xc + .string "j" + .byte 0x1 + .byte 0x2e + .long 0x2b + .long .LLST1 + .uleb128 0xc + .string "p" + .byte 0x1 + .byte 0x2f + .long 0xff + .long .LLST2 + .uleb128 0xd + .long 0x32 + .long .LBB6 + .long .LBE6 + .byte 0x1 + .byte 0x30 + .long 0xd3 + .uleb128 0xe + .long 0x50 + .byte 0 + .uleb128 0xf + .long 0x47 + .uleb128 0x6 + .byte 0xf2 + .long .Ldebug_info0+151 + .sleb128 8 + .uleb128 0x10 + .long 0x3e + .long .LLST3 + .byte 0 + .uleb128 0x11 + .long 0x32 + .long .LBB8 + .long .LBE8 + .byte 0x1 + .byte 0x33 + .uleb128 0xe + .long 0x50 + .byte 0x3 + .uleb128 0xf + .long 0x47 + .uleb128 0x6 + .byte 0xf2 + .long .Ldebug_info0+151 + .sleb128 8 + .uleb128 0x10 + .long 0x3e + .long .LLST4 + .byte 0 + .byte 0 + .uleb128 0x12 + .byte 0xad + .byte 0xe4 + .byte 0x6b + .byte 0x36 + .byte 0xdb + .byte 0x7e + .byte 0xda + .byte 0xb6 + .long 0x113 + .uleb128 0x13 + .long 0x113 + .byte 0x1 + .byte 0 + .uleb128 0x14 + .byte 0x4 + .byte 0x7 + .long .LASF0 + .uleb128 0xa + .string "bar" + .byte 0x1 + .byte 0x38 + .long 0x2b + .long .LFB2 + .long .LFE2 + .uleb128 0x1 + .byte 0x9c + .long 0x170 + .uleb128 0x15 + .string "i" + .byte 0x1 + .byte 0x38 + .long 0x2b + .uleb128 0x2 + .byte 0x91 + .sleb128 0 + .uleb128 0x16 + .string "j" + .byte 0x1 + .byte 0x3a + .long 0x25 + .uleb128 0x6 + .byte 0xf2 + .long .Ldebug_info0+307 + .sleb128 0 + .uleb128 0x16 + .string "k" + .byte 0x1 + .byte 0x3b + .long 0x170 + .uleb128 0x6 + .byte 0xf2 + .long .Ldebug_info0+319 + .sleb128 0 + .uleb128 0x16 + .string "l" + .byte 0x1 + .byte 0x3c + .long 0x176 + .uleb128 0x6 + .byte 0xf2 + .long .Ldebug_info0+335 + .sleb128 0 + .byte 0 + .uleb128 0x4 + .byte 0x4 + .long 0x25 + .uleb128 0x4 + .byte 0x4 + .long 0x170 + .uleb128 0x17 + .long .LASF4 + .byte 0x1 + .byte 0x41 + .long 0x2b + .long .LFB3 + .long .LFE3 + .uleb128 0x1 + .byte 0x9c + .uleb128 0x18 + .long 0x2b + .long 0x1a1 + .uleb128 0x13 + .long 0x113 + .byte 0x5 + .byte 0 + .uleb128 0x19 + .string "u" + .byte 0x1 + .byte 0x1d + .long 0x191 + .uleb128 0x1a + .string "u" + .byte 0x1 + .byte 0x1d + .long 0x191 + .uleb128 0x5 + .byte 0x3 + .long u + .byte 0 + .section .debug_abbrev,"",@progbits +.Ldebug_abbrev0: + .uleb128 0x1 + .uleb128 0x41 + .byte 0x1 + .uleb128 0x13 + .uleb128 0xb + .uleb128 0x10 + .uleb128 0x17 + .byte 0 + .byte 0 + .uleb128 0x2 + .uleb128 0x13 + .byte 0x1 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0xb + .uleb128 0xb + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x1 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0x3 + .uleb128 0xd + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x38 + .uleb128 0xb + .byte 0 + .byte 0 + .uleb128 0x4 + .uleb128 0xf + .byte 0 + .uleb128 0xb + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0x5 + .uleb128 0x24 + .byte 0 + .uleb128 0xb + .uleb128 0xb + .uleb128 0x3e + .uleb128 0xb + .uleb128 0x3 + .uleb128 0x8 + .byte 0 + .byte 0 + .uleb128 0x6 + .uleb128 0x11 + .byte 0x1 + .uleb128 0x25 + .uleb128 0xe + .uleb128 0x13 + .uleb128 0xb + .uleb128 0x3 + .uleb128 0xe + .uleb128 0x1b + .uleb128 0xe + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x12 + .uleb128 0x1 + .uleb128 0x10 + .uleb128 0x17 + .byte 0 + .byte 0 + .uleb128 0x7 + .uleb128 0x2e + .byte 0x1 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x27 + .uleb128 0x19 + .uleb128 0x20 + .uleb128 0xb + .uleb128 0x1 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0x8 + .uleb128 0x5 + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0x9 + .uleb128 0xf + .byte 0 + .uleb128 0xb + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x20 + .byte 0 + .byte 0 + .uleb128 0xa + .uleb128 0x2e + .byte 0x1 + .uleb128 0x3f + .uleb128 0x19 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x27 + .uleb128 0x19 + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x12 + .uleb128 0x1 + .uleb128 0x40 + .uleb128 0x18 + .uleb128 0x1 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0xb + .uleb128 0x5 + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x2 + .uleb128 0x17 + .byte 0 + .byte 0 + .uleb128 0xc + .uleb128 0x34 + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x2 + .uleb128 0x17 + .byte 0 + .byte 0 + .uleb128 0xd + .uleb128 0x1d + .byte 0x1 + .uleb128 0x31 + .uleb128 0x13 + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x12 + .uleb128 0x1 + .uleb128 0x58 + .uleb128 0xb + .uleb128 0x59 + .uleb128 0xb + .uleb128 0x1 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0xe + .uleb128 0x5 + .byte 0 + .uleb128 0x31 + .uleb128 0x13 + .uleb128 0x1c + .uleb128 0xb + .byte 0 + .byte 0 + .uleb128 0xf + .uleb128 0x5 + .byte 0 + .uleb128 0x31 + .uleb128 0x13 + .uleb128 0x2 + .uleb128 0x18 + .byte 0 + .byte 0 + .uleb128 0x10 + .uleb128 0x5 + .byte 0 + .uleb128 0x31 + .uleb128 0x13 + .uleb128 0x2 + .uleb128 0x17 + .byte 0 + .byte 0 + .uleb128 0x11 + .uleb128 0x1d + .byte 0x1 + .uleb128 0x31 + .uleb128 0x13 + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x12 + .uleb128 0x1 + .uleb128 0x58 + .uleb128 0xb + .uleb128 0x59 + .uleb128 0xb + .byte 0 + .byte 0 + .uleb128 0x12 + .uleb128 0x1 + .byte 0x1 + .uleb128 0x49 + .uleb128 0x20 + .uleb128 0x1 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0x13 + .uleb128 0x21 + .byte 0 + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x2f + .uleb128 0xb + .byte 0 + .byte 0 + .uleb128 0x14 + .uleb128 0x24 + .byte 0 + .uleb128 0xb + .uleb128 0xb + .uleb128 0x3e + .uleb128 0xb + .uleb128 0x3 + .uleb128 0xe + .byte 0 + .byte 0 + .uleb128 0x15 + .uleb128 0x5 + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x2 + .uleb128 0x18 + .byte 0 + .byte 0 + .uleb128 0x16 + .uleb128 0x34 + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x2 + .uleb128 0x18 + .byte 0 + .byte 0 + .uleb128 0x17 + .uleb128 0x2e + .byte 0 + .uleb128 0x3f + .uleb128 0x19 + .uleb128 0x3 + .uleb128 0xe + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x12 + .uleb128 0x1 + .uleb128 0x40 + .uleb128 0x18 + .byte 0 + .byte 0 + .uleb128 0x18 + .uleb128 0x1 + .byte 0x1 + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x1 + .uleb128 0x13 + .byte 0 + .byte 0 + .uleb128 0x19 + .uleb128 0x34 + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x3f + .uleb128 0x19 + .uleb128 0x3c + .uleb128 0x19 + .byte 0 + .byte 0 + .uleb128 0x1a + .uleb128 0x34 + .byte 0 + .uleb128 0x3 + .uleb128 0x8 + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x3f + .uleb128 0x19 + .uleb128 0x2 + .uleb128 0x18 + .byte 0 + .byte 0 + .byte 0 + .section .debug_loc,"",@progbits +.Ldebug_loc0: +.LLST0: + .long .LVL0-.Ltext0 + .long .LVL1-.Ltext0 + .value 0x2 + .byte 0x91 + .sleb128 0 + .long .LVL1-.Ltext0 + .long .LFE1-.Ltext0 + .value 0x6 + .byte 0x91 + .sleb128 0 + .byte 0x6 + .byte 0x31 + .byte 0x24 + .byte 0x9f + .long 0 + .long 0 +.LLST1: + .long .LVL1-.Ltext0 + .long .LVL4-.Ltext0 + .value 0x2 + .byte 0x91 + .sleb128 0 + .long .LVL4-.Ltext0 + .long .LFE1-.Ltext0 + .value 0x6 + .byte 0x91 + .sleb128 0 + .byte 0x6 + .byte 0x33 + .byte 0x1e + .byte 0x9f + .long 0 + .long 0 +.LLST2: + .long .LVL1-.Ltext0 + .long .LVL4-.Ltext0 + .value 0x20 + .byte 0xf2 + .long .Ldebug_info0+125 + .sleb128 0 + .byte 0x93 + .uleb128 0x4 + .byte 0x91 + .sleb128 0 + .byte 0x6 + .byte 0x32 + .byte 0x24 + .byte 0x9f + .byte 0x93 + .uleb128 0x4 + .byte 0xf2 + .long .Ldebug_info0+138 + .sleb128 0 + .byte 0x93 + .uleb128 0x4 + .byte 0x91 + .sleb128 0 + .byte 0x6 + .byte 0x31 + .byte 0x24 + .byte 0x9f + .byte 0x93 + .uleb128 0x4 + .long .LVL4-.Ltext0 + .long .LFE1-.Ltext0 + .value 0x20 + .byte 0xf2 + .long .Ldebug_info0+138 + .sleb128 0 + .byte 0x93 + .uleb128 0x4 + .byte 0x91 + .sleb128 0 + .byte 0x6 + .byte 0x36 + .byte 0x1e + .byte 0x9f + .byte 0x93 + .uleb128 0x4 + .byte 0xf2 + .long .Ldebug_info0+125 + .sleb128 0 + .byte 0x93 + .uleb128 0x4 + .byte 0x91 + .sleb128 0 + .byte 0x6 + .byte 0x31 + .byte 0x24 + .byte 0x9f + .byte 0x93 + .uleb128 0x4 + .long 0 + .long 0 +.LLST3: + .long .LVL1-.Ltext0 + .long .LVL2-.Ltext0 + .value 0x6 + .byte 0xf2 + .long .Ldebug_info0+151 + .sleb128 0 + .long .LVL2-.Ltext0 + .long .LVL3-.Ltext0 + .value 0x2 + .byte 0x30 + .byte 0x9f + .long .LVL3-.Ltext0 + .long .LFE1-.Ltext0 + .value 0x6 + .byte 0xf2 + .long .Ldebug_info0+151 + .sleb128 8 + .long 0 + .long 0 +.LLST4: + .long .LVL4-.Ltext0 + .long .LVL5-.Ltext0 + .value 0x6 + .byte 0xf2 + .long .Ldebug_info0+151 + .sleb128 0 + .long .LVL5-.Ltext0 + .long .LVL6-.Ltext0 + .value 0x2 + .byte 0x30 + .byte 0x9f + .long .LVL6-.Ltext0 + .long .LFE1-.Ltext0 + .value 0x6 + .byte 0xf2 + .long .Ldebug_info0+151 + .sleb128 8 + .long 0 + .long 0 + .section .debug_aranges,"",@progbits + .long 0x1c + .value 0x2 + .long .Ldebug_info0 + .byte 0x4 + .byte 0 + .value 0 + .value 0 + .long .Ltext0 + .long .Letext0-.Ltext0 + .long 0 + .long 0 + .section .debug_line,"",@progbits +.Ldebug_line0: + .section .debug_str,"MS",@progbits,1 +.LASF0: + .string "unsigned int" +.LASF3: + .string "/home/tromey/gnu/archer/archer/gdb/testsuite/gdb.dwarf2" +.LASF4: + .string "main" +.LASF2: + .string "implptr.c" +.LASF1: + .string "GNU C 4.6.0 20101116 (experimental) [trunk revision 166803]" + .ident "GCC: (GNU) 4.6.0 20101116 (experimental) [trunk revision 166803]" + .section .note.GNU-stack,"",@progbits diff --git a/gdb/testsuite/gdb.dwarf2/implptr.c b/gdb/testsuite/gdb.dwarf2/implptr.c new file mode 100644 index 0000000..640be80 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/implptr.c @@ -0,0 +1,68 @@ +/* Copyright (C) 2010 Free Software Foundation, Inc. + + This file is part of GDB. + + 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 implptr.S. + This came from Jakub's gcc-patches email implementing + DW_OP_GNU_implicit_pointer. + Note that it is not ever compiled, implptr.S is used instead. + However, it is used to extract breakpoint line numbers. */ + +struct S +{ + int *x, y; +}; + +int u[6]; + +static inline void +add (struct S *a, struct S *b, int c) +{ + *a->x += *b->x; + a->y += b->y; + u[c + 0]++; + a = (struct S *) 0; + u[c + 1]++; + a = b; + u[c + 2]++; +} + +int +foo (int i) +{ + int j = i; + struct S p[2] = { {&i, i * 2}, {&j, j * 2} }; + add (&p[0], &p[1], 0); + p[0].x = &j; + p[1].x = &i; + add (&p[0], &p[1], 3); + return i + j; /* foo breakpoint */ +} + +int __attribute__ ((noinline, used, noclone)) +bar (int i) +{ + int *j = &i; + int **k = &j; + int ***l = &k; + i++; /* bar breakpoint */ + return i; +} + +int main () +{ + return bar(5) + foo (23); +} diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp new file mode 100644 index 0000000..fa39908 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/implptr.exp @@ -0,0 +1,80 @@ +# 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/>. + +# Test DW_OP_GNU_implicit_pointer. + +# 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 +} + +set testfile "implptr" +set srcfile ${testfile}.S +set csrcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile}.x + +if {[prepare_for_testing ${testfile}.exp ${testfile}.x $srcfile]} { + return -1 +} + +if ![runto_main] { + return -1 +} + +# Test various pointer depths in bar. +proc implptr_test_bar {} { + global csrcfile + set line [gdb_get_line_number "bar breakpoint" $csrcfile] + gdb_test "break implptr.c:$line" "Breakpoint 2.*" \ + "set bar breakpoint for implptr" + gdb_continue_to_breakpoint "continue to bar breakpoint for implptr" + gdb_test "print j" " = .int .. <synthetic pointer>" "print j in implptr:bar" + gdb_test "print *j" " = 5" "print *j in implptr:bar" + gdb_test "print **k" " = 5" "print **k in implptr:bar" + gdb_test "print ***l" " = 5" "print ***l in implptr:bar" +} + +# Test some values in foo. +proc implptr_test_foo {} { + global csrcfile + set line [gdb_get_line_number "foo breakpoint" $csrcfile] + gdb_test "break implptr.c:$line" "Breakpoint 3.*" \ + "set foo breakpoint for implptr" + gdb_continue_to_breakpoint "continue to foo breakpoint for implptr" + gdb_test "print p\[0].x" " = .int .. <synthetic pointer>" \ + "print p\[0].x in implptr:foo" + gdb_test "print *p\[0].x" " = 69" \ + "print *p\[0].x in implptr:foo" + gdb_test "print/d *(((char *) p\[0].x) + 1)" " = 0" \ + "print byte inside *p\[0].x in implptr:foo" + gdb_test "print *(p\[0].x + 10)" \ + "access outside bounds of object referenced via synthetic pointer" \ + "print invalid offset from *p\[0].x in implptr:foo" + gdb_test "print j" " = 69" \ + "print j in implptr:foo" +} + +implptr_test_bar +implptr_test_foo |