[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff ec588175370a32dd40df86dc4672e65926817f25 864225ea1180f7e1098b6c64d1d29a617961583c --extensions h,cpp -- lldb/tools/lldb-dap/JSONUtils.cpp lldb/tools/lldb-dap/JSONUtils.h lldb/tools/lldb-dap/lldb-dap.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 333c0b21e5..ce1845525c 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -1401,7 +1401,8 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request, for (const auto &[key, value] : envMap) { if (key.empty()) g_dap.SendOutput(OutputType::Stderr, - "empty environment variable for value: \"" + value + '\"'); + "empty environment variable for value: \"" + value + + '\"'); else environment.try_emplace(key, value); } `` https://github.com/llvm/llvm-project/pull/106919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
https://github.com/Da-Viper created https://github.com/llvm/llvm-project/pull/106919 Fixes #95137 >From 539d44a522e9e0563079ddbefb59e1b4b4caaca6 Mon Sep 17 00:00:00 2001 From: Ezike Ebuka Date: Sun, 1 Sep 2024 17:26:11 +0100 Subject: [PATCH 1/3] [lldb-dap] Make environment option an object --- lldb/tools/lldb-dap/JSONUtils.cpp | 35 +-- lldb/tools/lldb-dap/JSONUtils.h | 21 +++ lldb/tools/lldb-dap/README.md | 5 - lldb/tools/lldb-dap/lldb-dap.cpp | 8 ++- lldb/tools/lldb-dap/package.json | 11 +++--- 5 files changed, 69 insertions(+), 11 deletions(-) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 7338e7cf41eb03..fc2ef80c79cfad 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -136,6 +136,31 @@ std::vector GetStrings(const llvm::json::Object *obj, return strs; } +std::unordered_map +GetStringObject(const llvm::json::Object &obj, llvm::StringRef key) { + std::unordered_map strs; + const auto *const json_object = obj.getObject(key); + if (!json_object) +return strs; + + for (const auto &[key, value] : *json_object) { +switch (value.kind()) { +case llvm::json::Value::String: + strs.emplace(key.str(), value.getAsString()->str()); + break; +case llvm::json::Value::Number: +case llvm::json::Value::Boolean: + strs.emplace(key.str(), llvm::to_string(value)); + break; +case llvm::json::Value::Null: +case llvm::json::Value::Object: +case llvm::json::Value::Array: + break; +} + } + return strs; +} + static bool IsClassStructOrUnionType(lldb::SBType t) { return (t.GetTypeClass() & (lldb::eTypeClassUnion | lldb::eTypeClassStruct | lldb::eTypeClassArray)) != 0; @@ -1370,13 +1395,11 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request, if (!cwd.empty()) run_in_terminal_args.try_emplace("cwd", cwd); - // We need to convert the input list of environments variables into a - // dictionary - std::vector envs = GetStrings(launch_request_arguments, "env"); + std::unordered_map envMap = + GetStringObject(*launch_request_arguments, "env"); llvm::json::Object environment; - for (const std::string &env : envs) { -size_t index = env.find('='); -environment.try_emplace(env.substr(0, index), env.substr(index + 1)); + for (const auto &[key, value] : envMap) { +environment.try_emplace(key, value); } run_in_terminal_args.try_emplace("env", llvm::json::Value(std::move(environment))); diff --git a/lldb/tools/lldb-dap/JSONUtils.h b/lldb/tools/lldb-dap/JSONUtils.h index b6356630b72682..de6228a0429944 100644 --- a/lldb/tools/lldb-dap/JSONUtils.h +++ b/lldb/tools/lldb-dap/JSONUtils.h @@ -16,6 +16,7 @@ #include "llvm/Support/JSON.h" #include #include +#include namespace lldb_dap { @@ -151,6 +152,26 @@ bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key); /// strings, numbers or booleans. std::vector GetStrings(const llvm::json::Object *obj, llvm::StringRef key); +/// Extract an object of key value strings for the specified key from an object. +/// +/// String values in the array will be extracted without any quotes +/// around them. Numbers and Booleans will be converted into +/// strings. Any NULL, array or objects values in the array will be +/// ignored. +/// +/// \param[in] obj +/// A JSON object that we will attempt to extract the array from +/// +/// \param[in] key +/// The key to use when extracting the value +/// +/// \return +/// An object of key value strings for the specified \a key, or +/// \a fail_value if there is no key that matches or if the +/// value is not an object or key and values in the object are not +/// strings, numbers or booleans. +std::unordered_map +GetStringObject(const llvm::json::Object &obj, llvm::StringRef key); /// Fill a response object given the request object. /// diff --git a/lldb/tools/lldb-dap/README.md b/lldb/tools/lldb-dap/README.md index 11a14d29ab51e2..5b6fc5ef990e60 100644 --- a/lldb/tools/lldb-dap/README.md +++ b/lldb/tools/lldb-dap/README.md @@ -77,7 +77,10 @@ adds `FOO=1` and `bar` to the environment: "name": "Debug", "program": "/tmp/a.out", "args": [ "one", "two", "three" ], - "env": [ "FOO=1", "BAR" ], + "env": { +"FOO": "1" +"BAR": "" + } } ``` diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index c5c4b09f15622b..804f467c7a4e20 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -1831,7 +1831,13 @@ lldb::SBError LaunchProcess(const llvm::json::Object &request) { launch_info.SetArguments(MakeArgv(args).data(), true); // Pass any environment variables along that the user specified. - auto envs = GetStrings(arguments, "env");
[Lldb-commits] [lldb] [lldb][AIX] Taking Linux Host Info header's base for AIX (PR #106910)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff e4cf0a047d30fcd6cf606af0764883ca896a5153 bf64f6ebf0e1b92c9a29b07adc4f5502e629c7cd --extensions h -- lldb/include/lldb/Host/aix/AbstractSocket.h lldb/include/lldb/Host/aix/Host.h lldb/include/lldb/Host/aix/HostInfoAIX.h lldb/include/lldb/Host/aix/Ptrace.h lldb/include/lldb/Host/aix/Support.h lldb/include/lldb/Host/aix/Uio.h lldb/include/lldb/Host/HostGetOpt.h lldb/include/lldb/Host/HostInfo.h lldb/include/lldb/Host/common/GetOptInc.h `` View the diff from clang-format here. ``diff diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h index 78a567a6b9..f8741c99ae 100644 --- a/lldb/include/lldb/Host/aix/AbstractSocket.h +++ b/lldb/include/lldb/Host/aix/AbstractSocket.h @@ -20,6 +20,6 @@ protected: size_t GetNameOffset() const override; void DeleteSocketFile(llvm::StringRef name) override; }; -} +} // namespace lldb_private #endif // ifndef liblldb_AbstractSocket_h_ diff --git a/lldb/include/lldb/Host/aix/HostInfoAIX.h b/lldb/include/lldb/Host/aix/HostInfoAIX.h index 2964f3f1dc..ba854e156c 100644 --- a/lldb/include/lldb/Host/aix/HostInfoAIX.h +++ b/lldb/include/lldb/Host/aix/HostInfoAIX.h @@ -38,6 +38,6 @@ protected: static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64); }; -} +} // namespace lldb_private #endif `` https://github.com/llvm/llvm-project/pull/106910 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] show dialog when executable is not found (PR #104711)
Da-Viper wrote: > Looks like this is ready to go. @Da-Viper do you need someone to merge this > for you? Yes, As I do not have write permission to the repository https://github.com/llvm/llvm-project/pull/104711 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
https://github.com/Da-Viper updated https://github.com/llvm/llvm-project/pull/106919 >From 539d44a522e9e0563079ddbefb59e1b4b4caaca6 Mon Sep 17 00:00:00 2001 From: Ezike Ebuka Date: Sun, 1 Sep 2024 17:26:11 +0100 Subject: [PATCH 1/4] [lldb-dap] Make environment option an object --- lldb/tools/lldb-dap/JSONUtils.cpp | 35 +-- lldb/tools/lldb-dap/JSONUtils.h | 21 +++ lldb/tools/lldb-dap/README.md | 5 - lldb/tools/lldb-dap/lldb-dap.cpp | 8 ++- lldb/tools/lldb-dap/package.json | 11 +++--- 5 files changed, 69 insertions(+), 11 deletions(-) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 7338e7cf41eb03..fc2ef80c79cfad 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -136,6 +136,31 @@ std::vector GetStrings(const llvm::json::Object *obj, return strs; } +std::unordered_map +GetStringObject(const llvm::json::Object &obj, llvm::StringRef key) { + std::unordered_map strs; + const auto *const json_object = obj.getObject(key); + if (!json_object) +return strs; + + for (const auto &[key, value] : *json_object) { +switch (value.kind()) { +case llvm::json::Value::String: + strs.emplace(key.str(), value.getAsString()->str()); + break; +case llvm::json::Value::Number: +case llvm::json::Value::Boolean: + strs.emplace(key.str(), llvm::to_string(value)); + break; +case llvm::json::Value::Null: +case llvm::json::Value::Object: +case llvm::json::Value::Array: + break; +} + } + return strs; +} + static bool IsClassStructOrUnionType(lldb::SBType t) { return (t.GetTypeClass() & (lldb::eTypeClassUnion | lldb::eTypeClassStruct | lldb::eTypeClassArray)) != 0; @@ -1370,13 +1395,11 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request, if (!cwd.empty()) run_in_terminal_args.try_emplace("cwd", cwd); - // We need to convert the input list of environments variables into a - // dictionary - std::vector envs = GetStrings(launch_request_arguments, "env"); + std::unordered_map envMap = + GetStringObject(*launch_request_arguments, "env"); llvm::json::Object environment; - for (const std::string &env : envs) { -size_t index = env.find('='); -environment.try_emplace(env.substr(0, index), env.substr(index + 1)); + for (const auto &[key, value] : envMap) { +environment.try_emplace(key, value); } run_in_terminal_args.try_emplace("env", llvm::json::Value(std::move(environment))); diff --git a/lldb/tools/lldb-dap/JSONUtils.h b/lldb/tools/lldb-dap/JSONUtils.h index b6356630b72682..de6228a0429944 100644 --- a/lldb/tools/lldb-dap/JSONUtils.h +++ b/lldb/tools/lldb-dap/JSONUtils.h @@ -16,6 +16,7 @@ #include "llvm/Support/JSON.h" #include #include +#include namespace lldb_dap { @@ -151,6 +152,26 @@ bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key); /// strings, numbers or booleans. std::vector GetStrings(const llvm::json::Object *obj, llvm::StringRef key); +/// Extract an object of key value strings for the specified key from an object. +/// +/// String values in the array will be extracted without any quotes +/// around them. Numbers and Booleans will be converted into +/// strings. Any NULL, array or objects values in the array will be +/// ignored. +/// +/// \param[in] obj +/// A JSON object that we will attempt to extract the array from +/// +/// \param[in] key +/// The key to use when extracting the value +/// +/// \return +/// An object of key value strings for the specified \a key, or +/// \a fail_value if there is no key that matches or if the +/// value is not an object or key and values in the object are not +/// strings, numbers or booleans. +std::unordered_map +GetStringObject(const llvm::json::Object &obj, llvm::StringRef key); /// Fill a response object given the request object. /// diff --git a/lldb/tools/lldb-dap/README.md b/lldb/tools/lldb-dap/README.md index 11a14d29ab51e2..5b6fc5ef990e60 100644 --- a/lldb/tools/lldb-dap/README.md +++ b/lldb/tools/lldb-dap/README.md @@ -77,7 +77,10 @@ adds `FOO=1` and `bar` to the environment: "name": "Debug", "program": "/tmp/a.out", "args": [ "one", "two", "three" ], - "env": [ "FOO=1", "BAR" ], + "env": { +"FOO": "1" +"BAR": "" + } } ``` diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index c5c4b09f15622b..804f467c7a4e20 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -1831,7 +1831,13 @@ lldb::SBError LaunchProcess(const llvm::json::Object &request) { launch_info.SetArguments(MakeArgv(args).data(), true); // Pass any environment variables along that the user specified. - auto envs = GetStrings(arguments, "env"); + auto envMa
[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)
@@ -97,7 +97,7 @@ class LLDB_API SBError { friend class lldb_private::ScriptInterpreter; friend class lldb_private::python::SWIGBridge; - SBError(const lldb_private::Status &error); + SBError(lldb_private::Status &&error); medismailben wrote: +1 https://github.com/llvm/llvm-project/pull/106774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Taking Linux Host Info header's base for AIX (PR #106910)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dhruv Srivastava (DhruvSrivastavaX) Changes This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 #101657 The complete changes for porting are present in this draft PR: #102601 Taking Base code for Host Info header files from Linux, and setting up header files for AIX Host Info. 1. Added definition `-D__AIX__` 2. Setup header files for AIX Host Info as boilerplate. --- Full diff: https://github.com/llvm/llvm-project/pull/106910.diff 10 Files Affected: - (modified) lldb/CMakeLists.txt (+6) - (modified) lldb/include/lldb/Host/HostGetOpt.h (+1-1) - (modified) lldb/include/lldb/Host/HostInfo.h (+3) - (added) lldb/include/lldb/Host/aix/AbstractSocket.h (+25) - (added) lldb/include/lldb/Host/aix/Host.h (+22) - (added) lldb/include/lldb/Host/aix/HostInfoAIX.h (+43) - (added) lldb/include/lldb/Host/aix/Ptrace.h (+60) - (added) lldb/include/lldb/Host/aix/Support.h (+29) - (added) lldb/include/lldb/Host/aix/Uio.h (+23) - (modified) lldb/include/lldb/Host/common/GetOptInc.h (+2-2) ``diff diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 59cdc4593463c1..f78b7619695c21 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -38,6 +38,12 @@ endif() include(LLDBConfig) include(AddLLDB) +# This has been added to keep the AIX build isolated for now. +# It will need to be modified later. +if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") + add_definitions("-D__AIX__") +endif() + # Define the LLDB_CONFIGURATION_xxx matching the build type. if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) add_definitions(-DLLDB_CONFIGURATION_DEBUG) diff --git a/lldb/include/lldb/Host/HostGetOpt.h b/lldb/include/lldb/Host/HostGetOpt.h index 52cfdf4dbb89c2..f450e561d6afb1 100644 --- a/lldb/include/lldb/Host/HostGetOpt.h +++ b/lldb/include/lldb/Host/HostGetOpt.h @@ -9,7 +9,7 @@ #ifndef LLDB_HOST_HOSTGETOPT_H #define LLDB_HOST_HOSTGETOPT_H -#if !defined(_MSC_VER) && !defined(__NetBSD__) +#if !defined(_MSC_VER) && !defined(__NetBSD__) && !defined(__AIX__) #include #include diff --git a/lldb/include/lldb/Host/HostInfo.h b/lldb/include/lldb/Host/HostInfo.h index b7010d69d88e7f..156df8cf6901df 100644 --- a/lldb/include/lldb/Host/HostInfo.h +++ b/lldb/include/lldb/Host/HostInfo.h @@ -55,6 +55,9 @@ #elif defined(__APPLE__) #include "lldb/Host/macosx/HostInfoMacOSX.h" #define HOST_INFO_TYPE HostInfoMacOSX +#elif defined(__AIX__) +#include "lldb/Host/aix/HostInfoAIX.h" +#define HOST_INFO_TYPE HostInfoAIX #else #include "lldb/Host/posix/HostInfoPosix.h" #define HOST_INFO_TYPE HostInfoPosix diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h new file mode 100644 index 00..78a567a6b90953 --- /dev/null +++ b/lldb/include/lldb/Host/aix/AbstractSocket.h @@ -0,0 +1,25 @@ +//===-- AbstractSocket.h *- C++ -*-===// +// +// 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 +// +//===--===// + +#ifndef liblldb_AbstractSocket_h_ +#define liblldb_AbstractSocket_h_ + +#include "lldb/Host/posix/DomainSocket.h" + +namespace lldb_private { +class AbstractSocket : public DomainSocket { +public: + AbstractSocket(bool child_processes_inherit); + +protected: + size_t GetNameOffset() const override; + void DeleteSocketFile(llvm::StringRef name) override; +}; +} + +#endif // ifndef liblldb_AbstractSocket_h_ diff --git a/lldb/include/lldb/Host/aix/Host.h b/lldb/include/lldb/Host/aix/Host.h new file mode 100644 index 00..ef1e74cd1d501b --- /dev/null +++ b/lldb/include/lldb/Host/aix/Host.h @@ -0,0 +1,22 @@ +//===-- Host.h --*- C++ -*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_HOST_LINUX_HOST_H +#define LLDB_HOST_LINUX_HOST_H + +#include "lldb/lldb-types.h" +#include + +namespace lldb_private { + +// Get PID (i.e. the primary thread ID) corresponding to the specified TID. +std::optional getPIDForTID(lldb::pid_t tid); + +} // namespace lldb_private + +#endif // #ifndef LLDB_HOST_LINUX_HOST_H diff --git a/lldb/include/lldb/Host/aix/HostInfoAIX.h b/lldb/include/lldb/Host/aix/HostInfoAIX.h new file mode 100644 index 00..2964f3f1dc9893 --- /dev/null +++ b/lldb/include/lldb/Host/aix/HostInfoAIX.h @@ -0,0 +1,43 @@ +//===-- HostInfoLinux.h -*- C++ -*-===// +//
[Lldb-commits] [lldb] [lldb][AIX] Taking Linux Host Info header's base for AIX (PR #106910)
https://github.com/DhruvSrivastavaX edited https://github.com/llvm/llvm-project/pull/106910 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Taking Linux Host Info header's base for AIX (PR #106910)
https://github.com/DhruvSrivastavaX edited https://github.com/llvm/llvm-project/pull/106910 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Taking Linux Host Info header's base for AIX (PR #106910)
https://github.com/DhruvSrivastavaX updated https://github.com/llvm/llvm-project/pull/106910 >From bf64f6ebf0e1b92c9a29b07adc4f5502e629c7cd Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava Date: Sun, 1 Sep 2024 09:26:34 -0500 Subject: [PATCH 1/2] Taking Linux Host Info base for AIX --- lldb/CMakeLists.txt | 6 +++ lldb/include/lldb/Host/HostGetOpt.h | 2 +- lldb/include/lldb/Host/HostInfo.h | 3 ++ lldb/include/lldb/Host/aix/AbstractSocket.h | 25 + lldb/include/lldb/Host/aix/Host.h | 22 lldb/include/lldb/Host/aix/HostInfoAIX.h| 43 +++ lldb/include/lldb/Host/aix/Ptrace.h | 60 + lldb/include/lldb/Host/aix/Support.h| 29 ++ lldb/include/lldb/Host/aix/Uio.h| 23 lldb/include/lldb/Host/common/GetOptInc.h | 4 +- 10 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 lldb/include/lldb/Host/aix/AbstractSocket.h create mode 100644 lldb/include/lldb/Host/aix/Host.h create mode 100644 lldb/include/lldb/Host/aix/HostInfoAIX.h create mode 100644 lldb/include/lldb/Host/aix/Ptrace.h create mode 100644 lldb/include/lldb/Host/aix/Support.h create mode 100644 lldb/include/lldb/Host/aix/Uio.h diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 59cdc4593463c1..f78b7619695c21 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -38,6 +38,12 @@ endif() include(LLDBConfig) include(AddLLDB) +# This has been added to keep the AIX build isolated for now. +# It will need to be modified later. +if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") + add_definitions("-D__AIX__") +endif() + # Define the LLDB_CONFIGURATION_xxx matching the build type. if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) add_definitions(-DLLDB_CONFIGURATION_DEBUG) diff --git a/lldb/include/lldb/Host/HostGetOpt.h b/lldb/include/lldb/Host/HostGetOpt.h index 52cfdf4dbb89c2..f450e561d6afb1 100644 --- a/lldb/include/lldb/Host/HostGetOpt.h +++ b/lldb/include/lldb/Host/HostGetOpt.h @@ -9,7 +9,7 @@ #ifndef LLDB_HOST_HOSTGETOPT_H #define LLDB_HOST_HOSTGETOPT_H -#if !defined(_MSC_VER) && !defined(__NetBSD__) +#if !defined(_MSC_VER) && !defined(__NetBSD__) && !defined(__AIX__) #include #include diff --git a/lldb/include/lldb/Host/HostInfo.h b/lldb/include/lldb/Host/HostInfo.h index b7010d69d88e7f..156df8cf6901df 100644 --- a/lldb/include/lldb/Host/HostInfo.h +++ b/lldb/include/lldb/Host/HostInfo.h @@ -55,6 +55,9 @@ #elif defined(__APPLE__) #include "lldb/Host/macosx/HostInfoMacOSX.h" #define HOST_INFO_TYPE HostInfoMacOSX +#elif defined(__AIX__) +#include "lldb/Host/aix/HostInfoAIX.h" +#define HOST_INFO_TYPE HostInfoAIX #else #include "lldb/Host/posix/HostInfoPosix.h" #define HOST_INFO_TYPE HostInfoPosix diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h new file mode 100644 index 00..78a567a6b90953 --- /dev/null +++ b/lldb/include/lldb/Host/aix/AbstractSocket.h @@ -0,0 +1,25 @@ +//===-- AbstractSocket.h *- C++ -*-===// +// +// 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 +// +//===--===// + +#ifndef liblldb_AbstractSocket_h_ +#define liblldb_AbstractSocket_h_ + +#include "lldb/Host/posix/DomainSocket.h" + +namespace lldb_private { +class AbstractSocket : public DomainSocket { +public: + AbstractSocket(bool child_processes_inherit); + +protected: + size_t GetNameOffset() const override; + void DeleteSocketFile(llvm::StringRef name) override; +}; +} + +#endif // ifndef liblldb_AbstractSocket_h_ diff --git a/lldb/include/lldb/Host/aix/Host.h b/lldb/include/lldb/Host/aix/Host.h new file mode 100644 index 00..ef1e74cd1d501b --- /dev/null +++ b/lldb/include/lldb/Host/aix/Host.h @@ -0,0 +1,22 @@ +//===-- Host.h --*- C++ -*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_HOST_LINUX_HOST_H +#define LLDB_HOST_LINUX_HOST_H + +#include "lldb/lldb-types.h" +#include + +namespace lldb_private { + +// Get PID (i.e. the primary thread ID) corresponding to the specified TID. +std::optional getPIDForTID(lldb::pid_t tid); + +} // namespace lldb_private + +#endif // #ifndef LLDB_HOST_LINUX_HOST_H diff --git a/lldb/include/lldb/Host/aix/HostInfoAIX.h b/lldb/include/lldb/Host/aix/HostInfoAIX.h new file mode 100644 index 00..2964f3f1dc9893 --- /dev/null +++ b/lldb/include/lldb/Host/aix/HostInfoAIX.h @
[Lldb-commits] [lldb] [lldb] Better matching of types in anonymous namespaces (PR #102111)
labath wrote: No worries, I was out a large part of August anyway. https://github.com/llvm/llvm-project/pull/102111 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] dd5d730 - [lldb] Better matching of types in anonymous namespaces (#102111)
Author: Pavel Labath Date: 2024-09-02T08:34:14+02:00 New Revision: dd5d73007240712957f2b633f795d9965afaadd6 URL: https://github.com/llvm/llvm-project/commit/dd5d73007240712957f2b633f795d9965afaadd6 DIFF: https://github.com/llvm/llvm-project/commit/dd5d73007240712957f2b633f795d9965afaadd6.diff LOG: [lldb] Better matching of types in anonymous namespaces (#102111) This patch extends TypeQuery matching to support anonymous namespaces. A new flag is added to control the behavior. In the "strict" mode, the query must match the type exactly -- all anonymous namespaces included. The dynamic type resolver in the itanium abi (the motivating use case for this) uses this flag, as it queries using the name from the demangles, which includes anonymous namespaces. This ensures we don't confuse a type with a same-named type in an anonymous namespace. However, this does *not* ensure we don't confuse two types in anonymous namespacs (in different CUs). To resolve this, we would need to use a completely different lookup algorithm, which probably also requires a DWARF extension. In the "lax" mode (the default), the anonymous namespaces in the query are optional, and this allows one search for the type using the usual language rules (`::A` matches `::(anonymous namespace)::A`). This patch also changes the type context computation algorithm in DWARFDIE, so that it includes anonymous namespace information. This causes a slight change in behavior: the algorithm previously stopped computing the context after encountering an anonymous namespace, which caused the outer namespaces to be ignored. This meant that a type like `NS::(anonymous namespace)::A` would be (incorrectly) recognized as `::A`). This can cause code depending on the old behavior to misbehave. The fix is to specify all the enclosing namespaces in the query, or use a non-exact match. Added: lldb/test/API/lang/cpp/dynamic-value/a.h lldb/test/API/lang/cpp/dynamic-value/anonymous-b.cpp Modified: lldb/include/lldb/Symbol/Type.h lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/source/Symbol/Type.cpp lldb/test/API/lang/cpp/dynamic-value/Makefile lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py lldb/test/API/lang/cpp/dynamic-value/pass-to-base.cpp lldb/test/API/lang/cpp/namespace/TestNamespace.py lldb/unittests/Symbol/TestType.cpp lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp Removed: diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 420307e0dbcf02..03d9f927997476 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -77,10 +77,13 @@ FLAGS_ENUM(TypeQueryOptions){ /// If set, the query will ignore all Module entries in the type context, /// even for exact matches. e_ignore_modules = (1u << 2), +/// If set, all anonymous namespaces in the context must be matched exactly +/// by the pattern. Otherwise, superfluous namespaces are skipped. +e_strict_namespaces = (1u << 3), /// When true, the find types call should stop the query as soon as a single /// matching type is found. When false, the type query should find all /// matching types. -e_find_one = (1u << 3), +e_find_one = (1u << 4), }; LLDB_MARK_AS_BITMASK_ENUM(TypeQueryOptions) @@ -264,7 +267,22 @@ class TypeQuery { bool GetExactMatch() const { return (m_options & e_exact_match) != 0; } bool GetIgnoreModules() const { return (m_options & e_ignore_modules) != 0; } - void SetIgnoreModules() { m_options &= ~e_ignore_modules; } + void SetIgnoreModules(bool b) { +if (b) + m_options |= e_ignore_modules; +else + m_options &= ~e_ignore_modules; + } + + bool GetStrictNamespaces() const { +return (m_options & e_strict_namespaces) != 0; + } + void SetStrictNamespaces(bool b) { +if (b) + m_options |= e_strict_namespaces; +else + m_options &= ~e_strict_namespaces; + } /// The \a m_context can be used in two ways: normal types searching with /// the context containing a stanadard declaration context for a type, or @@ -279,7 +297,7 @@ class TypeQuery { if (b) m_options |= e_find_one; else - m_options &= (e_exact_match | e_find_one); + m_options &= ~e_find_one; } /// Access the internal compiler context array. diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 7af768aad0bc19..4c547afe30fe81 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -90,6 +90,7 @@ TypeAndOrName ItaniumABILa
[Lldb-commits] [lldb] [lldb] Better matching of types in anonymous namespaces (PR #102111)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/102111 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 984fca5 - [lldb-dap] show dialog when executable is not found (#104711)
Author: Da-Viper Date: 2024-09-01T08:41:18-07:00 New Revision: 984fca5a8a7de726dc8d3ad232f45e1ae395829c URL: https://github.com/llvm/llvm-project/commit/984fca5a8a7de726dc8d3ad232f45e1ae395829c DIFF: https://github.com/llvm/llvm-project/commit/984fca5a8a7de726dc8d3ad232f45e1ae395829c.diff LOG: [lldb-dap] show dialog when executable is not found (#104711) Added: Modified: lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts lldb/tools/lldb-dap/src-ts/extension.ts Removed: diff --git a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts index 01c671f41ff782..2be21bfdf0dd69 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts @@ -14,10 +14,53 @@ export class LLDBDapDescriptorFactory this.lldbDapOptions = lldbDapOptions; } + static async isValidDebugAdapterPath( +pathUri: vscode.Uri, + ): Promise { +try { + const fileStats = await vscode.workspace.fs.stat(pathUri); + if (!(fileStats.type & vscode.FileType.File)) { +return false; + } +} catch (err) { + return false; +} +return true; + } + async createDebugAdapterDescriptor( session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined, ): Promise { +const config = vscode.workspace.getConfiguration( + "lldb-dap", + session.workspaceFolder, +); +const customPath = config.get("executable-path"); +const path: string = customPath || executable!!.command; + +const fileUri = vscode.Uri.file(path); +if (!(await LLDBDapDescriptorFactory.isValidDebugAdapterPath(fileUri))) { + LLDBDapDescriptorFactory.showLLDBDapNotFoundMessage(fileUri.path); +} return this.lldbDapOptions.createDapExecutableCommand(session, executable); } + + /** + * Shows a message box when the debug adapter's path is not found + */ + static async showLLDBDapNotFoundMessage(path: string) { +const openSettingsAction = "Open Settings"; +const callbackValue = await vscode.window.showErrorMessage( + `Debug adapter path: ${path} is not a valid file`, + openSettingsAction, +); + +if (openSettingsAction === callbackValue) { + vscode.commands.executeCommand( +"workbench.action.openSettings", +"lldb-dap.executable-path", + ); +} + } } diff --git a/lldb/tools/lldb-dap/src-ts/extension.ts b/lldb/tools/lldb-dap/src-ts/extension.ts index 7df09f7a29dad7..fdc4f47b238b5a 100644 --- a/lldb/tools/lldb-dap/src-ts/extension.ts +++ b/lldb/tools/lldb-dap/src-ts/extension.ts @@ -14,26 +14,32 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions { session: vscode.DebugSession, packageJSONExecutable: vscode.DebugAdapterExecutable | undefined, ): Promise { - const config = vscode.workspace -.getConfiguration("lldb-dap", session.workspaceFolder); + const config = vscode.workspace.getConfiguration( +"lldb-dap", +session.workspaceFolder, + ); const path = config.get("executable-path"); const log_path = config.get("log-path"); - let env : { [key: string]: string } = {}; + let env: { [key: string]: string } = {}; if (log_path) { env["LLDBDAP_LOG"] = log_path; } if (path) { -return new vscode.DebugAdapterExecutable(path, [], {env}); +return new vscode.DebugAdapterExecutable(path, [], { env }); } else if (packageJSONExecutable) { -return new vscode.DebugAdapterExecutable(packageJSONExecutable.command, packageJSONExecutable.args, { - ...packageJSONExecutable.options, - env: { -...packageJSONExecutable.options?.env, -...env - } -}); +return new vscode.DebugAdapterExecutable( + packageJSONExecutable.command, + packageJSONExecutable.args, + { +...packageJSONExecutable.options, +env: { + ...packageJSONExecutable.options?.env, + ...env, +}, + }, +); } else { return undefined; } @@ -58,6 +64,26 @@ export class LLDBDapExtension extends DisposableContext { new LLDBDapDescriptorFactory(this.lldbDapOptions), ), ); + +this.pushSubscription( + vscode.workspace.onDidChangeConfiguration(async (event) => { +if (event.affectsConfiguration("lldb-dap.executable-path")) { + const dapPath = vscode.workspace +.getConfiguration("lldb-dap") +.get("executable-path"); + + if (dapPath) { +const fileUri = vscode.Uri.file(dapPath); +if ( + await LLDBDapDescriptorFactory.isValidDebugAdapterPath(fileUri) +) { + return; +} +
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (Da-Viper) Changes Fixes #95137 --- Full diff: https://github.com/llvm/llvm-project/pull/106919.diff 5 Files Affected: - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+33-6) - (modified) lldb/tools/lldb-dap/JSONUtils.h (+21) - (modified) lldb/tools/lldb-dap/README.md (+5-2) - (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+21-13) - (modified) lldb/tools/lldb-dap/package.json (+24-9) ``diff diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 7338e7cf41eb03..333c0b21e57d01 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -136,6 +136,31 @@ std::vector GetStrings(const llvm::json::Object *obj, return strs; } +std::unordered_map +GetStringObject(const llvm::json::Object &obj, llvm::StringRef key) { + std::unordered_map strs; + const auto *const json_object = obj.getObject(key); + if (!json_object) +return strs; + + for (const auto &[key, value] : *json_object) { +switch (value.kind()) { +case llvm::json::Value::String: + strs.emplace(key.str(), value.getAsString()->str()); + break; +case llvm::json::Value::Number: +case llvm::json::Value::Boolean: + strs.emplace(key.str(), llvm::to_string(value)); + break; +case llvm::json::Value::Null: +case llvm::json::Value::Object: +case llvm::json::Value::Array: + break; +} + } + return strs; +} + static bool IsClassStructOrUnionType(lldb::SBType t) { return (t.GetTypeClass() & (lldb::eTypeClassUnion | lldb::eTypeClassStruct | lldb::eTypeClassArray)) != 0; @@ -1370,13 +1395,15 @@ CreateRunInTerminalReverseRequest(const llvm::json::Object &launch_request, if (!cwd.empty()) run_in_terminal_args.try_emplace("cwd", cwd); - // We need to convert the input list of environments variables into a - // dictionary - std::vector envs = GetStrings(launch_request_arguments, "env"); + std::unordered_map envMap = + GetStringObject(*launch_request_arguments, "env"); llvm::json::Object environment; - for (const std::string &env : envs) { -size_t index = env.find('='); -environment.try_emplace(env.substr(0, index), env.substr(index + 1)); + for (const auto &[key, value] : envMap) { +if (key.empty()) + g_dap.SendOutput(OutputType::Stderr, + "empty environment variable for value: \"" + value + '\"'); +else + environment.try_emplace(key, value); } run_in_terminal_args.try_emplace("env", llvm::json::Value(std::move(environment))); diff --git a/lldb/tools/lldb-dap/JSONUtils.h b/lldb/tools/lldb-dap/JSONUtils.h index b6356630b72682..de6228a0429944 100644 --- a/lldb/tools/lldb-dap/JSONUtils.h +++ b/lldb/tools/lldb-dap/JSONUtils.h @@ -16,6 +16,7 @@ #include "llvm/Support/JSON.h" #include #include +#include namespace lldb_dap { @@ -151,6 +152,26 @@ bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key); /// strings, numbers or booleans. std::vector GetStrings(const llvm::json::Object *obj, llvm::StringRef key); +/// Extract an object of key value strings for the specified key from an object. +/// +/// String values in the array will be extracted without any quotes +/// around them. Numbers and Booleans will be converted into +/// strings. Any NULL, array or objects values in the array will be +/// ignored. +/// +/// \param[in] obj +/// A JSON object that we will attempt to extract the array from +/// +/// \param[in] key +/// The key to use when extracting the value +/// +/// \return +/// An object of key value strings for the specified \a key, or +/// \a fail_value if there is no key that matches or if the +/// value is not an object or key and values in the object are not +/// strings, numbers or booleans. +std::unordered_map +GetStringObject(const llvm::json::Object &obj, llvm::StringRef key); /// Fill a response object given the request object. /// diff --git a/lldb/tools/lldb-dap/README.md b/lldb/tools/lldb-dap/README.md index 11a14d29ab51e2..c4f48001dad19a 100644 --- a/lldb/tools/lldb-dap/README.md +++ b/lldb/tools/lldb-dap/README.md @@ -34,7 +34,7 @@ file that defines how your program will be run. The JSON configuration file can |**launchCommands** |[string]| | LLDB commands executed to launch the program. Commands and command output will be sent to the debugger console when they are executed. |**exitCommands** |[string]| | LLDB commands executed when the program exits. Commands and command output will be sent to the debugger console when they are executed. |**terminateCommands** |[string]| | LLDB commands executed when the debugging session ends. Commands and command output will be sent to the debugger console when they are executed. -|**sourceMap** |[string[2]]| | Specify an array of path re-mappin
[Lldb-commits] [lldb] [lldb-dap] Add: show return value on step out (PR #106907)
https://github.com/Da-Viper updated https://github.com/llvm/llvm-project/pull/106907 >From 2ca64edb00d1f7b9d2938c9db32644c4a8cbc13e Mon Sep 17 00:00:00 2001 From: Ezike Ebuka Date: Sun, 1 Sep 2024 13:48:41 +0100 Subject: [PATCH 1/2] Add: show return value on step out --- lldb/tools/lldb-dap/lldb-dap.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index c5c4b09f15622b..c9116c62c46b5e 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -3801,6 +3801,17 @@ void request_variables(const llvm::json::Object &request) { variable_name_counts[GetNonNullVariableName(variable)]++; } +// Show return value if there is any ( in the top frame ) +auto process = g_dap.target.GetProcess(); +auto selectedThread = process.GetSelectedThread(); +lldb::SBValue stopReturnValue = selectedThread.GetStopReturnValue(); +if (stopReturnValue.IsValid() && +(selectedThread.GetSelectedFrame().GetFrameID() == 0)) { + auto renamedReturnValue = stopReturnValue.Clone("(Return Value)"); + variables.emplace_back( + CreateVariable(renamedReturnValue,0, UINT64_MAX, hex, false)); +} + // Now we construct the result with unique display variable names for (auto i = start_idx; i < end_idx; ++i) { lldb::SBValue variable = top_scope->GetValueAtIndex(i); >From 8119240ca46e0e9d25ebc1b9c41d1eb9bd4f9ee2 Mon Sep 17 00:00:00 2001 From: Ezike Ebuka Date: Sun, 1 Sep 2024 14:10:54 +0100 Subject: [PATCH 2/2] format file --- lldb/tools/lldb-dap/lldb-dap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index c9116c62c46b5e..bf87dd838c8a74 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -3809,7 +3809,7 @@ void request_variables(const llvm::json::Object &request) { (selectedThread.GetSelectedFrame().GetFrameID() == 0)) { auto renamedReturnValue = stopReturnValue.Clone("(Return Value)"); variables.emplace_back( - CreateVariable(renamedReturnValue,0, UINT64_MAX, hex, false)); + CreateVariable(renamedReturnValue, 0, UINT64_MAX, hex, false)); } // Now we construct the result with unique display variable names ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)
@@ -97,7 +97,7 @@ class LLDB_API SBError { friend class lldb_private::ScriptInterpreter; friend class lldb_private::python::SWIGBridge; - SBError(const lldb_private::Status &error); + SBError(lldb_private::Status &&error); compnerd wrote: I agree with @JDevlieghere that we shouldn't consider private symbols as ABI. As long as we do not decrease the access level, I think that the breakage should be fine. https://github.com/llvm/llvm-project/pull/106774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
@@ -160,9 +160,14 @@ "default": "${workspaceRoot}" }, "env": { -"type": "array", -"description": "Additional environment variables to set when launching the program. This is an array of strings that contains the variable name followed by an optional '=' character and the environment variable's value.", -"default": [] +"type": "object", +"description": "Additional environment variables to set when launching the program. eg { \"FOO\": \"1\" }", vogelsgesang wrote: ```suggestion "description": "Additional environment variables to set when launching the program. E.g. `{ \"FOO\": \"1\" }`", ``` https://github.com/llvm/llvm-project/pull/106919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
@@ -194,9 +199,14 @@ "description": "Specify a source path to remap \"./\" to allow full paths to be used when setting breakpoints in binaries that have relative source paths." }, "sourceMap": { -"type": "array", -"description": "Specify an array of path remappings; each element must itself be a two element array containing a source and destination path name. Overrides sourcePath.", -"default": [] +"type": "object", +"description": "Specify an object of path remappings; each entry has a key containing the source path and a value containing the destination path. E.g { \"/the/source/path\": \"/the/destination/path\" } Overrides sourcePath.", vogelsgesang wrote: ```suggestion "description": "Specify an object of path remappings; each entry has a key containing the source path and a value containing the destination path. E.g `{ \"/the/source/path\": \"/the/destination/path\" }`. Overrides sourcePath.", ``` https://github.com/llvm/llvm-project/pull/106919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
@@ -151,6 +152,26 @@ bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key); /// strings, numbers or booleans. std::vector GetStrings(const llvm::json::Object *obj, llvm::StringRef key); +/// Extract an object of key value strings for the specified key from an object. +/// +/// String values in the array will be extracted without any quotes vogelsgesang wrote: ```suggestion /// String values in the object will be extracted without any quotes ``` https://github.com/llvm/llvm-project/pull/106919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
@@ -151,6 +152,26 @@ bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key); /// strings, numbers or booleans. std::vector GetStrings(const llvm::json::Object *obj, llvm::StringRef key); +/// Extract an object of key value strings for the specified key from an object. vogelsgesang wrote: missing empty lines ```suggestion llvm::StringRef key); /// Extract an object of key value strings for the specified key from an object. ``` https://github.com/llvm/llvm-project/pull/106919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
@@ -151,6 +152,26 @@ bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key); /// strings, numbers or booleans. std::vector GetStrings(const llvm::json::Object *obj, llvm::StringRef key); +/// Extract an object of key value strings for the specified key from an object. +/// +/// String values in the array will be extracted without any quotes +/// around them. Numbers and Booleans will be converted into +/// strings. Any NULL, array or objects values in the array will be +/// ignored. +/// +/// \param[in] obj +/// A JSON object that we will attempt to extract the array from +/// +/// \param[in] key +/// The key to use when extracting the value +/// +/// \return +/// An object of key value strings for the specified \a key, or +/// \a fail_value if there is no key that matches or if the +/// value is not an object or key and values in the object are not +/// strings, numbers or booleans. +std::unordered_map +GetStringObject(const llvm::json::Object &obj, llvm::StringRef key); vogelsgesang wrote: Feels slightly more self-explanatory to me: ```suggestion GetStringMap(const llvm::json::Object &obj, llvm::StringRef key); ``` https://github.com/llvm/llvm-project/pull/106919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)
@@ -299,9 +309,14 @@ "description": "Specify a source path to remap \"./\" to allow full paths to be used when setting breakpoints in binaries that have relative source paths." }, "sourceMap": { -"type": "array", -"description": "Specify an array of path remappings; each element must itself be a two element array containing a source and destination path name. Overrides sourcePath.", -"default": [] +"type": "object", +"description": "Specify an object of path remappings; each entry has a key containing the source path and a value containing the destination path. E.g { \"/the/source/path\": \"/the/destination/path\" } Overrides sourcePath.", vogelsgesang wrote: ```suggestion "description": "Specify an object of path remappings; each entry has a key containing the source path and a value containing the destination path. E.g `{ \"/the/source/path\": \"/the/destination/path\" }`. Overrides sourcePath.", ``` https://github.com/llvm/llvm-project/pull/106919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add: show return value on step out (PR #106907)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff ec588175370a32dd40df86dc4672e65926817f25 2ca64edb00d1f7b9d2938c9db32644c4a8cbc13e --extensions cpp -- lldb/tools/lldb-dap/lldb-dap.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index c9116c62c4..bf87dd838c 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -3809,7 +3809,7 @@ void request_variables(const llvm::json::Object &request) { (selectedThread.GetSelectedFrame().GetFrameID() == 0)) { auto renamedReturnValue = stopReturnValue.Clone("(Return Value)"); variables.emplace_back( - CreateVariable(renamedReturnValue,0, UINT64_MAX, hex, false)); + CreateVariable(renamedReturnValue, 0, UINT64_MAX, hex, false)); } // Now we construct the result with unique display variable names `` https://github.com/llvm/llvm-project/pull/106907 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] show dialog when executable is not found (PR #104711)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/104711 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add: show return value on step out (PR #106907)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (Da-Viper) Changes https://github.com/user-attachments/assets/cff48c6f-37ae-4f72-b881-3eff4178fb3c --- Full diff: https://github.com/llvm/llvm-project/pull/106907.diff 1 Files Affected: - (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+11) ``diff diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index c5c4b09f15622b..c9116c62c46b5e 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -3801,6 +3801,17 @@ void request_variables(const llvm::json::Object &request) { variable_name_counts[GetNonNullVariableName(variable)]++; } +// Show return value if there is any ( in the top frame ) +auto process = g_dap.target.GetProcess(); +auto selectedThread = process.GetSelectedThread(); +lldb::SBValue stopReturnValue = selectedThread.GetStopReturnValue(); +if (stopReturnValue.IsValid() && +(selectedThread.GetSelectedFrame().GetFrameID() == 0)) { + auto renamedReturnValue = stopReturnValue.Clone("(Return Value)"); + variables.emplace_back( + CreateVariable(renamedReturnValue,0, UINT64_MAX, hex, false)); +} + // Now we construct the result with unique display variable names for (auto i = start_idx; i < end_idx; ++i) { lldb::SBValue variable = top_scope->GetValueAtIndex(i); `` https://github.com/llvm/llvm-project/pull/106907 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Taking Linux Host Info header's base for AIX (PR #106910)
https://github.com/DhruvSrivastavaX created https://github.com/llvm/llvm-project/pull/106910 This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 #101657 The complete changes for porting are present in this draft PR: #102601 Taking Base code for Host Info header files from Linux, and setting up header files for AIX Host Info. 1. Added definition `-D__AIX__` 2. Setup header files for AIX Host Info as boilerplate. >From bf64f6ebf0e1b92c9a29b07adc4f5502e629c7cd Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava Date: Sun, 1 Sep 2024 09:26:34 -0500 Subject: [PATCH] Taking Linux Host Info base for AIX --- lldb/CMakeLists.txt | 6 +++ lldb/include/lldb/Host/HostGetOpt.h | 2 +- lldb/include/lldb/Host/HostInfo.h | 3 ++ lldb/include/lldb/Host/aix/AbstractSocket.h | 25 + lldb/include/lldb/Host/aix/Host.h | 22 lldb/include/lldb/Host/aix/HostInfoAIX.h| 43 +++ lldb/include/lldb/Host/aix/Ptrace.h | 60 + lldb/include/lldb/Host/aix/Support.h| 29 ++ lldb/include/lldb/Host/aix/Uio.h| 23 lldb/include/lldb/Host/common/GetOptInc.h | 4 +- 10 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 lldb/include/lldb/Host/aix/AbstractSocket.h create mode 100644 lldb/include/lldb/Host/aix/Host.h create mode 100644 lldb/include/lldb/Host/aix/HostInfoAIX.h create mode 100644 lldb/include/lldb/Host/aix/Ptrace.h create mode 100644 lldb/include/lldb/Host/aix/Support.h create mode 100644 lldb/include/lldb/Host/aix/Uio.h diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 59cdc4593463c1..f78b7619695c21 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -38,6 +38,12 @@ endif() include(LLDBConfig) include(AddLLDB) +# This has been added to keep the AIX build isolated for now. +# It will need to be modified later. +if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") + add_definitions("-D__AIX__") +endif() + # Define the LLDB_CONFIGURATION_xxx matching the build type. if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) add_definitions(-DLLDB_CONFIGURATION_DEBUG) diff --git a/lldb/include/lldb/Host/HostGetOpt.h b/lldb/include/lldb/Host/HostGetOpt.h index 52cfdf4dbb89c2..f450e561d6afb1 100644 --- a/lldb/include/lldb/Host/HostGetOpt.h +++ b/lldb/include/lldb/Host/HostGetOpt.h @@ -9,7 +9,7 @@ #ifndef LLDB_HOST_HOSTGETOPT_H #define LLDB_HOST_HOSTGETOPT_H -#if !defined(_MSC_VER) && !defined(__NetBSD__) +#if !defined(_MSC_VER) && !defined(__NetBSD__) && !defined(__AIX__) #include #include diff --git a/lldb/include/lldb/Host/HostInfo.h b/lldb/include/lldb/Host/HostInfo.h index b7010d69d88e7f..156df8cf6901df 100644 --- a/lldb/include/lldb/Host/HostInfo.h +++ b/lldb/include/lldb/Host/HostInfo.h @@ -55,6 +55,9 @@ #elif defined(__APPLE__) #include "lldb/Host/macosx/HostInfoMacOSX.h" #define HOST_INFO_TYPE HostInfoMacOSX +#elif defined(__AIX__) +#include "lldb/Host/aix/HostInfoAIX.h" +#define HOST_INFO_TYPE HostInfoAIX #else #include "lldb/Host/posix/HostInfoPosix.h" #define HOST_INFO_TYPE HostInfoPosix diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h new file mode 100644 index 00..78a567a6b90953 --- /dev/null +++ b/lldb/include/lldb/Host/aix/AbstractSocket.h @@ -0,0 +1,25 @@ +//===-- AbstractSocket.h *- C++ -*-===// +// +// 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 +// +//===--===// + +#ifndef liblldb_AbstractSocket_h_ +#define liblldb_AbstractSocket_h_ + +#include "lldb/Host/posix/DomainSocket.h" + +namespace lldb_private { +class AbstractSocket : public DomainSocket { +public: + AbstractSocket(bool child_processes_inherit); + +protected: + size_t GetNameOffset() const override; + void DeleteSocketFile(llvm::StringRef name) override; +}; +} + +#endif // ifndef liblldb_AbstractSocket_h_ diff --git a/lldb/include/lldb/Host/aix/Host.h b/lldb/include/lldb/Host/aix/Host.h new file mode 100644 index 00..ef1e74cd1d501b --- /dev/null +++ b/lldb/include/lldb/Host/aix/Host.h @@ -0,0 +1,22 @@ +//===-- Host.h --*- C++ -*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_HOST_LINUX_HOST_H +#define LLDB_HOST_LINUX_HOST_H + +#include "lldb/lldb-types.h" +#include + +namespace lldb_pri
[Lldb-commits] [lldb] [lldb-dap] Add: show return value on step out (PR #106907)
https://github.com/Da-Viper created https://github.com/llvm/llvm-project/pull/106907 https://github.com/user-attachments/assets/cff48c6f-37ae-4f72-b881-3eff4178fb3c >From 2ca64edb00d1f7b9d2938c9db32644c4a8cbc13e Mon Sep 17 00:00:00 2001 From: Ezike Ebuka Date: Sun, 1 Sep 2024 13:48:41 +0100 Subject: [PATCH] Add: show return value on step out --- lldb/tools/lldb-dap/lldb-dap.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index c5c4b09f15622b..c9116c62c46b5e 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -3801,6 +3801,17 @@ void request_variables(const llvm::json::Object &request) { variable_name_counts[GetNonNullVariableName(variable)]++; } +// Show return value if there is any ( in the top frame ) +auto process = g_dap.target.GetProcess(); +auto selectedThread = process.GetSelectedThread(); +lldb::SBValue stopReturnValue = selectedThread.GetStopReturnValue(); +if (stopReturnValue.IsValid() && +(selectedThread.GetSelectedFrame().GetFrameID() == 0)) { + auto renamedReturnValue = stopReturnValue.Clone("(Return Value)"); + variables.emplace_back( + CreateVariable(renamedReturnValue,0, UINT64_MAX, hex, false)); +} + // Now we construct the result with unique display variable names for (auto i = start_idx; i < end_idx; ++i) { lldb::SBValue variable = top_scope->GetValueAtIndex(i); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits