LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 15302 - LLDB does not print 'anonymous namespace' prefix for variable names (if inferior built with GCC on Linux)
Summary: LLDB does not print 'anonymous namespace' prefix for variable names (if infer...
Status: RESOLVED FIXED
Alias: None
Product: lldb
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P enhancement
Assignee: LLDB commit list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-19 13:46 PST by Daniel Malea
Modified: 2016-09-26 09:21 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
dump of DWARF generated by clang (passes test) (17.61 KB, application/octet-stream)
2013-02-19 13:46 PST, Daniel Malea
Details
dump of DWARF generated by gcc (fails test) (23.33 KB, application/octet-stream)
2013-02-19 13:46 PST, Daniel Malea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Malea 2013-02-19 13:46:22 PST
Created attachment 10041 [details]
dump of DWARF generated by clang (passes test)

TestNamespace.py is failing with GCC. The DWARF output by GCC looks correct in that it contains a DW_TAG_namespace node, although it is not identical to what Clang outputs.

Attaching dumps both clang and gcc emitted dwarf for comparison.

To reproduce this failure, run:

python dotest.py -C gcc lang/cpp/namespace
Comment 1 Daniel Malea 2013-02-19 13:46:49 PST
Created attachment 10042 [details]
dump of DWARF generated by gcc (fails test)
Comment 2 Ashok Thirumurthi 2013-05-29 10:23:26 PDT
The test variant 'data_formatter_commands_after_steps' exposes a loss of every second "next" command.  This variant sets a breakpoint before a list is populated, and steps 4 times to populate the list with 4 items.  

When this script is run using dotest, dosep or manually at the lldb command prompt, 2 "next" commands are required to populate a single list item.  Note that this does not occur if the std::list contains integers rather than elements of type std::string.  Note that a single line of code constructs an std::string and adds an element to the list.

Also, this specific failure cannot be reproduced with clang r182733, whereas it reproduces reliably with gcc 4.6.3 (Ubuntu 12.04) gcc 4.6.2 (Debian buildbot) and icc 13.1 (Ubuntu 12.04).
Comment 3 emaste 2013-07-25 11:17:48 PDT
Related issue on FreeBSD:

runCmd: frame variable --show-declaration --show-globals i                      
output: main.cpp:12: (int) _GLOBAL__N_1::i = 3                                  
                                                                                
                                                                                
Expecting start string: main.cpp:12: (int) (anonymous namespace)::i = 3         
Not matched                                                                     
                                                                                
FAILURE
Comment 4 emaste 2013-09-16 09:59:58 PDT
The FreeBSD issue is just a bug in FreeBSD's __cxa_demangle in libcxxrt.  For example, using one of the testcases from libcxxabi:

% ./demangle-cxxrt _ZN12_GLOBAL__N_113ASTTypeWriter15VisitVectorTypeEPKN5clang10VectorTypeE
_GLOBAL__N_1::ASTTypeWriter::VisitVectorType(clang::VectorType const*)

% c++filt _ZN12_GLOBAL__N_113ASTTypeWriter15VisitVectorTypeEPKN5clang10VectorTypeE
(anonymous namespace)::ASTTypeWriter::VisitVectorType(clang::VectorType const*)
Comment 5 emaste 2013-11-15 15:29:33 PST
The FreeBSD issue is now fixed in two ways - the in-tree __cxa_demangle has been updated to address this case, and FreeBSD now uses the built-in demangler recently re-added to lldb (because the in-tree __cxa_demangle still has some other limitations).
Comment 6 labath 2016-09-26 09:21:28 PDT
Looks like the test passes now.