This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: error reading variable: value has been optimized out


On 26/08/2012 6:18 PM, Jan Kratochvil wrote:
> I agree with the fix but it should have GDB-testsuite compatible testcase.
> Also FYI it is only for backward compatibility with old GCCs.

Included a test case (below) that covers 4 different cases, all of which are currently broken in different ways. These are,

(1) Values held in a single register.

(2) Structure the size of two registers, the dwarf location is a single register, and the structure is assumed to continue into the next sequential register.

(3) Structures the size of two registers split over two registers using dwarf piece information.

(4) Values the size of a single register split over two registers using dwarf piece information to describe the location.

My original patch fixes (1) and (2), though as Tom suggested we could do better in case (2) if we used computed values to describe partially optimized out values, but as gcc is no longer creating examples like this I think we can accept the more limited solution I originally suggessted, if that's ok.

Cases (3) and (4) are not fixed by my original patch, and fail for a different reason.  I could remove these from the test, but I believe the tests are reasonable, or at least not totally crazy, so I'm reluctant to just delete them.  I could just commit the test with these two examples marked as known failing .... or I could fix them :)

The problem is this,

  - In dwarf2loc.c:dwarf_evaluate_loc_desc_full we create the computed value from the pieced location information.

  - In dwarf2loc.c:read_pieced_value we spot that some of the registers are missing and mark the computed value as optimized out.

  - In value.c:value_bits_valid we see the value is both computed, and is marked as optimized out, so we call the check_validity handler on the value.

  - This arrives in dwarf2loc.c:check_pieced_value_bits, the problem is that in here there's no case to handle pieces in registers, and so we just return the default answer that the bits are valid.

Possible fixes,

(a) Could add a case to check_pieced_value_bits to handle the register case, this would need to read the register though, which requires a frame, this would mean either adding a frame parameter back up the call stack, or using VALUE_FRAME_ID, which seems to call a deprecated function, so I'm guessing would be frowned upon.

(b) As the pieces walked in check_pieced_value_bits are private to the value we could, when reading the value in read_pieced_value change the location from DWARF_VALUE_REGISTER to DWARF_VALUE_OPTIMIZED_OUT, this would give us exactly the right result, but I don't really like it, it feels like we'd be throwing away some good information.

(c) We could have some extra state stored within the piece_closure that indicates if each piece is optimized out or not.  This would get set as part of read_pieced_value, and could then be used within check_pieced_value.

(d) Could add a VEC of optimized_out bits/bytes to struct value, similar to the unavailable member, then when we read the pieced value we would setup this VEC correctly and this would be used within value.c:value_bits_valid rather than having to call a special check_validity handler...

(e) I'm open to other ideas...


Thanks,



Andrew

gdb/testsuite/ChangeLog

