aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/Process/minidump
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
commitead246455adf1a215ec2715dad6533073a6beb4e (patch)
treef3f97a47d77053bf96fe74cdbd6fae74380e8a92 /source/Plugins/Process/minidump
parentfdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff)
downloadsrc-vendor/lldb.tar.gz
src-vendor/lldb.zip
Vendor import of stripped lldb trunk r375505, the last commit before thevendor/lldb/lldb-trunk-r375505vendor/lldb
upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/lldb/trunk@375505
Notes
Notes: svn path=/vendor/lldb/dist/; revision=353952 svn path=/vendor/lldb/lldb-r375505/; revision=353953; tag=vendor/lldb/lldb-trunk-r375505
Diffstat (limited to 'source/Plugins/Process/minidump')
-rw-r--r--source/Plugins/Process/minidump/MinidumpParser.cpp53
-rw-r--r--source/Plugins/Process/minidump/MinidumpParser.h2
-rw-r--r--source/Plugins/Process/minidump/MinidumpTypes.cpp37
-rw-r--r--source/Plugins/Process/minidump/MinidumpTypes.h113
-rw-r--r--source/Plugins/Process/minidump/ProcessMinidump.cpp94
-rw-r--r--source/Plugins/Process/minidump/ProcessMinidump.h2
-rw-r--r--source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp38
-rw-r--r--source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h6
8 files changed, 135 insertions, 210 deletions
diff --git a/source/Plugins/Process/minidump/MinidumpParser.cpp b/source/Plugins/Process/minidump/MinidumpParser.cpp
index ff015aa54b76..70933f91fe51 100644
--- a/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ b/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -188,6 +188,7 @@ ArchSpec MinidumpParser::GetArchitecture() {
case OSPlatform::Win32NT:
case OSPlatform::Win32CE:
triple.setOS(llvm::Triple::OSType::Win32);
+ triple.setVendor(llvm::Triple::VendorType::PC);
break;
case OSPlatform::Linux:
triple.setOS(llvm::Triple::OSType::Linux);
@@ -313,13 +314,15 @@ std::vector<const minidump::Module *> MinidumpParser::GetFilteredModuleList() {
return filtered_modules;
}
-const MinidumpExceptionStream *MinidumpParser::GetExceptionStream() {
- llvm::ArrayRef<uint8_t> data = GetStream(StreamType::Exception);
+const minidump::ExceptionStream *MinidumpParser::GetExceptionStream() {
+ auto ExpectedStream = GetMinidumpFile().getExceptionStream();
+ if (ExpectedStream)
+ return &*ExpectedStream;
- if (data.size() == 0)
- return nullptr;
-
- return MinidumpExceptionStream::Parse(data);
+ LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS),
+ ExpectedStream.takeError(),
+ "Failed to read minidump exception stream: {0}");
+ return nullptr;
}
llvm::Optional<minidump::Range>
@@ -426,23 +429,35 @@ CreateRegionsCacheFromLinuxMaps(MinidumpParser &parser,
static bool
CreateRegionsCacheFromMemoryInfoList(MinidumpParser &parser,
std::vector<MemoryRegionInfo> &regions) {
- auto data = parser.GetStream(StreamType::MemoryInfoList);
- if (data.empty())
- return false;
- auto mem_info_list = MinidumpMemoryInfo::ParseMemoryInfoList(data);
- if (mem_info_list.empty())
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES);
+ auto ExpectedInfo = parser.GetMinidumpFile().getMemoryInfoList();
+ if (!ExpectedInfo) {
+ LLDB_LOG_ERROR(log, ExpectedInfo.takeError(),
+ "Failed to read memory info list: {0}");
return false;
+ }
constexpr auto yes = MemoryRegionInfo::eYes;
constexpr auto no = MemoryRegionInfo::eNo;
- regions.reserve(mem_info_list.size());
- for (const auto &entry : mem_info_list) {
+ for (const MemoryInfo &entry : *ExpectedInfo) {
MemoryRegionInfo region;
- region.GetRange().SetRangeBase(entry->base_address);
- region.GetRange().SetByteSize(entry->region_size);
- region.SetReadable(entry->isReadable() ? yes : no);
- region.SetWritable(entry->isWritable() ? yes : no);
- region.SetExecutable(entry->isExecutable() ? yes : no);
- region.SetMapped(entry->isMapped() ? yes : no);
+ region.GetRange().SetRangeBase(entry.BaseAddress);
+ region.GetRange().SetByteSize(entry.RegionSize);
+
+ MemoryProtection prot = entry.Protect;
+ region.SetReadable(bool(prot & MemoryProtection::NoAccess) ? no : yes);
+ region.SetWritable(
+ bool(prot & (MemoryProtection::ReadWrite | MemoryProtection::WriteCopy |
+ MemoryProtection::ExecuteReadWrite |
+ MemoryProtection::ExeciteWriteCopy))
+ ? yes
+ : no);
+ region.SetExecutable(
+ bool(prot & (MemoryProtection::Execute | MemoryProtection::ExecuteRead |
+ MemoryProtection::ExecuteReadWrite |
+ MemoryProtection::ExeciteWriteCopy))
+ ? yes
+ : no);
+ region.SetMapped(entry.State != MemoryState::Free ? yes : no);
regions.push_back(region);
}
return !regions.empty();
diff --git a/source/Plugins/Process/minidump/MinidumpParser.h b/source/Plugins/Process/minidump/MinidumpParser.h
index fce64f0ed5fc..d206fe6c9a00 100644
--- a/source/Plugins/Process/minidump/MinidumpParser.h
+++ b/source/Plugins/Process/minidump/MinidumpParser.h
@@ -82,7 +82,7 @@ public:
// have the same name, it keeps the copy with the lowest load address.
std::vector<const minidump::Module *> GetFilteredModuleList();
- const MinidumpExceptionStream *GetExceptionStream();
+ const llvm::minidump::ExceptionStream *GetExceptionStream();
llvm::Optional<Range> FindMemoryRange(lldb::addr_t addr);
diff --git a/source/Plugins/Process/minidump/MinidumpTypes.cpp b/source/Plugins/Process/minidump/MinidumpTypes.cpp
index d7fc6e43d090..ed00b1cc07db 100644
--- a/source/Plugins/Process/minidump/MinidumpTypes.cpp
+++ b/source/Plugins/Process/minidump/MinidumpTypes.cpp
@@ -57,17 +57,6 @@ LinuxProcStatus::Parse(llvm::ArrayRef<uint8_t> &data) {
lldb::pid_t LinuxProcStatus::GetPid() const { return pid; }
-// Exception stuff
-const MinidumpExceptionStream *
-MinidumpExceptionStream::Parse(llvm::ArrayRef<uint8_t> &data) {
- const MinidumpExceptionStream *exception_stream = nullptr;
- Status error = consumeObject(data, exception_stream);
- if (error.Fail())
- return nullptr;
-
- return exception_stream;
-}
-
std::pair<llvm::ArrayRef<MinidumpMemoryDescriptor64>, uint64_t>
MinidumpMemoryDescriptor64::ParseMemory64List(llvm::ArrayRef<uint8_t> &data) {
const llvm::support::ulittle64_t *mem_ranges_count;
@@ -87,29 +76,3 @@ MinidumpMemoryDescriptor64::ParseMemory64List(llvm::ArrayRef<uint8_t> &data) {
*mem_ranges_count),
*base_rva);
}
-
-std::vector<const MinidumpMemoryInfo *>
-MinidumpMemoryInfo::ParseMemoryInfoList(llvm::ArrayRef<uint8_t> &data) {
- const MinidumpMemoryInfoListHeader *header;
- Status error = consumeObject(data, header);
- if (error.Fail() ||
- header->size_of_header < sizeof(MinidumpMemoryInfoListHeader) ||
- header->size_of_entry < sizeof(MinidumpMemoryInfo))
- return {};
-
- data = data.drop_front(header->size_of_header -
- sizeof(MinidumpMemoryInfoListHeader));
-
- if (header->size_of_entry * header->num_of_entries > data.size())
- return {};
-
- std::vector<const MinidumpMemoryInfo *> result;
- result.reserve(header->num_of_entries);
-
- for (uint64_t i = 0; i < header->num_of_entries; ++i) {
- result.push_back(reinterpret_cast<const MinidumpMemoryInfo *>(
- data.data() + i * header->size_of_entry));
- }
-
- return result;
-}
diff --git a/source/Plugins/Process/minidump/MinidumpTypes.h b/source/Plugins/Process/minidump/MinidumpTypes.h
index b4878e82de5d..a9c807930ebf 100644
--- a/source/Plugins/Process/minidump/MinidumpTypes.h
+++ b/source/Plugins/Process/minidump/MinidumpTypes.h
@@ -85,90 +85,6 @@ struct MinidumpMemoryDescriptor64 {
static_assert(sizeof(MinidumpMemoryDescriptor64) == 16,
"sizeof MinidumpMemoryDescriptor64 is not correct!");
-// Reference:
-// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680385(v=vs.85).aspx
-struct MinidumpMemoryInfoListHeader {
- llvm::support::ulittle32_t size_of_header;
- llvm::support::ulittle32_t size_of_entry;
- llvm::support::ulittle64_t num_of_entries;
-};
-static_assert(sizeof(MinidumpMemoryInfoListHeader) == 16,
- "sizeof MinidumpMemoryInfoListHeader is not correct!");
-
-enum class MinidumpMemoryInfoState : uint32_t {
- MemCommit = 0x1000,
- MemFree = 0x10000,
- MemReserve = 0x2000,
- LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ MemFree)
-};
-
-enum class MinidumpMemoryInfoType : uint32_t {
- MemImage = 0x1000000,
- MemMapped = 0x40000,
- MemPrivate = 0x20000,
- LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ MemImage)
-};
-
-// Reference:
-// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx
-enum class MinidumpMemoryProtectionContants : uint32_t {
- PageExecute = 0x10,
- PageExecuteRead = 0x20,
- PageExecuteReadWrite = 0x40,
- PageExecuteWriteCopy = 0x80,
- PageNoAccess = 0x01,
- PageReadOnly = 0x02,
- PageReadWrite = 0x04,
- PageWriteCopy = 0x08,
- PageTargetsInvalid = 0x40000000,
- PageTargetsNoUpdate = 0x40000000,
-
- PageWritable = PageExecuteReadWrite | PageExecuteWriteCopy | PageReadWrite |
- PageWriteCopy,
- PageExecutable = PageExecute | PageExecuteRead | PageExecuteReadWrite |
- PageExecuteWriteCopy,
- LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ PageTargetsInvalid)
-};
-
-// Reference:
-// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680386(v=vs.85).aspx
-struct MinidumpMemoryInfo {
- llvm::support::ulittle64_t base_address;
- llvm::support::ulittle64_t allocation_base;
- llvm::support::ulittle32_t allocation_protect;
- llvm::support::ulittle32_t alignment1;
- llvm::support::ulittle64_t region_size;
- llvm::support::ulittle32_t state;
- llvm::support::ulittle32_t protect;
- llvm::support::ulittle32_t type;
- llvm::support::ulittle32_t alignment2;
-
- static std::vector<const MinidumpMemoryInfo *>
- ParseMemoryInfoList(llvm::ArrayRef<uint8_t> &data);
-
- bool isReadable() const {
- const auto mask = MinidumpMemoryProtectionContants::PageNoAccess;
- return (static_cast<uint32_t>(mask) & protect) == 0;
- }
-
- bool isWritable() const {
- const auto mask = MinidumpMemoryProtectionContants::PageWritable;
- return (static_cast<uint32_t>(mask) & protect) != 0;
- }
-
- bool isExecutable() const {
- const auto mask = MinidumpMemoryProtectionContants::PageExecutable;
- return (static_cast<uint32_t>(mask) & protect) != 0;
- }
-
- bool isMapped() const {
- return state != static_cast<uint32_t>(MinidumpMemoryInfoState::MemFree);
- }
-};
-
-static_assert(sizeof(MinidumpMemoryInfo) == 48,
- "sizeof MinidumpMemoryInfo is not correct!");
-
// TODO misc2, misc3 ?
// Reference:
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680389(v=vs.85).aspx
@@ -202,35 +118,6 @@ private:
LinuxProcStatus() = default;
};
-// Exception stuff
-struct MinidumpException {
- enum : unsigned {
- ExceptonInfoMaxParams = 15,
- DumpRequested = 0xFFFFFFFF,
- };
-
- llvm::support::ulittle32_t exception_code;
- llvm::support::ulittle32_t exception_flags;
- llvm::support::ulittle64_t exception_record;
- llvm::support::ulittle64_t exception_address;
- llvm::support::ulittle32_t number_parameters;
- llvm::support::ulittle32_t unused_alignment;
- llvm::support::ulittle64_t exception_information[ExceptonInfoMaxParams];
-};
-static_assert(sizeof(MinidumpException) == 152,
- "sizeof MinidumpException is not correct!");
-
-struct MinidumpExceptionStream {
- llvm::support::ulittle32_t thread_id;
- llvm::support::ulittle32_t alignment;
- MinidumpException exception_record;
- LocationDescriptor thread_context;
-
- static const MinidumpExceptionStream *Parse(llvm::ArrayRef<uint8_t> &data);
-};
-static_assert(sizeof(MinidumpExceptionStream) == 168,
- "sizeof MinidumpExceptionStream is not correct!");
-
} // namespace minidump
} // namespace lldb_private
#endif // liblldb_MinidumpTypes_h_
diff --git a/source/Plugins/Process/minidump/ProcessMinidump.cpp b/source/Plugins/Process/minidump/ProcessMinidump.cpp
index a7fc42cad16c..e30a3c82a887 100644
--- a/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -49,16 +49,19 @@ namespace {
class PlaceholderObjectFile : public ObjectFile {
public:
PlaceholderObjectFile(const lldb::ModuleSP &module_sp,
- const ModuleSpec &module_spec, lldb::offset_t base,
- lldb::offset_t size)
+ const ModuleSpec &module_spec, lldb::addr_t base,
+ lldb::addr_t size)
: ObjectFile(module_sp, &module_spec.GetFileSpec(), /*file_offset*/ 0,
/*length*/ 0, /*data_sp*/ nullptr, /*data_offset*/ 0),
m_arch(module_spec.GetArchitecture()), m_uuid(module_spec.GetUUID()),
m_base(base), m_size(size) {
- m_symtab_up = llvm::make_unique<Symtab>(this);
+ m_symtab_up = std::make_unique<Symtab>(this);
}
- ConstString GetPluginName() override { return ConstString("placeholder"); }
+ static ConstString GetStaticPluginName() {
+ return ConstString("placeholder");
+ }
+ ConstString GetPluginName() override { return GetStaticPluginName(); }
uint32_t GetPluginVersion() override { return 1; }
bool ParseHeader() override { return true; }
Type CalculateType() override { return eTypeUnknown; }
@@ -80,7 +83,7 @@ public:
}
void CreateSections(SectionList &unified_section_list) override {
- m_sections_up = llvm::make_unique<SectionList>();
+ m_sections_up = std::make_unique<SectionList>();
auto section_sp = std::make_shared<Section>(
GetModule(), this, /*sect_id*/ 0, ConstString(".module_image"),
eSectionTypeOther, m_base, m_size, /*file_offset*/ 0, /*file_size*/ 0,
@@ -109,11 +112,12 @@ public:
GetFileSpec(), m_base, m_base + m_size);
}
+ lldb::addr_t GetBaseImageAddress() const { return m_base; }
private:
ArchSpec m_arch;
UUID m_uuid;
- lldb::offset_t m_base;
- lldb::offset_t m_size;
+ lldb::addr_t m_base;
+ lldb::addr_t m_size;
};
} // namespace
@@ -215,6 +219,9 @@ Status ProcessMinidump::DoLoadCore() {
m_thread_list = m_minidump_parser->GetThreads();
m_active_exception = m_minidump_parser->GetExceptionStream();
+
+ SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
ReadModuleList();
llvm::Optional<lldb::pid_t> pid = m_minidump_parser->GetPid();
@@ -234,39 +241,56 @@ uint32_t ProcessMinidump::GetPluginVersion() { return 1; }
Status ProcessMinidump::DoDestroy() { return Status(); }
void ProcessMinidump::RefreshStateAfterStop() {
+
if (!m_active_exception)
return;
- if (m_active_exception->exception_record.exception_code ==
- MinidumpException::DumpRequested) {
+ constexpr uint32_t BreakpadDumpRequested = 0xFFFFFFFF;
+ if (m_active_exception->ExceptionRecord.ExceptionCode ==
+ BreakpadDumpRequested) {
+ // This "ExceptionCode" value is a sentinel that is sometimes used
+ // when generating a dump for a process that hasn't crashed.
+
+ // TODO: The definition and use of this "dump requested" constant
+ // in Breakpad are actually Linux-specific, and for similar use
+ // cases on Mac/Windows it defines differnt constants, referring
+ // to them as "simulated" exceptions; consider moving this check
+ // down to the OS-specific paths and checking each OS for its own
+ // constant.
return;
}
lldb::StopInfoSP stop_info;
lldb::ThreadSP stop_thread;
- Process::m_thread_list.SetSelectedThreadByID(m_active_exception->thread_id);
+ Process::m_thread_list.SetSelectedThreadByID(m_active_exception->ThreadId);
stop_thread = Process::m_thread_list.GetSelectedThread();
ArchSpec arch = GetArchitecture();
if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
+ uint32_t signo = m_active_exception->ExceptionRecord.ExceptionCode;
+
+ if (signo == 0) {
+ // No stop.
+ return;
+ }
+
stop_info = StopInfo::CreateStopReasonWithSignal(
- *stop_thread, m_active_exception->exception_record.exception_code);
+ *stop_thread, signo);
} else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
stop_info = StopInfoMachException::CreateStopReasonWithMachException(
- *stop_thread, m_active_exception->exception_record.exception_code, 2,
- m_active_exception->exception_record.exception_flags,
- m_active_exception->exception_record.exception_address, 0);
+ *stop_thread, m_active_exception->ExceptionRecord.ExceptionCode, 2,
+ m_active_exception->ExceptionRecord.ExceptionFlags,
+ m_active_exception->ExceptionRecord.ExceptionAddress, 0);
} else {
std::string desc;
llvm::raw_string_ostream desc_stream(desc);
desc_stream << "Exception "
<< llvm::format_hex(
- m_active_exception->exception_record.exception_code, 8)
+ m_active_exception->ExceptionRecord.ExceptionCode, 8)
<< " encountered at address "
<< llvm::format_hex(
- m_active_exception->exception_record.exception_address,
- 8);
+ m_active_exception->ExceptionRecord.ExceptionAddress, 8);
stop_info = StopInfo::CreateStopReasonWithException(
*stop_thread, desc_stream.str().c_str());
}
@@ -331,8 +355,8 @@ bool ProcessMinidump::UpdateThreadList(ThreadList &old_thread_list,
// If the minidump contains an exception context, use it
if (m_active_exception != nullptr &&
- m_active_exception->thread_id == thread.ThreadId) {
- context_location = m_active_exception->thread_context;
+ m_active_exception->ThreadId == thread.ThreadId) {
+ context_location = m_active_exception->ThreadContext;
}
llvm::ArrayRef<uint8_t> context;
@@ -351,14 +375,15 @@ void ProcessMinidump::ReadModuleList() {
std::vector<const minidump::Module *> filtered_modules =
m_minidump_parser->GetFilteredModuleList();
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES));
+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
for (auto module : filtered_modules) {
std::string name = cantFail(m_minidump_parser->GetMinidumpFile().getString(
module->ModuleNameRVA));
+ const uint64_t load_addr = module->BaseOfImage;
+ const uint64_t load_size = module->SizeOfImage;
LLDB_LOG(log, "found module: name: {0} {1:x10}-{2:x10} size: {3}", name,
- module->BaseOfImage, module->BaseOfImage + module->SizeOfImage,
- module->SizeOfImage);
+ load_addr, load_addr + load_size, load_size);
// check if the process is wow64 - a 32 bit windows process running on a
// 64 bit windows
@@ -373,7 +398,7 @@ void ProcessMinidump::ReadModuleList() {
Status error;
// Try and find a module with a full UUID that matches. This function will
// add the module to the target if it finds one.
- lldb::ModuleSP module_sp = GetTarget().GetOrCreateModule(module_spec,
+ lldb::ModuleSP module_sp = GetTarget().GetOrCreateModule(module_spec,
true /* notify */, &error);
if (!module_sp) {
// Try and find a module without specifying the UUID and only looking for
@@ -386,8 +411,8 @@ void ProcessMinidump::ReadModuleList() {
ModuleSpec basename_module_spec(module_spec);
basename_module_spec.GetUUID().Clear();
basename_module_spec.GetFileSpec().GetDirectory().Clear();
- module_sp = GetTarget().GetOrCreateModule(basename_module_spec,
- true /* notify */, &error);
+ module_sp = GetTarget().GetOrCreateModule(basename_module_spec,
+ true /* notify */, &error);
if (module_sp) {
// We consider the module to be a match if the minidump UUID is a
// prefix of the actual UUID, or if either of the UUIDs are empty.
@@ -401,6 +426,19 @@ void ProcessMinidump::ReadModuleList() {
}
}
}
+ if (module_sp) {
+ // Watch out for place holder modules that have different paths, but the
+ // same UUID. If the base address is different, create a new module. If
+ // we don't then we will end up setting the load address of a different
+ // PlaceholderObjectFile and an assertion will fire.
+ auto *objfile = module_sp->GetObjectFile();
+ if (objfile && objfile->GetPluginName() ==
+ PlaceholderObjectFile::GetStaticPluginName()) {
+ if (((PlaceholderObjectFile *)objfile)->GetBaseImageAddress() !=
+ load_addr)
+ module_sp.reset();
+ }
+ }
if (!module_sp) {
// We failed to locate a matching local object file. Fortunately, the
// minidump format encodes enough information about each module's memory
@@ -415,12 +453,12 @@ void ProcessMinidump::ReadModuleList() {
name);
module_sp = Module::CreateModuleFromObjectFile<PlaceholderObjectFile>(
- module_spec, module->BaseOfImage, module->SizeOfImage);
+ module_spec, load_addr, load_size);
GetTarget().GetImages().Append(module_sp, true /* notify */);
}
bool load_addr_changed = false;
- module_sp->SetLoadAddress(GetTarget(), module->BaseOfImage, false,
+ module_sp->SetLoadAddress(GetTarget(), load_addr, false,
load_addr_changed);
}
}
@@ -444,7 +482,7 @@ bool ProcessMinidump::GetProcessInfo(ProcessInstanceInfo &info) {
// debug information than needed.
JITLoaderList &ProcessMinidump::GetJITLoaders() {
if (!m_jit_loaders_up) {
- m_jit_loaders_up = llvm::make_unique<JITLoaderList>();
+ m_jit_loaders_up = std::make_unique<JITLoaderList>();
}
return *m_jit_loaders_up;
}
diff --git a/source/Plugins/Process/minidump/ProcessMinidump.h b/source/Plugins/Process/minidump/ProcessMinidump.h
index c39040f61dc5..22dc24af7c0e 100644
--- a/source/Plugins/Process/minidump/ProcessMinidump.h
+++ b/source/Plugins/Process/minidump/ProcessMinidump.h
@@ -108,7 +108,7 @@ private:
FileSpec m_core_file;
lldb::DataBufferSP m_core_data;
llvm::ArrayRef<minidump::Thread> m_thread_list;
- const MinidumpExceptionStream *m_active_exception;
+ const minidump::ExceptionStream *m_active_exception;
lldb::CommandObjectSP m_command_sp;
bool m_is_wow64;
};
diff --git a/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp b/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp
index f2e456097dfc..72dead07dcb4 100644
--- a/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp
+++ b/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp
@@ -9,6 +9,7 @@
#include "RegisterContextMinidump_ARM.h"
#include "Utility/ARM_DWARF_Registers.h"
+#include "Utility/ARM_ehframe_Registers.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/LLDBAssert.h"
@@ -29,14 +30,14 @@ using namespace minidump;
#define DEF_R(i) \
{ \
"r" #i, nullptr, 4, OFFSET(r) + i * 4, eEncodingUint, eFormatHex, \
- {dwarf_r##i, dwarf_r##i, INV, INV, reg_r##i}, \
+ {ehframe_r##i, dwarf_r##i, INV, INV, reg_r##i}, \
nullptr, nullptr, nullptr, 0 \
}
#define DEF_R_ARG(i, n) \
{ \
"r" #i, "arg" #n, 4, OFFSET(r) + i * 4, eEncodingUint, eFormatHex, \
- {dwarf_r##i, dwarf_r##i, LLDB_REGNUM_GENERIC_ARG1 + i, INV, reg_r##i}, \
+ {ehframe_r##i, dwarf_r##i, LLDB_REGNUM_GENERIC_ARG1 + i, INV, reg_r##i}, \
nullptr, nullptr, nullptr, 0 \
}
@@ -173,7 +174,7 @@ static RegisterInfo g_reg_info_apple_fp = {
OFFSET(r) + 7 * 4,
eEncodingUint,
eFormatHex,
- {INV, dwarf_r7, LLDB_REGNUM_GENERIC_FP, INV, reg_r7},
+ {ehframe_r7, dwarf_r7, LLDB_REGNUM_GENERIC_FP, INV, reg_r7},
nullptr,
nullptr,
nullptr,
@@ -186,7 +187,7 @@ static RegisterInfo g_reg_info_fp = {
OFFSET(r) + 11 * 4,
eEncodingUint,
eFormatHex,
- {INV, dwarf_r11, LLDB_REGNUM_GENERIC_FP, INV, reg_r11},
+ {ehframe_r11, dwarf_r11, LLDB_REGNUM_GENERIC_FP, INV, reg_r11},
nullptr,
nullptr,
nullptr,
@@ -213,7 +214,7 @@ static RegisterInfo g_reg_infos[] = {
OFFSET(r) + 13 * 4,
eEncodingUint,
eFormatHex,
- {INV, dwarf_sp, LLDB_REGNUM_GENERIC_SP, INV, reg_sp},
+ {ehframe_sp, dwarf_sp, LLDB_REGNUM_GENERIC_SP, INV, reg_sp},
nullptr,
nullptr,
nullptr,
@@ -224,7 +225,7 @@ static RegisterInfo g_reg_infos[] = {
OFFSET(r) + 14 * 4,
eEncodingUint,
eFormatHex,
- {INV, dwarf_lr, LLDB_REGNUM_GENERIC_RA, INV, reg_lr},
+ {ehframe_lr, dwarf_lr, LLDB_REGNUM_GENERIC_RA, INV, reg_lr},
nullptr,
nullptr,
nullptr,
@@ -235,7 +236,7 @@ static RegisterInfo g_reg_infos[] = {
OFFSET(r) + 15 * 4,
eEncodingUint,
eFormatHex,
- {INV, dwarf_pc, LLDB_REGNUM_GENERIC_PC, INV, reg_pc},
+ {ehframe_pc, dwarf_pc, LLDB_REGNUM_GENERIC_PC, INV, reg_pc},
nullptr,
nullptr,
nullptr,
@@ -246,7 +247,7 @@ static RegisterInfo g_reg_infos[] = {
OFFSET(cpsr),
eEncodingUint,
eFormatHex,
- {INV, dwarf_cpsr, LLDB_REGNUM_GENERIC_FLAGS, INV, reg_cpsr},
+ {ehframe_cpsr, dwarf_cpsr, LLDB_REGNUM_GENERIC_FLAGS, INV, reg_cpsr},
nullptr,
nullptr,
nullptr,
@@ -476,12 +477,22 @@ RegisterContextMinidump_ARM::RegisterContextMinidump_ARM(
lldbassert(k_num_regs == k_num_reg_infos);
}
-size_t RegisterContextMinidump_ARM::GetRegisterCount() { return k_num_regs; }
+size_t RegisterContextMinidump_ARM::GetRegisterCountStatic() {
+ return k_num_regs;
+}
+
+// Used for unit testing so we can verify register info is filled in for
+// all register flavors (DWARF, EH Frame, generic, etc).
+size_t RegisterContextMinidump_ARM::GetRegisterCount() {
+ return GetRegisterCountStatic();
+}
+// Used for unit testing so we can verify register info is filled in.
const RegisterInfo *
-RegisterContextMinidump_ARM::GetRegisterInfoAtIndex(size_t reg) {
+RegisterContextMinidump_ARM::GetRegisterInfoAtIndexStatic(size_t reg,
+ bool apple) {
if (reg < k_num_reg_infos) {
- if (m_apple) {
+ if (apple) {
if (reg == reg_r7)
return &g_reg_info_apple_fp;
} else {
@@ -493,6 +504,11 @@ RegisterContextMinidump_ARM::GetRegisterInfoAtIndex(size_t reg) {
return nullptr;
}
+const RegisterInfo *
+RegisterContextMinidump_ARM::GetRegisterInfoAtIndex(size_t reg) {
+ return GetRegisterInfoAtIndexStatic(reg, m_apple);
+}
+
size_t RegisterContextMinidump_ARM::GetRegisterSetCount() {
return k_num_reg_sets;
}
diff --git a/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h b/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h
index eff8cdfef00a..7af3b98a6fe7 100644
--- a/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h
+++ b/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h
@@ -38,6 +38,12 @@ public:
// Do nothing... registers are always valid...
}
+ // Used for unit testing.
+ static size_t GetRegisterCountStatic();
+ // Used for unit testing.
+ static const lldb_private::RegisterInfo *
+ GetRegisterInfoAtIndexStatic(size_t reg, bool apple);
+
size_t GetRegisterCount() override;
const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;