[lldb-dev] Bug? in lldb/clang and expression evaluation

Filipe Cabecinhas filcab+lldb-dev at gmail.com
Thu Jul 28 18:47:27 PDT 2011


Hi all,

I'm trying to debug lldb to see where the active thread gets unselected,
using my patch for the "frame return" command.

But I'm having some problems. Most of the time, I can't evaluate C++
expressions, like "m_threads[idx]" (missing symbol: …), or
"process->GetSelectedThread()" (call is ambiguous, but no candidates are
given).
Since I was having these errors, I tried checking out if I could find those
candidates while clang parsed the AST.

Right now, I'm running a test program in lldb in lldb in lldb… It's not that
fun :-)

I will stop the bottom debugger in CommandObjectThread.cpp:413 and, in the
middle lldb, run the command:
    frame #0: 0x000000010031d875
LLDB`CommandObjectThreadStepWithTypeAndScope::Execute(lldb_private::Args&,
lldb_private::CommandReturnObject&) + 197 at CommandObjectThread.cpp:413
   410          else
   411          {
   412              const uint32_t num_threads =
process->GetThreadList().GetSize();
-> 413              Thread *thread = NULL;
   414
   415              if (command.GetArgumentCount() == 0)
   416              {
1) expr process->GetThreadList()


This command, normally, will error out with:
error: call to member function 'GetThreadList' is ambiguous
note: candidate function
note: candidate function
error: 1 errors parsing expression

Not listing the candidate functions (as it should?). If I stop that lldb, I
can't check the Diagnostic object (with the outermost lldb):
    frame #0: 0x000000010042b182
LLDB`clang::CompilerInstance::getDiagnostics() const + 114 at
CompilerInstance.h:254
   251    /// Get the current diagnostics engine.
   252    Diagnostic &getDiagnostics() const {
   253      assert(Diagnostics && "Compiler instance has no diagnostics!");
-> 254      return *Diagnostics;
   255    }
   256
   257    /// setDiagnostics - Replace the current diagnostics engine.
0) expr *(Diagnostics.Obj)
Assertion failed: (D && "Cannot get layout of forward declarations!"),
function getASTRecordLayout, file RecordLayoutBuilder.cpp, line 1835.
[1]    73430 illegal hardware instruction  lldb

This triggers an assert and shuts down clang. I have built lldb with the
debug version of llvm+clang, as it says on the docs/ folder.

Shouldn't clang+lldb be able to get that information? Any clues on where the
bug might lie? (clang? lldb?)

Regards,nbsp; Filipe Cabecinhas

P.S: XCode blows up, too, which shouldn't happen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110728/c6ec2c04/attachment.html>


More information about the lldb-dev mailing list