This is an archive of the discontinued LLVM Phabricator instance.

Use "_$" prefix instead of "$" for dynamic checker function inserted by LLDB during expression evaluation
ClosedPublic

Authored by bhushan on Oct 27 2015, 3:04 AM.

Details

Summary

There is a issue (llvm assertion) in evaluating expressions for MIPS on Linux.

(lldb) p fooptr(a,b)
lldb: /home/battarde/git/llvm/lib/MC/ELFObjectWriter.cpp:791: void {anonymous}::ELFObjectWriter::computeSymbolTable(llvm::MCAssembler&, const llvm::MCAsmLayout&, const SectionIndexMapTy&, const RevGroupMapTy&, {anonymous}::ELFObjectWriter::SectionOffsetsTy&): Assertion `Local || !Symbol.isTemporary()' failed.

This issue is caused due to the dynamic checker function’s name (hard-coded in LLDB in lldb\source\Expression\IRDynamicChecks.cpp) that start with “$” i.e “$__lldb_valid_pointer_check”.
The symbol "$" has a special meaning for MIPS i.e it is marker for temporary symbols for MIPS.

The discussion on lldb mailing list regarding this issue is at : http://lists.llvm.org/pipermail/lldb-dev/2015-October/008692.html

This patch fixes this issue by using "_$" prefix instead of "$" in dymanic checker function’s name.

-Bhushan

Diff Detail

Repository
rL LLVM

Event Timeline

bhushan updated this revision to Diff 38517.Oct 27 2015, 3:04 AM
bhushan retitled this revision from to Use "_$" prefix instead of "$" for dynamic checker function inserted by LLDB during expression evaluation.
bhushan updated this object.
bhushan added a reviewer: clayborg.
bhushan set the repository for this revision to rL LLVM.
emaste added a subscriber: emaste.Oct 27 2015, 8:36 AM
clayborg resigned from this revision.Oct 27 2015, 10:05 AM
clayborg edited reviewers, added: spyffe, jingham; removed: clayborg.

Lets let Sean Callanan and Jim Ingham make sure this is good as they are the expression parser masters.

Hi Sean/Jim

Could you please find some time to review this?

Thanks.

dean added a subscriber: dean.Nov 12 2015, 4:20 AM

Hi,
is there any update related to this patch? I don't see any activity from the last two weeks.

@Greg Clayton: you have inserted two reviewers but they don't seem to have commented on it. Can you please give a look?

Thanks

Hi Greg,

Can you have look into this? This patch is important to clear expression related tests for MIPS.

clayborg accepted this revision.Jan 19 2016, 10:09 AM
clayborg edited edge metadata.
This revision is now accepted and ready to land.Jan 19 2016, 10:09 AM
spyffe requested changes to this revision.Jan 19 2016, 10:39 AM
spyffe edited edge metadata.

That looks fine to me as far as it goes, but it doesn't cover other places where $ is used in function names, e.g. the name of the expression itself, and classes it's placed in. Could you have a look at ExpressionSourceCode.cpp and see if there is anything there that needs a $ as well?

This revision now requires changes to proceed.Jan 19 2016, 10:39 AM

That looks fine to me as far as it goes, but it doesn't cover other places where $ is used in function names, e.g. the name of the expression itself, and classes it's placed in. Could you have a look at ExpressionSourceCode.cpp and see if there is anything there that needs a $ as well?

The other function names in ExpressionSourceCode.cpp e.g. $__lldb_expr does not require to be prefixed with an additional underscore like _$__lldb_expr.
This is because these names get mangled by the compiler to something like _Z12$__lldb_exprPv, so they does not start with "$" and hence not marked as ‘temporary’ symbols.

The additional _ prefix is only needed for "$__lldb_valid_pointer_check" since this name does not get mangled by compiler (may be because it has C Language linkage).

spyffe accepted this revision.Jan 21 2016, 9:39 AM
spyffe edited edge metadata.

Thank you for that clarification. In that case, I think this patch is fine as it is.

This revision is now accepted and ready to land.Jan 21 2016, 9:39 AM