public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/25936] New: Sizeof value for arrays reported wrongly as zero
@ 2020-05-07  7:10 andre.poenitz at qt dot io
  2020-05-12 11:26 ` [Bug python/25936] " ssbssa at sourceware dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: andre.poenitz at qt dot io @ 2020-05-07  7:10 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25936

            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 completely
inlined.



#include <fstream>
#include <string>

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       // Good
    // py print(gdb.parse_and_eval('s.items').type.sizeof)  yields 0   // Bad
    // py print(gdb.parse_and_eval('s').type.fields()[0].type.sizeof)  yields 0
// Bad
    return s.items[0].is_open();
//    return int(s.items[0].size());
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-06 22:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07  7:10 [Bug python/25936] New: Sizeof value for arrays reported wrongly as zero andre.poenitz at qt dot io
2020-05-12 11:26 ` [Bug python/25936] " ssbssa at sourceware dot org
2020-05-25  6:15 ` andre.poenitz at qt dot io
2020-05-30 11:39 ` ssbssa at sourceware dot org
2020-05-30 12:47 ` [Bug symtab/25936] " andre.poenitz at qt dot io
2020-05-30 12:47 ` andre.poenitz at qt dot io
2023-03-06 22:42 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).