[lldb-dev] problem with simple expr command

Sean Callanan scallanan at apple.com
Wed Jan 8 10:18:44 PST 2014


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.
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.

As you deduced, the function that we’re not finding here is the string destructor.

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.


On Jan 6, 2014, at 10:13 AM, David Storch <david.storch at mongodb.com> wrote:

> Hi LLDB,
> 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:
> (lldb) expr (string) query.toString()
> 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
> error: The expression could not be prepared to run in the target
> 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).
> Version of lldb:
> lldb --version
> LLDB-179.5
> Any advice?
> Best,
> Dave
> -- 
> { name     : "David  Storch",
>   title    : "Software Engineer",
>   phone    : "781.859.9395",
>   location : "New York, NY" }
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140108/6ec69484/attachment.html>

More information about the lldb-dev mailing list