Bug 11546

Summary: CR: Python gdb.Type method template_argument fails for non-type template arguments
Product: gdb Reporter: Ariel Shaqed (Scolnicov) <ariels>
Component: pythonAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gdb-prs
Priority: P2    
Version: 7.1   
Target Milestone: 7.1   
Host: Linux ... 2.6.18-164.11.1.el5 #1 SMP Wed Jan 20 07:32:21 EST 201 Target:
Build: Last reconfirmed:
Attachments: nontype.cc

Description Ariel Shaqed (Scolnicov) 2010-04-27 15:22:05 UTC
I have C++ types containing non-type template parameters.  In the attached
program nontype.cc `eleven' is a variable of such a type.  I cannot get at the
template parameter n because of this limitation.  Unfortunately in my real class
such a parameter is relevant for pretty-printing.

[ariels@...]$ gdb ~/dev/Tests/C++/nontype
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ariels/dev/Tests/C++/nontype...done.
(gdb) b main
Breakpoint 1 at 0x400530: file ./nontype.cc, line 11.
(gdb) r
Starting program: /home/ariels/dev/Tests/C++/nontype

Breakpoint 1, main () at ./nontype.cc:11
11          return eleven.get();
(gdb) python print gdb.parse_and_eval('eleven').type
F<11>

(gdb) python print gdb.parse_and_eval('eleven').type.template_argument(0)
Traceback (most recent call last):
  File "<string>", line 1, in ?
RuntimeError: No type named 11.
Error while executing Python code.
Comment 1 Ariel Shaqed (Scolnicov) 2010-04-27 15:23:03 UTC
Created attachment 4753 [details]
nontype.cc

Sample program for description.  Compile with:
   g++ -fno-inline -g3 ./nontype.cc -o nontype
then open in gdb.
Comment 2 Tom Tromey 2010-04-27 15:25:27 UTC

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