<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">David,<div><br></div><div>a common problem with STL objects used in code is that all the accessor functions (and simple things like the destructor) is that they are inlined wherever they are used, so LLDB can’t find them when it wants to use them for expressions.</div><div>Eventually it’d be nice to generate them on demand, but we don’t currently do that – not least, because debug information doesn’t contain method definitions.</div><div><br></div><div>As you deduced, the function that we’re not finding here is the string destructor.</div><div><br></div><div>You could try rewriting your expression using “new” to leak a std::string and then assigning the string into the leaked std::string, avoiding the destructor, but if this is a common debugging technique for you you may want to consider having a dump() function on query that does the toString() work and either returns a const char* or simply dumps the string to stdout/stderr.</div><div><br><div>
<div>Sean</div>

</div>
<br><div><div>On Jan 6, 2014, at 10:13 AM, David Storch <<a href="mailto:david.storch@mongodb.com">david.storch@mongodb.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi LLDB,<div><br></div><div>I'm debugging a C++ program and want to do some inspection by calling the toString() method of an object. I'm pretty sure I have the syntax of the command correct, but I get the error shown below:</div>

<div><br></div><div><div>(lldb) expr (string) query.toString()</div><div>error: call to a function 'std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >(int)' that is not present in the target</div>

<div>error: The expression could not be prepared to run in the target</div><div><br></div><div>I interpret this error to mean that lldb is having trouble trying to deal with the lifecycle for the returned std::string (doesn't know how to invoke the string destructor).</div>

<div><br></div><div>Version of lldb:</div><div><span style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px">lldb --version</span><br style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px">

<span style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px">LLDB-179.5</span><br></div><div><span style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px"><br>

</span></div><div><span style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px">Any advice?</span></div><div><span style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px"><br>

</span></div><div><span style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px">Best,</span></div><div><span style="color:rgb(38,38,38);font-family:arial,sans-serif;font-size:13px;line-height:16px">Dave</span></div>

<div><br></div>-- <br><div dir="ltr"><div style="font-size: 11pt; margin: 0px 5pt; font-family: Arial; direction: ltr;"><img height="60" src="https://docs.google.com/document/d/14CGI2rcCJHfT7VbeISDKTqJ2lY5k4XIpv1NcFR_fBW0/pubimage?id=14CGI2rcCJHfT7VbeISDKTqJ2lY5k4XIpv1NcFR_fBW0&image_id=13grp_x7y_uXWcAB-nFt_rCJxbQ4XcfwAHHk7" width="206"></div><p style="font-size: 11pt; margin: 0px 5pt; font-family: Arial; direction: ltr; height: 11pt;"><span style="font-size:10pt;background-color:rgb(255,255,255);font-family:'Courier New';font-weight:bold"></span></p><div style="font-size: 11pt; margin: 0px 5pt; font-family: Arial; direction: ltr;"><span style="font-size:10pt;background-color:rgb(255,255,255);font-family:'Courier New';font-weight:bold">{ </span><span style="font-size:10pt;font-family:'Courier New'">name     : </span><span style="font-size:10pt;background-color:rgb(255,255,255);font-family:'Courier New';font-weight:bold">"David  Storch",</span></div><div style="font-size: 11pt; margin: 0px 5pt; font-family: Arial; direction: ltr;"><span style="font-size:10pt;background-color:rgb(255,255,255);font-family:'Courier New';font-weight:bold">  </span><span style="font-size:10pt;font-family:'Courier New'">title    : "Software Engineer",</span></div><div style="font-size: 11pt; margin: 0px 5pt; font-family: Arial; direction: ltr;"><span style="font-size:10pt;font-family:'Courier New'">  phone    : "</span><span style="color:rgb(51,51,51);font-size:10pt;font-family:'Courier New'">781.859.9395</span><span style="font-size:10pt;font-family:'Courier New'">",</span></div><div style="font-size: 11pt; margin: 0px 5pt; font-family: Arial; direction: ltr;"><span style="font-size:10pt;font-family:'Courier New'">  location : "New York, NY" </span><span style="color:rgb(51,51,51);font-size:10pt;background-color:rgb(255,255,255);font-family:'Courier New';font-weight:bold">}</span></div>

</div>
</div></div>
_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev<br></blockquote></div><br></div></body></html>