[Lldb-commits] [lldb] 4b2e38d - [lldb][NFC] Cleanup EditlineHistory
Author: Raphael Isemann Date: 2021-09-13T09:30:31+02:00 New Revision: 4b2e38d940673e6ec01c4653eacf620e7e53ae6d URL: https://github.com/llvm/llvm-project/commit/4b2e38d940673e6ec01c4653eacf620e7e53ae6d DIFF: https://github.com/llvm/llvm-project/commit/4b2e38d940673e6ec01c4653eacf620e7e53ae6d.diff LOG: [lldb][NFC] Cleanup EditlineHistory Added: Modified: lldb/source/Host/common/Editline.cpp Removed: diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 5bfb612c63bdb..b55061301f4d0 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -205,7 +205,7 @@ class EditlineHistory { // Use static GetHistory() function to get a EditlineHistorySP to one of // these objects EditlineHistory(const std::string &prefix, uint32_t size, bool unique_entries) - : m_history(nullptr), m_event(), m_prefix(prefix), m_path() { + : m_prefix(prefix) { m_history = history_winit(); history_w(m_history, &m_event, H_SETSIZE, size); if (unique_entries) @@ -298,11 +298,15 @@ class EditlineHistory { } protected: - HistoryW *m_history; // The history object - HistEventW m_event; // The history event needed to contain all history events - std::string m_prefix; // The prefix name (usually the editline program name) -// to use when loading/saving history - std::string m_path; // Path to the history file + /// The history object. + HistoryW *m_history = nullptr; + /// The history event needed to contain all history events. + HistEventW m_event; + /// The prefix name (usually the editline program name) to use when + /// loading/saving history. + std::string m_prefix; + /// Path to the history file. + std::string m_path; }; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D108554: [lldb] Support querying registers via generic names without alt_names
labath accepted this revision. labath added inline comments. This revision is now accepted and ready to land. Comment at: lldb/source/API/SBFrame.cpp:636-638 +if (const RegisterInfo *reg_info = +reg_ctx->GetRegisterInfoByName(name)) { + value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info); I like this. Comment at: lldb/source/Target/RegisterContext.cpp:57-59 + // Try matching generic register names first. This is consistent with + // how aliases work, esp. wrt "sp" generic alias taking precedence over + // "sp" pseudo-register on x86_64. This isn't just "consistent with" generic aliases taking precedence. This is actually the implementation of that precedence (at least, after we remove the aliases in the other patch. This should just state as a fact that we want the aliases to take priority. The historic trivia can go into the commit message. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108554/new/ https://reviews.llvm.org/D108554 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D109600: [lldb] Remove PluginInterface::GetPluginVersion
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGb03126768a84: [lldb] Remove PluginInterface::GetPluginVersion (authored by labath). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109600/new/ https://reviews.llvm.org/D109600 Files: lldb/include/lldb/Core/PluginInterface.h lldb/include/lldb/Symbol/SymbolVendor.h lldb/include/lldb/Target/ProcessTrace.h lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp lldb/source/Plugins/ABI/ARC/ABISysV_arc.h lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp lldb/source/Plugins/ABI/ARM/ABISysV_arm.h lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips.h lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h lldb/source/Plugins/ABI/X86/ABISysV_i386.h lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp lldb/source/Plugins/Language/ObjC/ObjCLanguage.h lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h lldb/source/Plugins/LanguageR
[Lldb-commits] [lldb] 8567f4d - [lldb] Support querying registers via generic names without alt_names
Author: Michał Górny Date: 2021-09-13T13:05:06+02:00 New Revision: 8567f4d4b9a79f041406026011fb8151b24b8c99 URL: https://github.com/llvm/llvm-project/commit/8567f4d4b9a79f041406026011fb8151b24b8c99 DIFF: https://github.com/llvm/llvm-project/commit/8567f4d4b9a79f041406026011fb8151b24b8c99.diff LOG: [lldb] Support querying registers via generic names without alt_names Update GetRegisterInfoByName() methods to support getting registers by a generic name independently of alt_name entries in the register context. This makes it possible to use generic names when interacting with gdbserver (that does not supply alt_names). It also makes it possible to remove some of the duplicated information from register context declarations and/or use alt_names for another purpose. Differential Revision: https://reviews.llvm.org/D108554 Added: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py Modified: lldb/include/lldb/Core/ValueObjectRegister.h lldb/source/API/SBFrame.cpp lldb/source/Core/ValueObjectRegister.cpp lldb/source/Host/common/NativeRegisterContext.cpp lldb/source/Target/RegisterContext.cpp Removed: diff --git a/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h index e210b36d2a45b..20a7411b6fdee 100644 --- a/lldb/include/lldb/Core/ValueObjectRegister.h +++ b/lldb/include/lldb/Core/ValueObjectRegister.h @@ -84,7 +84,7 @@ class ValueObjectRegister : public ValueObject { static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, -uint32_t reg_num); +const RegisterInfo *reg_info); llvm::Optional GetByteSize() override; @@ -119,15 +119,16 @@ class ValueObjectRegister : public ValueObject { CompilerType m_compiler_type; private: - void ConstructObject(uint32_t reg_num); + void ConstructObject(const RegisterInfo *reg_info); friend class ValueObjectRegisterSet; ValueObjectRegister(ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp, - uint32_t reg_num); + const RegisterInfo *reg_info); ValueObjectRegister(ExecutionContextScope *exe_scope, ValueObjectManager &manager, - lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); + lldb::RegisterContextSP ®_ctx_sp, + const RegisterInfo *reg_info); // For ValueObject only ValueObjectRegister(const ValueObjectRegister &) = delete; diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 8f9e426e066e7..7107768ba884b 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -633,18 +633,10 @@ SBValue SBFrame::FindValue(const char *name, ValueType value_type, { RegisterContextSP reg_ctx(frame->GetRegisterContext()); if (reg_ctx) { -const uint32_t num_regs = reg_ctx->GetRegisterCount(); -for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) { - const RegisterInfo *reg_info = - reg_ctx->GetRegisterInfoAtIndex(reg_idx); - if (reg_info && - ((reg_info->name && strcasecmp(reg_info->name, name) == 0) || - (reg_info->alt_name && -strcasecmp(reg_info->alt_name, name) == 0))) { -value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx); -sb_value.SetSP(value_sp); -break; - } +if (const RegisterInfo *reg_info = +reg_ctx->GetRegisterInfoByName(name)) { + value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info); + sb_value.SetSP(value_sp); } } } break; @@ -953,18 +945,10 @@ SBValue SBFrame::FindRegister(const char *name) { if (frame) { RegisterContextSP reg_ctx(frame->GetRegisterContext()); if (reg_ctx) { - const uint32_t num_regs = reg_ctx->GetRegisterCount(); - for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) { -const RegisterInfo *reg_info = -reg_ctx->GetRegisterInfoAtIndex(reg_idx); -if (reg_info && -((reg_info->name && strcasecmp(reg_info->name, name) == 0) || - (reg_info->alt_name && - strcasecmp(reg_info->alt_name, name) == 0))) { - value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx); - result.SetSP(value_sp); - break; -} + if (const RegisterInfo *reg_info = + reg_ctx->GetRegisterInfoByName(name)) { +value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info); +result.Se
[Lldb-commits] [lldb] e3d878b - [lldb] Remove redundant register alt_names
Author: Michał Górny Date: 2021-09-13T13:05:06+02:00 New Revision: e3d878bdd82e10658e7b31dc6adec4a582ba1891 URL: https://github.com/llvm/llvm-project/commit/e3d878bdd82e10658e7b31dc6adec4a582ba1891 DIFF: https://github.com/llvm/llvm-project/commit/e3d878bdd82e10658e7b31dc6adec4a582ba1891.diff LOG: [lldb] Remove redundant register alt_names Remove redundant register alt_names that correspond to their respective generic names. D108554 makes it possible to query registers through their generic names directly, therefore making repeating them via alt_name unnecessary. While at it, also remove alt_names that are equal to register names on PPC. This patch does not alter register definitions where the generic names are listed as primary names, and other names are provided as alt_name (e.g. ARM). Differential Revision: https://reviews.llvm.org/D109626 Added: Modified: lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp lldb/source/Plugins/Process/Utility/RegisterInfos_powerpc.h lldb/source/Plugins/Process/Utility/RegisterInfos_ppc64.h lldb/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h lldb/source/Plugins/Process/Utility/RegisterInfos_s390x.h lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Removed: diff --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp index 5a8963df536b2..f0b953ad0e8de 100644 --- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp @@ -42,7 +42,7 @@ static const RegisterInfo g_register_infos[] = { // === === === // === == {"r0", - "arg1", + nullptr, 4, 0, eEncodingUint, @@ -54,7 +54,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r1", - "arg2", + nullptr, 4, 0, eEncodingUint, @@ -66,7 +66,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r2", - "arg3", + nullptr, 4, 0, eEncodingUint, @@ -78,7 +78,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r3", - "arg4", + nullptr, 4, 0, eEncodingUint, diff --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp index 1db3c516030c1..90b51d93bf728 100644 --- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp @@ -45,7 +45,7 @@ static const RegisterInfo g_register_infos[] = { // === == == // === {"r0", - "arg1", + nullptr, 4, 0, eEncodingUint, @@ -57,7 +57,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r1", - "arg2", + nullptr, 4, 0, eEncodingUint, @@ -69,7 +69,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r2", - "arg3", + nullptr, 4, 0, eEncodingUint, @@ -81,7 +81,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r3", - "arg4", + nullptr, 4, 0, eEncodingUint, diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp index 5ec872c6d0762..65bb528798624 100644 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp @@ -131,7 +131,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r4", - "arg1", + nullptr, 4, 0, eEncodingUint, @@ -143,7 +143,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r5", - "arg2", + nullptr, 4, 0, eEncodingUint, @@ -155,7 +155,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r6", - "arg3", + nullptr, 4, 0, eEncodingUint, @@ -167,7 +167,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r7", - "arg4", + nullptr, 4, 0, eEncodingUint, @@ -431,7 +431,7 @@ static const RegisterInfo g_register_infos[] = { nullptr, 0}, {"r29", - "sp", + nullptr, 4, 0, eEncodingUint, @@ -443,7 +443,7 @@ static const RegisterInfo g_register_in
[Lldb-commits] [PATCH] D108554: [lldb] Support querying registers via generic names without alt_names
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG8567f4d4b9a7: [lldb] Support querying registers via generic names without alt_names (authored by mgorny). Herald added a project: LLDB. Changed prior to commit: https://reviews.llvm.org/D108554?vs=371941&id=372210#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108554/new/ https://reviews.llvm.org/D108554 Files: lldb/include/lldb/Core/ValueObjectRegister.h lldb/source/API/SBFrame.cpp lldb/source/Core/ValueObjectRegister.cpp lldb/source/Host/common/NativeRegisterContext.cpp lldb/source/Target/RegisterContext.cpp lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py === --- /dev/null +++ lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py @@ -0,0 +1,152 @@ +from __future__ import print_function +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +from gdbclientutils import * + + +class TestGDBServerTargetXML(GDBRemoteTestBase): + +@skipIfXmlSupportMissing +@skipIfRemote +@skipIfLLVMTargetMissing("X86") +def test_x86_64_regs(self): +"""Test grabbing various x86_64 registers from gdbserver.""" +reg_data = [ +"0102030405060708", # rcx +"1112131415161718", # rdx +"2122232425262728", # rsi +"3132333435363738", # rdi +"4142434445464748", # rbp +"5152535455565758", # rsp +"6162636465666768", # r8 +"7172737475767778", # r9 +"8182838485868788", # rip +"91929394", # eflags +"0102030405060708090a", # st0 +"1112131415161718191a", # st1 +] + 6 * [ +"2122232425262728292a" # st2..st7 +] + [ +"8182838485868788898a8b8c8d8e8f90", # xmm0 +"9192939495969798999a9b9c9d9e9fa0", # xmm1 +] + 14 * [ +"a1a2a3a4a5a6a7a8a9aaabacadaeafb0", # xmm2..xmm15 +] + [ +"", # mxcsr +] + [ +"b1b2b3b4b5b6b7b8b9babbbcbdbebfc0", # ymm0h +"c1c2c3c4c5c6c7c8c9cacbcccdcecfd0", # ymm1h +] + 14 * [ +"d1d2d3d4d5d6d7d8d9dadbdcdddedfe0", # ymm2h..ymm15h +] + +class MyResponder(MockGDBServerResponder): +def qXferRead(self, obj, annex, offset, length): +if annex == "target.xml": +return """ + + + i386:x86-64 + GNU/Linux + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""", False +else: +return None, False + +def readRegister(self, regnum): +return "" + +def readRegisters(self): +return "".join(reg_data) + +def writeRegisters(self, reg_hex): +return "OK" + +def haltReason(self): +return "T02thread:1ff0d;threads:1ff0d;thread-pcs:000100
[Lldb-commits] [PATCH] D109626: [lldb] Remove redundant register alt_names
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGe3d878bdd82e: [lldb] Remove redundant register alt_names (authored by mgorny). Herald added a project: LLDB. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109626/new/ https://reviews.llvm.org/D109626 Files: lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp lldb/source/Plugins/Process/Utility/RegisterInfos_powerpc.h lldb/source/Plugins/Process/Utility/RegisterInfos_ppc64.h lldb/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h lldb/source/Plugins/Process/Utility/RegisterInfos_s390x.h lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp === --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -851,14 +851,14 @@ static RegisterInfo g_register_infos[] = { // NAME ALT SZ OFF ENCODING FORMAT EH_FRAME DWARFGENERIC PROCESS PLUGIN LLDBVALUE REGSINVALIDATE REGS SIZE EXPR SIZE LEN // == == === === = == === === == = ===== = -{ "r0", "arg1", 4, 0, eEncodingUint,eFormatHex, { ehframe_r0, dwarf_r0,LLDB_REGNUM_GENERIC_ARG1,0, 0 }, nullptr, nullptr, nullptr, 0 }, -{ "r1", "arg2", 4, 0, eEncodingUint,eFormatHex, { ehframe_r1, dwarf_r1,LLDB_REGNUM_GENERIC_ARG2,1, 1 }, nullptr, nullptr, nullptr, 0 }, -{ "r2", "arg3", 4, 0, eEncodingUint,eFormatHex, { ehframe_r2, dwarf_r2,LLDB_REGNUM_GENERIC_ARG3,2, 2 }, nullptr, nullptr, nullptr, 0 }, -{ "r3", "arg4", 4, 0, eEncodingUint,eFormatHex, { ehframe_r3, dwarf_r3,LLDB_REGNUM_GENERIC_ARG4,3, 3 }, nullptr, nullptr, nullptr, 0 }, +{ "r0", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r0, dwarf_r0,LLDB_REGNUM_GENERIC_ARG1,0, 0 }, nullptr, nullptr, nullptr, 0 }, +{ "r1", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r1, dwarf_r1,LLDB_REGNUM_GENERIC_ARG2,1, 1 }, nullptr, nullptr, nullptr, 0 }, +{ "r2", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r2, dwarf_r2,LLDB_REGNUM_GENERIC_ARG3,2, 2 }, nullptr, nullptr, nullptr, 0 }, +{ "r3", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r3, dwarf_r3,LLDB_REGNUM_GENERIC_ARG4,3, 3 }, nullptr, nullptr, nullptr, 0 }, { "r4", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r4, dwarf_r4,LLDB_INVALID_REGNUM, 4, 4 }, nullptr, nullptr, nullptr, 0 }, { "r5", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r5, dwarf_r5,LLDB_INVALID_REGNUM, 5, 5 }, nullptr, nullptr, nullptr, 0 }, { "r6", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r6, dwarf_r6,LLDB_INVALID_REGNUM, 6, 6 }, nullptr, nullptr, nullptr, 0 }, -{ "r7", "fp", 4, 0, eEncodingUint,eFormatHex, { ehframe_r7, dwarf_r7,LLDB_REGNUM_GENERIC_FP, 7, 7 }, nullptr, nullptr, nullptr, 0 }, +{ "r7", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r7, dwarf_r7,LLDB_REGNUM_GENERIC_FP, 7, 7 }, nullptr, nullptr, nullptr, 0 }, { "r8", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r8, dwarf_r8,LLDB_INVALID_REGNUM, 8, 8 }, nullptr, nullptr, nullptr, 0 }, { "r9", nullptr, 4, 0, eEncodingUint,eFormatHex, { ehframe_r9, dwarf_r9,LLDB_INVALID_REGNUM, 9, 9 },
[Lldb-commits] [lldb] c82dbc2 - [lldb] Skip TestGuiBasicDebug due to pr51833
Author: Pavel Labath Date: 2021-09-13T15:11:28+02:00 New Revision: c82dbc2924bd37fc497cdfe581a21810aace608d URL: https://github.com/llvm/llvm-project/commit/c82dbc2924bd37fc497cdfe581a21810aace608d DIFF: https://github.com/llvm/llvm-project/commit/c82dbc2924bd37fc497cdfe581a21810aace608d.diff LOG: [lldb] Skip TestGuiBasicDebug due to pr51833 Added: Modified: lldb/test/API/commands/gui/basicdebug/TestGuiBasicDebug.py Removed: diff --git a/lldb/test/API/commands/gui/basicdebug/TestGuiBasicDebug.py b/lldb/test/API/commands/gui/basicdebug/TestGuiBasicDebug.py index e0eca428b6bd2..a7df72509d58f 100644 --- a/lldb/test/API/commands/gui/basicdebug/TestGuiBasicDebug.py +++ b/lldb/test/API/commands/gui/basicdebug/TestGuiBasicDebug.py @@ -14,7 +14,7 @@ class TestGuiBasicDebugCommandTest(PExpectTest): # PExpect uses many timeouts internally and doesn't play well # under ASAN on a loaded machine.. @skipIfAsan -@skipIf(oslist=["linux"], archs=["arm","aarch64"]) +@skipIf(bugnumber="llvm.org/pr51833") @skipIfCursesSupportMissing def test_gui(self): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] dd58083 - [lldb] [test] Remove parent output checks from follow-child tests
Author: Michał Górny Date: 2021-09-13T15:50:00+02:00 New Revision: dd5808330484ad3b82ba92ae1a249127b0e0bbb4 URL: https://github.com/llvm/llvm-project/commit/dd5808330484ad3b82ba92ae1a249127b0e0bbb4 DIFF: https://github.com/llvm/llvm-project/commit/dd5808330484ad3b82ba92ae1a249127b0e0bbb4.diff LOG: [lldb] [test] Remove parent output checks from follow-child tests Remove the parent output checks, as they make the test flaky while serving no real purpose. If the parent crashed/hanged, it will never resume the child and the test would fail anyway. Added: Modified: lldb/test/Shell/Subprocess/clone-follow-child-wp.test lldb/test/Shell/Subprocess/clone-follow-child.test lldb/test/Shell/Subprocess/fork-follow-child-softbp.test lldb/test/Shell/Subprocess/fork-follow-child-wp.test lldb/test/Shell/Subprocess/fork-follow-child.test lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test lldb/test/Shell/Subprocess/vfork-follow-child-wp.test lldb/test/Shell/Subprocess/vfork-follow-child.test Removed: diff --git a/lldb/test/Shell/Subprocess/clone-follow-child-wp.test b/lldb/test/Shell/Subprocess/clone-follow-child-wp.test index 325316867f1ad..6238d54237610 100644 --- a/lldb/test/Shell/Subprocess/clone-follow-child-wp.test +++ b/lldb/test/Shell/Subprocess/clone-follow-child-wp.test @@ -9,7 +9,6 @@ process launch -s watchpoint set variable -w write g_val # CHECK: Watchpoint created: continue -# CHECK: function run in parent # CHECK: stop reason = watchpoint continue # CHECK: stop reason = watchpoint diff --git a/lldb/test/Shell/Subprocess/clone-follow-child.test b/lldb/test/Shell/Subprocess/clone-follow-child.test index 0d17b81e697f8..dbdb580637cd0 100644 --- a/lldb/test/Shell/Subprocess/clone-follow-child.test +++ b/lldb/test/Shell/Subprocess/clone-follow-child.test @@ -7,5 +7,4 @@ settings set target.process.follow-fork-mode child settings set target.process.stop-on-exec false b parent_func process launch -# CHECK: function run in parent # CHECK: function run in exec'd child diff --git a/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test b/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test index 7129d7b682c56..d07ea3bbda993 100644 --- a/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test +++ b/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test @@ -8,7 +8,6 @@ settings set target.process.stop-on-exec false b child_func b parent_func process launch -# CHECK: function run in parent # CHECK: stop reason = breakpoint # CHECK-NEXT: child_func continue diff --git a/lldb/test/Shell/Subprocess/fork-follow-child-wp.test b/lldb/test/Shell/Subprocess/fork-follow-child-wp.test index f0de4a4deb501..77b442c078af9 100644 --- a/lldb/test/Shell/Subprocess/fork-follow-child-wp.test +++ b/lldb/test/Shell/Subprocess/fork-follow-child-wp.test @@ -9,7 +9,6 @@ process launch -s watchpoint set variable -w write g_val # CHECK: Watchpoint created: continue -# CHECK: function run in parent # CHECK: stop reason = watchpoint continue # CHECK: stop reason = watchpoint diff --git a/lldb/test/Shell/Subprocess/fork-follow-child.test b/lldb/test/Shell/Subprocess/fork-follow-child.test index c401e15288811..45bdf7ad6e870 100644 --- a/lldb/test/Shell/Subprocess/fork-follow-child.test +++ b/lldb/test/Shell/Subprocess/fork-follow-child.test @@ -7,5 +7,4 @@ settings set target.process.follow-fork-mode child settings set target.process.stop-on-exec false b parent_func process launch -# CHECK: function run in parent # CHECK: function run in exec'd child diff --git a/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test b/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test index c82a4f6cdc745..ac07ee67aedc7 100644 --- a/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test +++ b/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test @@ -8,5 +8,4 @@ settings set target.process.stop-on-exec false b child_func b parent_func process launch -# CHECK: function run in parent # CHECK: function run in exec'd child diff --git a/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test b/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test index 2de3229bfcad9..548a089cd4fa4 100644 --- a/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test +++ b/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test @@ -9,5 +9,4 @@ process launch -s watchpoint set variable -w write g_val # CHECK: Watchpoint created: continue -# CHECK: function run in parent # CHECK: function run in exec'd child diff --git a/lldb/test/Shell/Subprocess/vfork-follow-child.test b/lldb/test/Shell/Subprocess/vfork-follow-child.test index 833fbb8837afd..3237cb1ea2ebc 100644 --- a/lldb/test/Shell/Subprocess/vfork-follow-child.test +++ b/lldb/test/Shell/Subprocess/vfork-follow-child.test @@ -7,5 +7,4 @@ settings set target.process.follow-fork-mode child settings set target.process.stop-o
[Lldb-commits] [PATCH] D109691: [lldb] [ABI/AArch64] Recognize special regs by their xN names too
mgorny created this revision. mgorny added reviewers: labath, krytarowski, emaste. Herald added a subscriber: kristof.beyls. mgorny requested review of this revision. Recognize lr/sp/fp by their numeric register names in the ABI plugin. This is necessary to mark them appropriately when interfacing with gdbserver. https://reviews.llvm.org/D109691 Files: lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py === --- lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py +++ lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py @@ -635,5 +635,11 @@ ["x0 = 0x0807060504030201"]) self.match("register read arg2", ["x1 = 0x1817161514131211"]) +self.match("register read fp", + ["x29 = 0x3837363534333231"]) +self.match("register read lr", + ["x30 = 0x4847464544434241"]) +self.match("register read ra", + ["x30 = 0x4847464544434241"]) self.match("register read flags", ["cpsr = 0x74737271"]) Index: lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp === --- lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp +++ lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp @@ -55,9 +55,9 @@ uint32_t ABIAArch64::GetGenericNum(llvm::StringRef name) { return llvm::StringSwitch(name) .Case("pc", LLDB_REGNUM_GENERIC_PC) - .Case("lr", LLDB_REGNUM_GENERIC_RA) - .Case("sp", LLDB_REGNUM_GENERIC_SP) - .Case("fp", LLDB_REGNUM_GENERIC_FP) + .Cases("lr", "x30", LLDB_REGNUM_GENERIC_RA) + .Cases("sp", "x31", LLDB_REGNUM_GENERIC_SP) + .Cases("fp", "x29", LLDB_REGNUM_GENERIC_FP) .Case("cpsr", LLDB_REGNUM_GENERIC_FLAGS) .Case("x0", LLDB_REGNUM_GENERIC_ARG1) .Case("x1", LLDB_REGNUM_GENERIC_ARG2) Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py === --- lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py +++ lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py @@ -635,5 +635,11 @@ ["x0 = 0x0807060504030201"]) self.match("register read arg2", ["x1 = 0x1817161514131211"]) +self.match("register read fp", + ["x29 = 0x3837363534333231"]) +self.match("register read lr", + ["x30 = 0x4847464544434241"]) +self.match("register read ra", + ["x30 = 0x4847464544434241"]) self.match("register read flags", ["cpsr = 0x74737271"]) Index: lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp === --- lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp +++ lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp @@ -55,9 +55,9 @@ uint32_t ABIAArch64::GetGenericNum(llvm::StringRef name) { return llvm::StringSwitch(name) .Case("pc", LLDB_REGNUM_GENERIC_PC) - .Case("lr", LLDB_REGNUM_GENERIC_RA) - .Case("sp", LLDB_REGNUM_GENERIC_SP) - .Case("fp", LLDB_REGNUM_GENERIC_FP) + .Cases("lr", "x30", LLDB_REGNUM_GENERIC_RA) + .Cases("sp", "x31", LLDB_REGNUM_GENERIC_SP) + .Cases("fp", "x29", LLDB_REGNUM_GENERIC_FP) .Case("cpsr", LLDB_REGNUM_GENERIC_FLAGS) .Case("x0", LLDB_REGNUM_GENERIC_ARG1) .Case("x1", LLDB_REGNUM_GENERIC_ARG2) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D109695: [lldb] [Process/gdb-remote] Add x31 AArch64 register for gdbserver
mgorny created this revision. mgorny added reviewers: labath, emaste, krytarowski. Herald added subscribers: omjavaid, kristof.beyls. mgorny requested review of this revision. Create an x31 register that is aliased to sp if the latter is present and the former is not. This is needed to bring gdbserver support in line with lldb-server support, since the former reports x31 as sp. https://reviews.llvm.org/D109695 Files: lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_aarch64.cpp lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py === --- lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py +++ lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py @@ -623,6 +623,12 @@ ["x0 = 0x0807060504030201"]) self.match("register read x1", ["x1 = 0x1817161514131211"]) +self.match("register read x29", + ["x29 = 0x3837363534333231"]) +self.match("register read x30", + ["x30 = 0x4847464544434241"]) +self.match("register read x31", + ["x31 = 0x5857565554535251"]) self.match("register read sp", ["sp = 0x5857565554535251"]) self.match("register read pc", Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_aarch64.cpp === --- /dev/null +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_aarch64.cpp @@ -0,0 +1,49 @@ +//===-- GDBRemoteRegisterContext_aarch64.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "GDBRemoteRegisterContext.h" + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; + +static uint32_t x31_value_regs[2]; + +void GDBRemoteDynamicRegisterInfo::PreFinalize_aarch64() { + uint32_t max_regnum = 0; + uint32_t next_regindex = m_regs.size(); + for (const RegisterInfo ® : m_regs) +max_regnum = std::max(max_regnum, reg.kinds[eRegisterKindProcessPlugin]); + + ConstString group; + group.SetCString("aliases"); + + // Alias "sp" into "x31" if necessary. + const RegisterInfo *sp_reg = GetRegisterInfo("sp"); + const RegisterInfo *x31_reg = GetRegisterInfo("x31"); + + if (sp_reg && !x31_reg) { +x31_value_regs[0] = sp_reg->kinds[eRegisterKindProcessPlugin]; +x31_value_regs[1] = LLDB_INVALID_REGNUM; + +struct RegisterInfo new_reg { + "x31", nullptr, sp_reg->byte_size, LLDB_INVALID_INDEX32, sp_reg->encoding, + sp_reg->format, + { + LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, + ++max_regnum,next_regindex++, + }, + x31_value_regs, nullptr, nullptr, 0 +}; + +ConstString name; +ConstString alt_name; +name.SetCString(new_reg.name); +AddRegister(new_reg, name, alt_name, group); + } +} Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h === --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h @@ -42,6 +42,7 @@ bool UpdateARM64SVERegistersInfos(uint64_t vg); void Finalize(const lldb_private::ArchSpec &arch); + void PreFinalize_aarch64(); void PreFinalize_x86(const lldb_private::ArchSpec &arch); void PostFinalize_x86(); }; Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp === --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -1107,6 +1107,9 @@ return; switch (arch.GetMachine()) { + case llvm::Triple::aarch64: +PreFinalize_aarch64(); +break; case llvm::Triple::x86: case llvm::Triple::x86_64: PreFinalize_x86(arch); Index: lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt === --- lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt +++ lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt @@ -26,6 +26,7 @@ GDBRemoteCommunicationServerLLGS.cpp GDBRemoteCommunicationServerPlatform.cpp GDBRemoteRegisterContext.cpp
[Lldb-commits] [PATCH] D108831: [lldb] [gdb-remote] Add x86_64 pseudo-registers when using gdbserver
mgorny updated this revision to Diff 372261. mgorny added a comment. Rename the file to `_x86.cpp` to future-proof it. Replace`assert()s` with explicit skipping, we don't really want to crash on unexpected data in `target.xml`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108831/new/ https://reviews.llvm.org/D108831 Files: lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_x86.cpp lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py === --- lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py +++ lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py @@ -151,6 +151,26 @@ self.match("register read flags", ["eflags = 0x94939291"]) +# test pseudo-registers +self.match("register read ecx", + ["ecx = 0x04030201"]) +self.match("register read cx", + ["cx = 0x0201"]) +self.match("register read ch", + ["ch = 0x02"]) +self.match("register read cl", + ["cl = 0x01"]) +self.match("register read r8d", + ["r8d = 0x64636261"]) +self.match("register read r8w", + ["r8w = 0x6261"]) +self.match("register read r8l", + ["r8l = 0x61"]) +self.match("register read mm0", + ["mm0 = 0x0807060504030201"]) +self.match("register read mm1", + ["mm1 = 0x1817161514131211"]) + # both stX and xmmX should be displayed as vectors self.match("register read st0", ["st0 = {0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a}"]) @@ -162,3 +182,44 @@ self.match("register read xmm1", ["xmm1 = {0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 " "0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f 0xa0}"]) + +# test writing into pseudo-registers +self.runCmd("register write ecx 0xfffefdfc") +reg_data[0] = "fcfdfeff05060708" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read rcx", + ["rcx = 0x08070605fffefdfc"]) + +self.runCmd("register write cx 0xfbfa") +reg_data[0] = "fafbfeff05060708" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read ecx", + ["ecx = 0xfffefbfa"]) +self.match("register read rcx", + ["rcx = 0x08070605fffefbfa"]) + +self.runCmd("register write ch 0xf9") +reg_data[0] = "faf9feff05060708" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read cx", + ["cx = 0xf9fa"]) +self.match("register read ecx", + ["ecx = 0xfffef9fa"]) +self.match("register read rcx", + ["rcx = 0x08070605fffef9fa"]) + +self.runCmd("register write cl 0xf8") +reg_data[0] = "f8f9feff05060708" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read cx", + ["cx = 0xf9f8"]) +self.match("register read ecx", + ["ecx = 0xfffef9f8"]) +self.match("register read rcx", + ["rcx = 0x08070605fffef9f8"]) + +self.runCmd("register write mm0 0xfffefdfcfbfaf9f8") +reg_data[10] = "f8f9fafbfcfdfeff090a" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read st0", + ["st0 = {0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff 0x09 0x0a}"]) Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_x86.cpp === --- /dev/null +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_x86.cpp @@ -0,0 +1,189 @@ +//===-- GDBRemoteRegisterContext_x86.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "GDBRemoteRegisterContext.h" + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; + +enum PartialGPRRegKind { + eRegKind32, + eRegKind16, + eRegKind8h, + eRegKind8l, + + eRegKindCount +}; + +struct PartialGPRReg { + const char *name; + + // extra storage used for pointers + uint32_t value_regs[
[Lldb-commits] [PATCH] D109281: [lldb] [gdb-remote] Extend x86 pseudo-regs to i386
mgorny updated this revision to Diff 372263. mgorny added a comment. Rebase. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109281/new/ https://reviews.llvm.org/D109281 Files: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext_x86.cpp lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py === --- lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py +++ lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py @@ -385,11 +385,112 @@ # test generic aliases self.match("register read fp", ["ebp = 0x54535251"]) +self.match("register read sp", + ["esp = 0x44434241"]) self.match("register read pc", ["eip = 0x84838281"]) self.match("register read flags", ["eflags = 0x94939291"]) +# test pseudo-registers +self.match("register read cx", + ["cx = 0x1211"]) +self.match("register read ch", + ["ch = 0x12"]) +self.match("register read cl", + ["cl = 0x11"]) +self.match("register read mm0", + ["mm0 = 0x0807060504030201"]) +self.match("register read mm1", + ["mm1 = 0x1817161514131211"]) + +# both stX and xmmX should be displayed as vectors +self.match("register read st0", + ["st0 = {0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a}"]) +self.match("register read st1", + ["st1 = {0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a}"]) +self.match("register read xmm0", + ["xmm0 = {0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 " +"0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90}"]) +self.match("register read xmm1", + ["xmm1 = {0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 " +"0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f 0xa0}"]) + +# test recombining ymmX +self.match("register read ymm0h", + ["ymm0h = {0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 " +"0xb9 0xba 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0}"]) +self.match("register read ymm0", + ["ymm0 = {0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8a " +"0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0xb1 0xb2 0xb3 0xb4 0xb5 " +"0xb6 0xb7 0xb8 0xb9 0xba 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0}"]) +self.match("register read ymm1h", + ["ymm1h = {0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7 0xc8 " +"0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0}"]) +self.match("register read ymm1", + ["ymm1 = {0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a " +"0x9b 0x9c 0x9d 0x9e 0x9f 0xa0 0xc1 0xc2 0xc3 0xc4 0xc5 " +"0xc6 0xc7 0xc8 0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0}"]) + +# test writing into pseudo-registers +self.runCmd("register write cx 0xfbfa") +reg_data[1] = "fafb1314" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read ecx", + ["ecx = 0x1413fbfa"]) + +self.runCmd("register write ch 0xf9") +reg_data[1] = "faf91314" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read cx", + ["cx = 0xf9fa"]) +self.match("register read ecx", + ["ecx = 0x1413f9fa"]) + +self.runCmd("register write cl 0xf8") +reg_data[1] = "f8f91314" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read cx", + ["cx = 0xf9f8"]) +self.match("register read ecx", + ["ecx = 0x1413f9f8"]) + +self.runCmd("register write mm0 0xfffefdfcfbfaf9f8") +reg_data[10] = "f8f9fafbfcfdfeff090a" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read st0", + ["st0 = {0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff 0x09 0x0a}"]) + +self.runCmd("register write xmm0 \"{0xff 0xfe 0xfd 0xfc 0xfb 0xfa 0xf9 " +"0xf8 0xf7 0xf6 0xf5 0xf4 0xf3 0xf2 0xf1 0xf0}\"") +reg_data[18] = "fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0" +self.assertPacketLogContains(["G" + "".join(reg_data)]) +self.match("register read ymm0", + ["ymm0 = {0xff 0xfe 0xfd 0xfc 0xfb 0xfa 0xf9 0xf8 0xf7 0xf6 " +"0xf5 0xf4 0xf3 0xf2 0xf1 0xf0 0xb1 0xb2 0xb3 0xb4 0xb5 " +"0xb6 0xb7 0xb8 0xb9 0xba 0xbb 0xbc 0xbd 0xbe 0x
[Lldb-commits] [lldb] c4fa2c8 - [lldb] Fix warning in MinidumpFileBuilder.cpp
Author: Alex Langford Date: 2021-09-13T10:37:45-07:00 New Revision: c4fa2c8aa493e4c786446739ba3eb0eb4918d579 URL: https://github.com/llvm/llvm-project/commit/c4fa2c8aa493e4c786446739ba3eb0eb4918d579 DIFF: https://github.com/llvm/llvm-project/commit/c4fa2c8aa493e4c786446739ba3eb0eb4918d579.diff LOG: [lldb] Fix warning in MinidumpFileBuilder.cpp Fixes the following warning: $llvm_project/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:744:11: warning: format specifies type 'long' but the argument has type 'lldb::offset_t' (aka 'unsigned long long') [-Wformat] m_data.GetByteSize()); ^~~~ Added: Modified: lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp Removed: diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp index 1f9c96013ebff..03722b391004f 100644 --- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp +++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp @@ -740,7 +740,7 @@ Status MinidumpFileBuilder::Dump(lldb::FileUP &core_file) const { if (error.Fail() || bytes_written != m_data.GetByteSize()) { if (bytes_written != m_data.GetByteSize()) error.SetErrorStringWithFormat( - "Unable to write the data. (written %ld/%ld).", bytes_written, + "Unable to write the data. (written %ld/%llu).", bytes_written, m_data.GetByteSize()); return error; } @@ -767,4 +767,4 @@ size_t MinidumpFileBuilder::GetDirectoriesNum() const { size_t MinidumpFileBuilder::GetCurrentDataEndOffset() const { return sizeof(llvm::minidump::Header) + m_data.GetByteSize(); -} \ No newline at end of file +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D109633: [lldb-vscode] Fix focus thread when previous thread exits
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109633/new/ https://reviews.llvm.org/D109633 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e69d359 - [lldb] Actually fix format specifier after D108233
Author: Fangrui Song Date: 2021-09-13T13:40:37-07:00 New Revision: e69d359841b6358f1d17569212ef8cf91244ca11 URL: https://github.com/llvm/llvm-project/commit/e69d359841b6358f1d17569212ef8cf91244ca11 DIFF: https://github.com/llvm/llvm-project/commit/e69d359841b6358f1d17569212ef8cf91244ca11.diff LOG: [lldb] Actually fix format specifier after D108233 And revert c4fa2c8aa493e4c786446739ba3eb0eb4918d579 Added: Modified: lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp Removed: diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp index 03722b391004..a70e6a079f76 100644 --- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp +++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp @@ -28,6 +28,8 @@ #include "Plugins/Process/minidump/MinidumpTypes.h" +#include + using namespace lldb; using namespace lldb_private; using namespace llvm::minidump; @@ -729,7 +731,7 @@ Status MinidumpFileBuilder::Dump(lldb::FileUP &core_file) const { if (error.Fail() || bytes_written != header_size) { if (bytes_written != header_size) error.SetErrorStringWithFormat( - "Unable to write the header. (written %ld/%ld).", bytes_written, + "unable to write the header (written %zd/%zd)", bytes_written, header_size); return error; } @@ -740,7 +742,7 @@ Status MinidumpFileBuilder::Dump(lldb::FileUP &core_file) const { if (error.Fail() || bytes_written != m_data.GetByteSize()) { if (bytes_written != m_data.GetByteSize()) error.SetErrorStringWithFormat( - "Unable to write the data. (written %ld/%llu).", bytes_written, + "unable to write the data (written %zd/%" PRIu64 ")", bytes_written, m_data.GetByteSize()); return error; } @@ -752,7 +754,7 @@ Status MinidumpFileBuilder::Dump(lldb::FileUP &core_file) const { if (error.Fail() || bytes_written != directory_size) { if (bytes_written != directory_size) error.SetErrorStringWithFormat( -"Unable to write the directory. (written %ld/%ld).", bytes_written, +"unable to write the directory (written %zd/%zd)", bytes_written, directory_size); return error; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D109633: [lldb-vscode] Fix focus thread when previous thread exits
wallace accepted this revision. wallace added a comment. nice! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109633/new/ https://reviews.llvm.org/D109633 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D108233: WIP: Add minidump save-core functionality to ELF object files
MaskRay added inline comments. Comment at: lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:120 + if (error.Fail()) { +error.SetErrorString("Unable to convert the csd string to UTF16."); +return error; https://llvm.org/docs/CodingStandards.html#error-and-warning-messages Don't capitalize messages and don't append `.` Comment at: lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:732 + error.SetErrorStringWithFormat( + "Unable to write the header. (written %ld/%ld).", bytes_written, + header_size); The format specifiers are wrong. size_t should use %zd and one uint64_t below should use PRIu64. I have fixed them. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108233/new/ https://reviews.llvm.org/D108233 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D109339: Fix compilation error with older libstdc++
vadimcn updated this revision to Diff 372391. vadimcn added a comment. Re-formatted CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109339/new/ https://reviews.llvm.org/D109339 Files: lldb/include/lldb/Target/ThreadPlanStack.h Index: lldb/include/lldb/Target/ThreadPlanStack.h === --- lldb/include/lldb/Target/ThreadPlanStack.h +++ lldb/include/lldb/Target/ThreadPlanStack.h @@ -124,7 +124,8 @@ void AddThread(Thread &thread) { lldb::tid_t tid = thread.GetID(); -m_plans_list.emplace(tid, thread); +m_plans_list.emplace(std::piecewise_construct, std::forward_as_tuple(tid), + std::forward_as_tuple(thread)); } bool RemoveTID(lldb::tid_t tid) { Index: lldb/include/lldb/Target/ThreadPlanStack.h === --- lldb/include/lldb/Target/ThreadPlanStack.h +++ lldb/include/lldb/Target/ThreadPlanStack.h @@ -124,7 +124,8 @@ void AddThread(Thread &thread) { lldb::tid_t tid = thread.GetID(); -m_plans_list.emplace(tid, thread); +m_plans_list.emplace(std::piecewise_construct, std::forward_as_tuple(tid), + std::forward_as_tuple(thread)); } bool RemoveTID(lldb::tid_t tid) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D109738: [lldb] Fix bug 38317 - Address breakpoints don't work if set before the process launches
vadimcn created this revision. vadimcn added a reviewer: jingham. vadimcn added a project: LLDB. Herald added a subscriber: JDevlieghere. vadimcn requested review of this revision. Herald added a subscriber: lldb-commits. Setting an address breakpoint unconditionally creates a location, however that location may not necessarily have a resolved site (e.g. if the process hasn't been launched yet). Before this patch, LLDB wouldn't try to re-resolve such breakpoints. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109738 Files: lldb/source/Breakpoint/BreakpointResolverAddress.cpp lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py Index: lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py === --- lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py +++ lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py @@ -79,10 +79,33 @@ process = target.Launch(launch_info, error) self.assertTrue(process, PROCESS_IS_VALID) -thread = get_threads_stopped_at_breakpoint(process, breakpoint) +threads = get_threads_stopped_at_breakpoint(process, breakpoint) self.assertEqual( len(threads), 1, "There should be a thread stopped at our breakpoint") # The hit count for the breakpoint should now be 2. self.assertEquals(breakpoint.GetHitCount(), 2) + +process.Kill() + +# Create a breakpoint again, this time using the load address +load_address = address.GetLoadAddress(target) + +# Re-create the target to make sure that nothing is cached +target = self.createTestTarget() +breakpoint = target.BreakpointCreateByAddress(load_address) + +launch_info.Clear() +launch_info.SetLaunchFlags(flags) + +process = target.Launch(launch_info, error) +self.assertTrue(process, PROCESS_IS_VALID) + +threads = get_threads_stopped_at_breakpoint(process, breakpoint) +self.assertEqual( +len(threads), 1, +"There should be a thread stopped at our breakpoint") + +# The hit count for the breakpoint should be 1. +self.assertEquals(breakpoint.GetHitCount(), 1) Index: lldb/source/Breakpoint/BreakpointResolverAddress.cpp === --- lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -97,8 +97,12 @@ bool re_resolve = false; if (m_addr.GetSection() || m_module_filespec) re_resolve = true; - else if (GetBreakpoint()->GetNumLocations() == 0) -re_resolve = true; + else { +BreakpointSP breakpoint = GetBreakpoint(); +if (breakpoint->GetNumLocations() == 0 || +breakpoint->GetNumResolvedLocations() < breakpoint->GetNumLocations()) + re_resolve = true; + } if (re_resolve) BreakpointResolver::ResolveBreakpoint(filter); @@ -110,8 +114,12 @@ bool re_resolve = false; if (m_addr.GetSection()) re_resolve = true; - else if (GetBreakpoint()->GetNumLocations() == 0) -re_resolve = true; + else { +BreakpointSP breakpoint = GetBreakpoint(); +if (breakpoint->GetNumLocations() == 0 || +breakpoint->GetNumResolvedLocations() < breakpoint->GetNumLocations()) + re_resolve = true; + } if (re_resolve) BreakpointResolver::ResolveBreakpointInModules(filter, modules); @@ -151,7 +159,7 @@ BreakpointLocationSP loc_sp = breakpoint.GetLocationAtIndex(0); lldb::addr_t cur_load_location = m_addr.GetLoadAddress(&breakpoint.GetTarget()); - if (cur_load_location != m_resolved_addr) { + if (cur_load_location != m_resolved_addr || !loc_sp->IsResolved()) { m_resolved_addr = cur_load_location; loc_sp->ClearBreakpointSite(); loc_sp->ResolveBreakpointSite(); Index: lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py === --- lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py +++ lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py @@ -79,10 +79,33 @@ process = target.Launch(launch_info, error) self.assertTrue(process, PROCESS_IS_VALID) -thread = get_threads_stopped_at_breakpoint(process, breakpoint) +threads = get_threads_stopped_at_breakpoint(process, breakpoint) self.assertEqual( len(threads), 1, "There should be a thread stopped at our breakpoint") # The hit count for the breakpoint should now be 2. self.assertEquals(breakpoint.GetHitCount(), 2) + +process.Kill() + +# Create a breakpoint again, this time using