[Lldb-commits] [PATCH] D145180: [lldb] Introduce new SymbolFileJSON and ObjectFileJSON
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 2 12:57:36 PST 2023
JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, clayborg, labath, DavidSpickett, mib.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
JDevlieghere requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Herald added a project: LLDB.
Introduce a new object and symbol file format with the goal of mapping addresses to symbol names. I'd like to think of is as an extremely simple textual syntab. The new file format is extremely simple, it contains a triple, a UUID and a list of address to symbol name mapping. JSON is used for the encoding, but that's mostly an implementation detail: any other encoding could achieve the same thing. However I did purposely pick a human readable format.
The new format is motivated by two use cases:
1. Stripped binaries: when a binary is stripped, you lose the ability to do thing like setting symbolic breakpoints. You can keep the unstripped binary around, but if all you need is the stripped symbols then that's a lot of overhead. Instead, we could save the stripped symbols to a file and load them in the debugger when needed. I want to extend `llvm-strip` to have a mode where it emits this new file format.
2. Interactive crashlogs: with interactive crashlogs, if we don't have the binary or the dSYM for a particular module, we currently show an unnamed symbol for those frames. This is a regression compared to the textual format, that has these frames pre-symbolicated. Given that this information is available in the JSON crashlog, we need a way to tell LLDB about it. With the new symbol file format, we can easily synthesize a symbol file for each of those modules and load them to symbolicate those frames.
Here's an example of the file format:
{
"triple": "arm64-apple-macosx13.0.0",
"uuid": "36D0CCE7-8ED2-3CA3-96B0-48C1764DA908",
"symbols": [
{
"name": "main",
"addr": 4294983568
},
{
"name": "foo",
"addr": 4294983560
}
]
}
I've added a test case that illustrates the stripped binary workflow. For the interactive crashlogs, we'll need to extend the crashlog script.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145180
Files:
lldb/source/Plugins/ObjectFile/CMakeLists.txt
lldb/source/Plugins/ObjectFile/JSON/CMakeLists.txt
lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h
lldb/source/Plugins/SymbolFile/CMakeLists.txt
lldb/source/Plugins/SymbolFile/JSON/CMakeLists.txt
lldb/source/Plugins/SymbolFile/JSON/SymbolFileJSON.cpp
lldb/source/Plugins/SymbolFile/JSON/SymbolFileJSON.h
lldb/test/API/macosx/symbols/Makefile
lldb/test/API/macosx/symbols/TestSymbolFileJSON.py
lldb/test/API/macosx/symbols/main.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145180.501944.patch
Type: text/x-patch
Size: 23787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230302/aedf8610/attachment-0001.bin>
More information about the lldb-commits
mailing list