From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19933 invoked by alias); 8 Oct 2013 10:49:10 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 19907 invoked by uid 48); 8 Oct 2013 10:49:09 -0000 From: "gdb.bugs at mfriebe dot de" To: gdb-prs@sourceware.org Subject: [Bug gdb/16016] New: ptype incorrectly shows "record" (pascal/struct) as class (if accessed via pointer) (7.6.1 regression) Date: Tue, 08 Oct 2013 10:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.6 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gdb.bugs at mfriebe dot de X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-q4/txt/msg00028.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16016 Bug ID: 16016 Summary: ptype incorrectly shows "record" (pascal/struct) as class (if accessed via pointer) (7.6.1 regression) Product: gdb Version: 7.6 Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: gdb.bugs at mfriebe dot de GDB up to and including 7.5.1 are NOT affected GDB 7.6.0 was not tested GDB 7.6.1 (from mingw / tested on w32 vista) has the below issue Consider the following program (compiled with free pascal / dwarf2) program Test_Record_var_param; type TFoo = record a,b: Integer; end; PFoo = ^TFoo; var r1, r2: TFoo; p1, p2: PFoo; begin P1 := @r1; P2 := @r1; end. ----- "p1" and "p2" are both pointers to the record declaration. Except for the name, they point to the same dwarf information entry in .debug_info Yet running gdb -i mi -gdb-set language pascal ptype p1^ &"ptype p1^\n" ~"type = TFOO = record \n" ~" A : LONGINT;\n" ~" B : LONGINT;\n" ~"end\n" ^done (gdb) -data-evaluate-expression p1^ ^done,value="{A = 0, B = 0}" (gdb) ptype p2^ &"ptype p2^\n" ~"type = TFOO = class \n" ~" public\n"" ~" A : LONGINT;\n" ~" B : LONGINT;\n" ~"end\n" ^done (gdb) -data-evaluate-expression p2^ ^done,value="{A = 0, B = 0}" (gdb) ptype p2^ claims p2 points to a class, which is incorrect. This only happens if "ptype p1^" wal run first. Running ptype p2^ ptype p1^ and ptype p1^ will claim to be a class. -data-evaluate-expression correctly returns a record in all cases (a rlass would include the class name) --- Extract from objdump <1><9d>: Abbrev Number: 2 (DW_TAG_variable) <9e> DW_AT_name : P1 DW_AT_location : 5 byte block: 3 10 e0 40 0 (DW_OP_addr: 40e010) DW_AT_type : <0xf6> <1>: Abbrev Number: 2 (DW_TAG_variable) DW_AT_name : P2 DW_AT_location : 5 byte block: 3 20 e0 40 0 (DW_OP_addr: 40e020) DW_AT_type : <0xf6> Both DW_AT_type point to the same entry <1>: Abbrev Number: 4 (DW_TAG_typedef) DW_AT_name : TFOO DW_AT_type : <0xd5> <1>: Abbrev Number: 5 (DW_TAG_structure_type) DW_AT_name : TFOO DW_AT_byte_size : 8 <2>: Abbrev Number: 6 (DW_TAG_member)
DW_AT_name : A DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0) DW_AT_type : <0x10a> <2>: Abbrev Number: 6 (DW_TAG_member) DW_AT_name : B DW_AT_data_member_location: 2 byte block: 23 4 (DW_OP_plus_uconst: 4) DW_AT_type : <0x10a> <1>: Abbrev Number: 4 (DW_TAG_typedef) DW_AT_name : PFOO DW_AT_type : <0x100> <1><100>: Abbrev Number: 8 (DW_TAG_pointer_type) <101> DW_AT_type : <0xcb> <1><10a>: Abbrev Number: 4 (DW_TAG_typedef) <10b> DW_AT_name : LONGINT <113> DW_AT_type : <0x117> <1><117>: Abbrev Number: 9 (DW_TAG_base_type) <118> DW_AT_name : LONGINT <120> DW_AT_encoding : 5 (signed) <121> DW_AT_byte_size : 4 -- You are receiving this mail because: You are on the CC list for the bug.