[Lldb-commits] [lldb] [lldb] Support both Lua 5.3 and Lua 5.4 (PR #115500)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/115500 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (PR #115684)
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/115684 >From ae7d68adf9cc9c47208bd960eb98c117f5e8bdde Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 10 Nov 2024 07:52:56 -0800 Subject: [PATCH 1/2] [lldb] Use heterogenous lookups with std::map (NFC) Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string. Note that CommandMap just started accepting heterogeneous lookups (#115634). --- .../source/Interpreter/CommandInterpreter.cpp | 27 +-- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 227ed802aa933c..f2712af0a08a73 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1274,7 +1274,7 @@ CommandObject *CommandInterpreter::GetUserCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { std::string cmd_str(cmd); auto find_exact = [&](const CommandObject::CommandMap &map) { -auto found_elem = map.find(std::string(cmd)); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1310,7 +1310,7 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { auto find_exact = [&](const CommandObject::CommandMap &map) -> CommandObject * { -auto found_elem = map.find(cmd.str()); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1340,13 +1340,12 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( } bool CommandInterpreter::CommandExists(llvm::StringRef cmd) const { - return m_command_dict.find(std::string(cmd)) != m_command_dict.end(); + return m_command_dict.find(cmd) != m_command_dict.end(); } bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, std::string &full_name) const { - bool exact_match = - (m_alias_dict.find(std::string(cmd)) != m_alias_dict.end()); + bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end()); if (exact_match) { full_name.assign(std::string(cmd)); return exact_match; @@ -1374,15 +1373,15 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(std::string(cmd)) != m_alias_dict.end(); + return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { - return m_user_dict.find(std::string(cmd)) != m_user_dict.end(); + return m_user_dict.find(cmd) != m_user_dict.end(); } bool CommandInterpreter::UserMultiwordCommandExists(llvm::StringRef cmd) const { - return m_user_mw_dict.find(std::string(cmd)) != m_user_mw_dict.end(); + return m_user_mw_dict.find(cmd) != m_user_mw_dict.end(); } CommandAlias * @@ -1406,7 +1405,7 @@ CommandInterpreter::AddAlias(llvm::StringRef alias_name, } bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { - auto pos = m_alias_dict.find(std::string(alias_name)); + auto pos = m_alias_dict.find(alias_name); if (pos != m_alias_dict.end()) { m_alias_dict.erase(pos); return true; @@ -1415,7 +1414,7 @@ bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { } bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { - auto pos = m_command_dict.find(std::string(cmd)); + auto pos = m_command_dict.find(cmd); if (pos != m_command_dict.end()) { if (force || pos->second->IsRemovable()) { // Only regular expression objects or python commands are removable under @@ -1428,8 +1427,7 @@ bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { } bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { - CommandObject::CommandMap::iterator pos = - m_user_dict.find(std::string(user_name)); + CommandObject::CommandMap::iterator pos = m_user_dict.find(user_name); if (pos != m_user_dict.end()) { m_user_dict.erase(pos); return true; @@ -1438,8 +1436,7 @@ bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { } bool CommandInterpreter::RemoveUserMultiword(llvm::StringRef multi_name) { - CommandObject::CommandMap::iterator pos = - m_user_mw_dict.find(std::string(multi_name)); + CommandObject::CommandMap::iterator pos = m_user_mw_dict.find(multi_name); if (pos != m_user_mw_dict.end()) { m_user_mw_dict.erase(pos); return true; @@ -2213,7 +2210,7 @@ const CommandAlias * CommandInterpreter::GetAlias(llvm::StringRef alias_name) const { OptionArgVectorSP ret_val; - auto pos =
[Lldb-commits] [lldb] d8ebb08 - [lldb] Have disassembler show load addresses when using a core file (#115453)
Author: Pavel Labath Date: 2024-11-11T08:18:29+01:00 New Revision: d8ebb08a89734478bc66341cb95559b00a05b0b5 URL: https://github.com/llvm/llvm-project/commit/d8ebb08a89734478bc66341cb95559b00a05b0b5 DIFF: https://github.com/llvm/llvm-project/commit/d8ebb08a89734478bc66341cb95559b00a05b0b5.diff LOG: [lldb] Have disassembler show load addresses when using a core file (#115453) We got a bug report that the disassember output was not relocated (i.e. a load address) for a core file (like it is for a live process). It turns out this behavior it depends on whether the instructions were read from an executable file or from process memory (a core file will not typically contain the memory image for segments backed by an executable file). It's unclear whether this behavior is intentional, or if it was just trying to handle the case where we're dissassembling a module without a process, but I think it's undesirable. What makes it particularly confusing is that the instruction addresses are relocated in this case (unlike the when we don't have a process), so with large files and adresses it gets very hard to see whether the relocation has been applied or not. This patch removes the data_from_file check so that the instruction is relocated regardless of where it was read from. It will still not get relocated for the raw module use case, as those can't be relocated anywhere as they don't have a load address. Added: Modified: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/test/Shell/Commands/command-disassemble-process.yaml lldb/test/Shell/Commands/command-disassemble.s Removed: diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index 31edd8d46c444e..08264d837f9c23 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -583,7 +583,6 @@ class InstructionLLVMC : public lldb_private::Instruction { lldb::addr_t pc = m_address.GetFileAddress(); m_using_file_addr = true; -const bool data_from_file = disasm->m_data_from_file; bool use_hex_immediates = true; Disassembler::HexImmediateStyle hex_style = Disassembler::eHexStyleC; @@ -593,12 +592,10 @@ class InstructionLLVMC : public lldb_private::Instruction { use_hex_immediates = target->GetUseHexImmediates(); hex_style = target->GetHexImmediateStyle(); -if (!data_from_file) { - const lldb::addr_t load_addr = m_address.GetLoadAddress(target); - if (load_addr != LLDB_INVALID_ADDRESS) { -pc = load_addr; -m_using_file_addr = false; - } +const lldb::addr_t load_addr = m_address.GetLoadAddress(target); +if (load_addr != LLDB_INVALID_ADDRESS) { + pc = load_addr; + m_using_file_addr = false; } } } diff --git a/lldb/test/Shell/Commands/command-disassemble-process.yaml b/lldb/test/Shell/Commands/command-disassemble-process.yaml index 75be1a42fb196d..ce1b37bc8aea7a 100644 --- a/lldb/test/Shell/Commands/command-disassemble-process.yaml +++ b/lldb/test/Shell/Commands/command-disassemble-process.yaml @@ -20,7 +20,7 @@ # CHECK: (lldb) disassemble # CHECK-NEXT: command-disassemble-process.exe`main: -# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx) +# CHECK-NEXT: 0x4002 <+0>: jmp0x4004 ; <+2> # CHECK-NEXT: -> 0x4004 <+2>: addb %al, (%rdx) # CHECK-NEXT: 0x4006 <+4>: addb %al, (%rbx) # CHECK-NEXT: 0x4008 <+6>: addb %al, (%rsi) @@ -32,7 +32,7 @@ # CHECK-NEXT: 0x400a: addb %al, (%rdi) # CHECK-NEXT: (lldb) disassemble --frame # CHECK-NEXT: command-disassemble-process.exe`main: -# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx) +# CHECK-NEXT: 0x4002 <+0>: jmp0x4004 ; <+2> # CHECK-NEXT: -> 0x4004 <+2>: addb %al, (%rdx) # CHECK-NEXT: 0x4006 <+4>: addb %al, (%rbx) # CHECK-NEXT: 0x4008 <+6>: addb %al, (%rsi) @@ -44,13 +44,13 @@ # CHECK-NEXT: 0x400a: addb %al, (%rdi) # CHECK-NEXT: (lldb) disassemble --address 0x4004 # CHECK-NEXT: command-disassemble-process.exe`main: -# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx) +# CHECK-NEXT: 0x4002 <+0>: jmp0x4004 ; <+2> # CHECK-NEXT: -> 0x4004 <+2>: addb %al, (%rdx) # CHECK-NEXT: 0x4006 <+4>: addb %al, (%rbx) # CHECK-NEXT: 0x4008 <+6>: addb %al, (%rsi) # CHECK-NEXT: (lldb) disassemble --count 7 # CHECK-NEXT: command-disassemble-process.exe`main: -# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx) +# CHECK-NEXT: 0x4002 <+0>: jmp0x4004 ; <+2> # CHECK-NEXT: -> 0x4004 <+2>: addb %al, (%rdx) # CHECK-NEXT: 0x4006 <+4>: addb %al, (%rbx) # CHECK-NEXT: 0x4008 <+6>: addb %al, (%rsi) @
[Lldb-commits] [lldb] [lldb] Have disassembler show load addresses when using a core file (PR #115453)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/115453 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (PR #115684)
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/115684 Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string. Note that CommandMap just started accepting heterogeneous lookups (#115634). >From ae7d68adf9cc9c47208bd960eb98c117f5e8bdde Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 10 Nov 2024 07:52:56 -0800 Subject: [PATCH] [lldb] Use heterogenous lookups with std::map (NFC) Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string. Note that CommandMap just started accepting heterogeneous lookups (#115634). --- .../source/Interpreter/CommandInterpreter.cpp | 27 +-- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 227ed802aa933c..f2712af0a08a73 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1274,7 +1274,7 @@ CommandObject *CommandInterpreter::GetUserCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { std::string cmd_str(cmd); auto find_exact = [&](const CommandObject::CommandMap &map) { -auto found_elem = map.find(std::string(cmd)); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1310,7 +1310,7 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { auto find_exact = [&](const CommandObject::CommandMap &map) -> CommandObject * { -auto found_elem = map.find(cmd.str()); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1340,13 +1340,12 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( } bool CommandInterpreter::CommandExists(llvm::StringRef cmd) const { - return m_command_dict.find(std::string(cmd)) != m_command_dict.end(); + return m_command_dict.find(cmd) != m_command_dict.end(); } bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, std::string &full_name) const { - bool exact_match = - (m_alias_dict.find(std::string(cmd)) != m_alias_dict.end()); + bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end()); if (exact_match) { full_name.assign(std::string(cmd)); return exact_match; @@ -1374,15 +1373,15 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(std::string(cmd)) != m_alias_dict.end(); + return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { - return m_user_dict.find(std::string(cmd)) != m_user_dict.end(); + return m_user_dict.find(cmd) != m_user_dict.end(); } bool CommandInterpreter::UserMultiwordCommandExists(llvm::StringRef cmd) const { - return m_user_mw_dict.find(std::string(cmd)) != m_user_mw_dict.end(); + return m_user_mw_dict.find(cmd) != m_user_mw_dict.end(); } CommandAlias * @@ -1406,7 +1405,7 @@ CommandInterpreter::AddAlias(llvm::StringRef alias_name, } bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { - auto pos = m_alias_dict.find(std::string(alias_name)); + auto pos = m_alias_dict.find(alias_name); if (pos != m_alias_dict.end()) { m_alias_dict.erase(pos); return true; @@ -1415,7 +1414,7 @@ bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { } bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { - auto pos = m_command_dict.find(std::string(cmd)); + auto pos = m_command_dict.find(cmd); if (pos != m_command_dict.end()) { if (force || pos->second->IsRemovable()) { // Only regular expression objects or python commands are removable under @@ -1428,8 +1427,7 @@ bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { } bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { - CommandObject::CommandMap::iterator pos = - m_user_dict.find(std::string(user_name)); + CommandObject::CommandMap::iterator pos = m_user_dict.find(user_name); if (pos != m_user_dict.end()) { m_user_dict.erase(pos); return true; @@ -1438,8 +1436,7 @@ bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { } bool CommandInterpreter::RemoveUserMultiword(llvm::StringRef multi_name) { - CommandObject::CommandMap::iterator pos = - m_user_mw_dict.find(std::string(multi_name)); + CommandObject::CommandMap::iterator pos = m_user_mw_dict.find(multi_name); if (pos != m_user_mw_dict.end()) { m_user_mw_di
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (PR #115684)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Kazu Hirata (kazutakahirata) Changes Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string. Note that CommandMap just started accepting heterogeneous lookups (#115634). --- Full diff: https://github.com/llvm/llvm-project/pull/115684.diff 1 Files Affected: - (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+12-15) ``diff diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 227ed802aa933c..f2712af0a08a73 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1274,7 +1274,7 @@ CommandObject *CommandInterpreter::GetUserCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { std::string cmd_str(cmd); auto find_exact = [&](const CommandObject::CommandMap &map) { -auto found_elem = map.find(std::string(cmd)); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1310,7 +1310,7 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { auto find_exact = [&](const CommandObject::CommandMap &map) -> CommandObject * { -auto found_elem = map.find(cmd.str()); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1340,13 +1340,12 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( } bool CommandInterpreter::CommandExists(llvm::StringRef cmd) const { - return m_command_dict.find(std::string(cmd)) != m_command_dict.end(); + return m_command_dict.find(cmd) != m_command_dict.end(); } bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, std::string &full_name) const { - bool exact_match = - (m_alias_dict.find(std::string(cmd)) != m_alias_dict.end()); + bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end()); if (exact_match) { full_name.assign(std::string(cmd)); return exact_match; @@ -1374,15 +1373,15 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(std::string(cmd)) != m_alias_dict.end(); + return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { - return m_user_dict.find(std::string(cmd)) != m_user_dict.end(); + return m_user_dict.find(cmd) != m_user_dict.end(); } bool CommandInterpreter::UserMultiwordCommandExists(llvm::StringRef cmd) const { - return m_user_mw_dict.find(std::string(cmd)) != m_user_mw_dict.end(); + return m_user_mw_dict.find(cmd) != m_user_mw_dict.end(); } CommandAlias * @@ -1406,7 +1405,7 @@ CommandInterpreter::AddAlias(llvm::StringRef alias_name, } bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { - auto pos = m_alias_dict.find(std::string(alias_name)); + auto pos = m_alias_dict.find(alias_name); if (pos != m_alias_dict.end()) { m_alias_dict.erase(pos); return true; @@ -1415,7 +1414,7 @@ bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { } bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { - auto pos = m_command_dict.find(std::string(cmd)); + auto pos = m_command_dict.find(cmd); if (pos != m_command_dict.end()) { if (force || pos->second->IsRemovable()) { // Only regular expression objects or python commands are removable under @@ -1428,8 +1427,7 @@ bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { } bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { - CommandObject::CommandMap::iterator pos = - m_user_dict.find(std::string(user_name)); + CommandObject::CommandMap::iterator pos = m_user_dict.find(user_name); if (pos != m_user_dict.end()) { m_user_dict.erase(pos); return true; @@ -1438,8 +1436,7 @@ bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { } bool CommandInterpreter::RemoveUserMultiword(llvm::StringRef multi_name) { - CommandObject::CommandMap::iterator pos = - m_user_mw_dict.find(std::string(multi_name)); + CommandObject::CommandMap::iterator pos = m_user_mw_dict.find(multi_name); if (pos != m_user_mw_dict.end()) { m_user_mw_dict.erase(pos); return true; @@ -2213,7 +2210,7 @@ const CommandAlias * CommandInterpreter::GetAlias(llvm::StringRef alias_name) const { OptionArgVectorSP ret_val; - auto pos = m_alias_dict.find(std::string(alias_name)); + auto pos = m_alias_dict.find(alias_name); if (pos != m_alias_dict.end()) return (CommandAlias *)
[Lldb-commits] [lldb] [lldb] Transfer some environment variables into the tests on Windows build host (PR #115613)
labath wrote: It looks like what you need is `SystemDrive`. What's up with the other 10 variables? The reason we're not passing all environment variables is because we want to make the build reproducible. Passing `LOCALAPPDATA` makes it look like the test might actually depend on what you have in that directory, which is less than ideal. I'd like to avoid the other variables if possible. https://github.com/llvm/llvm-project/pull/115613 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (PR #115684)
https://github.com/JDevlieghere approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/115684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Refactoring JSONUtils to not use `g_dap` and instead passing in required arguments. (PR #115561)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/115561 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)
labath wrote: > Hi @labath, So the error was due to the endianness difference between Linux > and AIX. The previous failure with the new test case has gone now. I have > dropped a fix so that AIX binary is recognised on little endian platforms as > well, but if there is any better way to add this check, please do let me > know. Thanks! Are XCOFF files always big endian? If so, then all you need is to add a `DataExtractor::SetByteOrder()`. If not (and you want to support both endiannesses), then it would be better to add both cases to `XCOFFHeaderSizeFromMagic`. https://github.com/llvm/llvm-project/pull/111814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)
@@ -0,0 +1,193 @@ +//===-- ObjectFileXCOFF.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 "ObjectFileXCOFF.h" + +#include +#include +#include +#include + +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Progress.h" +#include "lldb/Core/Section.h" +#include "lldb/Host/FileSystem.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/RangeMap.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/Stream.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/BinaryFormat/XCOFF.h" +#include "llvm/Object/XCOFFObjectFile.h" +#include "llvm/Support/MemoryBuffer.h" + +using namespace llvm; +using namespace lldb; +using namespace lldb_private; + +LLDB_PLUGIN_DEFINE(ObjectFileXCOFF) + +// FIXME: target 64bit at this moment. + +// Static methods. +void ObjectFileXCOFF::Initialize() { + PluginManager::RegisterPlugin(GetPluginNameStatic(), +GetPluginDescriptionStatic(), CreateInstance, +CreateMemoryInstance, GetModuleSpecifications); +} + +void ObjectFileXCOFF::Terminate() { + PluginManager::UnregisterPlugin(CreateInstance); +} + +ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp, +DataBufferSP data_sp, +lldb::offset_t data_offset, +const lldb_private::FileSpec *file, +lldb::offset_t file_offset, +lldb::offset_t length) { + if (!data_sp) { +data_sp = MapFileData(*file, length, file_offset); +if (!data_sp) + return nullptr; +data_offset = 0; + } + if (!ObjectFileXCOFF::MagicBytesMatch(data_sp, data_offset, length)) +return nullptr; + // Update the data to contain the entire file if it doesn't already + if (data_sp->GetByteSize() < length) { +data_sp = MapFileData(*file, length, file_offset); +if (!data_sp) + return nullptr; +data_offset = 0; + } + auto objfile_up = std::make_unique( + module_sp, data_sp, data_offset, file, file_offset, length); + if (!objfile_up) +return nullptr; + + return objfile_up.release(); +} + +ObjectFile *ObjectFileXCOFF::CreateMemoryInstance( +const lldb::ModuleSP &module_sp, WritableDataBufferSP data_sp, +const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) { + return nullptr; +} + +size_t ObjectFileXCOFF::GetModuleSpecifications( +const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, +lldb::offset_t data_offset, lldb::offset_t file_offset, +lldb::offset_t length, lldb_private::ModuleSpecList &specs) { + const size_t initial_count = specs.GetSize(); + + if (ObjectFileXCOFF::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize())) { +ArchSpec arch_spec = +ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE); +ModuleSpec spec(file, arch_spec); +spec.GetArchitecture().SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64, + LLDB_INVALID_CPUTYPE, + llvm::Triple::AIX); +specs.Append(spec); + } + return specs.GetSize() - initial_count; +} + +static uint32_t XCOFFHeaderSizeFromMagic(uint32_t magic) { + switch (magic) { +/* TODO: 32bit not supported yet +case XCOFF::XCOFF32: + return sizeof(struct llvm::object::XCOFFFileHeader32); +*/ + + case XCOFF::XCOFF64: +return sizeof(struct llvm::object::XCOFFFileHeader64); +break; + + default: +break; + } + return 0; +} + +bool ObjectFileXCOFF::MagicBytesMatch(DataBufferSP &data_sp, + lldb::addr_t data_offset, + lldb::addr_t data_length) { + lldb_private::DataExtractor data; + data.SetData(data_sp, data_offset, data_length); + lldb::offset_t offset = 0; + uint16_t magic = data.GetU16(&offset); + if (magic == 0xF701) +magic = 0x01F7; /* Since AIX is big endian, and the host checking platform + might be little endian. */ labath wrote: I.e., something like this ```suggestion DataExtractor data(data_sp, data_offset, data_length); data.SetByteOrder(eByteOrderBig); lldb::offset_t offset = 0; uint16_t magic = data.Ge
[Lldb-commits] [lldb] [lldb] Disable TestCancelAttach for Windows host (PR #115619)
https://github.com/labath approved this pull request. The problem might have something to do with the fact that this somehow ends up in the windows platform code: ``` return Status::FromErrorString("attach by name is not supported"); lldb_private::Process::DoAttachToProcessWithName(const char * process_name, const lldb_private::ProcessAttachInfo & attach_info) at \llvm-project\lldb\include\lldb\Target\Process.h(1011) lldb_private::Process::Attach(lldb_private::ProcessAttachInfo & attach_info) at \llvm-project\lldb\source\Target\Process.cpp(2983) lldb_private::PlatformWindows::Attach(lldb_private::ProcessAttachInfo & attach_info, lldb_private::Debugger & debugger, lldb_private::Target * target, lldb_private::Status & error) at \llvm-project\lldb\source\Plugins\Platform\Windows\PlatformWindows.cpp(562) ``` I would not have expected that in a remote test suite run. https://github.com/llvm/llvm-project/pull/115619 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (#115590) (PR #115634)
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/115634 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (#115590) (PR #115634)
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/115634 >From 798021f7ff3a0f9578e7df39cc9bd6d11cb8c400 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 9 Nov 2024 14:48:11 -0800 Subject: [PATCH 1/2] [lldb] Use heterogenous lookups with std::map (NFC) (#115590) Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string. --- lldb/include/lldb/Interpreter/CommandObject.h | 10 ++ lldb/source/Commands/CommandObjectMultiword.cpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index c5167e5e0ecb6a..e6fea9e022c43a 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -35,8 +35,9 @@ namespace lldb_private { template int AddNamesMatchingPartialString( -const std::map &in_map, llvm::StringRef cmd_str, -StringList &matches, StringList *descriptions = nullptr) { +const std::map> &in_map, +llvm::StringRef cmd_str, StringList &matches, +StringList *descriptions = nullptr) { int number_added = 0; const bool add_all = cmd_str.empty(); @@ -54,7 +55,8 @@ int AddNamesMatchingPartialString( } template -size_t FindLongestCommandWord(std::map &dict) { +size_t +FindLongestCommandWord(std::map> &dict) { auto end = dict.end(); size_t max_len = 0; @@ -107,7 +109,7 @@ class CommandObject : public std::enable_shared_from_this { typedef std::vector CommandArgumentEntry; // Used to build individual command argument lists - typedef std::map CommandMap; + typedef std::map> CommandMap; CommandObject(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help = "", llvm::StringRef syntax = "", diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index b4cdfea9b1a3ef..c99b75ff29144d 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -32,7 +32,7 @@ CommandObjectMultiword::GetSubcommandSPExact(llvm::StringRef sub_cmd) { if (m_subcommand_dict.empty()) return {}; - auto pos = m_subcommand_dict.find(std::string(sub_cmd)); + auto pos = m_subcommand_dict.find(sub_cmd); if (pos == m_subcommand_dict.end()) return {}; @@ -64,7 +64,7 @@ CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd, // function, since I now know I have an exact match... sub_cmd = matches->GetStringAtIndex(0); -pos = m_subcommand_dict.find(std::string(sub_cmd)); +pos = m_subcommand_dict.find(sub_cmd); if (pos != m_subcommand_dict.end()) return_cmd_sp = pos->second; } >From 7cce7231ee08e788fa9e528e92dc018fd0b653a2 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 10 Nov 2024 07:29:15 -0800 Subject: [PATCH 2/2] Trigger build ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 15ce2e1 - [lldb] Use heterogenous lookups with std::map (NFC) (#115590) (#115634)
Author: Kazu Hirata Date: 2024-11-10T07:50:24-08:00 New Revision: 15ce2e183fb801ff418eb1347a9d5893e5665782 URL: https://github.com/llvm/llvm-project/commit/15ce2e183fb801ff418eb1347a9d5893e5665782 DIFF: https://github.com/llvm/llvm-project/commit/15ce2e183fb801ff418eb1347a9d5893e5665782.diff LOG: [lldb] Use heterogenous lookups with std::map (NFC) (#115590) (#115634) Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string. Added: Modified: lldb/include/lldb/Interpreter/CommandObject.h lldb/source/Commands/CommandObjectMultiword.cpp Removed: diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index c5167e5e0ecb6a..e6fea9e022c43a 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -35,8 +35,9 @@ namespace lldb_private { template int AddNamesMatchingPartialString( -const std::map &in_map, llvm::StringRef cmd_str, -StringList &matches, StringList *descriptions = nullptr) { +const std::map> &in_map, +llvm::StringRef cmd_str, StringList &matches, +StringList *descriptions = nullptr) { int number_added = 0; const bool add_all = cmd_str.empty(); @@ -54,7 +55,8 @@ int AddNamesMatchingPartialString( } template -size_t FindLongestCommandWord(std::map &dict) { +size_t +FindLongestCommandWord(std::map> &dict) { auto end = dict.end(); size_t max_len = 0; @@ -107,7 +109,7 @@ class CommandObject : public std::enable_shared_from_this { typedef std::vector CommandArgumentEntry; // Used to build individual command argument lists - typedef std::map CommandMap; + typedef std::map> CommandMap; CommandObject(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help = "", llvm::StringRef syntax = "", diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index b4cdfea9b1a3ef..c99b75ff29144d 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -32,7 +32,7 @@ CommandObjectMultiword::GetSubcommandSPExact(llvm::StringRef sub_cmd) { if (m_subcommand_dict.empty()) return {}; - auto pos = m_subcommand_dict.find(std::string(sub_cmd)); + auto pos = m_subcommand_dict.find(sub_cmd); if (pos == m_subcommand_dict.end()) return {}; @@ -64,7 +64,7 @@ CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd, // function, since I now know I have an exact match... sub_cmd = matches->GetStringAtIndex(0); -pos = m_subcommand_dict.find(std::string(sub_cmd)); +pos = m_subcommand_dict.find(sub_cmd); if (pos != m_subcommand_dict.end()) return_cmd_sp = pos->second; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (#115590) (PR #115634)
https://github.com/kazutakahirata closed https://github.com/llvm/llvm-project/pull/115634 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/vogelsgesang updated https://github.com/llvm/llvm-project/pull/113787 >From af45bc2e24623d7225d24a4680a28630d67d636e Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang Date: Sat, 26 Oct 2024 14:34:31 + Subject: [PATCH 1/7] [lldb-dap] Support column breakpoints This commit adds support for column breakpoints to lldb-dap. To do so, support for `breakpointLocations` was added. To find all available breakpoint positions, we iterate over the line table. The `setBreakpoints` request already forwarded the column correctly to `SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap` did not keep track of multiple breakpoints in the same line. To do so, the `SourceBreakpointMap` is now indexed by line+column instead of by line only. See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a high-level introduction to column breakpoints. --- .../test/tools/lldb-dap/dap_server.py | 30 ++- .../API/tools/lldb-dap/breakpoint/Makefile| 2 +- .../breakpoint/TestDAP_breakpointLocations.py | 74 +++ .../breakpoint/TestDAP_setBreakpoints.py | 172 +-- lldb/tools/lldb-dap/DAP.h | 2 +- lldb/tools/lldb-dap/lldb-dap.cpp | 197 +- .../llvm/DebugInfo/DWARF/DWARFDebugLine.h | 2 +- 7 files changed, 393 insertions(+), 86 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 63748a71f1122d..659408c709a249 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -612,6 +612,22 @@ def request_attach( command_dict = {"command": "attach", "type": "request", "arguments": args_dict} return self.send_recv(command_dict) +def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None): +(dir, base) = os.path.split(file_path) +source_dict = {"name": base, "path": file_path} +args_dict = {} +args_dict["source"] = source_dict +if line is not None: + args_dict["line"] = line +if end_line is not None: +args_dict["endLine"] = end_line +if column is not None: +args_dict["column"] = column +if end_column is not None: +args_dict["endColumn"] = end_column +command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict} +return self.send_recv(command_dict) + def request_configurationDone(self): command_dict = { "command": "configurationDone", @@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, data=None): breakpoint_data = data[i] bp = {"line": line} if breakpoint_data is not None: -if "condition" in breakpoint_data and breakpoint_data["condition"]: +if breakpoint_data.get("condition"): bp["condition"] = breakpoint_data["condition"] -if ( -"hitCondition" in breakpoint_data -and breakpoint_data["hitCondition"] -): +if breakpoint_data.get("hitCondition"): bp["hitCondition"] = breakpoint_data["hitCondition"] -if ( -"logMessage" in breakpoint_data -and breakpoint_data["logMessage"] -): +if breakpoint_data.get("logMessage"): bp["logMessage"] = breakpoint_data["logMessage"] +if breakpoint_data.get("column"): +bp["column"] = breakpoint_data["column"] breakpoints.append(bp) args_dict["breakpoints"] = breakpoints diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile index 7634f513e85233..06438b3e6e3139 100644 --- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile +++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile @@ -16,4 +16,4 @@ main-copy.cpp: main.cpp # The following shared library will be used to test breakpoints under dynamic loading libother: other-copy.c "$(MAKE)" -f $(MAKEFILE_RULES) \ - DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other + DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py new file mode 100644 index 00..d84ce843e3fba8 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_b
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/vogelsgesang updated https://github.com/llvm/llvm-project/pull/113787 >From af45bc2e24623d7225d24a4680a28630d67d636e Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang Date: Sat, 26 Oct 2024 14:34:31 + Subject: [PATCH 1/6] [lldb-dap] Support column breakpoints This commit adds support for column breakpoints to lldb-dap. To do so, support for `breakpointLocations` was added. To find all available breakpoint positions, we iterate over the line table. The `setBreakpoints` request already forwarded the column correctly to `SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap` did not keep track of multiple breakpoints in the same line. To do so, the `SourceBreakpointMap` is now indexed by line+column instead of by line only. See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a high-level introduction to column breakpoints. --- .../test/tools/lldb-dap/dap_server.py | 30 ++- .../API/tools/lldb-dap/breakpoint/Makefile| 2 +- .../breakpoint/TestDAP_breakpointLocations.py | 74 +++ .../breakpoint/TestDAP_setBreakpoints.py | 172 +-- lldb/tools/lldb-dap/DAP.h | 2 +- lldb/tools/lldb-dap/lldb-dap.cpp | 197 +- .../llvm/DebugInfo/DWARF/DWARFDebugLine.h | 2 +- 7 files changed, 393 insertions(+), 86 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 63748a71f1122d..659408c709a249 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -612,6 +612,22 @@ def request_attach( command_dict = {"command": "attach", "type": "request", "arguments": args_dict} return self.send_recv(command_dict) +def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None): +(dir, base) = os.path.split(file_path) +source_dict = {"name": base, "path": file_path} +args_dict = {} +args_dict["source"] = source_dict +if line is not None: + args_dict["line"] = line +if end_line is not None: +args_dict["endLine"] = end_line +if column is not None: +args_dict["column"] = column +if end_column is not None: +args_dict["endColumn"] = end_column +command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict} +return self.send_recv(command_dict) + def request_configurationDone(self): command_dict = { "command": "configurationDone", @@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, data=None): breakpoint_data = data[i] bp = {"line": line} if breakpoint_data is not None: -if "condition" in breakpoint_data and breakpoint_data["condition"]: +if breakpoint_data.get("condition"): bp["condition"] = breakpoint_data["condition"] -if ( -"hitCondition" in breakpoint_data -and breakpoint_data["hitCondition"] -): +if breakpoint_data.get("hitCondition"): bp["hitCondition"] = breakpoint_data["hitCondition"] -if ( -"logMessage" in breakpoint_data -and breakpoint_data["logMessage"] -): +if breakpoint_data.get("logMessage"): bp["logMessage"] = breakpoint_data["logMessage"] +if breakpoint_data.get("column"): +bp["column"] = breakpoint_data["column"] breakpoints.append(bp) args_dict["breakpoints"] = breakpoints diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile index 7634f513e85233..06438b3e6e3139 100644 --- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile +++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile @@ -16,4 +16,4 @@ main-copy.cpp: main.cpp # The following shared library will be used to test breakpoints under dynamic loading libother: other-copy.c "$(MAKE)" -f $(MAKEFILE_RULES) \ - DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other + DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py new file mode 100644 index 00..d84ce843e3fba8 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_b
[Lldb-commits] [clang] [lldb] [llvm] [AArch64] Reduce +sve2-aes to an alias of +sve-aes+sve2 (PR #114293)
@@ -6,10 +6,10 @@ tbx z0.b, z1.b, z2.b // CHECK: error: instruction requires: sve2 or sme // CHECK-NEXT: tbx z0.b, z1.b, z2.b -.arch_extension sve2-aes -.arch_extension nosve2-aes +.arch_extension sve-aes +.arch_extension nosve-aes SpencerAbson wrote: That's because all `sve2-aes` does is enable `sve2` and `sve-aes` (which these instructions are guarded by). The following sequence: ``` .arch_extension sve2-aes .arch_extension nosve2-aes ``` Would still allow the use of `aesd`, because disabling a specific feature does not disable it's dependencies. You raise a good point with this comment, we may need to reconsider if this is the intended behavior. In either case, I should not have removed the positive tests for `sve2-aes` so I'll fix that. https://github.com/llvm/llvm-project/pull/114293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [AArch64] Reduce +sve2-aes to an alias of +sve-aes+sve2 (PR #114293)
https://github.com/SpencerAbson deleted https://github.com/llvm/llvm-project/pull/114293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add framework for Data Inspection Language (DIL) work. (PR #115666)
https://github.com/cmtice created https://github.com/llvm/llvm-project/pull/115666 Add the framework code for hooking up and calling the Data Inspection Language (DIL) implementation, as an alternate implementation for the 'frame variable' command. For now, this is an opt-in option, via a target setting 'target.experimental.use-DIL'. See https://discourse.llvm.org/t/rfc-data-inspection-language/69893 for more information about this project. This PR does not actually call any of the DIL code; instead the piece that will eventually call the DIL code (StackFrame::DILEvaluateVariableExpression) calls back into the original 'frame variable' implementation. >From d757bf7ac49d504707e39fe6f3a0bc93da5aef30 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Sun, 10 Nov 2024 10:07:22 -0800 Subject: [PATCH] [LLDB] Add framework for Data Inspection Language (DIL) work. Add the framework code for hooking up and calling the Data Inspection Language (DIL) implementation, as an alternate implementation for the 'frame variable' command. For now, this is an opt-in option, via a target setting 'target.experimental.use-DIL'. See https://discourse.llvm.org/t/rfc-data-inspection-language/69893 for more information about this project. This PR does not actually call any of the DIL code; instead the piece that will eventually call the DIL code (StackFrame::DILEvaluateVariableExpression) calls back into the original 'frame variable' implementation. --- lldb/include/lldb/Target/StackFrame.h | 29 +++ lldb/include/lldb/Target/Target.h | 4 +++ lldb/source/API/SBFrame.cpp | 22 ++ lldb/source/Commands/CommandObjectFrame.cpp | 19 +--- .../Commands/CommandObjectWatchpoint.cpp | 14 +++-- lldb/source/Expression/UserExpression.cpp | 29 ++- .../SymbolFile/DWARF/DWARFASTParser.cpp | 15 -- lldb/source/Target/StackFrame.cpp | 9 ++ lldb/source/Target/Target.cpp | 21 ++ lldb/source/Target/TargetProperties.td| 3 ++ 10 files changed, 144 insertions(+), 21 deletions(-) diff --git a/lldb/include/lldb/Target/StackFrame.h b/lldb/include/lldb/Target/StackFrame.h index 3881137583b941..03128447b5d496 100644 --- a/lldb/include/lldb/Target/StackFrame.h +++ b/lldb/include/lldb/Target/StackFrame.h @@ -308,6 +308,35 @@ class StackFrame : public ExecutionContextScope, llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error); + /// Create a ValueObject for a variable name / pathname, possibly including + /// simple dereference/child selection syntax. + /// + /// \param[in] var_expr + /// The string specifying a variable to base the VariableObject off + /// of. + /// + /// \param[in] use_dynamic + /// Whether the correct dynamic type of an object pointer should be + /// determined before creating the object, or if the static type is + /// sufficient. One of the DynamicValueType enumerated values. + /// + /// \param[in] options + /// An unsigned integer of flags, values from + /// StackFrame::ExpressionPathOption + /// enum. + /// \param[in] var_sp + /// A VariableSP that will be set to the variable described in the + /// var_expr path. + /// + /// \param[in] error + /// Record any errors encountered while evaluating var_expr. + /// + /// \return + /// A shared pointer to the ValueObject described by var_expr. + lldb::ValueObjectSP DILEvaluateVariableExpression( + llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, + uint32_t options, lldb::VariableSP &var_sp, Status &error); + /// Determine whether this StackFrame has debug information available or not. /// /// \return diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index cab21c29a7486f..b5becfb0e4fe17 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -252,6 +252,10 @@ class TargetProperties : public Properties { bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const; + bool GetUseDIL(ExecutionContext *exe_ctx) const; + + void SetUseDIL(ExecutionContext *exe_ctx, bool b); + void SetRequireHardwareBreakpoints(bool b); bool GetRequireHardwareBreakpoints() const; diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index dc41e80b457d7d..4e3e47b7a5f60b 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -472,6 +472,7 @@ lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path, StackFrame *frame = nullptr; Target *target = exe_ctx.GetTargetPtr(); Process *process = exe_ctx.GetProcessPtr(); + bool use_DIL = target->GetUseDIL(&exe_ctx); if (target && process) { Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) { @@ -479,11 +480,22 @@ ll
[Lldb-commits] [lldb] [LLDB] Add framework for Data Inspection Language (DIL) work. (PR #115666)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (cmtice) Changes Add the framework code for hooking up and calling the Data Inspection Language (DIL) implementation, as an alternate implementation for the 'frame variable' command. For now, this is an opt-in option, via a target setting 'target.experimental.use-DIL'. See https://discourse.llvm.org/t/rfc-data-inspection-language/69893 for more information about this project. This PR does not actually call any of the DIL code; instead the piece that will eventually call the DIL code (StackFrame::DILEvaluateVariableExpression) calls back into the original 'frame variable' implementation. --- Full diff: https://github.com/llvm/llvm-project/pull/115666.diff 10 Files Affected: - (modified) lldb/include/lldb/Target/StackFrame.h (+29) - (modified) lldb/include/lldb/Target/Target.h (+4) - (modified) lldb/source/API/SBFrame.cpp (+17-5) - (modified) lldb/source/Commands/CommandObjectFrame.cpp (+15-4) - (modified) lldb/source/Commands/CommandObjectWatchpoint.cpp (+11-3) - (modified) lldb/source/Expression/UserExpression.cpp (+22-7) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp (+13-2) - (modified) lldb/source/Target/StackFrame.cpp (+9) - (modified) lldb/source/Target/Target.cpp (+21) - (modified) lldb/source/Target/TargetProperties.td (+3) ``diff diff --git a/lldb/include/lldb/Target/StackFrame.h b/lldb/include/lldb/Target/StackFrame.h index 3881137583b941..03128447b5d496 100644 --- a/lldb/include/lldb/Target/StackFrame.h +++ b/lldb/include/lldb/Target/StackFrame.h @@ -308,6 +308,35 @@ class StackFrame : public ExecutionContextScope, llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error); + /// Create a ValueObject for a variable name / pathname, possibly including + /// simple dereference/child selection syntax. + /// + /// \param[in] var_expr + /// The string specifying a variable to base the VariableObject off + /// of. + /// + /// \param[in] use_dynamic + /// Whether the correct dynamic type of an object pointer should be + /// determined before creating the object, or if the static type is + /// sufficient. One of the DynamicValueType enumerated values. + /// + /// \param[in] options + /// An unsigned integer of flags, values from + /// StackFrame::ExpressionPathOption + /// enum. + /// \param[in] var_sp + /// A VariableSP that will be set to the variable described in the + /// var_expr path. + /// + /// \param[in] error + /// Record any errors encountered while evaluating var_expr. + /// + /// \return + /// A shared pointer to the ValueObject described by var_expr. + lldb::ValueObjectSP DILEvaluateVariableExpression( + llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, + uint32_t options, lldb::VariableSP &var_sp, Status &error); + /// Determine whether this StackFrame has debug information available or not. /// /// \return diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index cab21c29a7486f..b5becfb0e4fe17 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -252,6 +252,10 @@ class TargetProperties : public Properties { bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const; + bool GetUseDIL(ExecutionContext *exe_ctx) const; + + void SetUseDIL(ExecutionContext *exe_ctx, bool b); + void SetRequireHardwareBreakpoints(bool b); bool GetRequireHardwareBreakpoints() const; diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index dc41e80b457d7d..4e3e47b7a5f60b 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -472,6 +472,7 @@ lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path, StackFrame *frame = nullptr; Target *target = exe_ctx.GetTargetPtr(); Process *process = exe_ctx.GetProcessPtr(); + bool use_DIL = target->GetUseDIL(&exe_ctx); if (target && process) { Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) { @@ -479,11 +480,22 @@ lldb::SBValue SBFrame::GetValueForVariablePath(const char *var_path, if (frame) { VariableSP var_sp; Status error; -ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath( -var_path, eNoDynamicValues, -StackFrame::eExpressionPathOptionCheckPtrVsMember | -StackFrame::eExpressionPathOptionsAllowDirectIVarAccess, -var_sp, error)); +ValueObjectSP value_sp; +if (use_DIL) { + // Use DIL parser/evaluator. + value_sp = frame->DILEvaluateVariableExpression( + var_path, eNoDynamicValues, + StackFrame::eExpressionPathOptionCheckPtrVsMember | + StackFrame::eExpressionPathOptionsAllowDirectIVarAccess, + var
[Lldb-commits] [clang] [lldb] [llvm] [AArch64] Reduce +sve2-aes to an alias of +sve-aes+sve2 (PR #114293)
@@ -6,10 +6,10 @@ tbx z0.b, z1.b, z2.b // CHECK: error: instruction requires: sve2 or sme // CHECK-NEXT: tbx z0.b, z1.b, z2.b -.arch_extension sve2-aes -.arch_extension nosve2-aes +.arch_extension sve-aes +.arch_extension nosve-aes SpencerAbson wrote: That's because all `sve2-aes` does is enable `sve2` and `sve-aes` (which these instructions are guarded by). The following sequence: ``` .arch_extension sve2-aes .arch_extension nosve2-aes ``` Would still allow the use of `aesd`, because disabling a specific feature does not disable it's dependencies. You raise a good point with this comment, we may need to reconsider if this is the intended behavior. In either case, I should not have removed the positive tests for sve2-aes so I'll fix that. https://github.com/llvm/llvm-project/pull/114293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits