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

* [Bug python/25936] Sizeof value for arrays reported wrongly as zero
  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 ` ssbssa at sourceware dot org
  2020-05-25  6:15 ` andre.poenitz at qt dot io
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ssbssa at sourceware dot org @ 2020-05-12 11:26 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
It's not really about python, the simple sizeof() also gives 0:

(gdb) p sizeof(s.items)
$1 = 0
(gdb) p sizeof(s.items[0])
$2 = 0
(gdb) p sizeof(std::fstream)
$3 = 0

It seems it doesn't have all the necessary debug information for std::fstream:

(gdb) pt s.items
type = class std::basic_fstream<char, std::char_traits<char> > {
    <incomplete type>
} [5]
(gdb) pt std::fstream
type = class std::basic_fstream<char, std::char_traits<char> > {
    <incomplete type>
}

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

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

* [Bug python/25936] Sizeof value for arrays reported wrongly as zero
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: andre.poenitz at qt dot io @ 2020-05-25  6:15 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Andre' <andre.poenitz at qt dot io> ---
What would be the right component?  "symtab"?

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

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

* [Bug python/25936] Sizeof value for arrays reported wrongly as zero
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ssbssa at sourceware dot org @ 2020-05-30 11:39 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Andre' from comment #2)
> What would be the right component?  "symtab"?

I think so, yes.

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

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

* [Bug symtab/25936] Sizeof value for arrays reported wrongly as zero
  2020-05-07  7:10 [Bug python/25936] New: Sizeof value for arrays reported wrongly as zero andre.poenitz at qt dot io
                   ` (2 preceding siblings ...)
  2020-05-30 11:39 ` ssbssa at sourceware dot org
@ 2020-05-30 12:47 ` 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
  5 siblings, 0 replies; 7+ messages in thread
From: andre.poenitz at qt dot io @ 2020-05-30 12:47 UTC (permalink / raw)
  To: gdb-prs

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

Andre' <andre.poenitz at qt dot io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|python                      |symtab

--- Comment #4 from Andre' <andre.poenitz at qt dot io> ---
Ok, thanks.

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

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

* [Bug symtab/25936] Sizeof value for arrays reported wrongly as zero
  2020-05-07  7:10 [Bug python/25936] New: Sizeof value for arrays reported wrongly as zero andre.poenitz at qt dot io
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: andre.poenitz at qt dot io @ 2020-05-30 12:47 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Andre' <andre.poenitz at qt dot io> ---
Ok, thanks.

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

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

* [Bug symtab/25936] Sizeof value for arrays reported wrongly as zero
  2020-05-07  7:10 [Bug python/25936] New: Sizeof value for arrays reported wrongly as zero andre.poenitz at qt dot io
                   ` (4 preceding siblings ...)
  2020-05-30 12:47 ` andre.poenitz at qt dot io
@ 2023-03-06 22:42 ` tromey at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2023-03-06 22:42 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-03-06
     Ever confirmed|0                           |1

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
Still buggy.

-- 
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).