Page MenuHomePhabricator

Fix for evaluating a function with an ambiguous symbol

Authored by EwanCrawford on Dec 1 2015, 8:47 AM.



I came across a bug for calling functions using expression evaluation, where the function name also matches a symbol from another compile unit.
The attached test case recreates it when compiled with gcc. Clang however doesn't seem to export a conflicting .rodata symbol so the bug doesn't appear.

Currently trying to call the function gives the following error in the test case.

(lldb) expr overloaded_symbol(1)
error: warning: got name from symbols: overloaded_symbol
error: reference to 'overloaded_symbol' is ambiguous
note: candidate found by name lookup is 'overloaded_symbol'
note: candidate found by name lookup is 'overloaded_symbol'
error: 1 errors parsing expression

This patch in the clang expression parser stops us turning the symbol into a global variable declaration if we've already found
a matching function. I'm not familiar with this code, so if there's a better way to fix this please let me know.

Diff Detail


Event Timeline

EwanCrawford retitled this revision from to Fix for evaluating a function with an ambiguous symbol .
EwanCrawford updated this object.
EwanCrawford added a reviewer: spyffe.
EwanCrawford set the repository for this revision to rL LLVM.
EwanCrawford added a subscriber: lldb-commits.
spyffe accepted this revision.Jul 11 2016, 11:17 AM
spyffe edited edge metadata.

Sorry for getting to this review so late.
This looks all right, and pretty conservative. As long as the test suite is okay with it, this looks fine!
Thanks for the test case, too.

This revision is now accepted and ready to land.Jul 11 2016, 11:17 AM
EwanCrawford abandoned this revision.Jul 12 2016, 4:49 AM

Thanks for getting around to looking at this Sean, i'd forgotten about it.
Unfortunately the patch seems to have gone stale as the test case no longer passes.
So i'm just going to close the review for now.