c++/7932: Emit debug information about non-type template parameters

bangerth@ticam.utexas.edu bangerth@ticam.utexas.edu
Mon Sep 16 10:56:00 GMT 2002


>Number:         7932
>Category:       c++
>Synopsis:       Emit debug information about non-type template parameters
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 16 10:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
gcc 3.2
>Description:
This is more like a feature request than a bug-report, so
is low priority. But it might be low-hanging fruit for
someone knowledgable about this kind of stuff:

It would be nice to have debug information about the values
of non-type template parameters, for example to evaluate
expressions including them (thus being able to just cut-and-
paste them from the program). I guess, these parameters
would then just appear as constant variables with a 
lifetime equal to the entire scope.

Example program and debug session:
----------------------
#include <cstdlib>

template <int dim> struct X {
    X(){ abort(); };
};

int main () {
  X<1> x;
};
-----------------

When executed, the program stops at the site of the abort.
In a debugger, then try this:
-----------------
(gdb) r
Starting program: /home/bangerth/tmp/gcc/a.out

Program received signal SIGABRT, Aborted.
0x40131ab1 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x40131ab1 in kill () from /lib/libc.so.6
#1  0x401318a8 in raise () from /lib/libc.so.6
#2  0x40132edb in abort () from /lib/libc.so.6
#3  0x080485ab in X<1>::X() () at x.cc:4
#4  0x0804855b in main () at x.cc:8
#5  0x401209ed in __libc_start_main () from /lib/libc.so.6
(gdb) fr 3
#3  0x080485ab in X<1>::X() () at x.cc:4
4           X(){ abort(); };
(gdb) p dim
No symbol "dim" in current context.

Regards
  Wolfgang
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list