This is the mail archive of the gdb-cvs@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]

[binutils-gdb] bitfield-parent-optimized-out: Fix struct definition


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b7f38fdae7c75e1d13abd455b3931950db28d22b

commit b7f38fdae7c75e1d13abd455b3931950db28d22b
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date:   Tue Nov 15 20:52:03 2016 +0100

    bitfield-parent-optimized-out: Fix struct definition
    
    The "struct S" type in bitfield-parent-optimized-out.exp is declared to
    have a size of 4 bytes but to hold two 4-byte members: an int-based
    bitfield and a 4-byte int.  Also, both members have the same
    data_member_location 2, causing them to overlap and to reach 2 bytes
    beyond the structure's boundary.
    
    This is fixed by increasing the structure size to 8 and setting the
    first and second member's data_member_location to 0 and 4, respectively.
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.dwarf2/bitfield-parent-optimized-out.exp: Fix DWARF code for
    	the definition of struct S.

Diff:
---
 gdb/testsuite/ChangeLog                                    | 5 +++++
 gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp | 5 ++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 054629f..d9e61f4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-15  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+	* gdb.dwarf2/bitfield-parent-optimized-out.exp: Fix DWARF code for
+	the definition of struct S.
+
 2016-11-11  Catherine Moore  <clm@codesourcery.com>
 
 	* gdb.base/dump.exp: Identify verilog format dump tests as such.
diff --git a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
index 27d8044..b789970 100644
--- a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
@@ -43,19 +43,18 @@ Dwarf::assemble $asm_file {
 
 	    struct_label: structure_type {
 		{name S}
-		{byte_size 4 DW_FORM_sdata}
+		{byte_size 8 DW_FORM_sdata}
 	    } {
 		member {
 		    {name bitfield}
 		    {type :$int_label}
 		    {bit_size 12 DW_FORM_sdata}
 		    {bit_offset 20 DW_FORM_sdata}
-		    {data_member_location 2 DW_FORM_sdata}
 		}
 		member {
 		    {name intfield}
 		    {type :$int_label}
-		    {data_member_location 2 DW_FORM_sdata}
+		    {data_member_location 4 DW_FORM_sdata}
 		}
 	    }


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