29#include "llvm/BinaryFormat/ELF.h"
40namespace ELF = llvm::ELF;
45 return "ELF core dump plug-in.";
57 if (crash_file && !can_connect) {
61 const size_t header_size =
sizeof(llvm::ELF::Elf64_Ehdr);
64 crash_file->
GetPath(), header_size, 0);
65 if (data_sp && data_sp->GetByteSize() == header_size &&
70 if (elf_header.
Parse(data, &data_offset)) {
75 if (elf_header.
e_type == llvm::ELF::ET_CORE)
76 process_sp = std::make_shared<ProcessElfCore>(target_sp, listener_sp,
85 bool plugin_specified_by_name) {
129 last_entry->
data.GetRangeEnd() == range_entry.
data.GetRangeBase() &&
132 last_entry->
data.SetRangeEnd(range_entry.
data.GetRangeEnd());
139 const uint32_t permissions =
140 ((header.
p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
141 ((header.
p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
142 ((header.
p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
175 if (core ==
nullptr) {
180 llvm::ArrayRef<elf::ELFProgramHeader> segments = core->
ProgramHeaders();
181 if (segments.size() == 0) {
201 bool ranges_are_sorted =
true;
212 if (H.p_type == llvm::ELF::PT_NOTE) {
218 if (H.p_type == llvm::ELF::PT_LOAD) {
220 if (vm_addr > last_addr)
221 ranges_are_sorted =
false;
223 }
else if (H.p_type == llvm::ELF::PT_AARCH64_MEMTAG_MTE) {
225 if (tag_addr > last_addr)
226 ranges_are_sorted =
false;
227 tag_addr = last_addr;
231 if (!ranges_are_sorted) {
239 bool siginfo_signal_found =
false;
240 bool prstatus_signal_found =
false;
243 if (!thread_data.siginfo_bytes.empty() || thread_data.signo != 0)
244 siginfo_signal_found =
true;
245 if (thread_data.prstatus_sig != 0)
246 prstatus_signal_found =
true;
248 if (!siginfo_signal_found) {
251 if (prstatus_signal_found) {
253 thread_data.signo = thread_data.prstatus_sig;
267 if (!exe_module_sp) {
272 if (!exe_module_sp) {
277 std::optional<NT_FILE_Entry> exe_header =
280 if (llvm::Expected<lldb::ModuleSP> module_sp_or_err =
283 exe_header->end - exe_header->start))
284 exe_module_sp = *module_sp_or_err;
286 llvm::consumeError(module_sp_or_err.takeError());
290 if (!exe_module_sp) {
294 exe_header ? (exe_header->end - exe_header->start) : 0;
297 exe_module_spec, load_addr, size);
299 exe_module_sp->SetPlatformFileSpec(
318 assert(
m_uuids.count(entry.path) == 0 ||
m_uuids[entry.path] == uuid);
320 LLDB_LOGF(log,
"%s found UUID @ %16.16" PRIx64
": %s \"%s\"",
321 __FUNCTION__, entry.start, uuid.
GetAsString().c_str(),
328 std::set<MemoryRegionInfo, std::less<>> finalized_regions;
332 const lldb::addr_t range_base = region_info.GetRange().GetRangeBase();
333 const lldb::addr_t range_end = region_info.GetRange().GetRangeEnd();
338 return entry.start == range_base;
341 region_info.SetName(file_entry->path.c_str());
345 if (tag_entry && tag_entry->
GetRangeEnd() == range_end)
348 finalized_regions.insert(std::move(region_info));
354 if (file_entry.start >= file_entry.end)
358 std::vector<MemoryRegionInfo::RangeType> uncovered_ranges;
360 const lldb::addr_t range_base = region_info.GetRange().GetRangeBase();
361 const lldb::addr_t range_end = region_info.GetRange().GetRangeEnd();
363 if (range_end <= cursor)
365 if (range_base >= file_entry.end)
368 if (cursor < range_base)
369 uncovered_ranges.emplace_back(cursor, range_base - cursor);
371 cursor = std::max(cursor, range_end);
372 if (cursor >= file_entry.end)
376 if (cursor < file_entry.end)
377 uncovered_ranges.emplace_back(cursor, file_entry.end - cursor);
383 if (!file_entry.path.empty())
384 region_info.
SetName(file_entry.path.c_str());
385 finalized_regions.insert(std::move(region_info));
399 path_style = *guessed_style;
408 std::optional<NT_FILE_Entry> exe_header =
426 std::string execfn_str;
470 if (std::optional<lldb::addr_t> load_addr = spec.
GetLoadAddress()) {
471 if (std::optional<NT_FILE_Entry> nt =
484 LLDB_LOGF(log,
"ProcessElfCore::FindModuleUUID() found UUID for %s: %s",
486 it->second.GetAsString().c_str());
493 llvm::StringRef dyld_name;
496 llvm::Triple::UnknownOS)
511 for (
lldb::tid_t tid = 0; tid < num_threads; ++tid) {
516 return new_thread_list.
GetSize(
false) > 0;
532 addr = abi_sp->FixAnyAddress(addr);
546 [load_addr](
const auto &entry) {
547 return entry.GetRange().Contains(load_addr);
549 if (range_entry != following) {
550 region_info = *range_entry;
558 : following->GetRange().GetRangeBase());
572 if (core_objfile ==
nullptr)
578 if (address_range ==
nullptr || address_range->
GetRangeEnd() < addr) {
580 "core file does not contain 0x%" PRIx64, addr);
588 size_t bytes_to_read = size;
589 size_t bytes_copied = 0;
595 if (file_start == file_end)
600 if (file_end > file_start + offset)
601 bytes_left = file_end - (file_start + offset);
603 if (bytes_to_read > bytes_left)
604 bytes_to_read = bytes_left;
609 core_objfile->
CopyData(offset + file_start, bytes_to_read, buf);
614llvm::Expected<std::vector<lldb::addr_t>>
617 if (core_objfile ==
nullptr)
618 return llvm::createStringError(llvm::inconvertibleErrorCode(),
619 "No core object file.");
621 llvm::Expected<const MemoryTagManager *> tag_manager_or_err =
623 if (!tag_manager_or_err)
624 return tag_manager_or_err.takeError();
634 if (!tag_entry || (addr + len) >= tag_entry->
GetRangeEnd())
635 return llvm::createStringError(llvm::inconvertibleErrorCode(),
636 "No tag segment that covers this range.");
641 return core_objfile->
CopyData(offset, length, dst);
661 ObjectFile *obj_file = executable_sp->GetObjectFile();
674 int pr_version = data.
GetU32(&offset);
678 LLDB_LOGF(log,
"FreeBSD PRSTATUS unexpected version %d", pr_version);
700 int pr_version = data.
GetU32(&offset);
704 LLDB_LOGF(log,
"FreeBSD PRPSINFO unexpected version %d", pr_version);
717 uint32_t &cpi_siglwp,
721 uint32_t version = data.
GetU32(&offset);
723 return llvm::createStringError(
724 "Error parsing NetBSD core(5) notes: Unsupported procinfo version");
726 uint32_t cpisize = data.
GetU32(&offset);
728 return llvm::createStringError(
729 "Error parsing NetBSD core(5) notes: Unsupported procinfo size");
731 cpi_signo = data.
GetU32(&offset);
738 cpi_pid = data.
GetU32(&offset);
748 cpi_nlwps = data.
GetU32(&offset);
751 cpi_siglwp = data.
GetU32(&offset);
753 return llvm::Error::success();
760 int version = data.
GetU32(&offset);
768llvm::Expected<std::vector<CoreNote>>
771 std::vector<CoreNote> result;
773 while (offset <
segment.GetByteSize()) {
776 return llvm::createStringError(
"unable to parse note segment");
778 size_t note_start = offset;
779 size_t note_size = llvm::alignTo(
note.n_descsz, 4);
785 return std::move(result);
790 bool lp64 = (arch.
GetMachine() == llvm::Triple::aarch64 ||
793 bool have_prstatus =
false;
794 bool have_prpsinfo =
false;
796 for (
const auto &
note : notes) {
797 if (
note.info.n_name !=
"FreeBSD")
800 if ((
note.info.n_type == ELF::NT_PRSTATUS && have_prstatus) ||
801 (
note.info.n_type == ELF::NT_PRPSINFO && have_prpsinfo)) {
806 have_prstatus =
false;
807 have_prpsinfo =
false;
810 switch (
note.info.n_type) {
811 case ELF::NT_PRSTATUS:
812 have_prstatus =
true;
815 case ELF::NT_PRPSINFO:
816 have_prpsinfo =
true;
819 case ELF::NT_FREEBSD_THRMISC: {
821 thread_data.
name =
note.data.GetCStr(&offset, 20);
824 case ELF::NT_FREEBSD_PROCSTAT_AUXV:
833 if (!have_prstatus) {
834 return llvm::createStringError(
835 "Could not find NT_PRSTATUS note in core file.");
838 return llvm::Error::success();
865 bool had_nt_regs =
false;
874 for (
const auto &
note : notes) {
875 llvm::StringRef name =
note.info.n_name;
877 if (name ==
"NetBSD-CORE") {
887 }
else if (name.consume_front(
"NetBSD-CORE@")) {
889 if (name.getAsInteger(10, tid))
890 return llvm::createStringError(
891 "Error parsing NetBSD core(5) notes: Cannot convert LWP ID "
895 case llvm::Triple::aarch64: {
906 thread_data.
tid = tid;
908 return llvm::createStringError(
909 "Could not find general purpose registers note in core file.");
912 if (!had_nt_regs || tid != thread_data.
tid)
913 return llvm::createStringError(
914 "Error parsing NetBSD core(5) notes: Unexpected order "
915 "of NOTEs PT_GETFPREG before PT_GETREG");
919 case llvm::Triple::x86: {
930 thread_data.
tid = tid;
932 return llvm::createStringError(
933 "Could not find general purpose registers note in core file.");
936 if (!had_nt_regs || tid != thread_data.
tid)
937 return llvm::createStringError(
938 "Error parsing NetBSD core(5) notes: Unexpected order "
939 "of NOTEs PT_GETFPREG before PT_GETREG");
943 case llvm::Triple::x86_64: {
954 thread_data.
tid = tid;
956 return llvm::createStringError(
957 "Could not find general purpose registers note in core file.");
960 if (!had_nt_regs || tid != thread_data.
tid)
961 return llvm::createStringError(
962 "Error parsing NetBSD core(5) notes: Unexpected order "
963 "of NOTEs PT_GETFPREG before PT_GETREG");
978 return llvm::createStringError(
979 "Error parsing NetBSD core(5) notes: No threads information "
980 "specified in notes");
983 return llvm::createStringError(
984 "Error parsing NetBSD core(5) notes: Mismatch between the number "
985 "of LWPs in netbsd_elfcore_procinfo and the number of LWPs specified "
998 if (data.tid == siglwp) {
1006 return llvm::createStringError(
1007 "Error parsing NetBSD core(5) notes: Signal passed to unknown LWP");
1010 return llvm::Error::success();
1015 for (
const auto &
note : notes) {
1018 if (!llvm::StringRef(
note.info.n_name).starts_with(
"OpenBSD"))
1021 switch (
note.info.n_type) {
1037 return llvm::createStringError(
1038 "Could not find general purpose registers note in core file.");
1041 return llvm::Error::success();
1058 bool have_prstatus =
false;
1059 bool have_prpsinfo =
false;
1061 for (
const auto &
note : notes) {
1062 if (
note.info.n_name !=
"CORE" &&
note.info.n_name !=
"LINUX")
1065 if ((
note.info.n_type == ELF::NT_PRSTATUS && have_prstatus) ||
1066 (
note.info.n_type == ELF::NT_PRPSINFO && have_prpsinfo)) {
1071 have_prstatus =
false;
1072 have_prpsinfo =
false;
1075 switch (
note.info.n_type) {
1076 case ELF::NT_PRSTATUS: {
1077 have_prstatus =
true;
1085 size_t len =
note.data.GetByteSize() - header_size;
1089 case ELF::NT_PRPSINFO: {
1090 have_prpsinfo =
true;
1098 auto core_arg = llvm::StringRef(prpsinfo.
pr_psargs,
1107 CoreArgs(core_arg, core_arg.size() ==
1111 case ELF::NT_SIGINFO: {
1115 static_cast<const char *
>(
note.data.GetData(&offset, size));
1119 case ELF::NT_FILE: {
1122 const uint64_t count =
note.data.GetAddress(&offset);
1123 note.data.GetAddress(&offset);
1124 for (uint64_t i = 0; i < count; ++i) {
1126 entry.
start =
note.data.GetAddress(&offset);
1127 entry.
end =
note.data.GetAddress(&offset);
1131 for (uint64_t i = 0; i < count; ++i) {
1132 const char *path =
note.data.GetCStr(&offset);
1133 if (path && path[0])
1149 return llvm::Error::success();
1158 assert(segment_header.
p_type == llvm::ELF::PT_NOTE);
1162 return notes_or_error.takeError();
1164 case llvm::Triple::FreeBSD:
1166 case llvm::Triple::Linux:
1168 case llvm::Triple::NetBSD:
1170 case llvm::Triple::OpenBSD:
1176 llvm::Triple::UnknownOS)
1179 return llvm::createStringError(
1180 "don't know how to parse core file: unsupported OS");
1187 const size_t elf_header_size = addr_size == 4 ?
sizeof(llvm::ELF::Elf32_Ehdr)
1188 :
sizeof(llvm::ELF::Elf64_Ehdr);
1190 std::vector<uint8_t> elf_header_bytes;
1191 elf_header_bytes.resize(elf_header_size);
1195 if (byte_read != elf_header_size ||
1197 return invalid_uuid;
1198 DataExtractor elf_header_data(elf_header_bytes.data(), elf_header_size,
1203 elf_header.
Parse(elf_header_data, &offset);
1207 std::vector<uint8_t> ph_bytes;
1210 bool found_first_load_segment =
false;
1211 for (
unsigned int i = 0; i < elf_header.
e_phnum; ++i) {
1220 program_header.
Parse(program_header_data, &offset);
1221 if (program_header.
p_type == llvm::ELF::PT_LOAD &&
1222 !found_first_load_segment) {
1223 base_addr = program_header.
p_vaddr;
1224 found_first_load_segment =
true;
1226 if (program_header.
p_type != llvm::ELF::PT_NOTE)
1229 std::vector<uint8_t> note_bytes;
1230 note_bytes.resize(program_header.
p_memsz);
1237 if (byte_read != program_header.
p_memsz)
1239 DataExtractor segment_data(note_bytes.data(), note_bytes.size(),
1242 if (!notes_or_error) {
1243 llvm::consumeError(notes_or_error.takeError());
1244 return invalid_uuid;
1247 if (
note.info.n_namesz == 4 &&
1248 note.info.n_type == llvm::ELF::NT_GNU_BUILD_ID &&
1249 "GNU" ==
note.info.n_name &&
1250 note.data.ValidOffsetForDataOfSize(0,
note.info.n_descsz))
1251 return UUID(
note.data.GetData().take_front(
note.info.n_descsz));
1254 return invalid_uuid;
1272 if (target_arch.
IsMIPS()) {
1280 assert(
m_auxv.GetByteSize() == 0 ||
1287 return std::nullopt;
1296 bool added_executable =
false;
1298 const bool add_exe_file_as_first_arg =
true;
1301 add_exe_file_as_first_arg);
1302 added_executable =
true;
1308 add_exe_file_as_first_arg);
1309 added_executable =
true;
1314 bool first_arg_is_executable =
true;
1315 if (added_executable) {
1319 first_arg_is_executable =
false;
1323 info.
SetArguments(process_args, first_arg_is_executable);
1328std::optional<ProcessElfCore::NT_FILE_Entry>
1331 if (file_entry.start <= addr && addr < file_entry.end)
1334 return std::nullopt;
1337std::optional<ProcessElfCore::NT_FILE_Entry>
1352 return std::nullopt;
1358 if (std::optional<uint64_t> opt_value =
1360 if (std::optional<NT_FILE_Entry> nt =
1366 if (std::optional<uint64_t> opt_value =
1368 if (std::optional<NT_FILE_Entry> nt =
1372 return std::nullopt;
static llvm::raw_ostream & error(Stream &strm)
static llvm::raw_ostream & note(Stream &strm)
#define LLDB_LOGF(log,...)
#define LLDB_PLUGIN_DEFINE(PluginName)
static FileSpec CreateFileSpecFromPath(llvm::StringRef path)
Correctly create a FileSpec from a path found in a core file.
static void ParseOpenBSDProcInfo(ThreadData &thread_data, const DataExtractor &data)
static void ParseFreeBSDPrPsInfo(ProcessElfCore &process, const DataExtractor &data, bool lp64)
static void ParseFreeBSDPrStatus(ThreadData &thread_data, const DataExtractor &data, bool lp64)
static llvm::Error ParseNetBSDProcInfo(const DataExtractor &data, uint32_t &cpi_nlwps, uint32_t &cpi_signo, uint32_t &cpi_siglwp, uint32_t &cpi_pid)
@ AUXV_AT_EXECFN
Filename of executable.
@ AUXV_AT_PHDR
Program headers.
@ AUXV_AT_ENTRY
Program entry point.
std::optional< uint64_t > GetAuxValue(enum EntryType entry_type) const
static llvm::StringRef GetPluginNameStatic()
static llvm::StringRef GetPluginNameStatic()
Generic COFF object file reader.
lldb_private::DataExtractor GetSegmentData(const elf::ELFProgramHeader &H)
llvm::ArrayRef< elf::ELFProgramHeader > ProgramHeaders()
std::vector< NT_FILE_Entry > m_nt_file_entries
std::optional< NT_FILE_Entry > GetNTFileEntryForExecutableELFHeader()
Intelligently find the NT_FILE entry for the executable's ELF header.
std::set< lldb_private::MemoryRegionInfo, std::less<> > m_core_range_infos
lldb::addr_t GetImageInfoAddress() override
Get the image information address for the current process.
lldb::addr_t AddAddressRangeFromMemoryTagSegment(const elf::ELFProgramHeader &header)
lldb_private::DataExtractor m_auxv
bool FindModuleUUID(lldb_private::ModuleSpec &spec) override
Given a module spec, try to find the UUID information.
llvm::Error parseLinuxNotes(llvm::ArrayRef< lldb_private::CoreNote > notes)
A description of a linux process usually contains the following NOTE entries:
llvm::Error ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader &segment_header, const lldb_private::DataExtractor &segment_data)
Parse Thread context from PT_NOTE segment and store it in the thread list A note segment consists of ...
void UpdateBuildIdForNTFileEntries()
std::vector< ThreadData > m_thread_data
lldb_private::Range< lldb::addr_t, lldb::addr_t > FileRange
bool DoUpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list) override
Update the thread list following process plug-in's specific logic.
static llvm::StringRef GetPluginDescriptionStatic()
std::unordered_map< std::string, lldb_private::UUID > m_uuids
llvm::Expected< std::vector< lldb_private::CoreNote > > parseSegment(const lldb_private::DataExtractor &segment)
lldb::addr_t AddAddressRangeFromLoadSegment(const elf::ELFProgramHeader &header)
~ProcessElfCore() override
bool GetMainExecutableModuleSpec(lldb_private::ModuleSpec &exe_spec)
llvm::Error parseFreeBSDNotes(llvm::ArrayRef< lldb_private::CoreNote > notes)
size_t DoReadMemory(const lldb_private::ProcessAddress &addr, void *buf, size_t size, lldb_private::Status &error) override
Actually do the reading of memory from a process.
lldb_private::UUID FindBuidIdInCoreMemory(lldb::addr_t address)
VMRangeToFileOffset m_core_aranges
lldb_private::Status DoGetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo ®ion_info) override
DoGetMemoryRegionInfo is called by GetMemoryRegionInfo after it has removed non address bits from loa...
Process::CoreArgs m_process_args
size_t ReadMemory(const lldb_private::ProcessAddress &addr, void *buf, size_t size, lldb_private::Status &error) override
Read of memory from a process.
VMRangeToFileOffset m_core_tag_ranges
llvm::Error parseNetBSDNotes(llvm::ArrayRef< lldb_private::CoreNote > notes)
NetBSD specific Thread context from PT_NOTE segment.
lldb_private::Status DoLoadCore() override
ProcessElfCore(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const lldb_private::FileSpec &core_file)
lldb_private::DynamicLoader * GetDynamicLoader() override
Get the dynamic loader plug-in for this process.
llvm::Expected< std::vector< lldb::addr_t > > ReadMemoryTags(lldb::addr_t addr, size_t len) override
Read memory tags for the range addr to addr+len.
lldb_private::DataExtractor GetAuxvData() override
bool IsAlive() override
Check if a process is still alive.
uint32_t GetNumThreadContexts()
std::string m_executable_name
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const lldb_private::FileSpec *crash_file_path, bool can_connect)
llvm::Error parseOpenBSDNotes(llvm::ArrayRef< lldb_private::CoreNote > notes)
void RefreshStateAfterStop() override
Currently called as part of ShouldStop.
lldb_private::ArchSpec GetArchitecture()
bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override
Check if a plug-in instance can debug the file in module.
std::optional< Process::CoreArgs > GetCoreFileArgs() override
Provide arguments of a command that triggered a core dump.
bool GetProcessInfo(lldb_private::ProcessInstanceInfo &info) override
static llvm::StringRef GetPluginNameStatic()
void FinalizeMemoryRegionInfos()
lldb::ModuleSP m_core_module_sp
std::optional< NT_FILE_Entry > GetNTFileEntryContainingAddress(lldb::addr_t addr)
Find the NT_FILE entry that contains an address.
lldb_private::Status DoDestroy() override
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
bool IsValid() const
Check if the object state is valid.
An architecture specification class.
void MergeFrom(const ArchSpec &other)
Merges fields from another ArchSpec into this ArchSpec.
bool IsMIPS() const
if MIPS architecture return true.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
A command line argument class.
void DeleteArgumentAtIndex(size_t idx)
Deletes the argument value at index if idx is a valid argument index.
const char * GetArgumentAtIndex(size_t idx) const
Gets the null-terminated C string argument pointer for the argument at index idx.
A plug-in interface definition class for dynamic loaders.
static DynamicLoader * FindPlugin(Process *process, llvm::StringRef plugin_name)
Find a dynamic loader plugin for a given process.
static std::optional< Style > GuessPathStyle(llvm::StringRef absolute_path)
Attempt to guess path style for a given path string.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
llvm::sys::path::Style Style
static FileSystem & Instance()
std::shared_ptr< DataBuffer > CreateDataBuffer(const llvm::Twine &path, uint64_t size=0, uint64_t offset=0)
Create memory buffer from path.
void SetReadable(LazyBool val)
MemoryRegionInfo & SetMemoryTagged(LazyBool val)
void SetName(const char *name)
Range< lldb::addr_t, lldb::addr_t > RangeType
void SetLLDBPermissions(uint32_t permissions)
void SetMapped(LazyBool val)
void SetExecutable(LazyBool val)
void SetWritable(LazyBool val)
virtual llvm::Expected< std::vector< lldb::addr_t > > UnpackTagsFromCoreFileSegment(CoreReaderFn reader, lldb::addr_t tag_segment_virtual_address, lldb::addr_t tag_segment_data_address, lldb::addr_t addr, size_t len) const =0
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool invoke_locate_callback=true, bool invoke_symbol_locators=true)
void SetLoadAddress(lldb::addr_t addr)
Set the load address of a module in process memory.
FileSpec & GetPlatformFileSpec()
ArchSpec & GetArchitecture()
void SetTarget(lldb::TargetSP target)
Set the target to be used when resolving a module.
std::optional< lldb::addr_t > GetLoadAddress() const
Get the load address of a module in process memory.
static lldb::ModuleSP CreateModuleFromObjectFile(Args &&...args)
A plug-in interface definition class for object file parsers.
virtual lldb_private::Address GetImageInfoAddress(Target *target)
Similar to Process::GetImageInfoAddress().
@ eTypeCoreFile
A core file that has a checkpoint of a program's execution state.
size_t CopyData(lldb::offset_t offset, size_t length, void *dst) const
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
PostMortemProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec &core_file)
An address in a process, qualified by an address space.
lldb::addr_t GetValue() const
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
void SetArchitecture(const ArchSpec &arch)
void SetArg0(llvm::StringRef arg)
void SetArguments(const Args &args, bool first_arg_is_executable)
void SetProcessID(lldb::pid_t pid)
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp)
size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, size_t cstr_max_len, Status &error)
Read a null-terminated C string from memory.
void SetCanJIT(bool can_jit)
Sets whether executing JIT-compiled code in this process is possible.
lldb::DynamicLoaderUP m_dyld_up
llvm::Expected< const MemoryTagManager * > GetMemoryTagManager()
If this architecture and process supports memory tagging, return a tag manager that can be used to ma...
lldb::ByteOrder GetByteOrder() const
llvm::Expected< lldb::ModuleSP > ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read=512)
Creates and populates a module using an in-memory object file.
void SetID(lldb::pid_t new_pid)
Sets the stored pid.
uint32_t GetAddressByteSize() const
virtual void Finalize(bool destructing)
This object is about to be destroyed, do any necessary cleanup.
ThreadList m_thread_list
The threads for this process as the user will see them.
const lldb::UnixSignalsSP & GetUnixSignals()
const lldb::ABISP & GetABI()
Target & GetTarget()
Get the target object pointer for this module.
RangeData< lldb::addr_t, lldb::addr_t, FileRange > Entry
llvm::Error ToError() const
FIXME: Replace all uses with takeError() instead.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
bool Fail() const
Test for error condition.
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
const ArchSpec & GetArchitecture() const
void RebuildModuleListWithExecutable(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Clear the module list and rebuild it around a new main executable.
void AddThread(const lldb::ThreadSP &thread_sp)
uint32_t GetSize(bool can_update=true)
Represents UUID's of various sizes.
std::string GetAsString(llvm::StringRef separator="-") const
static lldb::UnixSignalsSP Create(const ArchSpec &arch)
#define LLDB_INVALID_ADDRESS
@ NT_PROCINFO_CPI_SIGIGNORE_SIZE
@ NT_PROCINFO_CPI_NAME_SIZE
@ NT_PROCINFO_CPI_RUID_SIZE
@ NT_PROCINFO_CPI_SVUID_SIZE
@ NT_PROCINFO_CPI_SIGCODE_SIZE
@ NT_PROCINFO_CPI_SVGID_SIZE
@ NT_PROCINFO_CPI_EUID_SIZE
@ NT_PROCINFO_CPI_PPID_SIZE
@ NT_PROCINFO_CPI_RGID_SIZE
@ NT_PROCINFO_CPI_SIGCATCH_SIZE
@ NT_PROCINFO_CPI_SIGMASK_SIZE
@ NT_PROCINFO_CPI_SID_SIZE
@ NT_PROCINFO_CPI_SIGPEND_SIZE
@ NT_PROCINFO_CPI_EGID_SIZE
@ NT_PROCINFO_CPI_PGRP_SIZE
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Listener > ListenerSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch)
static size_t GetSize(const lldb_private::ArchSpec &arch)
lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch)
llvm::StringRef siginfo_bytes
lldb_private::DataExtractor gpregset
std::vector< lldb_private::CoreNote > notes
BaseType GetRangeBase() const
void SetRangeEnd(BaseType end)
SizeType GetByteSize() const
void SetRangeBase(BaseType b)
Set the start value for the range, and keep the same size.
BaseType GetRangeEnd() const