[lldb-dev] Fixing cross platform mac to linux remote expression evaluation
Robert Flack
flackr at gmail.com
Thu Apr 30 15:36:51 PDT 2015
Hi,
I've been looking into why expression evaluation is failing when targeting
a remote Linux machine from Mac lldb host and it seems there are only 2
distinct problems remaining - both around memory allocation:
1. Can't find symbol for mmap.
2. Once found, lldb is calling mmap with incorrect constant values for
MAP_ANON.
For problem 1, the library being linked against (e.g. /lib/x86_64-linux-gnu/
libc-2.19.so) is copied into a local module cache, but we don't copy the
unstripped library in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so (I'm
assuming we can't call mmap from the symtab file
given SymbolFileSymtab::FindFunctions returns 0). To avoid having to
duplicate the symbol discovery (in Symbols::LocateExecutableSymbolFile) we
should probably ask lldb-platform on the target to find the symbol files
for the current target (I'm thinking Platform::ResolveSymbolFile looks like
the right place).
For problem 2, we're building the argument list to mmap and the constant
for MAP_ANON on macosx is 0x1000 whereas for linux it's 0x20. I'm not sure
what the right way to fix this is, I could imagine asking Platform to
allocate memory, but this would likely be an involved change, or perhaps
being able to ask platform for various OS specific const values which would
be hard-coded into it when built for the target.
Anyways, I wanted to send this out to see if anyone had any thoughts on
either of these issues or was already working on them. I have verified (by
hacking in the correct const values for linux and placing debug libs in a
path where they will be found) that this fixes expression evaluation (and
14 tests start passing) for mac->linux debugging.
Thanks in advance for any suggestions,
Rob
P.S. the 14 tests passing mac->linux by fixing this (for other people
looking at cross platform tests):
Test11588.py
TestAnonymous.py
TestBreakpointConditions.py
TestCPPStaticMethods.py
TestCStrings.py
TestCallStdStringFunction.py
TestDataFormatterCpp.py
TestDataFormatterStdList.py
TestExprDoesntBlock.py
TestExprHelpExamples.py
TestFunctionTypes.py
TestPrintfAfterUp.py
TestSBValuePersist.py
TestSetValues.py
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150430/1a6066e2/attachment.html>
More information about the lldb-dev
mailing list