[Lldb-commits] [PATCH] D158785: [lldb] Add a "thread extrainfo" LC_NOTE for Mach-O corefiles, to store the thread IDs of the threads
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 24 18:21:55 PDT 2023
jasonmolenda updated this revision to Diff 553324.
jasonmolenda added a subscriber: jingham.
jasonmolenda added a comment.
After thinking about this more, and talking with @jingham I rewrote the patch so LC_NOTE "thread extrainfo" is a JSON dictionary with a key `threads` that has an array. The number of entries in the array must match the number of LC_THREADs in the Mach-O corefile. Each array entry may have a `thread_id` key with a thread id for that LC_THREAD, or lldb will create a thread_id for it. I expect we will add more per-thread keys in the future.
The payload looks like
{"threads":[{"thread_id":18368681},{"thread_id":18368703},{"thread_id":18368704}]}
and JSON is stored as a c-string, requires a nul byte '\0' at the end.
I've treated the LC_NOTEs in Mach-O as strictly defined binary data until now, so producers and consumers both had a reference to work with. But I think in the case of per-thread information in a corefile, we will have different people wanting to add different fields -- some fixed width, some variable length -- and specifying a JSON format that can be extended more easily is probably the correct way to go here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158785/new/
https://reviews.llvm.org/D158785
Files:
lldb/include/lldb/Symbol/ObjectFile.h
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
lldb/source/Plugins/Process/mach-core/ThreadMachCore.h
lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158785.553324.patch
Type: text/x-patch
Size: 13593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230825/bab45019/attachment.bin>
More information about the lldb-commits
mailing list