Page 1 of 1

Debugging wxString using lldb

Posted: Wed Jun 19, 2019 1:39 pm
by guggy
Hello,

I'm trying to view the content of a wxString using lldb. But all I get is

m_impl = error: summary string parsing error
m_convertedToChar = (m_str = 0x0000000000000000, m_len = 140737344281512)

The message box I placed in the code showed me, that the string has a correct content ("hello world" is shown.)

System: OpenSuse Tumbleweed (Linux)
wxWidgets: 3.1.2
lldb : Version 8.0.0
Compiler: gcc9 and clang 8

I build the libraries in several ways:
../configure --with-gtk --enable-debug [ --enable-stl ] [--with-opengl] [CC=clang CXX=clang++ CXXCPP="clang++"]

(parameters in [] were switched on and of by me)

I also tried the scripts I found on Stackoverflow
https://stackoverflow.com/questions/129 ... ng-in-lldb)
but them didn't help either.

Has someone a hint what I could try next? Or better, found a solution?

Thanks in advance,
Guggy

Re: Debugging wxString using lldb

Posted: Wed Jun 19, 2019 3:26 pm
by DavidHart
Hi,

I can't reproduce your problem in (a virtualbox guest) openSUSE 15.1, using the system lldb 7 and a self-built wx3.1.3. I get:

Code: Select all

(lldb) print foo
(wxString) $0 = {
  m_impl = {
    _M_dataplus = (_M_p = L"Test lldb")
    _M_string_length = 9
     = (_M_local_buf = wchar_t [4] @ 0x00000000025e8910, _M_allocated_capacity = 9)
  }
  m_convertedToChar = (m_str = <no value available>, m_len = 140737351911908)
}
That's from a terminal, without any special lldb instructions. However it might help you to know that the IDE CodeLite, when using lldb to debug a program, passes
type summary add wxString --summary-string "${var.m_impl._M_dataplus._M_p}"

Regards,

David

Re: Debugging wxString using lldb

Posted: Thu Jun 20, 2019 9:24 am
by guggy
Thank you David,

I pass the line, it shortend the output, but sorely it didn't solve the problem for me.

Regards,
Guggy

Re: Debugging wxString using lldb

Posted: Thu Jun 20, 2019 10:41 am
by DavidHart
I pass the line, it shortend the output, but sorely it didn't solve the problem for me.
Hmm. One (unlikely) possibility is that your locale is causing the problem. Try changing the program's terminal to en_US.
Oh, and try with gdb instead, in case it's a lldb-specific issue.

Otherwise, try with the openSUSE wxWidgets package; 15.1 has libwx_gtk3u* so you should have too.

If that's still no help, please post here a minimal compilable program that demonstrates the problem.

Re: Debugging wxString using lldb

Posted: Tue Jun 25, 2019 12:07 pm
by guggy
Sadyl non of thist worked..

I used the sample from

https://docs.wxwidgets.org/stable/overv ... world.html

and changed
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50, 50), wxSize(450, 340) );
frame->Show( true );

wxString test= "hello,";
test << " I am here";

wxMessageBox(test);

return true;
}

to inspect the content of the "test"-String. The attatched file for CMake is a modified version from the minimal-sample from wxWidgets.

Finaly, after days of trying I downgraded my OS to OpenSuse Leap15.1, used the lldb-Version 7, the prebuild wxWidgets from the repository - and everything works fine. The only thing that is a pity is that i still dont know why it didn't work...

But, many thanks anyways, David.

Re: Debugging wxString using lldb

Posted: Tue Jun 25, 2019 3:03 pm
by DavidHart
The only thing that is a pity is that i still dont know why it didn't work...
Well, it's unlikely to be the lldb version. I just tested lldb 8.0 (in ubuntu 19.04): it displayed a wxString normally. Nor is it the g++ version: I built there with g++ 9.1.

You could try self-building wx3.1.2 again in leap 15.1 and see if it fails for you; unlikely as my wx3.1.3 worked OK. Otherwise, perhaps there's some change in a tumbleweed dependent lib that's caused the problem...