This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/375: debug problems when there are multiple expansions of same template



>Number:         375
>Category:       gdb
>Synopsis:       debug problems when there are multiple expansions of same template
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 22 12:08:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Joe Buck
>Release:        5.1.1
>Organization:
>Environment:
sparc-sun-solaris2.7
>Description:
Consider the program in the attachment
below.  Notice that there are two expansions of "func",
based on two values for the template argument.

If a breakpoint is set at line 15, it affects only the first
template expansion: func<5>(sc_uint<5> const&).  There is
no breakpoint in func<6>(sc_uint<6> const&), furthermore
there doesn't appear to be any way of setting such a breakpoint, as gdb doesn't seem to be able to find the
func symbols by name completion as in "break 'fu TAB".

By contrast, a recent version of Sun's dbx debugger understands that there can be a many-to-one mapping of
source lines and names.  Under that debugger, if I set
a breakpoint at line 15 it affects both template expansions,
turning into two breakpoints.  gdb should do this.

It is possible that this is exposing two distinct bugs:
handling multiple template expansions, and C++ name lookup
>How-To-Repeat:
I compiled the attached program with gcc 3.0.3 on Solaris 2.7.
First say "break 15" and run the program to completion.
Observe that there is only one breakpoint, in the first call
to func.
Now try to find a way of setting a breakpoint in the second
function.  Everything I tried fails: gdb can't locate any
symbols named "func", and gdb is convinced that the line
number refers only to the first template expansion.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="tt.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="tt.cpp"

I2luY2x1ZGUgPGlvc3RyZWFtLmg+Cgp0ZW1wbGF0ZTxpbnQgVz4KY2xhc3Mgc2NfdWludCB7CnB1
YmxpYzoKICAgIHNjX3VpbnQodW5zaWduZWQgdikgOiBtX3ZhbHVlKHYgJiAoKDFVPDxXKS0xVSkp
IHt9CiAgICB1bnNpZ25lZCB2YWx1ZSgpIGNvbnN0IHsgcmV0dXJuIG1fdmFsdWU7fQpwcml2YXRl
OgogICAgdW5zaWduZWQgbV92YWx1ZTsKfTsKCnRlbXBsYXRlPGludCBXPgp2b2lkIGZ1bmMoY29u
c3Qgc2NfdWludDxXPiYgdSkKewogICAgY291dCA8PCAid2lkdGg6ICIgPDwgVyA8PCAiLCB2YWx1
ZTogIiA8PCB1LnZhbHVlKCkgPDwgZW5kbDsKfQoKaW50IG1haW4oKSB7CiAgICBzY191aW50PDU+
IHY1ID0gMjM7CiAgICBzY191aW50PDY+IHY2ID0gMjQ7CiAgICBmdW5jKHY1KTsKICAgIGZ1bmMo
djYpOwp9Cg==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]