[Lldb-commits] [lldb] [lldb][AIX] Added Ptrace extensions for AIX (PR #108000)

2024-11-09 Thread Dhruv Srivastava via lldb-commits
https://github.com/DhruvSrivastavaX updated 
https://github.com/llvm/llvm-project/pull/108000

>From 426874ab276182858b75e9bbf8704dab1742757c Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava 
Date: Tue, 10 Sep 2024 04:38:32 -0500
Subject: [PATCH 1/4] Ptrace code base for AIX

---
 lldb/include/lldb/Host/aix/Ptrace.h | 60 +
 1 file changed, 60 insertions(+)
 create mode 100644 lldb/include/lldb/Host/aix/Ptrace.h

diff --git a/lldb/include/lldb/Host/aix/Ptrace.h 
b/lldb/include/lldb/Host/aix/Ptrace.h
new file mode 100644
index 00..aabd3fd4fc5573
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -0,0 +1,60 @@
+//===-- Ptrace.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
+//
+//===--===//
+
+// This file defines ptrace functions & structures
+
+#ifndef liblldb_Host_linux_Ptrace_h_
+#define liblldb_Host_linux_Ptrace_h_
+
+#include 
+
+#ifndef __GLIBC__
+typedef int __ptrace_request;
+#endif
+
+#define DEBUG_PTRACE_MAXBYTES 20
+
+// Support ptrace extensions even when compiled without required kernel support
+#ifndef PTRACE_GETREGS
+#define PTRACE_GETREGS 12
+#endif
+#ifndef PTRACE_SETREGS
+#define PTRACE_SETREGS 13
+#endif
+#ifndef PTRACE_GETFPREGS
+#define PTRACE_GETFPREGS 14
+#endif
+#ifndef PTRACE_SETFPREGS
+#define PTRACE_SETFPREGS 15
+#endif
+#ifndef PTRACE_GETREGSET
+#define PTRACE_GETREGSET 0x4204
+#endif
+#ifndef PTRACE_SETREGSET
+#define PTRACE_SETREGSET 0x4205
+#endif
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+#ifndef PTRACE_ARCH_PRCTL
+#define PTRACE_ARCH_PRCTL 30
+#endif
+#ifndef ARCH_GET_FS
+#define ARCH_SET_GS 0x1001
+#define ARCH_SET_FS 0x1002
+#define ARCH_GET_FS 0x1003
+#define ARCH_GET_GS 0x1004
+#endif
+#ifndef PTRACE_PEEKMTETAGS
+#define PTRACE_PEEKMTETAGS 33
+#endif
+#ifndef PTRACE_POKEMTETAGS
+#define PTRACE_POKEMTETAGS 34
+#endif
+
+#endif // liblldb_Host_linux_Ptrace_h_

>From 61bdaf75ddbd5940af5f23363311ffcacb0540d7 Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava 
Date: Tue, 10 Sep 2024 05:43:37 -0500
Subject: [PATCH 2/4] Modified specific to AIX

---
 lldb/include/lldb/Host/aix/Ptrace.h | 38 +
 1 file changed, 11 insertions(+), 27 deletions(-)

diff --git a/lldb/include/lldb/Host/aix/Ptrace.h 
b/lldb/include/lldb/Host/aix/Ptrace.h
index aabd3fd4fc5573..5d5ae82c9dab7d 100644
--- a/lldb/include/lldb/Host/aix/Ptrace.h
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -8,29 +8,25 @@
 
 // This file defines ptrace functions & structures
 
-#ifndef liblldb_Host_linux_Ptrace_h_
-#define liblldb_Host_linux_Ptrace_h_
+#ifndef liblldb_Host_aix_Ptrace_h_
+#define liblldb_Host_aix_Ptrace_h_
 
 #include 
 
-#ifndef __GLIBC__
-typedef int __ptrace_request;
-#endif
-
 #define DEBUG_PTRACE_MAXBYTES 20
 
 // Support ptrace extensions even when compiled without required kernel support
 #ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS 12
+#define PTRACE_GETREGS (PT_COMMAND_MAX + 1)
 #endif
 #ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS 13
+#define PTRACE_SETREGS (PT_COMMAND_MAX + 2)
 #endif
 #ifndef PTRACE_GETFPREGS
-#define PTRACE_GETFPREGS 14
+#define PTRACE_GETFPREGS (PT_COMMAND_MAX + 3)
 #endif
 #ifndef PTRACE_SETFPREGS
-#define PTRACE_SETFPREGS 15
+#define PTRACE_SETFPREGS (PT_COMMAND_MAX + 4)
 #endif
 #ifndef PTRACE_GETREGSET
 #define PTRACE_GETREGSET 0x4204
@@ -38,23 +34,11 @@ typedef int __ptrace_request;
 #ifndef PTRACE_SETREGSET
 #define PTRACE_SETREGSET 0x4205
 #endif
-#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA 25
-#endif
-#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL 30
-#endif
-#ifndef ARCH_GET_FS
-#define ARCH_SET_GS 0x1001
-#define ARCH_SET_FS 0x1002
-#define ARCH_GET_FS 0x1003
-#define ARCH_GET_GS 0x1004
-#endif
-#ifndef PTRACE_PEEKMTETAGS
-#define PTRACE_PEEKMTETAGS 33
+#ifndef PTRACE_GETVRREGS
+#define PTRACE_GETVRREGS (PT_COMMAND_MAX + 5)
 #endif
-#ifndef PTRACE_POKEMTETAGS
-#define PTRACE_POKEMTETAGS 34
+#ifndef PTRACE_GETVSRREGS
+#define PTRACE_GETVSRREGS (PT_COMMAND_MAX + 6)
 #endif
 
-#endif // liblldb_Host_linux_Ptrace_h_
+#endif // liblldb_Host_aix_Ptrace_h_

>From 1134b6fb81cedd75e447f42f788bb6d96351cdf3 Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava 
Date: Tue, 10 Sep 2024 08:32:41 -0500
Subject: [PATCH 3/4] Addressed comments

---
 lldb/include/lldb/Host/aix/Ptrace.h | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lldb/include/lldb/Host/aix/Ptrace.h 
b/lldb/include/lldb/Host/aix/Ptrace.h
index 5d5ae82c9dab7d..06678d1e1a2484 100644
--- a/lldb/include/lldb/Host/aix/Ptrace.h
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -8,13 +8,11 @@
 
 // This file defines ptrace functions & structures
 
-#ifndef liblldb_Host_aix_Ptrace_h_
-#defi

[Lldb-commits] [lldb] [lldb][AIX] Added Ptrace extensions for AIX (PR #108000)

2024-11-09 Thread Dhruv Srivastava via lldb-commits
DhruvSrivastavaX wrote:

Hi @labath 
To keep the changes for Process Plugin going forward, I have changed the file 
path as discussed. 
Will proceed to push the AIX Process Plugin related files next. 
Please review once more and see if we can proceed with the merge?
Once the NativeProcessAIX and other files come into play, I will optimize as 
per further suggestions from you. 

https://github.com/llvm/llvm-project/pull/108000
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Use heterogenous lookups with std::map (NFC) (PR #115590)

2024-11-09 Thread Nikita Popov via lldb-commits
https://github.com/nikic approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/115590
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Disable TestCancelAttach for Windows host (PR #115619)

2024-11-09 Thread Dmitry Vasilyev via lldb-commits
slydiman wrote:

https://lab.llvm.org/staging/#/builders/197/builds/76

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)

2024-11-09 Thread Kazu Hirata via lldb-commits
https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/115634

Heterogenous lookups allow us to call find with StringRef, avoiding a
temporary heap allocation of std::string.


>From 798021f7ff3a0f9578e7df39cc9bd6d11cb8c400 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Sat, 9 Nov 2024 14:48:11 -0800
Subject: [PATCH] [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;
   }

___
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)

2024-11-09 Thread via lldb-commits
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.


---
Full diff: https://github.com/llvm/llvm-project/pull/115634.diff


2 Files Affected:

- (modified) lldb/include/lldb/Interpreter/CommandObject.h (+6-4) 
- (modified) lldb/source/Commands/CommandObjectMultiword.cpp (+2-2) 


``diff
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;
   }

``




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][ObjC] Fix method list entry offset calculation (PR #115571)

2024-11-09 Thread Jonas Devlieghere via lldb-commits
https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/115571
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] c3c424d - [lldb-dap] Use heterogenous lookups with std::map (NFC) (#115590)

2024-11-09 Thread via lldb-commits
Author: Kazu Hirata
Date: 2024-11-09T08:22:41-08:00
New Revision: c3c424d2eafeba4ec25df8698e6311a8fa78fbfe

URL: 
https://github.com/llvm/llvm-project/commit/c3c424d2eafeba4ec25df8698e6311a8fa78fbfe
DIFF: 
https://github.com/llvm/llvm-project/commit/c3c424d2eafeba4ec25df8698e6311a8fa78fbfe.diff

LOG: [lldb-dap] 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.

Added: 


Modified: 
lldb/tools/lldb-dap/DAP.cpp
lldb/tools/lldb-dap/DAP.h

Removed: 




diff  --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 647e28080b6339..e45f9bf359e5bf 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -692,7 +692,7 @@ bool DAP::HandleObject(const llvm::json::Object &object) {
   const auto packet_type = GetString(object, "type");
   if (packet_type == "request") {
 const auto command = GetString(object, "command");
-auto handler_pos = request_handlers.find(std::string(command));
+auto handler_pos = request_handlers.find(command);
 if (handler_pos != request_handlers.end()) {
   handler_pos->second(object);
   return true; // Success

diff  --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index dab4ce44ab202c..1641a58c7dbd06 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -171,7 +171,7 @@ struct DAP {
   // the old process here so we can detect this case and keep running.
   lldb::pid_t restarting_process_id;
   bool configuration_done_sent;
-  std::map request_handlers;
+  std::map> request_handlers;
   bool waiting_for_run_in_terminal;
   ProgressEventReporter progress_event_reporter;
   // Keep track of the last stop thread index IDs as threads won't go away



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Use heterogenous lookups with std::map (NFC) (PR #115590)

2024-11-09 Thread Kazu Hirata via lldb-commits
https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/115590
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Transfer some environment variables into the tests on Windows build host (PR #115613)

2024-11-09 Thread via lldb-commits
llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)


Changes

Some API tests (compiler calls) create a lot of garbage and cause unexpected 
behavior in case of Windows host and Linux target, e.g.
```
lldb/test/API/commands/process/attach/%SystemDrive%/
lldb/test/API/functionalities/deleted-executable/%SystemDrive%/
lldb/test/API/functionalities/exec/%SystemDrive%/
lldb/test/API/functionalities/load_unload/%SystemDrive%/
lldb/test/API/functionalities/target-new-solib-notifications/%SystemDrive%/
lldb/test/API/functionalities/thread/create_after_attach/%SystemDrive%/
```
It can be fixed by transfer some standard Windows environment variables into 
API tests.

---
Full diff: https://github.com/llvm/llvm-project/pull/115613.diff


1 Files Affected:

- (modified) lldb/test/API/lit.cfg.py (+19) 


``diff
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 6ef09f36a1907e..febf8dc3d19021 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -334,3 +334,22 @@ def delete_module_cache(path):
 # Propagate XDG_CACHE_HOME
 if "XDG_CACHE_HOME" in os.environ:
 config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"]
+
+# Transfer some environment variables into the tests on Windows build host.
+if platform.system() == "Windows":
+for v in [
+"SystemDrive",
+"SystemRoot",
+"ALLUSERSPROFILE",
+"APPDATA",
+"LOCALAPPDATA",
+"USERDNSDOMAIN",
+"USERDOMAIN",
+"USERNAME",
+"USERPROFILE",
+"USERDOMAIN_ROAMINGPROFILE",
+"COMPUTERNAME",
+"ProgramData",
+]:
+if v in os.environ:
+config.environment[v] = os.environ[v]

``




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] Transfer some environment variables into the tests on Windows build host (PR #115613)

2024-11-09 Thread Dmitry Vasilyev via lldb-commits
https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/115613

Some API tests (compiler calls) create a lot of garbage and cause unexpected 
behavior in case of Windows host and Linux target, e.g.
```
lldb/test/API/commands/process/attach/%SystemDrive%/
lldb/test/API/functionalities/deleted-executable/%SystemDrive%/
lldb/test/API/functionalities/exec/%SystemDrive%/
lldb/test/API/functionalities/load_unload/%SystemDrive%/
lldb/test/API/functionalities/target-new-solib-notifications/%SystemDrive%/
lldb/test/API/functionalities/thread/create_after_attach/%SystemDrive%/
```
It can be fixed by transfer some standard Windows environment variables into 
API tests.

>From 17b3338decd050612d0b804ef6d9966912b0950b Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 9 Nov 2024 21:11:16 +0400
Subject: [PATCH] [lldb] Transfer some environment variables into the tests on
 Windows build host

Some API tests (compiler calls) create a lot of garbage and cause unexpected 
behavior in case of Windows host and Linux target, e.g.
```
lldb/test/API/commands/process/attach/%SystemDrive%/
lldb/test/API/functionalities/deleted-executable/%SystemDrive%/
lldb/test/API/functionalities/exec/%SystemDrive%/
lldb/test/API/functionalities/load_unload/%SystemDrive%/
lldb/test/API/functionalities/target-new-solib-notifications/%SystemDrive%/
lldb/test/API/functionalities/thread/create_after_attach/%SystemDrive%/
```
It can be fixed by transfer some standard Windows environment variables into 
API tests.
---
 lldb/test/API/lit.cfg.py | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 6ef09f36a1907e..febf8dc3d19021 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -334,3 +334,22 @@ def delete_module_cache(path):
 # Propagate XDG_CACHE_HOME
 if "XDG_CACHE_HOME" in os.environ:
 config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"]
+
+# Transfer some environment variables into the tests on Windows build host.
+if platform.system() == "Windows":
+for v in [
+"SystemDrive",
+"SystemRoot",
+"ALLUSERSPROFILE",
+"APPDATA",
+"LOCALAPPDATA",
+"USERDNSDOMAIN",
+"USERDOMAIN",
+"USERNAME",
+"USERPROFILE",
+"USERDOMAIN_ROAMINGPROFILE",
+"COMPUTERNAME",
+"ProgramData",
+]:
+if v in os.environ:
+config.environment[v] = os.environ[v]

___
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)

2024-11-09 Thread Dhruv Srivastava via lldb-commits
https://github.com/DhruvSrivastavaX updated 
https://github.com/llvm/llvm-project/pull/111814

>From 08c9d5ae66ca857d165dc878ebd1b2e0de364a24 Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava 
Date: Thu, 10 Oct 2024 02:24:42 -0500
Subject: [PATCH 1/8] Taking base file structure from ELF as reference

---
 .../ObjectFile/XCOFF/ObjectFileXCOFF.h| 440 ++
 1 file changed, 440 insertions(+)
 create mode 100644 lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h

diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h 
b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
new file mode 100644
index 00..aba3a5bfcbf5b6
--- /dev/null
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
@@ -0,0 +1,440 @@
+//===-- ObjectFileELF.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_SOURCE_PLUGINS_OBJECTFILE_ELF_OBJECTFILEELF_H
+#define LLDB_SOURCE_PLUGINS_OBJECTFILE_ELF_OBJECTFILEELF_H
+
+#include 
+
+#include 
+#include 
+
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
+#include "lldb/lldb-private.h"
+
+#include "ELFHeader.h"
+
+struct ELFNote {
+  elf::elf_word n_namesz = 0;
+  elf::elf_word n_descsz = 0;
+  elf::elf_word n_type = 0;
+
+  std::string n_name;
+
+  ELFNote() = default;
+
+  /// Parse an ELFNote entry from the given DataExtractor starting at position
+  /// \p offset.
+  ///
+  /// \param[in] data
+  ///The DataExtractor to read from.
+  ///
+  /// \param[in,out] offset
+  ///Pointer to an offset in the data.  On return the offset will be
+  ///advanced by the number of bytes read.
+  ///
+  /// \return
+  ///True if the ELFRel entry was successfully read and false otherwise.
+  bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
+
+  size_t GetByteSize() const {
+return 12 + llvm::alignTo(n_namesz, 4) + llvm::alignTo(n_descsz, 4);
+  }
+};
+
+/// \class ObjectFileELF
+/// Generic ELF object file reader.
+///
+/// This class provides a generic ELF (32/64 bit) reader plugin implementing
+/// the ObjectFile protocol.
+class ObjectFileELF : public lldb_private::ObjectFile {
+public:
+  // Static Functions
+  static void Initialize();
+
+  static void Terminate();
+
+  static llvm::StringRef GetPluginNameStatic() { return "elf"; }
+
+  static llvm::StringRef GetPluginDescriptionStatic() {
+return "ELF object file reader.";
+  }
+
+  static lldb_private::ObjectFile *
+  CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
+ lldb::offset_t data_offset, const lldb_private::FileSpec 
*file,
+ lldb::offset_t file_offset, lldb::offset_t length);
+
+  static lldb_private::ObjectFile *CreateMemoryInstance(
+  const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
+  const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
+
+  static size_t 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);
+
+  static bool MagicBytesMatch(lldb::DataBufferSP &data_sp, lldb::addr_t offset,
+  lldb::addr_t length);
+
+  // PluginInterface protocol
+  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
+
+  // LLVM RTTI support
+  static char ID;
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || ObjectFile::isA(ClassID);
+  }
+  static bool classof(const ObjectFile *obj) { return obj->isA(&ID); }
+
+  // ObjectFile Protocol.
+  bool ParseHeader() override;
+
+  bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value,
+  bool value_is_offset) override;
+
+  lldb::ByteOrder GetByteOrder() const override;
+
+  bool IsExecutable() const override;
+
+  uint32_t GetAddressByteSize() const override;
+
+  lldb_private::AddressClass GetAddressClass(lldb::addr_t file_addr) override;
+
+  void ParseSymtab(lldb_private::Symtab &symtab) override;
+
+  bool IsStripped() override;
+
+  void CreateSections(lldb_private::SectionList &unified_section_list) 
override;
+
+  void Dump(lldb_private::Stream *s) override;
+
+  lldb_private::ArchSpec GetArchitecture() override;
+
+  lldb_private::UUID GetUUID() override;
+
+  /// Return the contents of the .gnu_debuglink section, if the object file
+  

[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)

2024-11-09 Thread Dhruv Srivastava via lldb-commits
DhruvSrivastavaX 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!

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] Disable TestCancelAttach for Windows host (PR #115619)

2024-11-09 Thread Dmitry Vasilyev via lldb-commits
https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/115619

See #115618 for details.

>From 400bab13848936de4c5742b11e0d1d2f5e92f5ec Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sun, 10 Nov 2024 01:20:07 +0400
Subject: [PATCH] [lldb] Disable TestCancelAttach for Windows host

See #115618 for details.
---
 .../API/python_api/process/cancel_attach/TestCancelAttach.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py 
b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
index 9f643d50e58fc0..3be0a85d595002 100644
--- a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
+++ b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
@@ -14,6 +14,11 @@
 class AttachCancelTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
+@skipIf(
+remote=True,
+hostoslist=["windows"],
+bugnumber="https://github.com/llvm/llvm-project/issues/115618";,
+)
 def test_scripted_implementation(self):
 """Test that cancelling a stuck "attach waitfor" works."""
 # First make an empty target for the attach:

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Disable TestCancelAttach for Windows host (PR #115619)

2024-11-09 Thread via lldb-commits
llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)


Changes

See #115618 for details.

---
Full diff: https://github.com/llvm/llvm-project/pull/115619.diff


1 Files Affected:

- (modified) lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py 
(+5) 


``diff
diff --git a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py 
b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
index 9f643d50e58fc0..3be0a85d595002 100644
--- a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
+++ b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
@@ -14,6 +14,11 @@
 class AttachCancelTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
+@skipIf(
+remote=True,
+hostoslist=["windows"],
+bugnumber="https://github.com/llvm/llvm-project/issues/115618";,
+)
 def test_scripted_implementation(self):
 """Test that cancelling a stuck "attach waitfor" works."""
 # First make an empty target for the attach:

``




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