Bug 110495 - Object and static class member causes infinite recursion.
Summary: Object and static class member causes infinite recursion.
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: 1
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Elena Zannoni
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-20 09:02 UTC by Ralph Loader
Modified: 2007-11-30 22:10 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2005-08-29 07:08:16 UTC


Attachments (Terms of Use)

Description Ralph Loader 2003-11-20 09:02:58 UTC
gdb can go into an infinite recursion printing static members of a C++
object.

With this source file:
------------------------------------------
struct derived;

struct base
{
  static derived bar;
};

struct derived : base
{
};

derived base::bar;

base foo;

int main()
{
  return 0;
}
---------------------------------
break main, run, and then print foo gives and output ending:

 = {<base> = {static bar = {<base> = {static bar = {<base> = {static
bar = {<base> = {static bar = {<base> = {static bar = {<base> =
{static bar = {<base> = {static bar = {<base> = {static bar = {<base>
= {static bar = {<base> = {static bar = {<base> = {static bar =
{<base> = {static bar = {<base> = {static bar = {<base> = {static bar
= {<base> = {static bar = {<base> = {static bar = {<base> = {static
bar = {<base> = {static bar = {<base> = {static bar = {<base> =
{static bar = {<base> = {static bar = {<base> = {static bar = {<base>
= {static bar = {<base> = {static bar = {<base> = {static bar =
{<base> = {static bar = {<base> = {static bar = {<base> = {static bar
= {<base> = {static bar = {<base> = {static bar = {<base> = {static
bar = {<base> = {static bar = {<base> = {static bar = {<base> =
{static bar = {<base> = {static bar = {<base> = {static bar = {<base>
= {static bar = {<base> = {static bar = {<base> = {static bar =
{<base> = {static bar = {<base> = {static bar = {<base> = {static bar
= {<base> = {static bar = {<base> = {static bar = {<base> = {static
bar = {<base> = {static bar = {<base> = {static bar = {<base> =
{static bar = {<base> = {static bar = {<base> = {static bar = {<base>
= {static bar = {<base> = {static bar = {<base> = {static bar =
{<base> = {static bar = {<base> = {static bar = {<base> = {static bar
= {<base> = {static bar = {<base> = {static bar = {<base> = {static
bar = {<base> = {static bar = {<base> = {static barSegmentation fault


I don't actually understand why gdb always attempts to print static
class members while printing an object.  I've never found it useful
and it clutters the display.

Comment 1 Elena Zannoni 2004-01-13 20:42:06 UTC
have you tried setting the printing of static members to OFF?

(gdb) set print static-members off

does that get you any further?



Comment 2 Ralph Loader 2004-01-14 05:07:49 UTC
Yes, the bug only happens if static-members is not turned off.

Comment 3 Ralph Loader 2005-08-29 07:08:16 UTC
This bug appears to have been fixed upstream


Note You need to log in before you can comment on or make changes to this bug.