Need help on LLDB on Fedora x86_64 Linux

Hi, list,
When I use lastest LLDB(and Clang/LLVM) to debug a hello world program
on Fedora 18 x86_64 Linux. I encounter a crash of LLDB. I have
debugged LLDB using gdb-7.6.2, and found that the offending line is :

Breakpoint 3, llvm::MCExternalSymbolizer::tryAddingSymbolicOperand (
    this=0x7fe470000c50, MI=..., cStream=..., Value=258220247920,
    Address=258220234131, IsBranch=true, Offset=1, InstSize=4)
    at /mnt/work/llvm/lib/MC/MCExternalSymbolizer.cpp:135
135 Expr = RelInfo->createExprForCAPIVariantKind(Expr,
SymbolicOp.VariantKind);

where RelInfo (of type std::unique_ptr<MCRelocationInfo>) is 0, so
LLDB crash, I'm new to this, can some one explain this to me.

LLDB does not has this problem about 2 weeks ago.
Attached is the debug log.

Thank you.

debug-log.txt (20.7 KB)

a.c (103 Bytes)

Hi Xu,Chiheng,

Locally I’m using this patch to work around the issue. I’m not yet sure if it’s the right fix since I haven’t had cycles to dig into the root cause yet, but it does get me past the seg faults in the scenarios I’m using. This patch is against the llvm repo:

https://llvm.org/svn/llvm-project/llvm/trunk@203176

— a/lib/MC/MCExternalSymbolizer.cpp
+++ b/lib/MC/MCExternalSymbolizer.cpp
@@ -132,7 +132,8 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
Expr = MCConstantExpr::Create(0, Ctx);
}

  • Expr = RelInfo->createExprForCAPIVariantKind(Expr, SymbolicOp.VariantKind);
  • if (RelInfo)
  • Expr = RelInfo->createExprForCAPIVariantKind(Expr, SymbolicOp.VariantKind);
    if (!Expr)
    return false;