From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 98CFE383F851; Thu, 7 May 2020 07:10:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98CFE383F851 From: "andre.poenitz at qt dot io" To: gdb-prs@sourceware.org Subject: [Bug python/25936] New: Sizeof value for arrays reported wrongly as zero Date: Thu, 07 May 2020 07:10:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: 9.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: andre.poenitz at qt dot io X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 May 2020 07:10:43 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D25936 Bug ID: 25936 Summary: Sizeof value for arrays reported wrongly as zero Product: gdb Version: 9.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: andre.poenitz at qt dot io Target Milestone: --- In the code below, the array data member reported to have a size zero. The behavior depends on the actual types in the array, std::fstream and std::strings are only examples, possibly it works for types that are comple= tely inlined. #include #include struct S { std::fstream items[5]; // Does not work. Same for QObject, ... // std::string items[5]; // Works. Same for int, ... }; int main() { S s; // Break here. // py print(gdb.parse_and_eval('s').type.sizeof) yields 2640 // G= ood // py print(gdb.parse_and_eval('s.items').type.sizeof) yields 0 // B= ad // py print(gdb.parse_and_eval('s').type.fields()[0].type.sizeof) yiel= ds 0 // Bad return s.items[0].is_open(); // return int(s.items[0].size()); } --=20 You are receiving this mail because: You are on the CC list for the bug.=