Skip to content

Commit 2cab996

Browse files
committed
Add "process metadata" Mach-O LC_NOTE for corefiles
Add a new LC_NOTE for Mach-O corefiles, "proces metadata", which is a JSON string. Currently there may be a `threads` key in the JSON, and if `threads` is present, it is an array with the same number of elements as there are LC_THREADs in the corefile. This patch adds support for a `thread_id` key-value for each `thread` entry, to supply a thread ID for that LC_THREAD. Differential Revision: https://reviews.llvm.org/D158785 rdar://113037252
1 parent dfd1d8d commit 2cab996

File tree

7 files changed

+418
-294
lines changed

7 files changed

+418
-294
lines changed

lldb/include/lldb/Symbol/ObjectFile.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,30 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
538538
return false;
539539
}
540540

541+
/// Get metadata about threads from the corefile.
542+
///
543+
/// The corefile may have metadata (e.g. a Mach-O "thread extrainfo"
544+
/// LC_NOTE) which for the threads in the process; this method tries
545+
/// to retrieve them.
546+
///
547+
/// \param[out] tids
548+
/// Filled in with a vector of tid_t's that matches the number
549+
/// of threads in the corefile (ObjectFile::GetNumThreadContexts).
550+
/// If a tid is not specified for one of the corefile threads,
551+
/// that entry in the vector will have LLDB_INVALID_THREAD_ID and
552+
/// the caller should assign a tid to the thread that does not
553+
/// conflict with the ones provided in this array.
554+
/// As additional metadata are added, this method may return a
555+
/// \a tids vector with no thread id's specified at all; the
556+
/// corefile may only specify one of the other metadata.
557+
///
558+
/// \return
559+
/// Returns true if thread metadata was found in this corefile.
560+
///
561+
virtual bool GetCorefileThreadExtraInfos(std::vector<lldb::tid_t> &tids) {
562+
return false;
563+
}
564+
541565
virtual lldb::RegisterContextSP
542566
GetThreadContextAtIndex(uint32_t idx, lldb_private::Thread &thread) {
543567
return lldb::RegisterContextSP();

0 commit comments

Comments
 (0)