public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/12421] New: prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node...
@ 2011-01-20  3:17 nomura at netapp dot com
  2011-01-20  3:20 ` [Bug python/12421] " nomura at netapp dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nomura at netapp dot com @ 2011-01-20  3:17 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12421

           Summary: prettyprinting STL map fails in C frames with No type
                    named std::_Rb_tree_node...
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned@sourceware.org
        ReportedBy: nomura@netapp.com


gdb 7.2 with python 2.6

prettyprinting certain STL types fails if the current frame is non-C++, or if
e.g "set language c" is used to force this condition.  This leads to erratic
behavior when printing global variables in a mixed-language application.

Testcase:

[cyclsvl06]$ cat a.C
#include <string>
#include <map>

class C {
        static C *_db;
        std::map<std::string, int> x;
};

C root;
C* C::_db = &root;

main() {}

Compile with: g++ -g a.C  (using g++ 4.1.2 on RHEL 5.4 64-bit in this case)

Debug with gdb 7,2, built --with-python (python 2.6) and sourcing in
printers.py
per http://sourceware.org/gdb/wiki/STLSupport

# immediately on entry to gdb we print the global variable.  we have no
# frame - language might default to C++
(gdb) print  *'C::_db'
$1 = {static _db = 0x6014e0, x = std::map with 0 elements}

# force language to c.  Alternatively, if a C-language stack frame is
# available, switch to it.  We get a type lookup error.
(gdb) set lang c
(gdb) print  *'C::_db'
$2 = {static _db = 0x6014e0, x = std::map with 0 elements
    Traceback (most recent call last):
  File "/usr/software/gdb/share/python/libstdcxx/v6/printers.py", line 374, in
children
    nodetype = gdb.lookup_type('std::_Rb_tree_node< std::pair< %s, %s > >' %
(keytype, valuetype))
RuntimeError: No type named std::_Rb_tree_node< std::pair< const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int >
>.
}

# back to C++ to toggle the behaviour
(gdb) set lang c++
(gdb) print  *'C::_db'
$3 = {static _db = 0x6014e0, x = std::map with 0 elements}
(gdb) 


It seems the subtype "const std::basic_string<char, std::char_traits<char>,
std::allocator<char> >" is an issue.  In "C language mode", lookup_type()
fails with this, but if it were coded with the const qualifier at the end
rather than the beginning, lookup will succeed.  In "C++ language mode"
either placement of the const qualifier is tolerated by lookup_type().

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/12421] prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node...
  2011-01-20  3:17 [Bug python/12421] New: prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node nomura at netapp dot com
@ 2011-01-20  3:20 ` nomura at netapp dot com
  2011-01-20  3:21 ` nomura at netapp dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: nomura at netapp dot com @ 2011-01-20  3:20 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12421

nomura at netapp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |native
                 CC|                            |nomura at netapp dot com
               Host|                            |Linux RHEL5.4 64-bit
              Build|                            |native

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/12421] prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node...
  2011-01-20  3:17 [Bug python/12421] New: prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node nomura at netapp dot com
  2011-01-20  3:20 ` [Bug python/12421] " nomura at netapp dot com
@ 2011-01-20  3:21 ` nomura at netapp dot com
  2021-01-15 15:38 ` ssbssa at sourceware dot org
  2022-06-05 14:38 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: nomura at netapp dot com @ 2011-01-20  3:21 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12421

nomura at netapp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|native                      |x86_64-redhat-linux
               Host|Linux RHEL5.4 64-bit        |x86_64-redhat-linux
              Build|native                      |x86_64-redhat-linux

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug python/12421] prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node...
  2011-01-20  3:17 [Bug python/12421] New: prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node nomura at netapp dot com
  2011-01-20  3:20 ` [Bug python/12421] " nomura at netapp dot com
  2011-01-20  3:21 ` nomura at netapp dot com
@ 2021-01-15 15:38 ` ssbssa at sourceware dot org
  2022-06-05 14:38 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ssbssa at sourceware dot org @ 2021-01-15 15:38 UTC (permalink / raw)
  To: gdb-prs

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

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> ---
I think this is the same problem as in PR25234.

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

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

* [Bug python/12421] prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node...
  2011-01-20  3:17 [Bug python/12421] New: prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node nomura at netapp dot com
                   ` (2 preceding siblings ...)
  2021-01-15 15:38 ` ssbssa at sourceware dot org
@ 2022-06-05 14:38 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-06-05 14:38 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Marking as a dup.

*** This bug has been marked as a duplicate of bug 25234 ***

-- 
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:[~2022-06-05 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-20  3:17 [Bug python/12421] New: prettyprinting STL map fails in C frames with No type named std::_Rb_tree_node nomura at netapp dot com
2011-01-20  3:20 ` [Bug python/12421] " nomura at netapp dot com
2011-01-20  3:21 ` nomura at netapp dot com
2021-01-15 15:38 ` ssbssa at sourceware dot org
2022-06-05 14:38 ` 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).