[lldb-dev] LLDB gcc std lib data formatters
Bryan Bennetts via lldb-dev
lldb-dev at lists.llvm.org
Mon Feb 19 01:51:46 PST 2018
Hi,
Apologies if this is the wrong forum for this question - redirection to
the correct place would be appreciated...
I am running
lldb --version
lldb-900.0.64
Swift-4.0
with binaries compiled using g++
g++-5 --version
g++-5 (Homebrew GCC 5.5.0_2) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.(although I have tried a build from repo as well)
The website <https://lldb.llvm.org/varformats.html> implies that gcc std
library formatters should be available:
By default, several categories are created in LLDB:
- default: this is the category where every formatter ends up, unless
another category is specified
- objc: formatters for basic and common Objective-C types that do not
specifically depend on Mac OS X
- gnu-libstdc++: formatters for std::string, std::vector, std::list and
std::map as implemented by libstdcpp
However I see:
(lldb) type category list
Category: default (enabled)
Category: VectorTypes (enabled, applicable for language(s): objective-c++)
Category: runtime-synthetics (enabled, applicable for language(s):
objective-c++, swift)
Category: system (enabled, applicable for language(s): objective-c++)
(lldb) type category enable gnu-libstdc++
warning: empty category enabled (typo?)
And the std containers do not print nicely:
containerTest: cat main.cpp
#include <iostream>
#include <vector>
using namespace std;
int main()
{
auto v = vector< unsigned >{ 0, 1, 2, 3, 4, 5, 6, 7, 9 };
for( auto i : v )
{
cout << i << "\n";
}
return( 0 );
}
containerTest: g++-5 -g -std=c++11 main.cpp
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:157:11:
warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:157:11: note:
change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:386:11:
warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:386:11: note:
change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:430:11:
warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:430:11: note:
change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:683:11:
warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/2_/07xjgwq904376gst9m3ddb100000gn/T//cctjpiwL.s:683:11: note:
change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
containerTest: lldb ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 13 at main.cpp:8, address =
0x0000000100001673
(lldb) run
Process 98294 launched: './a.out' (x86_64)
Process 98294 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100001673 a.out`main at main.cpp:8
5
6 int main()
7 {
-> 8 auto v = vector< unsigned >{ 0, 1, 2, 3, 4, 5, 6, 7, 9 };
9
10 for( auto i : v )
11 {
Target 0: (a.out) stopped.
(lldb) n
Process 98294 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
frame #0: 0x00000001000016bd a.out`main at main.cpp:10
7 {
8 auto v = vector< unsigned >{ 0, 1, 2, 3, 4, 5, 6, 7, 9 };
9
-> 10 for( auto i : v )
11 {
12 cout << i << "\n";
13 }
Target 0: (a.out) stopped.
(lldb) p v
(vector<unsigned int, allocator<unsigned int> >) $0 = {
_Vector_base<unsigned int, allocator<unsigned int> > = {
_M_impl = {
_M_start = 0x0000000100402050
_M_finish = 0x0000000100402074
_M_end_of_storage = 0x0000000100402074
}
}
}
(lldb)
Anyone able to point me at either a python pretty printer or solution to
this?
Cheers, Bryan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180219/4a0c0aba/attachment.html>
More information about the lldb-dev
mailing list