This patch adds support for creating modules from JSON object files. This is necessary for crashlogs (see rGc17a1f3df70b for more details) where we don't have neither the module nor the symbol file.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Fix bug in ObjectFileJSON where we wouldn't read the rest of the file and fail parsing.
lldb/lldb/test/API/macosx/symbols/TestObjectFileJSON.py | ||
---|---|---|
12 ↗ | (On Diff #512963) | nit |
lldb/source/Core/Section.cpp | ||
683–684 | We should use o.mapOptional here since the address, size and type are marked optional. | |
lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp | ||
110 | I guess this is due to the fact that we only read the first 512 bytes from the binary the first time we load it ? It would be good to mention it in a comment. | |
209 | ditto | |
lldb/test/API/macosx/symbols/TestObjectFileJSON.py | ||
13 | It looks like you've included this test twice. |
lldb/source/Core/Section.cpp | ||
---|---|---|
683–684 | They're not exactly the same: map with a std::optional lets you deal with whether the value was set outside of the deserialization method, while mapOptional requires you to have initialized the variable to the default value previously, or pass it as a third argument. In this particular case it doesn't really matter, as the default value is pretty trivial, but I'd rather preserve that a value wasn't set. That's different from the call to mapOptional for the symbol and section vectors, where I don't care whether the vector is empty or was omitted completely. |
lldb/test/API/macosx/symbols/TestObjectFileJSON.py | ||
---|---|---|
82 | The test was (95%!) flaky because the two generated files had the same timestamp (and so lldb considered them identical and did not reload). I fixed that by adding a sleep, but your intention was not to test file reloading then it would be better to just use different filenames. (There could also be a bug somewhere, because I was under the impression that we should treat files with different UUIDs as distinct even if they happen to have the same timestamp.) |
FYI this test is failing on our Windows on Arm bot due to not finding strip: https://lab.llvm.org/buildbot/#/builders/219/builds/2164/steps/6/logs/stdio
I see other uses so not sure why this one isn't working. Maybe it can use llvm-strip instead? @omjavaid
I didn't see this until now. I'll update the test. We shouldn't need strip for this test but we're sharing the Makefile for SymbolFileJSON. I'll see if it makes more sense to split up the test.
We should use o.mapOptional here since the address, size and type are marked optional.