Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341336

Summary: Empty function names since gdb 7.2 for functions in anonymous namespace
Product: [Tools] CDT Reporter: Jens Elmenthaler <jens.elmenthaler>
Component: cdt-debug-dsf-gdbAssignee: Marc-André Laperle <malaperle>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, malaperle, pawel.1.piech
Version: 8.0   
Target Milestone: 8.3.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix
none
Improved fix
cdtdoug: iplog+
Original fix cdtdoug: iplog+

Description Jens Elmenthaler CLA 2011-03-30 06:48:56 EDT
Build Identifier: HEAD

With gdb 7.2. the function name reporting by -var-list-frames for functions in anonymous namespaces has changed from "name" to "(anonoumous namespace)::name".

This breaks the current parse implementation in MIFrame.

Reproducible: Always
Comment 1 Jens Elmenthaler CLA 2011-03-30 06:53:43 EDT
Created attachment 192175 [details]
Fix
Comment 2 Jens Elmenthaler CLA 2012-03-11 16:01:44 EDT
Created attachment 212437 [details]
Improved fix
Comment 3 Marc-André Laperle CLA 2012-03-12 19:51:16 EDT
I think it would be nice to display (anonoumous namespace)::name() in the stack since the other namespaces get displayed. For example, if I change it from anonymous to Namespace, it displays Namespace::name(). What do you think?
Comment 4 Jens Elmenthaler CLA 2012-03-13 03:22:42 EDT
Created attachment 212524 [details]
Original fix
Comment 5 Jens Elmenthaler CLA 2012-03-13 03:35:51 EDT
(In reply to comment #3)
> I think it would be nice to display (anonoumous namespace)::name() in the stack
> since the other namespaces get displayed. For example, if I change it from
> anonymous to Namespace, it displays Namespace::name(). What do you think?
This is what the original fix did. But there seems code around that assumes that the function names are valid symbol names. Parenthesis in namespace names break this assumption. One indicator of this assumption is that with the original patch, the label for functions in an anonymous namespace were shown like "(anonymous namespace)::name" while in ordinary namespaces you have "ns::name()" (note the trailing "()").

I see the following alternatives:
1) make the client code working with parenthesis in function names (= original patch + improvements in the clients). Would it be just parenthesis, or other puncutation characters as well? Where would I stop?

2) The MI layer returns valid function names.
   a) Just remove the anonymous namespace label from the function name, which ressults in the same behavior as pre-gdb-7.2 (= improved patch). 
   b) replace "(anonymous namespace)" by something else, still yielding valid function names in C++. Not nice, because it shows function names that in fact don't exist.
Comment 6 Marc Khouzam CLA 2012-04-16 14:41:08 EDT
Hi Jens,

now that we started using Gerrit, could you push your change there?  Hopefully it will make the review faster:
http://wiki.eclipse.org/CDT/git#Using_Gerrit_for_CDT

Then put a link to the gerrit review in this bugzilla to correlate.

Thanks!
Comment 7 Jens Elmenthaler CLA 2012-08-31 15:31:18 EDT
I finally managed to push it to Gerrit, please look at https://git.eclipse.org/r/#/c/7554/

I realized that CDI already had a fix for it and just copied it over.
Comment 8 Marc-André Laperle CLA 2013-10-28 20:46:37 EDT
The fix has been merged into master. Thanks Jens!
Comment 9 Marc-André Laperle CLA 2013-10-28 21:38:27 EDT
*** Bug 419912 has been marked as a duplicate of this bug. ***