public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug varobj/10687] New: Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8
@ 2009-09-23 8:00 linde at acc dot umu dot se
2010-02-17 19:31 ` [Bug c++/10687] " tromey at redhat dot com
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: linde at acc dot umu dot se @ 2009-09-23 8:00 UTC (permalink / raw)
To: gdb-prs
How to reproduce:
Test program (v2.cpp):
---clip--
class vec2
{
public:
vec2() { _v[0] = _v[1] = 0; }
vec2(int x, int y) { _v[0] = x; _v[1] = y; }
static vec2 axis[2];
private:
int _v[2];
};
vec2 vec2::axis[2] = { vec2(1,0), vec2(0,1) };
int main(int argc, char*argv[])
{
vec2 a;
return 0;
}
--clip--
Compile: "g++ -g -o v2 v2.cpp" (I used gcc 4.3.3)
GNU gdb 6.8
....
(gdb) break main
Breakpoint 1 at 0x400563: file v2.cpp, line 16.
(gdb) r
Starting program: /home/linde/v2
Breakpoint 1, main (argc=1, argv=0x7fff734e7018) at v2.cpp:16
16 vec2 a;
(gdb) p a
$1 = {static axis = {{static axis = {{static axis = {{static axis = {{static
axis = {{static axis = { ....
If using gdb directly one will get
---Type <return> to continue, or q <return> to quit---
after a certain amount of output. However, if using gdb through a frontend
such as cgdb or ddd, gdb will crash with segfault.
IF the array is removed and the following is added to the class:
static vec2 t;
and futher down
vec2 vec2::t = vec2(1,1);
Then gdb will show the following when printing a:
{static t = {static t = <same as static member of an already seen type>, _v =
{1, 1}}, _v = {0, 0}}
(after a:s constructor has ran).
So the problem seems to be that gdb can not detect that it's an already seen
type when there is an array involved. And if the type is not recognized, the
recursion will not break and the type vec2 kept being expanded because of "axis".
--
Summary: Printing c++ class with static array (of same type) can
produce infinite output in gdb 6.8
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: varobj
AssignedTo: unassigned at sourceware dot org
ReportedBy: linde at acc dot umu dot se
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=10687
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/10687] Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8
2009-09-23 8:00 [Bug varobj/10687] New: Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8 linde at acc dot umu dot se
@ 2010-02-17 19:31 ` tromey at redhat dot com
2010-04-07 17:41 ` cmoller at redhat dot com
2010-04-21 11:21 ` cmoller at redhat dot com
2 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2010-02-17 19:31 UTC (permalink / raw)
To: gdb-prs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|varobj |c++
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2010-02-17 19:31:20
date| |
http://sourceware.org/bugzilla/show_bug.cgi?id=10687
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/10687] Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8
2009-09-23 8:00 [Bug varobj/10687] New: Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8 linde at acc dot umu dot se
2010-02-17 19:31 ` [Bug c++/10687] " tromey at redhat dot com
@ 2010-04-07 17:41 ` cmoller at redhat dot com
2010-04-21 11:21 ` cmoller at redhat dot com
2 siblings, 0 replies; 5+ messages in thread
From: cmoller at redhat dot com @ 2010-04-07 17:41 UTC (permalink / raw)
To: gdb-prs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at sourceware dot|cmoller at redhat dot com
|org |
Status|NEW |ASSIGNED
http://sourceware.org/bugzilla/show_bug.cgi?id=10687
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/10687] Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8
2009-09-23 8:00 [Bug varobj/10687] New: Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8 linde at acc dot umu dot se
2010-02-17 19:31 ` [Bug c++/10687] " tromey at redhat dot com
2010-04-07 17:41 ` cmoller at redhat dot com
@ 2010-04-21 11:21 ` cmoller at redhat dot com
2 siblings, 0 replies; 5+ messages in thread
From: cmoller at redhat dot com @ 2010-04-21 11:21 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From cmoller at redhat dot com 2010-04-21 11:21 -------
Fixed with patch pr10687.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://sourceware.org/bugzilla/show_bug.cgi?id=10687
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/10687] Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8
[not found] <bug-10687-4717@http.sourceware.org/bugzilla/>
@ 2014-11-05 3:21 ` amodra at gmail dot com
0 siblings, 0 replies; 5+ messages in thread
From: amodra at gmail dot com @ 2014-11-05 3:21 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=10687
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://sourceware.org/ml/g
| |db-patches/2010-04/msg00439
| |.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-05 3:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-23 8:00 [Bug varobj/10687] New: Printing c++ class with static array (of same type) can produce infinite output in gdb 6.8 linde at acc dot umu dot se
2010-02-17 19:31 ` [Bug c++/10687] " tromey at redhat dot com
2010-04-07 17:41 ` cmoller at redhat dot com
2010-04-21 11:21 ` cmoller at redhat dot com
[not found] <bug-10687-4717@http.sourceware.org/bugzilla/>
2014-11-05 3:21 ` amodra at gmail dot com
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).