[lldb-dev] synthetic for std::wstring

Nino Kettlitz nino.kettlitz at googlemail.com
Tue Feb 28 07:55:17 PST 2012


Hi,

are there any Python scripts to debug a std::wstring (i.e. 
std::basic_string<int> in osx)?
It would be very useful, especially when debugging a vector of strings 
(i.estd::vector< std::wstring >)

After searching a while in the internet I found nothing, so I started to 
write my own Python class for generating synthetic children (exactly one 
chiled, i.e. the string itself),
but there are several problems I could not solve.

My test programm looks as follows:

     std::vector< std::wstring > aWideStringVector;
     aWideStringVector.push_back(L"Filter/EQ");
     aWideStringVector.push_back(L"Lowpass Filter");
     aWideStringVector.push_back(L"Wah Wah");
     aWideStringVector.push_back(L"Pitch Shift");
     aWideStringVector.push_back(L"Highpass Filter");
     aWideStringVector.push_back(L"Bandpass Filter");

I registered the synthetic children class with type synthetic add -x 
"^(std::)?basic_string<.+>" --python-class 
wstring.StdWStringSynthProvider but

frame variable aWideStringVector

gives me

(vector<std::basic_string<wchar_t>, 
std::allocator<std::basic_string<wchar_t> > >) aWideStringVector = {
}

and

frame variable aWideStringVector[0]

gives me

error: array index 0 is not valid for 
"(vector<std::basic_string<wchar_t>, 
std::allocator<std::basic_string<wchar_t> > >) aWideStringVector"

Am I doing something wrong?
Is it in general a good idea to debug a std::wstring with synthetic 
children?

thanks,
Nino
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wstring.py
Type: text/x-python-script
Size: 1579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20120228/7fe06238/attachment.bin>


More information about the lldb-dev mailing list