diff options
Diffstat (limited to 'lldb/source/Plugins/Process')
8 files changed, 42 insertions, 46 deletions
diff --git a/lldb/source/Plugins/Process/Utility/GDBRemoteSignals.cpp b/lldb/source/Plugins/Process/Utility/GDBRemoteSignals.cpp index 15981a2..a8d18f7 100644 --- a/lldb/source/Plugins/Process/Utility/GDBRemoteSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/GDBRemoteSignals.cpp @@ -47,7 +47,7 @@ void GDBRemoteSignals::Reset() { AddSignal(25, "SIGXFSZ", false, true, true, "file size limit exceeded"); AddSignal(26, "SIGVTALRM", false, true, true, "virtual time alarm"); AddSignal(27, "SIGPROF", false, false, false, "profiling time alarm"); - AddSignal(28, "SIGWINCH", false, true, true, "window size changes"); + AddSignal(28, "SIGWINCH", false, false, false, "window size changes"); AddSignal(29, "SIGLOST", false, true, true, "resource lost"); AddSignal(30, "SIGUSR1", false, true, true, "user defined signal 1"); AddSignal(31, "SIGUSR2", false, true, true, "user defined signal 2"); diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 5346bab..dbbfc6a 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -160,7 +160,7 @@ void LinuxSignals::Reset() { ADD_LINUX_SIGNAL(25, "SIGXFSZ", false, true, true, "file size limit exceeded"); ADD_LINUX_SIGNAL(26, "SIGVTALRM", false, true, true, "virtual time alarm"); ADD_LINUX_SIGNAL(27, "SIGPROF", false, false, false, "profiling time alarm"); - ADD_LINUX_SIGNAL(28, "SIGWINCH", false, true, true, "window size changes"); + ADD_LINUX_SIGNAL(28, "SIGWINCH", false, false, false, "window size changes"); ADD_LINUX_SIGNAL(29, "SIGIO", false, true, true, "input/output ready/Pollable event", "SIGPOLL"); ADD_LINUX_SIGNAL(30, "SIGPWR", false, true, true, "power failure"); ADD_LINUX_SIGNAL(31, "SIGSYS", false, true, true, "invalid system call"); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp index e0f3971..c361b2a 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp @@ -9,6 +9,7 @@ #include "RegisterContextFreeBSD_x86_64.h" #include "RegisterContextFreeBSD_i386.h" #include "RegisterContextPOSIX_x86.h" +#include "llvm/Support/Threading.h" #include <vector> using namespace lldb_private; @@ -69,40 +70,34 @@ struct UserArea { #include "RegisterInfos_x86_64.h" #undef DECLARE_REGISTER_INFOS_X86_64_STRUCT -static std::vector<lldb_private::RegisterInfo> &GetSharedRegisterInfoVector() { - static std::vector<lldb_private::RegisterInfo> register_infos; - return register_infos; -} - -static const RegisterInfo * -GetRegisterInfo_i386(const lldb_private::ArchSpec &arch) { - static std::vector<lldb_private::RegisterInfo> g_register_infos( - GetSharedRegisterInfoVector()); - - // Allocate RegisterInfo only once - if (g_register_infos.empty()) { - // Copy the register information from base class - std::unique_ptr<RegisterContextFreeBSD_i386> reg_interface( - new RegisterContextFreeBSD_i386(arch)); - const RegisterInfo *base_info = reg_interface->GetRegisterInfo(); - g_register_infos.insert(g_register_infos.end(), &base_info[0], - &base_info[k_num_registers_i386]); +static std::vector<lldb_private::RegisterInfo> & +GetSharedRegisterInfoVector_i386(const lldb_private::ArchSpec &arch) { + static std::vector<lldb_private::RegisterInfo> g_register_infos; + static llvm::once_flag g_initialized; + llvm::call_once(g_initialized, [&]() { + if (g_register_infos.empty()) { + // Copy the register information from base class + std::unique_ptr<RegisterContextFreeBSD_i386> reg_interface( + new RegisterContextFreeBSD_i386(arch)); + const RegisterInfo *base_info = reg_interface->GetRegisterInfo(); + g_register_infos.insert(g_register_infos.end(), &base_info[0], + &base_info[k_num_registers_i386]); // Include RegisterInfos_x86_64 to update the g_register_infos structure // with x86_64 offsets. #define UPDATE_REGISTER_INFOS_I386_STRUCT_WITH_X86_64_OFFSETS #include "RegisterInfos_x86_64.h" #undef UPDATE_REGISTER_INFOS_I386_STRUCT_WITH_X86_64_OFFSETS - } - - return &g_register_infos[0]; + } + }); + return g_register_infos; } static const RegisterInfo * PrivateGetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) { switch (target_arch.GetMachine()) { case llvm::Triple::x86: - return GetRegisterInfo_i386(target_arch); + return &GetSharedRegisterInfoVector_i386(target_arch)[0]; case llvm::Triple::x86_64: return g_register_infos_x86_64; default: @@ -116,9 +111,10 @@ PrivateGetRegisterCount(const lldb_private::ArchSpec &target_arch) { switch (target_arch.GetMachine()) { case llvm::Triple::x86: // This vector should have already been filled. - assert(!GetSharedRegisterInfoVector().empty() && + assert(!GetSharedRegisterInfoVector_i386(target_arch).empty() && "i386 register info vector not filled."); - return static_cast<uint32_t>(GetSharedRegisterInfoVector().size()); + return static_cast<uint32_t>( + GetSharedRegisterInfoVector_i386(target_arch).size()); case llvm::Triple::x86_64: return static_cast<uint32_t>(sizeof(g_register_infos_x86_64) / sizeof(g_register_infos_x86_64[0])); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 7d2bd45..11f164c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -211,6 +211,12 @@ bool GDBRemoteCommunicationClient::GetReverseStepSupported() { return m_supports_reverse_step == eLazyBoolYes; } +bool GDBRemoteCommunicationClient::GetMultiMemReadSupported() { + if (m_supports_multi_mem_read == eLazyBoolCalculate) + GetRemoteQSupported(); + return m_supports_multi_mem_read == eLazyBoolYes; +} + bool GDBRemoteCommunicationClient::QueryNoAckModeSupported() { if (m_supports_not_sending_acks == eLazyBoolCalculate) { m_send_acks = true; @@ -339,6 +345,7 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { m_supported_async_json_packets_is_valid = false; m_supported_async_json_packets_sp.reset(); m_supports_jModulesInfo = true; + m_supports_multi_mem_read = eLazyBoolCalculate; } // These flags should be reset when we first connect to a GDB server and when @@ -365,6 +372,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_x_packet_state.reset(); m_supports_reverse_continue = eLazyBoolNo; m_supports_reverse_step = eLazyBoolNo; + m_supports_multi_mem_read = eLazyBoolNo; m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if // not, we assume no limit @@ -424,6 +432,8 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_reverse_continue = eLazyBoolYes; else if (x == "ReverseStep+") m_supports_reverse_step = eLazyBoolYes; + else if (x == "MultiMemRead+") + m_supports_multi_mem_read = eLazyBoolYes; // Look for a list of compressions in the features list e.g. // qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib- // deflate,lzma diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index a765e95..ad590a2 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -342,6 +342,8 @@ public: bool GetReverseStepSupported(); + bool GetMultiMemReadSupported(); + LazyBool SupportsAllocDeallocMemory() // const { // Uncomment this to have lldb pretend the debug server doesn't respond to @@ -574,6 +576,7 @@ protected: std::optional<xPacketState> m_x_packet_state; LazyBool m_supports_reverse_continue = eLazyBoolCalculate; LazyBool m_supports_reverse_step = eLazyBoolCalculate; + LazyBool m_supports_multi_mem_read = eLazyBoolCalculate; bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1, m_supports_qUserName : 1, m_supports_qGroupName : 1, diff --git a/lldb/source/Plugins/Process/wasm/RegisterContextWasm.cpp b/lldb/source/Plugins/Process/wasm/RegisterContextWasm.cpp index b468171..2e02076 100644 --- a/lldb/source/Plugins/Process/wasm/RegisterContextWasm.cpp +++ b/lldb/source/Plugins/Process/wasm/RegisterContextWasm.cpp @@ -22,7 +22,7 @@ using namespace lldb_private::process_gdb_remote; using namespace lldb_private::wasm; RegisterContextWasm::RegisterContextWasm( - wasm::ThreadWasm &thread, uint32_t concrete_frame_idx, + ThreadGDBRemote &thread, uint32_t concrete_frame_idx, GDBRemoteDynamicRegisterInfoSP reg_info_sp) : GDBRemoteRegisterContext(thread, concrete_frame_idx, reg_info_sp, false, false) {} diff --git a/lldb/source/Plugins/Process/wasm/RegisterContextWasm.h b/lldb/source/Plugins/Process/wasm/RegisterContextWasm.h index 7e63eb8..6ca31e5 100644 --- a/lldb/source/Plugins/Process/wasm/RegisterContextWasm.h +++ b/lldb/source/Plugins/Process/wasm/RegisterContextWasm.h @@ -10,6 +10,7 @@ #define LLDB_SOURCE_PLUGINS_PROCESS_WASM_REGISTERCONTEXTWASM_H #include "Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h" +#include "Plugins/Process/gdb-remote/ThreadGDBRemote.h" #include "ThreadWasm.h" #include "Utility/WasmVirtualRegisters.h" #include "lldb/lldb-private-types.h" @@ -34,7 +35,7 @@ class RegisterContextWasm : public process_gdb_remote::GDBRemoteRegisterContext { public: RegisterContextWasm( - wasm::ThreadWasm &thread, uint32_t concrete_frame_idx, + process_gdb_remote::ThreadGDBRemote &thread, uint32_t concrete_frame_idx, process_gdb_remote::GDBRemoteDynamicRegisterInfoSP reg_info_sp); ~RegisterContextWasm() override; diff --git a/lldb/source/Plugins/Process/wasm/UnwindWasm.cpp b/lldb/source/Plugins/Process/wasm/UnwindWasm.cpp index 99845dd..319c5e2 100644 --- a/lldb/source/Plugins/Process/wasm/UnwindWasm.cpp +++ b/lldb/source/Plugins/Process/wasm/UnwindWasm.cpp @@ -9,6 +9,7 @@ #include "UnwindWasm.h" #include "Plugins/Process/gdb-remote/ThreadGDBRemote.h" #include "ProcessWasm.h" +#include "RegisterContextWasm.h" #include "ThreadWasm.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" @@ -18,21 +19,6 @@ using namespace lldb_private; using namespace process_gdb_remote; using namespace wasm; -class WasmGDBRemoteRegisterContext : public GDBRemoteRegisterContext { -public: - WasmGDBRemoteRegisterContext(ThreadGDBRemote &thread, - uint32_t concrete_frame_idx, - GDBRemoteDynamicRegisterInfoSP ®_info_sp, - uint64_t pc) - : GDBRemoteRegisterContext(thread, concrete_frame_idx, reg_info_sp, false, - false) { - // Wasm does not have a fixed set of registers but relies on a mechanism - // named local and global variables to store information such as the stack - // pointer. The only actual register is the PC. - PrivateSetRegisterValue(0, pc); - } -}; - lldb::RegisterContextSP UnwindWasm::DoCreateRegisterContextForFrame(lldb_private::StackFrame *frame) { if (m_frames.size() <= frame->GetFrameIndex()) @@ -43,9 +29,9 @@ UnwindWasm::DoCreateRegisterContextForFrame(lldb_private::StackFrame *frame) { ProcessWasm *wasm_process = static_cast<ProcessWasm *>(thread->GetProcess().get()); - return std::make_shared<WasmGDBRemoteRegisterContext>( - *gdb_thread, frame->GetConcreteFrameIndex(), - wasm_process->GetRegisterInfo(), m_frames[frame->GetFrameIndex()]); + return std::make_shared<RegisterContextWasm>(*gdb_thread, + frame->GetConcreteFrameIndex(), + wasm_process->GetRegisterInfo()); } uint32_t UnwindWasm::DoGetFrameCount() { |