Bug 9946 - gdb does not understand DW_TAG_template_value_param
Summary: gdb does not understand DW_TAG_template_value_param
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.8
: P2 normal
Target Milestone: 7.3
Assignee: Tom Tromey
URL:
Keywords:
: 10590 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-12 18:47 UTC by Tom Tromey
Modified: 2010-11-14 03:47 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2010-05-25 17:48:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2009-03-12 18:47:38 UTC
We have a g++ that has been modified to emit DW_TAG_template_value_param.
However, gdb does not then make the corresponding symbols visible
to the user.

A simple test case is something like:

#include <stdio.h>

template<int X>
class T
{
public:
  T()
  {
    printf ("%d\n", X);
  }
};

int main()
{
  T<23> t;
  return 0;
}

If you break in the constructor, "print X" should show "23".
Comment 1 Tom Tromey 2009-09-02 18:37:15 UTC
*** Bug 10590 has been marked as a duplicate of this bug. ***
Comment 2 Sourceware Commits 2010-07-28 16:24:27 UTC
Subject: Bug 9946

CVSROOT:	/cvs/src
Module name:	src
Changes by:	tromey@sourceware.org	2010-07-28 16:24:00

Modified files:
	gdb            : ChangeLog cp-namespace.c cp-support.h 
	                 dwarf2read.c gdbtypes.c gdbtypes.h objfiles.c 
	                 objfiles.h symfile.c symtab.c symtab.h 
	gdb/testsuite  : ChangeLog 
Added files:
	gdb/testsuite/gdb.cp: temargs.cc temargs.exp 

Log message:
	gdb
	PR c++/9946:
	* symfile.c (reread_symbols): Clear template_symbols.
	* symtab.h (struct symbol) <is_cplus_template_function>: New
	field.
	(SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION): New macro.
	(struct template_symbol): New.
	* symtab.c (lookup_symbol_aux_local): Use
	cp_lookup_symbol_imports_or_template.
	* objfiles.h (struct objfile) <template_symbols>: New field.
	* objfiles.c (relocate_one_symbol): New function.
	(objfile_relocate1): Use it.  Relocate isolated symbols.
	* gdbtypes.h (struct cplus_struct_type) <n_template_arguments,
	template_arguments>: New fields.
	(TYPE_N_TEMPLATE_ARGUMENTS): New macro.
	(TYPE_TEMPLATE_ARGUMENTS): Likewise.
	(TYPE_TEMPLATE_ARGUMENT): Likewise.
	(lookup_typename): Update.
	* gdbtypes.c (lookup_typename): Constify "block" argument.
	* dwarf2read.c: Include vec.h.
	(symbolp): New typedef.
	(read_func_scope): Read template arguments.  Allocate a
	template_symbol when needed.
	(read_structure_type): Read template arguments.
	(new_symbol_full): New function, from new_symbol.  Handle
	DW_TAG_template_type_param and DW_TAG_template_value_param.
	(new_symbol): Rewrite as wrapper.
	* cp-support.h (cp_lookup_symbol_imports_or_template): Declare.
	* cp-namespace.c: Include language.h.
	(search_symbol_list): New function.
	(cp_lookup_symbol_imports_or_template): Likewise.
	gdb/testsuite
	PR c++/9946:
	* gdb.cp/temargs.exp: New file.
	* gdb.cp/temargs.cc: New file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.12035&r2=1.12036
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/cp-namespace.c.diff?cvsroot=src&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/cp-support.h.diff?cvsroot=src&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.429&r2=1.430
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbtypes.c.diff?cvsroot=src&r1=1.195&r2=1.196
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbtypes.h.diff?cvsroot=src&r1=1.133&r2=1.134
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/objfiles.c.diff?cvsroot=src&r1=1.116&r2=1.117
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/objfiles.h.diff?cvsroot=src&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/symfile.c.diff?cvsroot=src&r1=1.291&r2=1.292
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/symtab.c.diff?cvsroot=src&r1=1.246&r2=1.247
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/symtab.h.diff?cvsroot=src&r1=1.159&r2=1.160
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2393&r2=1.2394
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/temargs.cc.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/temargs.exp.diff?cvsroot=src&r1=NONE&r2=1.1

Comment 3 Tom Tromey 2010-07-28 16:25:51 UTC
I checked in the fix.
Comment 4 Jan Kratochvil 2010-11-14 03:47:00 UTC
Re: Regression gdb.cp/temargs.exp: test value of P in inner_m
http://sourceware.org/ml/gdb-patches/2010-08/msg00562.html
->
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41736