summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp12
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp15
-rw-r--r--lldb/source/Plugins/Language/ObjC/Cocoa.cpp2
-rw-r--r--lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp2
-rw-r--r--lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp15
-rw-r--r--lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h1
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp2
-rw-r--r--lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp9
-rw-r--r--lldb/source/Plugins/Process/minidump/MinidumpParser.cpp6
-rw-r--r--lldb/source/Plugins/Process/minidump/MinidumpParser.h1
-rw-r--r--lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp16
-rw-r--r--lldb/source/Plugins/Process/minidump/ProcessMinidump.h7
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h1
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp16
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h2
15 files changed, 67 insertions, 40 deletions
diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp b/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp
index cd91f4a6ff1b..b1151febb7cc 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp
@@ -90,17 +90,9 @@ void InstrumentationRuntimeASanLibsanitizers::Activate() {
if (!process_sp)
return;
- lldb::ModuleSP module_sp = GetRuntimeModuleSP();
-
Breakpoint *breakpoint = ReportRetriever::SetupBreakpoint(
- module_sp, process_sp, ConstString("sanitizers_address_on_report"));
-
- if (!breakpoint) {
- breakpoint = ReportRetriever::SetupBreakpoint(
- module_sp, process_sp,
- ConstString("_Z22raise_sanitizers_error23sanitizer_error_context"));
- }
-
+ GetRuntimeModuleSP(), process_sp,
+ ConstString("sanitizers_address_on_report"));
if (!breakpoint)
return;
diff --git a/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp b/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
index 04ce339d8f66..74e0fa7d49f8 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
@@ -219,7 +219,6 @@ bool ReportRetriever::NotifyBreakpointHit(ProcessSP process_sp,
return true; // Return true to stop the target
}
-// FIXME: Setup the breakpoint using a less fragile SPI. rdar://124399066
Breakpoint *ReportRetriever::SetupBreakpoint(ModuleSP module_sp,
ProcessSP process_sp,
ConstString symbol_name) {
@@ -235,19 +234,13 @@ Breakpoint *ReportRetriever::SetupBreakpoint(ModuleSP module_sp,
if (!symbol->ValueIsAddress() || !symbol->GetAddressRef().IsValid())
return nullptr;
- Target &target = process_sp->GetTarget();
- addr_t symbol_address = symbol->GetAddressRef().GetOpcodeLoadAddress(&target);
-
- if (symbol_address == LLDB_INVALID_ADDRESS)
- return nullptr;
-
+ const Address &address = symbol->GetAddressRef();
const bool internal = true;
const bool hardware = false;
- Breakpoint *breakpoint =
- process_sp->GetTarget()
- .CreateBreakpoint(symbol_address, internal, hardware)
- .get();
+ Breakpoint *breakpoint = process_sp->GetTarget()
+ .CreateBreakpoint(address, internal, hardware)
+ .get();
return breakpoint;
}
diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
index b35e27ad8123..1d79edbede5d 100644
--- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -1226,7 +1226,7 @@ bool lldb_private::formatters::ObjCSELSummaryProvider(
time_t lldb_private::formatters::GetOSXEpoch() {
static time_t epoch = 0;
if (!epoch) {
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(_AIX)
tzset();
tm tm_epoch;
tm_epoch.tm_sec = 0;
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 3835f2b08a05..b202898ff438 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -8,7 +8,7 @@
#include "ObjectContainerBSDArchive.h"
-#if defined(_WIN32) || defined(__ANDROID__)
+#if defined(_WIN32) || defined(__ANDROID__) || defined(_AIX)
// Defines from ar, missing on Windows
#define SARMAG 8
#define ARFMAG "`\n"
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index bcac5edbc1a7..c5013ea5e3be 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -58,8 +58,8 @@ Status MinidumpFileBuilder::AddHeaderAndCalculateDirectories() {
// First set the offset on the file, and on the bytes saved
m_saved_data_size = HEADER_SIZE;
// We know we will have at least Misc, SystemInfo, Modules, and ThreadList
- // (corresponding memory list for stacks) And an additional memory list for
- // non-stacks.
+ // (corresponding memory list for stacks), an additional memory list for
+ // non-stacks, and a stream to mark this minidump was generated by LLDB.
lldb_private::Target &target = m_process_sp->GetTarget();
m_expected_directories = 6;
// Check if OS is linux and reserve directory space for all linux specific
@@ -90,7 +90,10 @@ Status MinidumpFileBuilder::AddHeaderAndCalculateDirectories() {
"sections. Written / Expected (%" PRIx64 " / %" PRIx64 ")",
new_offset, m_saved_data_size);
- return error;
+ if (error.Fail())
+ return error;
+
+ return AddLLDBGeneratedStream();
}
Status MinidumpFileBuilder::AddDirectory(StreamType type,
@@ -126,6 +129,12 @@ Status MinidumpFileBuilder::AddDirectory(StreamType type,
return error;
}
+Status MinidumpFileBuilder::AddLLDBGeneratedStream() {
+ Status error;
+ StreamType type = StreamType::LLDBGenerated;
+ return AddDirectory(type, 0);
+}
+
Status MinidumpFileBuilder::AddSystemInfo() {
Status error;
const llvm::Triple &target_triple =
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
index 58b284608bd5..48293ee1bf5e 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
@@ -120,6 +120,7 @@ public:
void DeleteFile() noexcept;
private:
+ lldb_private::Status AddLLDBGeneratedStream();
// Add data to the end of the buffer, if the buffer exceeds the flush level,
// trigger a flush.
lldb_private::Status AddData(const void *data, uint64_t size);
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index d18b718d4a56..0cf64807ec0d 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -64,7 +64,7 @@ static Status DeleteForwardPortWithAdb(uint16_t local_port,
static Status FindUnusedPort(uint16_t &port) {
Status error;
- std::unique_ptr<TCPSocket> tcp_socket(new TCPSocket(true, false));
+ std::unique_ptr<TCPSocket> tcp_socket(new TCPSocket(true));
if (error.Fail())
return error;
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index b3916cc913f7..5f85f99ce7bd 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -1031,6 +1031,8 @@ UUID ProcessElfCore::FindBuidIdInCoreMemory(lldb::addr_t address) {
std::vector<uint8_t> ph_bytes;
ph_bytes.resize(elf_header.e_phentsize);
+ lldb::addr_t base_addr = 0;
+ bool found_first_load_segment = false;
for (unsigned int i = 0; i < elf_header.e_phnum; ++i) {
byte_read = ReadMemory(ph_addr + i * elf_header.e_phentsize,
ph_bytes.data(), elf_header.e_phentsize, error);
@@ -1041,6 +1043,11 @@ UUID ProcessElfCore::FindBuidIdInCoreMemory(lldb::addr_t address) {
offset = 0;
elf::ELFProgramHeader program_header;
program_header.Parse(program_header_data, &offset);
+ if (program_header.p_type == llvm::ELF::PT_LOAD &&
+ !found_first_load_segment) {
+ base_addr = program_header.p_vaddr;
+ found_first_load_segment = true;
+ }
if (program_header.p_type != llvm::ELF::PT_NOTE)
continue;
@@ -1049,7 +1056,7 @@ UUID ProcessElfCore::FindBuidIdInCoreMemory(lldb::addr_t address) {
// We need to slide the address of the p_vaddr as these values don't get
// relocated in memory.
- const lldb::addr_t vaddr = program_header.p_vaddr + address;
+ const lldb::addr_t vaddr = program_header.p_vaddr + address - base_addr;
byte_read =
ReadMemory(vaddr, note_bytes.data(), program_header.p_memsz, error);
if (byte_read != program_header.p_memsz)
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
index afc095ddbb2f..94c0a5f11e43 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -49,6 +49,11 @@ llvm::ArrayRef<uint8_t> MinidumpParser::GetStream(StreamType stream_type) {
return m_file->getRawStream(stream_type).value_or(llvm::ArrayRef<uint8_t>());
}
+std::optional<llvm::ArrayRef<uint8_t>>
+MinidumpParser::GetRawStream(StreamType stream_type) {
+ return m_file->getRawStream(stream_type);
+}
+
UUID MinidumpParser::GetModuleUUID(const minidump::Module *module) {
auto cv_record =
GetData().slice(module->CvRecord.RVA, module->CvRecord.DataSize);
@@ -651,6 +656,7 @@ MinidumpParser::GetStreamTypeAsString(StreamType stream_type) {
ENUM_TO_CSTR(FacebookAbortReason);
ENUM_TO_CSTR(FacebookThreadName);
ENUM_TO_CSTR(FacebookLogcat);
+ ENUM_TO_CSTR(LLDBGenerated);
}
return "unknown stream type";
}
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.h b/lldb/source/Plugins/Process/minidump/MinidumpParser.h
index f0b6e6027c52..2c5e6f19ff9a 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.h
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.h
@@ -59,6 +59,7 @@ public:
llvm::ArrayRef<uint8_t> GetData();
llvm::ArrayRef<uint8_t> GetStream(StreamType stream_type);
+ std::optional<llvm::ArrayRef<uint8_t>> GetRawStream(StreamType stream_type);
UUID GetModuleUUID(const minidump::Module *module);
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
index 5b0df72130c1..05b3bb9f54f9 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -354,6 +354,22 @@ DataExtractor ProcessMinidump::GetAuxvData() {
GetAddressByteSize(), GetAddressByteSize());
}
+bool ProcessMinidump::IsLLDBMinidump() {
+ std::optional<llvm::ArrayRef<uint8_t>> lldb_generated_section =
+ m_minidump_parser->GetRawStream(StreamType::LLDBGenerated);
+ return lldb_generated_section.has_value();
+}
+
+DynamicLoader *ProcessMinidump::GetDynamicLoader() {
+ // This is a workaround for the dynamic loader not playing nice in issue
+ // #119598. The specific reason we use the dynamic loader is to get the TLS
+ // info sections, which we can assume are not being written to the minidump
+ // unless it's an LLDB generate minidump.
+ if (IsLLDBMinidump())
+ return PostMortemProcess::GetDynamicLoader();
+ return nullptr;
+}
+
void ProcessMinidump::BuildMemoryRegions() {
if (m_memory_regions)
return;
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
index 3d235670a33a..ad8d0ed7a483 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
@@ -53,6 +53,8 @@ public:
Status DoLoadCore() override;
+ DynamicLoader *GetDynamicLoader() override;
+
// Returns AUXV structure found in the core file
lldb_private::DataExtractor GetAuxvData() override;
@@ -74,8 +76,8 @@ public:
ArchSpec GetArchitecture();
- Status GetMemoryRegions(
- lldb_private::MemoryRegionInfos &region_list) override;
+ Status
+ GetMemoryRegions(lldb_private::MemoryRegionInfos &region_list) override;
bool GetProcessInfo(ProcessInstanceInfo &info) override;
@@ -113,6 +115,7 @@ private:
std::optional<MemoryRegionInfos> m_memory_regions;
void BuildMemoryRegions();
+ bool IsLLDBMinidump();
};
} // namespace minidump
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
index 518a478af5f6..0f0e4a563e8b 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
@@ -84,6 +84,7 @@ public:
static PythonObject ToSWIGWrapper(lldb::ValueObjectSP value_sp);
static PythonObject ToSWIGWrapper(lldb::TargetSP target_sp);
static PythonObject ToSWIGWrapper(lldb::ProcessSP process_sp);
+ static PythonObject ToSWIGWrapper(lldb::ModuleSP module_sp);
static PythonObject ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp);
static PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp);
static PythonObject ToSWIGWrapper(Status &&status);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 28e7cceb3971..e2f76e88dd6f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1222,11 +1222,9 @@ DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
}
if (die.HasChildren()) {
- bool skip_artificial = true;
- ParseChildParameters(containing_decl_ctx, die, skip_artificial, is_static,
- is_variadic, has_template_params,
- function_param_types, function_param_decls,
- type_quals);
+ ParseChildParameters(containing_decl_ctx, die, is_static, is_variadic,
+ has_template_params, function_param_types,
+ function_param_decls, type_quals);
}
bool ignore_containing_context = false;
@@ -2325,7 +2323,7 @@ DWARFASTParserClang::ConstructDemangledNameFromDWARF(const DWARFDIE &die) {
clang::DeclContext *containing_decl_ctx =
GetClangDeclContextContainingDIE(die, nullptr);
- ParseChildParameters(containing_decl_ctx, die, true, is_static, is_variadic,
+ ParseChildParameters(containing_decl_ctx, die, is_static, is_variadic,
has_template_params, param_types, param_decls,
type_quals);
sstr << "(";
@@ -3069,8 +3067,8 @@ bool DWARFASTParserClang::ParseChildMembers(
size_t DWARFASTParserClang::ParseChildParameters(
clang::DeclContext *containing_decl_ctx, const DWARFDIE &parent_die,
- bool skip_artificial, bool &is_static, bool &is_variadic,
- bool &has_template_params, std::vector<CompilerType> &function_param_types,
+ bool &is_static, bool &is_variadic, bool &has_template_params,
+ std::vector<CompilerType> &function_param_types,
std::vector<clang::ParmVarDecl *> &function_param_decls,
unsigned &type_quals) {
if (!parent_die)
@@ -3125,7 +3123,7 @@ size_t DWARFASTParserClang::ParseChildParameters(
}
bool skip = false;
- if (skip_artificial && is_artificial) {
+ if (is_artificial) {
// In order to determine if a C++ member function is "const" we
// have to look at the const-ness of "this"...
if (arg_idx == 0 &&
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 55f8e38d7486..5b1c204bbe81 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -189,7 +189,7 @@ protected:
size_t
ParseChildParameters(clang::DeclContext *containing_decl_ctx,
const lldb_private::plugin::dwarf::DWARFDIE &parent_die,
- bool skip_artificial, bool &is_static, bool &is_variadic,
+ bool &is_static, bool &is_variadic,
bool &has_template_params,
std::vector<lldb_private::CompilerType> &function_args,
std::vector<clang::ParmVarDecl *> &function_param_decls,