public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "andre.poenitz at qt dot io" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-25936-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2020-05-07  7:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07  7:10 andre.poenitz at qt dot io [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-25936-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).