2012-08-31  Andrew Burgess  <aburgess@broadcom.com>

	* gdb.dwarf2/dw2-op-out-param.S: New file.
	* gdb.dwarf2/dw2-op-out-param.exp: New file.
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S
new file mode 100644
index 0000000..d9bb1b3
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S
@@ -0,0 +1,602 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2012 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 the behaviour of gdb when the location information describes a
+   function parameter as being in a particular register, but a newer frame
+   on the call stack has clobbered the register (we mark it undefined in
+   the dwarf).
+
+   It can, reasonably, be argued that should dwarf like this be seen in the
+   wild, then this is an issue with the dwarf producer as having the
+   location of an item be in a callee clobbered register does not make much
+   sense.  However, older versions of gcc used to do this, and it is not a
+   bad thing to ensure that gdb does a sane thing when presented with such
+   dwarf.
+
+   This test covers 4 cases.
+   (1) 8-byte basic types in 8-byte registers.
+   (2) 16-byte structures being passed using a single reference register,
+       the structure is assumed to flow into the adjacent register.
+   (3) 16-byte structures split over two registers using dwarf pieces.
+   (4) 8-byte basic types being passed in two 4-byte chunks using two
+       registers and dwarf piece information to describe the placement.  */
+
+        .text
+
+.Ltext0:
+        
+        /* main */
+.globl main
+        .type   main, @function
+main:
+.Ltext1:
+        sub    $0x8,%rsp
+.Ltext2:
+        movq    $0xdeadbeefdeadbeef, %rbx
+        movq    $0xdeadbeefdeadbeef, %rcx
+        movq    $0xdeadbeefdeadbeef, %rdx
+        movq    $0xdeadbeefdeadbeef, %rsi
+        movq    $0xdeadbeefdeadbeef, %rdi
+        
+        callq    test1
+        nop
+
+        callq    test2
+        nop
+
+        callq    test3
+        nop
+
+        callq    test4
+        nop
+        
+        add    $0x8,%rsp
+        retq
+.Ltext3:
+        .size   main, .-main
+
+        /* breakpt */
+.globl breakpt
+        .type   breakpt, @function
+breakpt:
+.Ltext4:
+        sub    $0x8,%rsp
+        add    $0x8, %rsp
+        retq
+.Ltext5:
+        .size   breakpt, .-breakpt
+        
+        /* test1 */
+.globl test1
+        .type   test1, @function
+test1:
+.Ltext5:
+        sub    $0x8,%rsp
+.Ltext6:
+        nop
+        callq    breakpt
+        nop
+        add    $0x8,%rsp
+        retq
+.Ltext7:
+        .size   test1, .-test1
+
+        /* test2 */
+.globl test2
+        .type   test2, @function
+test2:
+.Ltext8:
+        sub    $0x8,%rsp
+.Ltext9:
+        nop
+        callq    breakpt
+        nop
+        add    $0x8,%rsp
+        retq
+.Ltext10:
+        .size   test2, .-test2
+
+        /* test3 */
+.globl test3
+        .type   test3, @function
+test3:
+.Ltext11:
+        sub    $0x8,%rsp
+.Ltext12:
+        nop
+        callq    breakpt
+        nop
+        add    $0x8,%rsp
+        retq
+.Ltext13:
+        .size   test3, .-test3
+
+        /* test4 */
+.globl test4
+        .type   test4, @function
+test4:
+.Ltext14:
+        sub    $0x8,%rsp
+.Ltext15:
+        nop
+        callq    breakpt
+        nop
+        add    $0x8,%rsp
+        retq
+.Ltext16:
+        .size   test4, .-test4
+        
+
+.Letext0:
+
+        /*******************************************************/
+
+        .section	.debug_frame,"",@progbits
+        
+        /* CIE */
+.Lframe0:
+	.long	.LECIE0-.LSCIE0 /* length */
+.LSCIE0:
+	.long	0xffffffff      /* CIE_id */
+	.byte	0x1             /* version */
+	.string	""              /* augmentation */
+	.uleb128 0x1            /* code alignment */
+	.sleb128 -8             /* data alignment */
+	.byte	0x10            /* R/A column */
+        /* Initial instructions */
+	.byte	0xc             /* DW_CFA_def_cfa */
+	.uleb128 0x7            /* reg# */
+	.uleb128 0x8            /* offset */
+	.byte	0x90            /* DW_CFA_offset (r16) */
+	.uleb128 0x1            /* offset */
+	.align 8
+.LECIE0:
+
+        /* FDE : breakpt */
+.LSFDE0:
+	.long	.LEFDE0-.LASFDE0        /* length */
+.LASFDE0:
+	.long	.Lframe0                /* CIE reference */
+	.quad	.Ltext4                 /* start */
+	.quad	.Ltext5-.Ltext4         /* length */
+        /* Instructions */
+        .byte   0x7             /* DW_CFA_undefined */
+        .uleb128 0x2            /* reg# */
+        .byte   0x7             /* DW_CFA_undefined */
+        .uleb128 0x4            /* reg# */
+        .byte   0x7             /* DW_CFA_undefined */
+        .uleb128 0x5            /* reg# */        
+	.align 8
+.LEFDE0:
+
+        /* FDE : test1 */
+.LSFDE2:
+	.long	.LEFDE2-.LASFDE2        /* length */
+.LASFDE2:
+	.long	.Lframe0                /* CIE reference */
+	.quad	.Ltext5                 /* start */
+	.quad	.Ltext7-.Ltext5         /* length */
+        /* Instructions */
+ 	.byte	0x4
+	.long	.Ltext6-.Ltext5
+	.byte	0xe
+	.uleb128 0x10
+	.align 8
+.LEFDE2:
+
+        /* FDE : test2 */
+.LSFDE3:
+	.long	.LEFDE3-.LASFDE3        /* length */
+.LASFDE3:
+	.long	.Lframe0                /* CIE reference */
+	.quad	.Ltext8                 /* start */
+	.quad	.Ltext10-.Ltext8        /* length */
+        /* Instructions */
+ 	.byte	0x4
+	.long	.Ltext9-.Ltext8
+	.byte	0xe
+	.uleb128 0x10
+	.align 8
+.LEFDE3:
+
+        /* FDE : test3 */
+.LSFDE4:
+	.long	.LEFDE4-.LASFDE4        /* length */
+.LASFDE4:
+	.long	.Lframe0                /* CIE reference */
+	.quad	.Ltext11                /* start */
+	.quad	.Ltext13-.Ltext11       /* length */
+        /* Instructions */
+ 	.byte	0x4
+	.long	.Ltext12-.Ltext11
+	.byte	0xe
+	.uleb128 0x10
+	.align 8
+.LEFDE4:
+
+        /* FDE : test4 */
+.LSFDE5:
+	.long	.LEFDE5-.LASFDE5        /* length */
+.LASFDE5:
+	.long	.Lframe0                /* CIE reference */
+	.quad	.Ltext14                /* start */
+	.quad	.Ltext16-.Ltext14       /* length */
+        /* Instructions */
+ 	.byte	0x4
+	.long	.Ltext15-.Ltext14
+	.byte	0xe
+	.uleb128 0x10
+	.align 8
+.LEFDE5:
+
+        /* FDE : main */
+.LSFDE9:
+	.long	.LEFDE9-.LASFDE9        /* length */
+.LASFDE9:
+	.long	.Lframe0                /* CIE reference */
+	.quad	.Ltext1                 /* start */
+	.quad	.Ltext3-.Ltext1         /* length */
+        /* Instructions */
+ 	.byte	0x4
+	.long	.Ltext2-.Ltext1
+	.byte	0xe
+	.uleb128 0x10
+	.align 8
+.LEFDE9:
+
+        /*******************************************************/        
+        
+	.section	.debug_info,"",@progbits
+.Ldebug_info0:
+        .long  .Ldebug_info_end - .Ldebug_info_start   /* Length */
+.Ldebug_info_start:
+	.value	0x2                     /* DWARF version number. */
+	.long	.Ldebug_abbrev0         /* Offset into .debug_abbrev */
+	.byte	0x8                     /* Pointer size */
+
+.LDI0:        
+	.uleb128 0x1                    /* DW_TAG_compile_unit */
+	.string	"GNU C 4.2.1"           /* DW_AT_producer */
+	.byte	0x1                     /* DW_AT_language */
+	.quad	.Ltext0                 /* DW_AT_low_pc */
+	.quad	.Letext0                /* DW_AT_high_pc */
+
+.LDI1:
+	.uleb128 0x2                    /* DW_TAG_subprogram */
+	.byte	0x1                     /* DW_AT_external */
+	.string	"breakpt"               /* DW_AT_name */
+	.byte	0x1                     /* DW_AT_prototyped */
+	.quad	.Ltext4                 /* DW_AT_low_pc */
+	.quad	.Ltext5                 /* DW_AT_high_pc */        
+
+.LDI2:
+	.uleb128 0x5                    /* DW_TAG_base_type */
+	.byte	0x8                     /* DW_AT_byte_size */
+	.byte	0x5                     /* DW_AT_encoding (DW_ATE_signed) */
+	.string	"long int"              /* DW_AT_name */
+
+.LDI3:
+        .uleb128 0x7                    /* DW_TAG_structure_type */
+        .string "big"                   /* DW_AT_name */
+        .byte   0x10                    /* DW_AT_byte_size */
+        .long   .LDI6                   /* DW_AT_sibling */
+        
+.LDI4:
+        .uleb128 0x8                    /* DW_TAG_member */
+        .string "a"                     /* DW_AT_name */
+        .long   .LDI2                   /* DW_AT_type */
+        .byte   0x2                     /* DW_AT_data_member_location : length */
+        .byte   0x23                    /* DW_OP_plus_uconst */
+        .uleb128 0x0                    /*   + 0 */
+        
+.LDI5:
+        .uleb128 0x8                    /* DW_TAG_structure_type */
+        .string "b"                     /* DW_AT_name */
+        .long   .LDI2                   /* DW_AT_type */
+        .byte   0x2                     /* DW_AT_data_member_location : length */
+        .byte   0x23                    /* DW_OP_plus_uconst */
+        .uleb128 0x8                    /*   + 8 */
+        .byte   0x0
+
+.LDI6:
+	.uleb128 0x6                    /* DW_TAG_subprogram */
+	.byte	0x1                     /* DW_AT_external */
+	.string	"main"                  /* DW_AT_name */
+	.long	.LDI2                   /* DW_AT_type */
+	.quad	.Ltext1                 /* DW_AT_low_pc */
+	.quad	.Ltext3                 /* DW_AT_high_pc */
+
+.LDI7:
+	.uleb128 0x3                    /* DW_TAG_subprogram */
+	.byte	0x1                     /* DW_AT_external */
+	.string	"test1"                 /* DW_AT_name */
+	.byte	0x1                     /* DW_AT_prototyped */
+	.quad	.Ltext5                 /* DW_AT_low_pc */
+	.quad	.Ltext7                 /* DW_AT_high_pc */
+	.long	.LDI11                  /* DW_AT_sibling */        
+        
+.LDI8:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand0"              /* DW_AT_name */
+	.long	.LDI2                   /* DW_AT_type */
+	.byte	1                       /* DW_AT_location : length */
+	.byte	0x52                    /* DW_OP_reg2 */
+
+.LDI9:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand1"              /* DW_AT_name */
+	.long	.LDI2                   /* DW_AT_type */
+	.byte	1                       /* DW_AT_location : length */
+	.byte	0x53                    /* DW_OP_reg3 */        
+        
+.LDI10:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand2"              /* DW_AT_name */
+	.long	.LDI2                   /* DW_AT_type */
+	.byte	1                       /* DW_AT_location : length */
+	.byte	0x54                    /* DW_OP_reg4 */
+        
+	.byte	0x0        
+
+.LDI11:
+	.uleb128 0x3                    /* DW_TAG_subprogram */
+	.byte	0x1                     /* DW_AT_external */
+	.string	"test2"                 /* DW_AT_name */
+	.byte	0x1                     /* DW_AT_prototyped */
+	.quad	.Ltext8                 /* DW_AT_low_pc */
+	.quad	.Ltext10                /* DW_AT_high_pc */
+	.long	.LDI15                   /* DW_AT_sibling */        
+        
+.LDI12:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand0"              /* DW_AT_name */
+	.long	.LDI3                   /* DW_AT_type */
+	.byte	1                       /* DW_AT_location : length */
+	.byte	0x51                    /* DW_OP_reg1 */
+
+.LDI13:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand1"              /* DW_AT_name */
+	.long	.LDI3                   /* DW_AT_type */
+	.byte	1                       /* DW_AT_location : length */
+	.byte	0x52                    /* DW_OP_reg2 */        
+        
+.LDI14:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand2"              /* DW_AT_name */
+	.long	.LDI3                   /* DW_AT_type */
+	.byte	1                       /* DW_AT_location : length */
+	.byte	0x54                    /* DW_OP_reg4 */
+        
+	.byte	0x0
+
+.LDI15:
+	.uleb128 0x3                    /* DW_TAG_subprogram */
+	.byte	0x1                     /* DW_AT_external */
+	.string	"test3"                 /* DW_AT_name */
+	.byte	0x1                     /* DW_AT_prototyped */
+	.quad	.Ltext11                /* DW_AT_low_pc */
+	.quad	.Ltext13                /* DW_AT_high_pc */
+	.long	.LDI19                  /* DW_AT_sibling */        
+        
+.LDI16:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand0"              /* DW_AT_name */
+	.long	.LDI3                   /* DW_AT_type */
+	.byte	6                       /* DW_AT_location : length */
+	.byte	0x51                    /* DW_OP_reg1 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x8                    /*    8 bytes */
+	.byte	0x52                    /* DW_OP_reg2 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x8                    /*    8 bytes */
+
+.LDI17:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand1"              /* DW_AT_name */
+	.long	.LDI3                   /* DW_AT_type */
+	.byte	6                       /* DW_AT_location : length */
+	.byte	0x52                    /* DW_OP_reg2 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x8                    /*    8 bytes */
+	.byte	0x53                    /* DW_OP_reg3 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x8                    /*    8 bytes */
+        
+.LDI18:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand2"              /* DW_AT_name */
+	.long	.LDI3                   /* DW_AT_type */
+	.byte	6                       /* DW_AT_location : length */
+	.byte	0x54                    /* DW_OP_reg4 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x8                    /*    8 bytes */
+	.byte	0x55                    /* DW_OP_reg5 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x8                    /*    8 bytes */
+        
+	.byte	0x0
+
+.LDI19:
+	.uleb128 0x3                    /* DW_TAG_subprogram */
+	.byte	0x1                     /* DW_AT_external */
+	.string	"test4"                 /* DW_AT_name */
+	.byte	0x1                     /* DW_AT_prototyped */
+	.quad	.Ltext14                /* DW_AT_low_pc */
+	.quad	.Ltext16                /* DW_AT_high_pc */
+	.long	.LDIE0                  /* DW_AT_sibling */        
+        
+.LDI20:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand0"              /* DW_AT_name */
+	.long	.LDI2                   /* DW_AT_type */
+	.byte	6                       /* DW_AT_location : length */
+	.byte	0x51                    /* DW_OP_reg1 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x4                    /*    4 bytes */
+	.byte	0x52                    /* DW_OP_reg2 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x4                    /*    4 bytes */
+
+.LDI21:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand1"              /* DW_AT_name */
+	.long	.LDI2                   /* DW_AT_type */
+	.byte	6                       /* DW_AT_location : length */
+	.byte	0x52                    /* DW_OP_reg2 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x4                    /*    4 bytes */
+	.byte	0x53                    /* DW_OP_reg3 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x4                    /*    4 bytes */
+        
+.LDI22:
+	.uleb128 0x4                    /* DW_TAG_formal_parameter */
+	.string	"operand2"              /* DW_AT_name */
+	.long	.LDI2                   /* DW_AT_type */
+	.byte	6                       /* DW_AT_location : length */
+	.byte	0x54                    /* DW_OP_reg4 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x4                    /*    4 bytes */
+	.byte	0x55                    /* DW_OP_reg5 */
+        .byte   0x93                    /* DW_OP_piece */
+        .uleb128 0x4                    /*    4 bytes */
+        
+	.byte	0x0
+        
+.LDIE0:
+	.byte	0x0
+.Ldebug_info_end:
+
+        /*******************************************************/        
+        
+	.section	.debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+	.uleb128 0x1    /* abbrev code */
+	.uleb128 0x11   /* TAG: DW_TAG_compile_unit */
+	.byte	0x1     /* DW_CHILDREN_yes */
+	.uleb128 0x25   /* DW_AT_producer */
+	.uleb128 0x8    /*   DW_FORM_string */
+	.uleb128 0x13   /* DW_AT_language */
+	.uleb128 0xb    /*   DW_FORM_data1 */
+        .uleb128 0x11   /* DW_AT_low_pc */
+        .uleb128 0x1    /*   DW_FORM_addr */
+        .uleb128 0x12   /* DW_AT_high_pc */
+        .uleb128 0x1    /*   DW_FORM_addr */
+	.byte	0x0
+	.byte	0x0
+        
+	.uleb128 0x2    /* abbrev code */
+	.uleb128 0x2e   /* TAG: DW_TAG_subprogram */
+	.byte	0x0     /* DW_CHILDREN_no */
+	.uleb128 0x3f   /* DW_AT_external */
+	.uleb128 0xc    /*   DW_FORM_flag */
+	.uleb128 0x3    /* DW_AT_name */
+	.uleb128 0x8    /*   DW_FORM_string */
+	.uleb128 0x27   /* DW_AT_prototyped */
+	.uleb128 0xc    /*    DW_FORM_flag*/
+	.uleb128 0x11   /* DW_AT_low_pc */
+	.uleb128 0x1    /*   DW_FORM_addr */
+	.uleb128 0x12   /* DW_AT_high_pc */
+	.uleb128 0x1    /*   DW_FORM_addr */
+	.byte	0x0
+	.byte	0x0
+        
+	.uleb128 0x3    /* 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 0x27   /* DW_AT_prototyped */
+	.uleb128 0xc    /*    DW_FORM_flag*/
+	.uleb128 0x11   /* DW_AT_low_pc */
+	.uleb128 0x1    /*   DW_FORM_addr */
+	.uleb128 0x12   /* DW_AT_high_pc */
+	.uleb128 0x1    /*   DW_FORM_addr */
+	.uleb128 0x1    /* DW_AT_sibling */
+	.uleb128 0x13   /*   DW_FORM_ref4 */
+	.byte	0x0
+	.byte	0x0
+        
+	.uleb128 0x4    /* 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 0x49   /* DW_AT_type */
+	.uleb128 0x13   /*   DW_FORM_ref4 */
+	.uleb128 0x2    /* DW_AT_location */
+	.uleb128 0xa    /*   DW_FORM_block1 */
+	.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	0x0     /* DW_CHILDREN_no */
+	.uleb128 0x3f   /* DW_AT_external */
+	.uleb128 0xc    /*   DW_FORM_flag */
+	.uleb128 0x3    /* DW_AT_name */
+	.uleb128 0x8    /*   DW_FORM_string */
+	.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 */
+	.byte	0x0
+	.byte	0x0
+
+        .uleb128 0x7    /* abbrev code */
+        .uleb128 0x13   /* DW_TAG_structure_type */
+        .byte   0x1     /* DW_CHILDREN_yes */
+        .uleb128 0x3    /* DW_AT_name */
+        .uleb128 0x8    /*   DW_FORM_string */
+        .uleb128 0xb    /* DW_AT_byte_size */
+        .uleb128 0xb    /*    DW_FORM_data1 */
+        .uleb128 0x1    /* DW_AT_sibling */
+        .uleb128 0x13   /*   DW_FORM_ref4 */
+        .byte   0x0
+        .byte   0x0
+        
+        .uleb128 0x8    /* abbrev code */
+        .uleb128 0xd    /* DW_TAG_member */
+        .byte   0x0     /* DW_children_no */
+        .uleb128 0x3    /* DW_AT_name */
+        .uleb128 0x8    /*   DW_FORM_string */
+        .uleb128 0x49   /* DW_AT_type */
+        .uleb128 0x13   /*   DW_FORM_ref4 */
+        .uleb128 0x38   /* DW_AT_data_member_location */
+        .uleb128 0xa    /*   DW_FORM_block1 */
+        .byte   0x0
+        .byte   0x0
+        
+	.byte	0x0
+
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp
new file mode 100644
index 0000000..c367935
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp
@@ -0,0 +1,62 @@
+# Copyright 2012 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/>.
+
+load_lib dwarf.exp
+
+set test "dw2-op-out-param"
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if ![dwarf2_support] {
+    return 0  
+}
+
+# This test can only be run on x86-64 targets.
+if {![istarget x86_64-*] || ![is_lp64_target]} {
+    return 0
+}
+
+if { [prepare_for_testing "${test}.exp" "${test}" ${test}.S {nodebug}] } {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+gdb_test "break breakpt" "Breakpoint.*at.*"
+
+# Change the radix, making it easier to spot 0xdeadbeef in output.
+gdb_test "set output-radix 16" \
+    "Output radix now set to decimal 16, hex 10, octal 20."
+
+# So we get to see the structure arguments.
+gdb_test "set print frame-arguments all" ""
+
+gdb_continue_to_breakpoint "Stop in breakpt for test1"
+
+gdb_test "bt" "#0  ($hex in )?breakpt \\(\\)\r\n#1  ($hex in )?test1 \\(operand0=<optimized out>, operand1=0xdeadbeefdeadbeef, operand2=<optimized out>\\)\r\n#2  ($hex in )?main \\(\\)" "Backtrace for test1"
+
+gdb_continue_to_breakpoint "Stop in breakpt for test2"
+
+gdb_test "bt" "#0  ($hex in )?breakpt \\(\\)\r\n#1  ($hex in )?test2 \\(operand0=<optimized out>, operand1=<optimized out>, operand2=<optimized out>\\)\r\n#2  ($hex in )?main \\(\\)" "Backtrace for test2"
+
+gdb_continue_to_breakpoint "Stop in breakpt for test3"
+
+gdb_test "bt" "#0  ($hex in )?breakpt \\(\\)\r\n#1  ($hex in )?test3 \\(operand0={a = 0xdeadbeefdeadbeef, b = <optimized out>}, operand1={a = <optimized out>, b = 0xdeadbeefdeadbeef}, operand2={a = <optimized out>, b = <optimized out>}\\)\r\n#2  ($hex in )?main \\(\\)" "Backtrace for test3"
+
+gdb_continue_to_breakpoint "Stop in breakpt for test4"
+
+gdb_test "bt" "#0  ($hex in )?breakpt \\(\\)\r\n#1  ($hex in )?test4 \\(operand0=<optimized out>, operand1=<optimized out>, operand2=<optimized out>\\)\r\n#2  ($hex in )?main \\(\\)" "Backtrace for test4"
+



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]