[Lldb-commits] [lldb] [lldb][lldb-dap] Support breakpoint info bytes (PR #141122)

2025-05-29 Thread Ebuka Ezike via lldb-commits


@@ -16,12 +15,61 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x-}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+  // request if SBProcess::GetMemoryRegionInfo returns error.
+  if (err.Success() && !(region.IsReadable() || region.IsWritable())) {
+response.description = llvm::formatv(
+"memory region for address {} has no read or write permissions",
+load_addr);
+
+  } else {
+response.description =
+llvm::formatv("{} bytes at {:x}", byte_size, load_addr);
+response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,

da-viper wrote:

Would this also apply to the default databreakpointinfo since since we know 
that we are able read and write to the address of the scope variables ? 

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, Breakpoints. (PR #141983)

2025-05-29 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, attach tests. (PR #141981)

2025-05-29 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


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


[Lldb-commits] [lldb] [LLDB] Add bit extraction to DIL (PR #141422)

2025-05-29 Thread via lldb-commits

jimingham wrote:

I agree with Pavel that using `-` for ranges of bitfields was an unfortunate 
choice, which really only worked because we didn't intend to provide the 
addition operators in the ValueObject path specifications.  Now that we're 
going to add those, we ought to switch to something that isn't ambiguous.  And 
operations on one of the ends of a range request seem like something you really 
might want to do.

If we are worried about supporting older uses of path expressions while we're 
quite dramatically expanding what you can express in this syntax, we probably 
should make the parser have a mode where it emulates the old path expression, 
turning off the new operators.

`:` seems like a fine separator.  C# seems to use `..` and swift uses `...` and 
`..<` for the open and half-open ranges.  But it seems like a single character 
is simpler?

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


[Lldb-commits] [lldb] [lldb-dap] Treat empty thread names as unset (PR #141529)

2025-05-29 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Remove intrusive reference count from `DiagnosticOptions` (PR #139584)

2025-05-29 Thread James Y Knight via lldb-commits

jyknight wrote:

I'm trying to update some non-in-tree code after this change, and I don't think 
I understand the newly-expected lifetime rules after this change. I see all the 
comments that say this makes lifetime clearer...so I expect I'm just 
misunderstanding things.

Previously, DiagnosticsEngine kept a DiagnosticOptions member via 
IntrusiveRefCntPtr, which meant the DiagnosticsOptions lifetime would be at 
least as long as the DiagnosticsEngine.

Now, it stores a reference. Which means, I think, that the creator of a 
DiagnosticsEngine needs to somehow ensure by themselves that the 
DiagnosticsOptions value has a sufficiently long lifetime.

But this seems very hard to figure out what lifetimes should be now, because 
DiagnosticsEngine is, itself, refcounted. How does it make sense to have a 
borrowed reference to DiagnosticsOption in the refcounted DiagnosticsEngine 
type? ISTM the caller who creates a DiagnosticsEngine cannot now easily know 
what the lifetime of the DiagnosticsEngine is going to be, and thus, has no way 
to ensure the DiagnosticsOptions lifetime is correct?

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

I'm going to wait to see how many build issues we get before landing.

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Pavel Labath via lldb-commits

labath wrote:

Ummm... I should have caught this before, but this isn't correct because the 
host system may (and some do) use different signal numbers for these constants. 

So, on windows, you get an undefined symbol error, but on e.g. macos, you'd 
just get a wrong value. You should take these values from the UnixSignals 
object.

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits


@@ -34,6 +34,20 @@
 #define MAP_PRIVATE 2
 #define MAP_ANON 0x20
 
+// For other platforms that use platform linux
+#ifndef SIGILL
+#define SIGILL 4
+#endif
+#ifndef SIGBUS
+#define SIGBUS 7
+#endif
+#ifndef SIGFPE
+#define SIGFPE 8
+#endif
+#ifndef SIGSEGV
+#define SIGSEGV 11

Jlalond wrote:

They're all defined in 
[signal.h](https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/signal.h),
 but we can build this class on a platform that won't have access to signal.h, 
so we need to ensure they're defined. 

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


[Lldb-commits] [lldb] Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (PR #141670)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

Hey @felipepiovezan am I reading green dragon right 
https://green.lab.llvm.org/job/llvm.org/job/as-lldb-cmake/changes

Looks like the build with my changes failed (with I believe unrelated test 
failures), then went green? Does that mean we're working on Darwin? 

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


[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)

2025-05-29 Thread via lldb-commits

dlav-sc wrote:

@DavidSpickett, @asb could you take another look at this patch, please?

I've added support for instructional step for any possible riscv atomic 
sequence (or at least I believe so). Additionally, I've made some minor 
refactoring to the software's single-step logic.

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


[Lldb-commits] [lldb] [lldb-dap] fix config value comparison (PR #142017)

2025-05-29 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen created 
https://github.com/llvm/llvm-project/pull/142017

Fix TypeSCript comparison (when defining an empty config string like 
`commandEscapePrefix=""` it would skip it)

>From 8632a15c5fa4a11b1a108d9b763b9241b5a2bc41 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Thu, 29 May 2025 21:22:58 +0200
Subject: [PATCH] [lldb-dap] fix config value comparison

---
 lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts 
b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts
index 957bc5e1eb956..316ffaf47c3d2 100644
--- a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts
+++ b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts
@@ -84,7 +84,7 @@ export class LLDBDapConfigurationProvider
 continue;
   }
   const value = config.get(key);
-  if (!value || value === cfg.default) {
+  if (value === undefined || value === cfg.default) {
 continue;
   }
   switch (cfg.type) {

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


[Lldb-commits] [lldb] [lldb-dap] fix config value comparison (PR #142017)

2025-05-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ely Ronnen (eronnen)


Changes

Fix TypeSCript comparison (when defining an empty config string like 
`commandEscapePrefix=""` it would skip it)

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


1 Files Affected:

- (modified) lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts (+1-1) 


``diff
diff --git a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts 
b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts
index 957bc5e1eb956..316ffaf47c3d2 100644
--- a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts
+++ b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts
@@ -84,7 +84,7 @@ export class LLDBDapConfigurationProvider
 continue;
   }
   const value = config.get(key);
-  if (!value || value === cfg.default) {
+  if (value === undefined || value === cfg.default) {
 continue;
   }
   switch (cfg.type) {

``




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


[Lldb-commits] [lldb] Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (PR #141670)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

Put up a fix for Windows on #141971 

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


[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)

2025-05-29 Thread via lldb-commits

https://github.com/dlav-sc edited 
https://github.com/llvm/llvm-project/pull/127505
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread Dhruv Srivastava via lldb-commits

DhruvSrivastavaX wrote:

@labath 
> The code seems okay. I don't know anything about the format, so I don't know 
> which parts are "obvious" and which not, but I'd encourage you to add 
> comments where you think it might be useful.

Sure, I have added some comments for that now. 

> You're right that lldb-test doesn't dump symbols. You should be able to test 
> these changes with something like `lldb %t -o "image dump symtab"`, but if 
> you find that is missing some crucial piece of information, it would also be 
> fine to extend lldb-test to dump the data you need

Yes, I had checked it using `image dump symtab` itself, my symbols do get 
added. 
As for the `lldb-test` not emitting symbols, I will create an issue for it so 
that we can start upgrading lldb-test as well. 


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


[Lldb-commits] [lldb] [lldb][lldb-dap] Support breakpoint info bytes (PR #141122)

2025-05-29 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper updated 
https://github.com/llvm/llvm-project/pull/141122

>From 9408d17b1acf308c7a299bdc6c413a3505d1a039 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 21 May 2025 23:26:14 +0100
Subject: [PATCH 1/9] [lldb][lldb-dap] support DataBreakpointBytes capability

---
 .../DataBreakpointInfoRequestHandler.cpp  | 48 ++-
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  3 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  2 +-
 3 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
index 8cb25d0603449..9b969560d7973 100644
--- a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
 #include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 #include "lldb/API/SBMemoryRegionInfo.h"
@@ -16,12 +15,59 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+  // request if SBProcess::GetMemoryRegionInfo returns error.
+  if (err.Success() && !(region.IsReadable() || region.IsWritable())) {
+response.description = llvm::formatv(
+"memory region for address {} has no read or write permissions",
+load_addr);
+  } else {
+response.description = llvm::formatv("{} bytes at {:x}", load_addr);
+response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,
+protocol::eDataBreakpointAccessTypeWrite,
+protocol::eDataBreakpointAccessTypeReadWrite};
+  }
+
+  return response;
+}
+
 /// Obtains information on a possible data breakpoint that could be set on an
 /// expression or variable. Clients should only call this request if the
 /// corresponding capability supportsDataBreakpoints is true.
 llvm::Expected
 DataBreakpointInfoRequestHandler::Run(
 const protocol::DataBreakpointInfoArguments &args) const {
+
+  if (args.asAddress.value_or(false))
+return HandleDataBreakpointBytes(dap, args);
+
   protocol::DataBreakpointInfoResponseBody response;
   lldb::SBFrame frame = dap.GetLLDBFrame(args.frameId.value_or(UINT64_MAX));
   lldb::SBValue variable = dap.variables.FindVariable(
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 3a965bcc87a5e..dec68683fee65 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -420,6 +420,9 @@ class DataBreakpointInfoRequestHandler
 public:
   using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "dataBreakpointInfo"; }
+  FeatureSet GetSupportedFeatures() const override {
+return {protocol::eAdapterFeatureDataBreakpointBytes};
+  }
   llvm::Expected
   Run(const protocol::DataBreakpointInfoArguments &args) const override;
 };
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 7c774e50d6e56..cde441351fc88 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -668,7 +668,7 @@ struct DataBreakpointInfoArguments {
   /// pause on data access anywhere within that range.
   /// Clients may set this property only if the `supportsDataBreakpointBytes`
   /// capability is true.
-  std::optional bytes;
+  std::optional bytes;
 
   /// If `true`, the `name` is a memory address and the debugger should
   /// interpret it as a decimal value, or hex value if it is prefixed with 
`0x`.

>From e407716994a4ed0b054984c21a4824a06adebd7a Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Thu, 22 May 2025 15:18:57 +0100
Subject: [PATCH 2/9] [lldb]

[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread David Peixotto via lldb-commits

https://github.com/dmpots approved this pull request.

Approving to unblock windows build break.

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread David Peixotto via lldb-commits


@@ -34,6 +34,20 @@
 #define MAP_PRIVATE 2
 #define MAP_ANON 0x20
 
+// For other platforms that use platform linux

dmpots wrote:

Are these guaranteed to be defines and not constants? 

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread David Peixotto via lldb-commits


@@ -34,6 +34,20 @@
 #define MAP_PRIVATE 2
 #define MAP_ANON 0x20
 
+// For other platforms that use platform linux
+#ifndef SIGILL
+#define SIGILL 4
+#endif
+#ifndef SIGBUS
+#define SIGBUS 7
+#endif
+#ifndef SIGFPE
+#define SIGFPE 8
+#endif
+#ifndef SIGSEGV
+#define SIGSEGV 11

dmpots wrote:

You mentioned offline that we define these somewhere else as well? Would be 
good to have a cleanup to unify them into a single header I think.

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread David Peixotto via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread John Harrison via lldb-commits

ashgti wrote:

Looks like my tests failed on the buildkit linux host, looking into why 
python3.10 failed. They passed on the 'CI Checks / Build and Test Linux' but 
that has python 3.12.

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


[Lldb-commits] [lldb] 5fe9aea - Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (#141670)

2025-05-29 Thread via lldb-commits

Author: Jacob Lalonde
Date: 2025-05-29T08:43:55-07:00
New Revision: 5fe9aea6d128a8569e27f8c66272e481f10c61ae

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

LOG: Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." 
(#141670)

After some debugging, I found out ProcessELFCore never updates the
platform. I've updated ProcessElfCore to set the arch and platform
before we parse the Notes.

Added: 


Modified: 
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/Target/UnixSignals.h
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
lldb/source/Plugins/Process/elf-core/ThreadElfCore.h
lldb/source/Target/UnixSignals.cpp
lldb/unittests/Signals/UnixSignalsTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index a702abb540fd9..35ffdabf907e7 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -21,6 +21,7 @@
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/File.h"
 #include "lldb/Interpreter/Options.h"
+#include "lldb/Target/StopInfo.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/FileSpec.h"
@@ -960,6 +961,8 @@ class Platform : public PluginInterface {
 
   virtual CompilerType GetSiginfoType(const llvm::Triple &triple);
 
+  virtual lldb::StopInfoSP GetStopInfoFromSiginfo(Thread &thread) { return {}; 
}
+
   virtual Args GetExtraStartupCommands();
 
   typedef std::function code = std::nullopt,
std::optional addr = std::nullopt,
std::optional lower = std::nullopt,
-   std::optional upper = std::nullopt) const;
+   std::optional upper = std::nullopt,
+   std::optional pid = std::nullopt,
+   std::optional uid = std::nullopt) const;
 
   bool SignalIsValid(int32_t signo) const;
 
@@ -105,7 +107,7 @@ class UnixSignals {
  llvm::StringRef description,
  llvm::StringRef alias = llvm::StringRef());
 
-  enum SignalCodePrintOption { None, Address, Bounds };
+  enum SignalCodePrintOption { None, Address, Bounds, Sender };
 
   // Instead of calling this directly, use a ADD_SIGCODE macro to get compile
   // time checks when on the native platform.

diff  --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 9db2c83acc125..cb60caf1cb422 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -14,6 +14,7 @@
 #include 
 #endif
 
+#include "Plugins/Process/Utility/LinuxSignals.h"
 #include "Utility/ARM64_DWARF_Registers.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/PluginManager.h"
@@ -480,3 +481,107 @@ CompilerType PlatformLinux::GetSiginfoType(const 
llvm::Triple &triple) {
   ast->CompleteTagDeclarationDefinition(siginfo_type);
   return siginfo_type;
 }
+
+static std::string GetDescriptionFromSiginfo(lldb::ValueObjectSP siginfo_sp) {
+  if (!siginfo_sp)
+return "";
+
+  lldb_private::LinuxSignals linux_signals;
+  int code = 
siginfo_sp->GetChildMemberWithName("si_code")->GetValueAsSigned(0);
+  int signo =
+  siginfo_sp->GetChildMemberWithName("si_signo")->GetValueAsSigned(-1);
+
+  auto sifields = siginfo_sp->GetChildMemberWithName("_sifields");
+  if (!sifields)
+return linux_signals.GetSignalDescription(signo, code);
+
+  // declare everything that we can populate later.
+  std::optional addr;
+  std::optional upper;
+  std::optional lower;
+  std::optional pid;
+  std::optional uid;
+
+  // The negative si_codes are special and mean this signal was sent from user
+  // space not the kernel. These take precedence because they break some of the
+  // invariants around kernel sent signals. Such as SIGSEGV won't have an
+  // address.
+  if (code < 0) {
+auto sikill = sifields->GetChildMemberWithName("_kill");
+if (sikill) {
+  auto pid_sp = sikill->GetChildMemberWithName("si_pid");
+  if (pid_sp)
+pid = pid_sp->GetValueAsUnsigned(-1);
+  auto uid_sp = sikill->GetChildMemberWithName("si_uid");
+  if (uid_sp)
+uid = uid_sp->GetValueAsUnsigned(-1);
+}
+  } else {
+
+switch (signo) {
+case SIGILL:
+case SIGFPE:
+case SIGBUS: {
+  auto sigfault = sifields->GetChildMemberWithName("_sigfault");
+  if (!sigfault)
+break;
+
+  auto addr_sp = sigfault->GetChildM

[Lldb-commits] [lldb] Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (PR #141670)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

@JDevlieghere I did run this on my local Mac (Very slowly on an M1 🥲). Got no 
failures, but still FYI

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Support breakpoint info bytes (PR #141122)

2025-05-29 Thread Ebuka Ezike via lldb-commits


@@ -16,12 +15,61 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x-}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this

da-viper wrote:

We could use it since `GetMemoryRegionInfo` falls back to 
[qXfer-memory-map-read](https://sourceware.org/gdb/current/onlinedocs/gdb.html/General-Query-Packets.html#qXfer-memory-map-read)
https://github.com/llvm/llvm-project/blob/ba75febd4fd2d02d19ee67d30b7f9c7a5f017248/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp#L1707-L1729

just have to update it to set readable and writeable. 

https://github.com/llvm/llvm-project/pull/141122
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett commented:

I'm a bit bothered by how many `continue` are here, but they seem to be here 
for good reasons.

Once you've addressed this round of comments I'll read it again and see if it's 
clearer to me.

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle

DavidSpickett wrote:

This dot prefix is what exactly, is it an expectation of XCOFF in general? 
Seems like only some symbols will have it.

You say "for demangle" but it's not clear where that happens or if you mean 
remove it so that some other thing later can do it. If it does happen in this 
function perhaps clarify:
```
// Remove the dot prefix so that we can demangle it.
```
Now the link between action and purpose is clearer.

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle
+llvm::StringRef symbol_name =
+symbolName.starts_with(".") ? symbolName.drop_front() : symbolName;
+auto storageClass = xcoff_sym_ref.getStorageClass();
+if (storageClass == XCOFF::C_HIDEXT && symbolName != "TOC") {
+  if (xcoff_sym_ref.getNumberOfAuxEntries() != 1)
+continue;
+  auto aux_csect_or_err = xcoff_sym_ref.getXCOFFCsectAuxRef();
+  if (!aux_csect_or_err) {
+consumeError(aux_csect_or_err.takeError());
+continue;
+  }
+  const llvm::object::XCOFFCsectAuxRef csect_aux = aux_csect_or_err.get();
+  if (csect_aux.getStorageMappingClass() != XCOFF::XMC_PR ||
+  (m_binary->is64Bit() ? (csect_aux.getAuxType64() != XCOFF::AUX_CSECT)
+   : false))
+continue;

DavidSpickett wrote:

Yes please, my reaction was "this looks very clever but needs to be refactored" 
:)

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle
+llvm::StringRef symbol_name =
+symbolName.starts_with(".") ? symbolName.drop_front() : symbolName;
+auto storageClass = xcoff_sym_ref.getStorageClass();
+if (storageClass == XCOFF::C_HIDEXT && symbolName != "TOC") {
+  if (xcoff_sym_ref.getNumberOfAuxEntries() != 1)
+continue;
+  auto aux_csect_or_err = xcoff_sym_ref.getXCOFFCsectAuxRef();
+  if (!aux_csect_or_err) {
+consumeError(aux_csect_or_err.takeError());
+continue;
+  }
+  const llvm::object::XCOFFCsectAuxRef csect_aux = aux_csect_or_err.get();
+  if (csect_aux.getStorageMappingClass() != XCOFF::XMC_PR ||
+  (m_binary->is64Bit() ? (csect_aux.getAuxType64() != XCOFF::AUX_CSECT)
+   : false))
+continue;
+}
+
+Symbol symbol;
+symbol.GetMangled().SetValue(ConstString(symbol_name));
+
+int16_t sectionNumber = xcoff_sym_ref.getSectionNumber();

DavidSpickett wrote:

But later you say:
```
if (sectionNumber > 0 
```
and it's a signed int, so it could be negative.

So if it can be 0, then sectionIndex could become 0x. Now maybe 
it doesn't get used in that scenario but if it did, it would not do good things.

I would move the `if sectionNumber > 0` up to before you calculate the section 
index. Then you aren't creating random sectionIndex values. 

Plus, it should be clearer then what range of values we expect from 
sectionNumber.

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle
+llvm::StringRef symbol_name =
+symbolName.starts_with(".") ? symbolName.drop_front() : symbolName;
+auto storageClass = xcoff_sym_ref.getStorageClass();
+if (storageClass == XCOFF::C_HIDEXT && symbolName != "TOC") {
+  if (xcoff_sym_ref.getNumberOfAuxEntries() != 1)
+continue;
+  auto aux_csect_or_err = xcoff_sym_ref.getXCOFFCsectAuxRef();
+  if (!aux_csect_or_err) {
+consumeError(aux_csect_or_err.takeError());
+continue;
+  }
+  const llvm::object::XCOFFCsectAuxRef csect_aux = aux_csect_or_err.get();
+  if (csect_aux.getStorageMappingClass() != XCOFF::XMC_PR ||
+  (m_binary->is64Bit() ? (csect_aux.getAuxType64() != XCOFF::AUX_CSECT)
+   : false))
+continue;
+}
+
+Symbol symbol;
+symbol.GetMangled().SetValue(ConstString(symbol_name));
+
+int16_t sectionNumber = xcoff_sym_ref.getSectionNumber();
+size_t sectionIndex = static_cast(sectionNumber - 1);
+if (sectionNumber > 0 && sectionIndex < sectionList->GetSize()) {
+  lldb::SectionSP section_sp =
+  sectionList->GetSectionAtIndex(sectionNumber - 1);

DavidSpickett wrote:

`sectionNumber -1` is just the `sectionIndex` you already made, I think the 
parameter type is also size_t so you can just use it here.

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle
+llvm::StringRef symbol_name =
+symbolName.starts_with(".") ? symbolName.drop_front() : symbolName;
+auto storageClass = xcoff_sym_ref.getStorageClass();
+if (storageClass == XCOFF::C_HIDEXT && symbolName != "TOC") {
+  if (xcoff_sym_ref.getNumberOfAuxEntries() != 1)
+continue;
+  auto aux_csect_or_err = xcoff_sym_ref.getXCOFFCsectAuxRef();
+  if (!aux_csect_or_err) {
+consumeError(aux_csect_or_err.takeError());
+continue;
+  }
+  const llvm::object::XCOFFCsectAuxRef csect_aux = aux_csect_or_err.get();
+  if (csect_aux.getStorageMappingClass() != XCOFF::XMC_PR ||
+  (m_binary->is64Bit() ? (csect_aux.getAuxType64() != XCOFF::AUX_CSECT)
+   : false))
+continue;
+}
+
+Symbol symbol;
+symbol.GetMangled().SetValue(ConstString(symbol_name));
+
+int16_t sectionNumber = xcoff_sym_ref.getSectionNumber();

DavidSpickett wrote:

I assume this is defined by some XCOFF standard to start at 1? So the line 
below isn't going to be doing 0 - 1, at minimum it will be 1-1.

I would add a clarifying comment here:
```
// Note that XCOFF section numbers start from 1.
```
Assuming that's correct.

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)

DavidSpickett wrote:

Could also be written as:
```
switch (symboltype):
case foo: return bla;
...
default: ...
```

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}

DavidSpickett wrote:

The use of `continue` is ok but I find it harder to read when there is:
```
continue;
immediately more code here
```
Please put a blank line after each continue or block that contains the 
continue, like:
```
if (bla) {
  continue;
}

rest of code goes here
```

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread David Spickett via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {

DavidSpickett wrote:

Mark this `static`, because it's only used in this file.

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


[Lldb-commits] [lldb] Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (PR #141670)

2025-05-29 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-win` 
running on `as-builder-10` while building `lldb` at step 8 "build-default".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/197/builds/5997


Here is the relevant piece of the build log for the reference

```
Step 8 (build-default) failure: cmake (failure)
...
110.921 [633/130/4709]Building CXX object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\SBWatchpoint.cpp.obj
110.945 [632/130/4710]Building CXX object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\SBTypeEnumMember.cpp.obj
111.136 [631/130/4711]Building CXX object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\SBValueList.cpp.obj
111.178 [630/130/4712]Building CXX object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\SBVariablesOptions.cpp.obj
111.399 [629/130/4713]Building CXX object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\SBWatchpointOptions.cpp.obj
111.622 [628/130/4714]Building CXX object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\SBValue.cpp.obj
111.676 [627/130/4715]Linking CXX static library lib\lldbValueObject.lib
111.824 [626/130/4716]Building CXX object 
tools\lldb\tools\lldb-dap\CMakeFiles\lldbDAP.dir\DAPLog.cpp.obj
112.070 [625/130/4717]Building CXX object 
tools\lldb\tools\lldb-dap\CMakeFiles\lldbDAP.dir\DAPError.cpp.obj
112.170 [624/130/4718]Building CXX object 
tools\lldb\source\Plugins\Platform\Linux\CMakeFiles\lldbPluginPlatformLinux.dir\PlatformLinux.cpp.obj
FAILED: 
tools/lldb/source/Plugins/Platform/Linux/CMakeFiles/lldbPluginPlatformLinux.dir/PlatformLinux.cpp.obj
 
ccache 
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe
  /nologo /TP -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE 
-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS 
-D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\source\Plugins\Platform\Linux
 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\Platform\Linux
 -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\include 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\include 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\build\include 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include 
-IC:\Python312\include 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\..\clang\include 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\..\clang\include 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source 
-IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\source 
-D__OPTIMIZE__ /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj 
/permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 
-wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 
-wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 
-wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 
-wd4275 -w14062 -we4238 /Gw /O2 /Ob2  -MD   -wd4018 -wd4068 -wd4150 -wd4201 
-wd4251 -wd4521 -wd4530 -wd4589  /EHs-c- /GR- -UNDEBUG -std:c++17 /showIncludes 
/Fotools\lldb\source\Plugins\Platform\Linux\CMakeFiles\lldbPluginPlatformLinux.dir\PlatformLinux.cpp.obj
 
/Fdtools\lldb\source\Plugins\Platform\Linux\CMakeFiles\lldbPluginPlatformLinux.dir\lldbPluginPlatformLinux.pdb
 /FS -c 
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\Platform\Linux\PlatformLinux.cpp
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\Platform\Linux\PlatformLinux.cpp(524):
 error C2065: 'SIGBUS': undeclared identifier
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\Platform\Linux\PlatformLinux.cpp(524):
 error C2131: expression did not evaluate to a constant
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\Platform\Linux\PlatformLinux.cpp(524):
 note: a non-constant (sub-)expression was encountered
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\Platform\Linux\PlatformLinux.cpp(524):
 error C2051: case expression not constant
112.294 [624/129/4719]Building CXX object 
tools\lldb\tools\lldb-dap\CMakeFiles\lldbDAP.dir\BreakpointBase.cpp.obj
112.330 [624/128/4720]Building CXX object 
tools\lldb\source\Plugins\Language\CPlusPlus\CMakeFiles\lldbPluginCPlusPlusLanguage.dir\Coroutines.cpp.obj
112.357 [624/127/4721]Building CXX object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\__\__\bindings\python\LLDBWrapPython.cpp.obj
cl : Command line warning D9025 : overriding '/W4' with '/W0'
112.365 [624/126/4722]Building RC object 
tools\lldb\source\API\CMakeFiles\liblldb.dir\C_\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\resources\windows_version_resource.rc.re

[Lldb-commits] [lldb] Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (PR #141670)

2025-05-29 Thread Jacob Lalonde via lldb-commits

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Support breakpoint info bytes (PR #141122)

2025-05-29 Thread John Harrison via lldb-commits


@@ -16,12 +15,61 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x-}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+  // request if SBProcess::GetMemoryRegionInfo returns error.
+  if (err.Success() && !(region.IsReadable() || region.IsWritable())) {
+response.description = llvm::formatv(
+"memory region for address {} has no read or write permissions",
+load_addr);
+
+  } else {
+response.description =
+llvm::formatv("{} bytes at {:x}", byte_size, load_addr);
+response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,

ashgti wrote:

I think that depends on the variable, right? If its mutable, then it would be 
rw but some variables are `const` or if the compiler optimized a variable away, 
it may not be something we can mutate.

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Pavel Labath via lldb-commits

labath wrote:

> Are these actually different on Mac? These 4 are the same on BSD to my 
> knowledge.

I haven't checked, I guess these four might be the same on a mac, but that 
definitely is not the case everywhere. We're currently growing AIX support, and 
that one seems to have different numbers: 
https://www.ibm.com/docs/en/sdk-java-technology/8?topic=reference-signal-handling.
 According to the linux manpage, the values can vary even across linux 
different architectures.

> I'm not sure how Linux Signals is building actually, but it appears to have 
> built successfully

Uses some macro trickery. We provide the symbolic constant and the value. We 
always use the constant value, but on linux, the macro also expands to a 
static_assert which checks that our constant matches what the system headers 
say.



> @labath I'm landing to not leave the build broken, but if you have a better 
> solution/means of doing this let me know and I'll implement it

You should be able to get the UnixSignals object from the thread 
(`->GetProces()->GetUnixSignals()`). Then, instead of the symbolic constant 
(e.g. SIGSEGV), you compare the signal number to value from that object 
(`signals->GetSignalNumberFromName("SIGSEGV")`).

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


[Lldb-commits] [lldb] [LLDB] Add bit extraction to DIL (PR #141422)

2025-05-29 Thread Pavel Labath via lldb-commits

labath wrote:

> If we are worried about supporting older uses of path expressions while we're 
> quite dramatically expanding what you can express in this syntax, we probably 
> should make the parser have a mode where it emulates the old path expression, 
> turning off the new operators.

FTR, I am *not* worried about supporting older uses. I was just anticipating 
that someone might be. As far as I am concerned we can pretty much any aspect 
of the path expression (but let's do that after flipping the flag).

> `:` seems like a fine separator. C# seems to use `..` and swift uses `...` 
> and `..<` for the open and half-open ranges. But it seems like a single 
> character is simpler?

Ah, I didn't realise this was so diverse. `:` would still be my first choice, 
but I'd be fine with the other options as well...

https://github.com/llvm/llvm-project/pull/141422
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread Dhruv Srivastava via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle
+llvm::StringRef symbol_name =
+symbolName.starts_with(".") ? symbolName.drop_front() : symbolName;
+auto storageClass = xcoff_sym_ref.getStorageClass();
+if (storageClass == XCOFF::C_HIDEXT && symbolName != "TOC") {
+  if (xcoff_sym_ref.getNumberOfAuxEntries() != 1)
+continue;
+  auto aux_csect_or_err = xcoff_sym_ref.getXCOFFCsectAuxRef();
+  if (!aux_csect_or_err) {
+consumeError(aux_csect_or_err.takeError());
+continue;
+  }
+  const llvm::object::XCOFFCsectAuxRef csect_aux = aux_csect_or_err.get();
+  if (csect_aux.getStorageMappingClass() != XCOFF::XMC_PR ||
+  (m_binary->is64Bit() ? (csect_aux.getAuxType64() != XCOFF::AUX_CSECT)
+   : false))
+continue;

DhruvSrivastavaX wrote:

Yes, my effort to avoid another `continue` 🙂 .
But I have modified that now. 

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

@labath I'm landing to not leave the build broken, but if you have a better 
solution/means of doing this let me know and I'll implement it

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


[Lldb-commits] [lldb] 159646c - [LLDB] Add ifndef to platform linux (#141971)

2025-05-29 Thread via lldb-commits

Author: Jacob Lalonde
Date: 2025-05-29T11:20:05-07:00
New Revision: 159646cd39eb6451c8906a65e04d2566882f

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

LOG: [LLDB] Add ifndef to platform linux (#141971)

Another iteration of fixes for #141670. Platform linux can be used by
other platforms, so we need to supply the signal values if they're not
defined.

Values are from the
[manpage](https://man7.org/linux/man-pages/man7/signal.7.html)

Added: 


Modified: 
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index cb60caf1cb422..dd6490c7141e5 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -34,6 +34,20 @@
 #define MAP_PRIVATE 2
 #define MAP_ANON 0x20
 
+// For other platforms that use platform linux
+#ifndef SIGILL
+#define SIGILL 4
+#endif
+#ifndef SIGBUS
+#define SIGBUS 7
+#endif
+#ifndef SIGFPE
+#define SIGFPE 8
+#endif
+#ifndef SIGSEGV
+#define SIGSEGV 11
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::platform_linux;



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


[Lldb-commits] [lldb] [LLDB] Add bit extraction to DIL (PR #141422)

2025-05-29 Thread via lldb-commits

cmtice wrote:

> I agree with Pavel that using `-` for ranges of bitfields was an unfortunate 
> choice, which really only worked because we didn't intend to provide the 
> addition operators in the ValueObject path specifications. Now that we're 
> going to add those, we ought to switch to something that isn't ambiguous. And 
> operations on one of the ends of a range request seem like something you 
> really might want to do.
> 
> If we are worried about supporting older uses of path expressions while we're 
> quite dramatically expanding what you can express in this syntax, we probably 
> should make the parser have a mode where it emulates the old path expression, 
> turning off the new operators.
> 
> `:` seems like a fine separator. C# seems to use `..` and swift uses `...` 
> and `..<` for the open and half-open ranges. But it seems like a single 
> character is simpler?

My 2 cents: I prefer using ':'

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-29 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/141426

>From 4c20703077eb4bbee8cfeb59022dec89d8697d83 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Wed, 21 May 2025 23:39:56 +0200
Subject: [PATCH 1/4] Reuse creation of Source objects for assembly and normal
 sources

---
 lldb/tools/lldb-dap/Breakpoint.cpp|  14 +-
 .../Handler/DisassembleRequestHandler.cpp |  21 +--
 .../Handler/LocationsRequestHandler.cpp   |  10 +-
 .../Handler/StackTraceRequestHandler.cpp  |   6 +-
 lldb/tools/lldb-dap/JSONUtils.cpp | 123 +-
 lldb/tools/lldb-dap/JSONUtils.h   |  49 ++-
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |   2 +
 7 files changed, 100 insertions(+), 125 deletions(-)

diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp 
b/lldb/tools/lldb-dap/Breakpoint.cpp
index 2d0fd9c9c3954..440d589b912fc 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -9,12 +9,10 @@
 #include "Breakpoint.h"
 #include "DAP.h"
 #include "JSONUtils.h"
-#include "LLDBUtils.h"
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBBreakpointLocation.h"
 #include "lldb/API/SBLineEntry.h"
 #include "lldb/API/SBMutex.h"
-#include "lldb/lldb-enumerations.h"
 #include "llvm/ADT/StringExtras.h"
 #include 
 #include 
@@ -66,17 +64,15 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
 "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(m_bp.GetTarget()));
 breakpoint.instructionReference = formatted_addr;
 
-lldb::StopDisassemblyType stop_disassembly_display =
-GetStopDisassemblyDisplay(m_dap.debugger);
-auto line_entry = bp_addr.GetLineEntry();
-if (!ShouldDisplayAssemblySource(line_entry, stop_disassembly_display)) {
+auto source = CreateSource(bp_addr, m_dap.debugger);
+if (!source.IsAssemblySource()) {
+  auto line_entry = bp_addr.GetLineEntry();
   const auto line = line_entry.GetLine();
   if (line != LLDB_INVALID_LINE_NUMBER)
 breakpoint.line = line;
   const auto column = line_entry.GetColumn();
   if (column != LLDB_INVALID_COLUMN_NUMBER)
 breakpoint.column = column;
-  breakpoint.source = CreateSource(line_entry);
 } else {
   // Assembly breakpoint.
   auto symbol = bp_addr.GetSymbol();
@@ -86,10 +82,10 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
 .ReadInstructions(symbol.GetStartAddress(), bp_addr, nullptr)
 .GetSize() +
 1;
-
-breakpoint.source = CreateAssemblySource(m_dap.target, bp_addr);
   }
 }
+
+breakpoint.source = std::move(source);
   }
 
   return breakpoint;
diff --git a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
index 1d110eac18126..49e7c788a7fb3 100644
--- a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
@@ -13,6 +13,7 @@
 #include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 #include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBInstruction.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/lldb-types.h"
@@ -81,12 +82,15 @@ static lldb::SBAddress 
GetDisassembleStartAddress(lldb::SBTarget target,
   .GetAddress();
 }
 
-static DisassembledInstruction ConvertSBInstructionToDisassembledInstruction(
-lldb::SBTarget &target, lldb::SBInstruction &inst, bool resolve_symbols) {
+static DisassembledInstruction
+ConvertSBInstructionToDisassembledInstruction(lldb::SBDebugger &debugger,
+  lldb::SBInstruction &inst,
+  bool resolve_symbols) {
   if (!inst.IsValid())
 return GetInvalidInstruction();
 
-  auto addr = inst.GetAddress();
+  lldb::SBTarget target = debugger.GetSelectedTarget();
+  lldb::SBAddress addr = inst.GetAddress();
   const auto inst_addr = addr.GetLoadAddress(target);
 
   // FIXME: This is a workaround - this address might come from
@@ -139,15 +143,14 @@ static DisassembledInstruction 
ConvertSBInstructionToDisassembledInstruction(
 
   disassembled_inst.instruction = std::move(instruction);
 
+  auto source = CreateSource(addr, debugger);
   auto line_entry = addr.GetLineEntry();
-  // If the line number is 0 then the entry represents a compiler generated
-  // location.
 
-  if (line_entry.GetStartAddress() == addr && line_entry.IsValid() &&
+  if (!source.IsAssemblySource() && line_entry.IsValid() &&
+  line_entry.GetStartAddress() == addr && line_entry.IsValid() &&
   line_entry.GetFileSpec().IsValid() && line_entry.GetLine() != 0) {
-auto source = CreateSource(line_entry);
-disassembled_inst.location = std::move(source);
 
+disassembled_inst.location = std::move(source);
 const auto line = line_entry.GetLine();
 if (line != 0 && line != LLDB_INVALID_LINE_NUMBER)
   disassembled

[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

https://lab.llvm.org/buildbot/#/builders/197/builds/6014 looks like we're 
passing

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


[Lldb-commits] [lldb] [LLDB][Minidump] Fix bug in generating 64b memory minidumps (PR #141995)

2025-05-29 Thread Greg Clayton via lldb-commits

https://github.com/clayborg approved this pull request.


https://github.com/llvm/llvm-project/pull/141995
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread Dhruv Srivastava via lldb-commits

https://github.com/DhruvSrivastavaX updated 
https://github.com/llvm/llvm-project/pull/141577

>From a62cd7b510f3cf74ee356a95a26e0f9922f4b39c Mon Sep 17 00:00:00 2001
From: DhruvSrivastavaX 
Date: Tue, 27 May 2025 05:44:55 -0500
Subject: [PATCH 1/3] Added XCOFF ParseSymtab handling

---
 .../ObjectFile/XCOFF/ObjectFileXCOFF.cpp  | 66 ++-
 1 file changed, 65 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp 
b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
index e629355cd40b9..7dfe6c362add4 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
@@ -188,7 +188,71 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle
+llvm::StringRef symbol_name =
+symbolName.starts_with(".") ? symbolName.drop_front() : symbolName;
+auto storageClass = xcoff_sym_ref.getStorageClass();
+if (storageClass == XCOFF::C_HIDEXT && symbolName != "TOC") {
+  if (xcoff_sym_ref.getNumberOfAuxEntries() != 1)
+continue;
+  auto aux_csect_or_err = xcoff_sym_ref.getXCOFFCsectAuxRef();
+  if (!aux_csect_or_err) {
+consumeError(aux_csect_or_err.takeError());
+continue;
+  }
+  const llvm::object::XCOFFCsectAuxRef csect_aux = aux_csect_or_err.get();
+  if (csect_aux.getStorageMappingClass() != XCOFF::XMC_PR ||
+  (m_binary->is64Bit() ? (csect_aux.getAuxType64() != XCOFF::AUX_CSECT)
+   : false))
+continue;
+}
+
+Symbol symbol;
+symbol.GetMangled().SetValue(ConstString(symbol_name));
+
+int16_t sectionNumber = xcoff_sym_ref.getSectionNumber();
+size_t sectionIndex = static_cast(sectionNumber - 1);
+if (sectionNumber > 0 && sectionIndex < sectionList->GetSize()) {
+  lldb::SectionSP section_sp =
+  sectionList->GetSectionAtIndex(sectionNumber - 1);
+  if (!section_sp || section_sp->GetFileAddress() == LLDB_INVALID_ADDRESS)
+continue;
+  lldb::addr_t file_addr = section_sp->GetFileAddress();
+  lldb::addr_t symbolValue = xcoff_sym_ref.getValue();
+  if (symbolValue < file_addr)
+continue;
+  symbol.GetAddressRef() = Address(section_sp, symbolValue - file_addr);
+}
+
+Expected sym_type_or_err =
+symbol_ref.getType();
+symbol.SetType(MapSymbolType(sym_type_or_err.get()));
+printf("%s %d\n", symbol.GetName(), *sym_type_or_err);
+
+lldb_symtab.AddSymbol(symbol);
+  }
+}
 
 bool ObjectFileXCOFF::IsStripped() { return false; }
 

>From 21f5a39976457589e2ab9666820c08331aaf4542 Mon Sep 17 00:00:00 2001
From: Dhruv Srivastava 
Date: Tue, 27 May 2025 16:33:08 +0530
Subject: [PATCH 2/3] cleanup

---
 lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp 
b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
index 7dfe6c362add4..1e84b86cd6f0a 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
@@ -247,8 +247,11 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
 
 Expected sym_type_or_err =
 symbol_ref.getType();
+if (!sym_type_or_err) {
+  consumeError(sym_type_or_err.takeError());
+  continue;
+}
 symbol.SetType(MapSymbolType(sym_type_or_err.get()));
-printf("%s %d\n", symbol.GetName(), *sym_type_or_err);
 
 lldb_symtab.AddSymbol(symbol);
   }

>From 4d631899cd3ab96ea3819e1ece3ce2851d1f9f6c Mon Sep 17 00:00:00 2001
From: DhruvSrivastavaX 
Date: Thu, 29 May 2025 07:37:23 -0500
Subject: [PATCH 3/3] Addressed comments

---
 .../ObjectFile/XCOFF/ObjectFileXCOFF.cpp  | 27 ---
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp 
b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCO

[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread John Harrison via lldb-commits

https://github.com/ashgti updated 
https://github.com/llvm/llvm-project/pull/141689

>From ad0a9cd321d260cd87b852b335da9565f8326449 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Tue, 27 May 2025 16:40:10 -0700
Subject: [PATCH 1/4] [lldb-dap] Test Gardening, improving DebugCommunication.

Improving the readability and correctness of DebugCommunication by adding type 
annotations to many parts of the library and trying to improve the 
implementation of a few key areas of the code to better handle correctness.

Specifically, this refactored the `DebugCommunication._handle_recv_packet` 
function to ensure consistency with the reader thread when handling state 
changes and improved the `DebugCommunication._recv_packet` helper to make it 
easier to follow by adding some additional helpers.
---
 .../test/tools/lldb-dap/dap_server.py | 557 ++
 .../test/tools/lldb-dap/lldbdap_testcase.py   |  16 +-
 .../tools/lldb-dap/cancel/TestDAP_cancel.py   |  27 +-
 3 files changed, 340 insertions(+), 260 deletions(-)

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 a028381a0a4f9..cc235f4fe8b1a 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
@@ -12,13 +12,52 @@
 import sys
 import threading
 import time
-from typing import Any, Optional, Union, BinaryIO, TextIO
+from typing import (
+Any,
+Optional,
+Union,
+BinaryIO,
+TextIO,
+TypedDict,
+Literal,
+Callable,
+TypeVar,
+)
 
 ## DAP type references
-Event = dict[str, Any]
-Request = dict[str, Any]
-Response = dict[str, Any]
+
+
+class Event(TypedDict):
+type: Literal["event"]
+seq: Literal[0]
+event: str
+body: Optional[dict]
+
+
+class Request(TypedDict):
+type: Literal["request"]
+seq: int
+command: str
+arguments: Optional[dict]
+
+
+class Response(TypedDict):
+type: Literal["response"]
+seq: Literal[0]
+request_seq: int
+success: bool
+command: str
+message: Optional[str]
+body: Optional[dict]
+
+
+_T = TypeVar("_T")
 ProtocolMessage = Union[Event, Request, Response]
+# An internal type used for tracking protocol messages and an EOF sentinel
+# value. 'None' cannot easily be used as a sentinel because it is a falsey
+# value. When returned outside of DebugCommunication an EOFError is typically
+# converted into 'None'.
+_InternalProtocolMessage = Union[Event, Request, Response, EOFError]
 
 
 def dump_memory(base_addr, data, num_per_line, outfile):
@@ -58,44 +97,42 @@ def dump_memory(base_addr, data, num_per_line, outfile):
 outfile.write("\n")
 
 
-def read_packet(f, verbose=False, trace_file=None):
+def read_packet(
+f: BinaryIO, verbose=False, trace_file=None
+) -> _InternalProtocolMessage:
 """Decode a JSON packet that starts with the content length and is
 followed by the JSON bytes from a file 'f'. Returns None on EOF.
 """
-line = f.readline().decode("utf-8")
+line = f.readline().decode()
 if len(line) == 0:
-return None  # EOF.
+return EOFError()  # EOF.
 
 # Watch for line that starts with the prefix
 prefix = "Content-Length: "
 if line.startswith(prefix):
 # Decode length of JSON bytes
 if verbose:
-print('content: "%s"' % (line))
+print("content:", line)
 length = int(line[len(prefix) :])
 if verbose:
-print('length: "%u"' % (length))
+print("length:", length)
 # Skip empty line
-line = f.readline()
+line = f.readline().decode()
 if verbose:
-print('empty: "%s"' % (line))
+print("empty:", line)
 # Read JSON bytes
-json_str = f.read(length)
+json_str = f.read(length).decode()
 if verbose:
-print('json: "%s"' % (json_str))
+print("json:", json_str)
 if trace_file:
-trace_file.write("from adapter:\n%s\n" % (json_str))
+trace_file.write(f"from adapter:\n{json_str}\n")
 # Decode the JSON bytes into a python dictionary
 return json.loads(json_str)
 
 raise Exception("unexpected malformed message from lldb-dap: " + line)
 
 
-def packet_type_is(packet, packet_type):
-return "type" in packet and packet["type"] == packet_type
-
-
-def dump_dap_log(log_file):
+def dump_dap_log(log_file: str):
 print("= DEBUG ADAPTER PROTOCOL LOGS =", file=sys.stderr)
 if log_file is None:
 print("no log file available", file=sys.stderr)
@@ -124,8 +161,8 @@ def __init__(
 def __str__(self):
 return f"Source(name={self.name}, path={self.path}), 
source_reference={self.source_reference})"
 
-def as_dict(self):
-source_dict = {}
+def as_dict(self) -> dict:
+source_dict: dict[str, Any] = {}

[Lldb-commits] [lldb] [lldb][lldb-dap] Support breakpoint info bytes (PR #141122)

2025-05-29 Thread John Harrison via lldb-commits


@@ -16,12 +15,61 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x-}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+  // request if SBProcess::GetMemoryRegionInfo returns error.
+  if (err.Success() && !(region.IsReadable() || region.IsWritable())) {
+response.description = llvm::formatv(
+"memory region for address {} has no read or write permissions",
+load_addr);
+
+  } else {
+response.description =
+llvm::formatv("{} bytes at {:x}", byte_size, load_addr);
+response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,

ashgti wrote:

I think in the `SBWatchpoint` we can check `IsWatchingReads` and 
`IsWatchingWrites` to check if the watchpoint is r/w/rw.

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-x86_64-debian` 
running on `lldb-x86_64-debian` while building `lldb` at step 6 "test".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/162/builds/23448


Here is the relevant piece of the build log for the reference

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: 
functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
 (108 of 2967)
PASS: lldb-api :: 
tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py (109 of 
2967)
PASS: lldb-api :: lang/cpp/namespace/TestNamespace.py (110 of 2967)
PASS: lldb-api :: functionalities/inferior-assert/TestInferiorAssert.py (111 of 
2967)
PASS: lldb-api :: lang/cpp/dynamic-value/TestDynamicValue.py (112 of 2967)
PASS: lldb-api :: tools/lldb-dap/coreFile/TestDAP_coreFile.py (113 of 2967)
PASS: lldb-api :: api/listeners/TestListener.py (114 of 2967)
PASS: lldb-api :: 
functionalities/breakpoint/thread_plan_user_breakpoint/TestThreadPlanUserBreakpoint.py
 (115 of 2967)
PASS: lldb-api :: functionalities/thread/step_until/TestStepUntil.py (116 of 
2967)
PASS: lldb-api :: 
functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py
 (117 of 2967)
FAIL: lldb-api :: tools/lldb-dap/optimized/TestDAP_optimized.py (118 of 2967)
 TEST 'lldb-api :: 
tools/lldb-dap/optimized/TestDAP_optimized.py' FAILED 
Script:
--
/usr/bin/python3 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u 
CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env 
LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env 
LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 
--build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --make 
/usr/bin/gmake --llvm-tools-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root 
/home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --cmake-build-type Release -t 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/tools/lldb-dap/optimized
 -p TestDAP_optimized.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
8a49db35f45e56c92522c6079e51553e80c07aec)
  clang revision 8a49db35f45e56c92522c6079e51553e80c07aec
  llvm revision 8a49db35f45e56c92522c6079e51553e80c07aec
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 
'debugserver', 'objc']

--
Command Output (stderr):
--
Change dir to: 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/tools/lldb-dap/optimized
runCmd: settings clear --all

output: 

runCmd: settings set symbols.enable-external-lookup false

output: 

runCmd: settings set target.inherit-tcc true

output: 

runCmd: settings set target.disable-aslr false

output: 

runCmd: settings set target.detach-on-error false

output: 


```



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


[Lldb-commits] [lldb] Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (PR #141670)

2025-05-29 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond updated 
https://github.com/llvm/llvm-project/pull/141670

>From 048cc769d6380bcb899bbcc5acf7f9349b51c5d3 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Tue, 27 May 2025 13:40:40 -0700
Subject: [PATCH 1/6] Reapply "[LLDB][ELF Core] Support all the Generic
 (Negative) SI Codes." (#141645)

This reverts commit 9d33b9291318c117429ab461c2119c108abd6ed2.
---
 lldb/include/lldb/Target/Platform.h   |   3 +
 lldb/include/lldb/Target/UnixSignals.h|   6 +-
 .../Plugins/Platform/Linux/PlatformLinux.cpp  | 105 
 .../Plugins/Platform/Linux/PlatformLinux.h|   2 +
 .../Plugins/Process/Utility/LinuxSignals.cpp  | 154 ++
 .../Process/elf-core/ProcessElfCore.cpp   |  20 +--
 .../Process/elf-core/ThreadElfCore.cpp| 136 +---
 .../Plugins/Process/elf-core/ThreadElfCore.h  |  75 +++--
 lldb/source/Target/UnixSignals.cpp|  15 +-
 lldb/unittests/Signals/UnixSignalsTest.cpp|   9 +
 10 files changed, 295 insertions(+), 230 deletions(-)

diff --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index a702abb540fd9..35ffdabf907e7 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -21,6 +21,7 @@
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/File.h"
 #include "lldb/Interpreter/Options.h"
+#include "lldb/Target/StopInfo.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/FileSpec.h"
@@ -960,6 +961,8 @@ class Platform : public PluginInterface {
 
   virtual CompilerType GetSiginfoType(const llvm::Triple &triple);
 
+  virtual lldb::StopInfoSP GetStopInfoFromSiginfo(Thread &thread) { return {}; 
}
+
   virtual Args GetExtraStartupCommands();
 
   typedef std::function code = std::nullopt,
std::optional addr = std::nullopt,
std::optional lower = std::nullopt,
-   std::optional upper = std::nullopt) const;
+   std::optional upper = std::nullopt,
+   std::optional pid = std::nullopt,
+   std::optional uid = std::nullopt) const;
 
   bool SignalIsValid(int32_t signo) const;
 
@@ -105,7 +107,7 @@ class UnixSignals {
  llvm::StringRef description,
  llvm::StringRef alias = llvm::StringRef());
 
-  enum SignalCodePrintOption { None, Address, Bounds };
+  enum SignalCodePrintOption { None, Address, Bounds, Sender };
 
   // Instead of calling this directly, use a ADD_SIGCODE macro to get compile
   // time checks when on the native platform.
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 9db2c83acc125..cb60caf1cb422 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -14,6 +14,7 @@
 #include 
 #endif
 
+#include "Plugins/Process/Utility/LinuxSignals.h"
 #include "Utility/ARM64_DWARF_Registers.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/PluginManager.h"
@@ -480,3 +481,107 @@ CompilerType PlatformLinux::GetSiginfoType(const 
llvm::Triple &triple) {
   ast->CompleteTagDeclarationDefinition(siginfo_type);
   return siginfo_type;
 }
+
+static std::string GetDescriptionFromSiginfo(lldb::ValueObjectSP siginfo_sp) {
+  if (!siginfo_sp)
+return "";
+
+  lldb_private::LinuxSignals linux_signals;
+  int code = 
siginfo_sp->GetChildMemberWithName("si_code")->GetValueAsSigned(0);
+  int signo =
+  siginfo_sp->GetChildMemberWithName("si_signo")->GetValueAsSigned(-1);
+
+  auto sifields = siginfo_sp->GetChildMemberWithName("_sifields");
+  if (!sifields)
+return linux_signals.GetSignalDescription(signo, code);
+
+  // declare everything that we can populate later.
+  std::optional addr;
+  std::optional upper;
+  std::optional lower;
+  std::optional pid;
+  std::optional uid;
+
+  // The negative si_codes are special and mean this signal was sent from user
+  // space not the kernel. These take precedence because they break some of the
+  // invariants around kernel sent signals. Such as SIGSEGV won't have an
+  // address.
+  if (code < 0) {
+auto sikill = sifields->GetChildMemberWithName("_kill");
+if (sikill) {
+  auto pid_sp = sikill->GetChildMemberWithName("si_pid");
+  if (pid_sp)
+pid = pid_sp->GetValueAsUnsigned(-1);
+  auto uid_sp = sikill->GetChildMemberWithName("si_uid");
+  if (uid_sp)
+uid = uid_sp->GetValueAsUnsigned(-1);
+}
+  } else {
+
+switch (signo) {
+case SIGILL:
+case SIGFPE:
+case SIGBUS: {
+  auto sigfault = sifields->GetChildMemberWithName("_sigfault");
+  if (!sigfault)
+break;
+
+  auto addr_sp = sigfault->GetChildMemberWithName("si_addr");
+  if (addr_sp)
+addr = addr_sp->GetValueAsUnsigned(-1);
+  break;
+}
+case SIGSEGV: {
+

[Lldb-commits] [lldb] Reapply "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (PR #141670)

2025-05-29 Thread Jacob Lalonde via lldb-commits


@@ -27,6 +27,30 @@
 #ifndef SEGV_CPERR
 #define SEGV_CPERR 10
 #endif
+#ifndef SI_QUEUE
+#define SI_QUEUE -1
+#endif
+#ifndef SI_TIMER
+#define SI_TIMER -2
+#endif
+#ifndef SI_MESGQ
+#define SI_MESGQ -3
+#endif
+#ifndef SI_ASYNCIO
+#define SI_ASYNCIO -4
+#endif
+#ifndef SI_SIGIO
+#define SI_SIGIO -5
+#endif
+#ifndef SI_TKILL
+#define SI_TKILL -6
+#endif

Jlalond wrote:

Originally I just did DE_THREAD, but because they were all moved to ASM generic 
in the same commit in the Linux Kernel I thought it would be safest to do all 
of them

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond created 
https://github.com/llvm/llvm-project/pull/141971

Another iteration of fixes for #141670. Platform linux can be used by other 
platforms, so we need to supply the signal values if they're not defined.

>From 0612b888a0dd0cda09fbaa89f5e68c15a1bc9e98 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Thu, 29 May 2025 09:10:09 -0700
Subject: [PATCH] Add ifndef to platform linux

---
 .../Plugins/Platform/Linux/PlatformLinux.cpp   | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index cb60caf1cb422..dd6490c7141e5 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -34,6 +34,20 @@
 #define MAP_PRIVATE 2
 #define MAP_ANON 0x20
 
+// For other platforms that use platform linux
+#ifndef SIGILL
+#define SIGILL 4
+#endif
+#ifndef SIGBUS
+#define SIGBUS 7
+#endif
+#ifndef SIGFPE
+#define SIGFPE 8
+#endif
+#ifndef SIGSEGV
+#define SIGSEGV 11
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::platform_linux;

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)


Changes

Another iteration of fixes for #141670. Platform linux can be used by 
other platforms, so we need to supply the signal values if they're not defined.

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


1 Files Affected:

- (modified) lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp (+14) 


``diff
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index cb60caf1cb422..dd6490c7141e5 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -34,6 +34,20 @@
 #define MAP_PRIVATE 2
 #define MAP_ANON 0x20
 
+// For other platforms that use platform linux
+#ifndef SIGILL
+#define SIGILL 4
+#endif
+#ifndef SIGBUS
+#define SIGBUS 7
+#endif
+#ifndef SIGFPE
+#define SIGFPE 8
+#endif
+#ifndef SIGSEGV
+#define SIGSEGV 11
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::platform_linux;

``




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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits

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


[Lldb-commits] [lldb] [LLDB][Minidump] Fix bug in generating 64b memory minidumps (PR #141995)

2025-05-29 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond created 
https://github.com/llvm/llvm-project/pull/141995

In #129307, we introduced read write in chunks, and during the final revision 
of the PR I changed the behavior for 64b memory regions and did not test an 
actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region. 

64b regions has been a problem in testing for some time as it's a waste of test 
resources to generation a 5gb+ Minidump. I will work with @clayborg and @labath 
to come up with a way to specify creating a 64b list instead of a 32b list 
(likely via the yamilizer).

>From 929c63c892889ab33520020f1fc74e7f91388d41 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Thu, 29 May 2025 10:32:16 -0700
Subject: [PATCH] Fix bug where we update the index before accessing the
 descriptor for 64b memory ranges on Minidumps

---
 .../source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 2818d31eb2301..806f256d9da48 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -1170,7 +1170,6 @@ 
MinidumpFileBuilder::AddMemoryList_64(std::vector &ranges,
   "(%" PRIx64 "bytes) "
   "[%" PRIx64 ", %" PRIx64 ")",
   region_index, ranges.size(), size, addr, addr + size);
-++region_index;
 
 progress.Increment(1, "Adding Memory Range " + core_range.Dump());
 uint64_t bytes_read = 0;
@@ -1186,6 +1185,8 @@ 
MinidumpFileBuilder::AddMemoryList_64(std::vector &ranges,
   cleanup_required = true;
   descriptors[region_index].DataSize = bytes_read;
 }
+
+++region_index;
   }
 
   // Early return if there is no cleanup needed.

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


[Lldb-commits] [lldb] [LLDB][Minidump] Fix bug in generating 64b memory minidumps (PR #141995)

2025-05-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)


Changes

In #129307, we introduced read write in chunks, and during the final 
revision of the PR I changed the behavior for 64b memory regions and did not 
test an actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region. 

64b regions has been a problem in testing for some time as it's a waste of test 
resources to generation a 5gb+ Minidump. I will work with @clayborg and 
@labath to come up with a way to specify creating a 64b list instead of 
a 32b list (likely via the yamilizer).

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


1 Files Affected:

- (modified) lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
(+2-1) 


``diff
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 2818d31eb2301..806f256d9da48 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -1170,7 +1170,6 @@ 
MinidumpFileBuilder::AddMemoryList_64(std::vector &ranges,
   "(%" PRIx64 "bytes) "
   "[%" PRIx64 ", %" PRIx64 ")",
   region_index, ranges.size(), size, addr, addr + size);
-++region_index;
 
 progress.Increment(1, "Adding Memory Range " + core_range.Dump());
 uint64_t bytes_read = 0;
@@ -1186,6 +1185,8 @@ 
MinidumpFileBuilder::AddMemoryList_64(std::vector &ranges,
   cleanup_required = true;
   descriptors[region_index].DataSize = bytes_read;
 }
+
+++region_index;
   }
 
   // Early return if there is no cleanup needed.

``




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


[Lldb-commits] [lldb] [LLDB][Minidump] Fix bug in generating 64b memory minidumps (PR #141995)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

```
MINIDUMP_MEMORY64_LIST:
NumberOfMemoryRanges = 0x0042
BaseRva  = 0x7f1963c0
MemoryRanges[0]  = [0x - 0x7f1a4020)
MemoryRanges[1]  = [0x - 0x7f1e0820)
MemoryRanges[2]  = [0x - 0x7f20c960d000)
MemoryRanges[3]  = [0x - 0x7f2de3c0)
MemoryRanges[4]  = [0x - 0x7f2df22f)
MemoryRanges[5]  = [0x1000 - 0x7f2df22f2000)
MemoryRanges[6]  = [0x2000 - 0x7f2df22f5000)
MemoryRanges[7]  = [0x - 0x7f2df22f6000)
MemoryRanges[8]  = [0x - 0x7f2df22ff000)
MemoryRanges[9]  = [0x - 0x7f2df2303000)
MemoryRanges[10] = [0x1000 - 0x7f2df2305000)
MemoryRanges[11] = [0x - 0x7f2df2326000)
MemoryRanges[12] = [0x - 0x7f2df238e000)
MemoryRanges[13] = [0x - 0x7f2df23de000)
MemoryRanges[14] = [0x3000 - 0x7f2df23e4000)
MemoryRanges[15] = [0x - 0x7f2df23e6000)
MemoryRanges[16] = [0x - 0x7f2df23f8000)
MemoryRanges[17] = [0x - 0x7f2df23fd000)
MemoryRanges[18] = [0x2000 - 0x7f2df2401000)
MemoryRanges[19] = [0x1000 - 0x7f2df2401000)
MemoryRanges[20] = [0x - 0x7f2df43d6000)
MemoryRanges[21] = [0x - 0x7f2df820c000)
MemoryRanges[22] = [0x00288000 - 0x7f2df871c000)
MemoryRanges[23] = [0x00136000 - 0x7f2df8701000)
MemoryRanges[24] = [0x8000 - 0x7f2df85db000)
MemoryRanges[25] = [0x - 0x7f2df85d6000)
MemoryRanges[26] = [0x - 0x7f2df85dd000)
MemoryRanges[27] = [0x - 0x7f2df85e1000)
MemoryRanges[28] = [0x1000 - 0x7f2df85e3000)
MemoryRanges[29] = [0x - 0x7f2df85ed000)
MemoryRanges[30] = [0x - 0x7f2df861f000)
MemoryRanges[31] = [0x - 0x7f2df8629000)
MemoryRanges[32] = [0x2000 - 0x7f2df862d000)
MemoryRanges[33] = [0x4000 - 0x7f2df8633000)
MemoryRanges[34] = [0x - 0x7f2df863)
MemoryRanges[35] = [0x - 0x7f2df8631000)
MemoryRanges[36] = [0x - 0x7f2df8633000)
MemoryRanges[37] = [0x1000 - 0x7f2df8635000)
MemoryRanges[38] = [0x - 0x7f2df8637000)
MemoryRanges[39] = [0x - 0x7f2df8649000)
MemoryRanges[40] = [0x - 0x7f2df864d000)
MemoryRanges[41] = [0x3000 - 0x7f2df8653000)
MemoryRanges[42] = [0x - 0x7f2df8653000)
MemoryRanges[43] = [0x - 0x7f2df866f000)
MemoryRanges[44] = [0x - 0x7f2df867a000)
MemoryRanges[45] = [0x1000 - 0x7f2df867c000)
MemoryRanges[46] = [0x1000 - 0x7f2df867d000)
MemoryRanges[47] = [0x - 0x7f2df868a000)
MemoryRanges[48] = [0x - 0x7f2df869b000)
MemoryRanges[49] = [0x - 0x7f2df86ac000)
MemoryRanges[50] = [0x1000 - 0x7f2df86ae000)
MemoryRanges[51] = [0x - 0x7f2df86af000)
MemoryRanges[52] = [0x - 0x7f2df86bf000)
MemoryRanges[53] = [0x - 0x7f2df86c6000)
MemoryRanges[54] = [0x1000 - 0x7f2df86c8000)
MemoryRanges[55] = [0x - 0x7f2df86d6000)
MemoryRanges[56] = [0x - 0x7f2df8748000)
MemoryRanges[57] = [0x - 0x7f2df87a)
MemoryRanges[58] = [0x3000 - 0x7f2df87a6000)
MemoryRanges[59] = [0x4000 - 0x7f2df87ab000)
MemoryRanges[60] = [0x2000 - 0x7f2df87ab000)
MemoryRanges[61] = [0x - 0x7f2df87aa000)
MemoryRanges[62] = [0x - 0x7f2df87d3000)
MemoryRanges[63] = [0x - 0x7f2df87df000)
MemoryRanges[64] = [0x00022000 - 0x7ffc7e2ce000)
MemoryRanges[65] = [0x3000 - 0x6000)
```

Tested against a process with 64b memory

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


[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)

2025-05-29 Thread via lldb-commits

https://github.com/dlav-sc updated 
https://github.com/llvm/llvm-project/pull/127505

>From 2520b8d7884d320ed7923685b1a3e8652a7e8f5f Mon Sep 17 00:00:00 2001
From: Daniil Avdeev 
Date: Fri, 23 May 2025 13:27:46 +
Subject: [PATCH 1/2] [lldb][RISCV] handle lr/sc single step

lldb-server had limited support for single-stepping through the
lr/sc atomic sequence. This patch enhances that support for all
possible atomic sequences.
---
 lldb/include/lldb/Core/EmulateInstruction.h   |  45 +++
 lldb/source/Core/EmulateInstruction.cpp   |  93 +
 .../Instruction/ARM/EmulateInstructionARM.cpp |  11 ++
 .../Instruction/ARM/EmulateInstructionARM.h   |  18 +++
 .../LoongArch/EmulateInstructionLoongArch.cpp | 122 +++---
 .../LoongArch/EmulateInstructionLoongArch.h   |   2 -
 .../RISCV/EmulateInstructionRISCV.cpp | 117 ++---
 .../RISCV/EmulateInstructionRISCV.h   |  37 +-
 .../Process/FreeBSD/NativeProcessFreeBSD.cpp  |  14 +-
 .../NativeProcessSoftwareSingleStep.cpp   | 108 +++-
 .../Utility/NativeProcessSoftwareSingleStep.h |   2 +-
 .../LoongArch/TestLoongArchEmulator.cpp   |  36 +++---
 12 files changed, 422 insertions(+), 183 deletions(-)

diff --git a/lldb/include/lldb/Core/EmulateInstruction.h 
b/lldb/include/lldb/Core/EmulateInstruction.h
index b459476883fc5..0e3564206ccb8 100644
--- a/lldb/include/lldb/Core/EmulateInstruction.h
+++ b/lldb/include/lldb/Core/EmulateInstruction.h
@@ -32,6 +32,31 @@ class RegisterValue;
 class Stream;
 class Target;
 class UnwindPlan;
+class EmulateInstruction;
+
+using BreakpointLocations = std::vector;
+
+class SingleStepBreakpointLocationsPredictor {
+public:
+  SingleStepBreakpointLocationsPredictor(
+  std::unique_ptr emulator_up)
+  : m_emulator_up{std::move(emulator_up)} {}
+
+  virtual BreakpointLocations GetBreakpointLocations(Status &status);
+
+  virtual unsigned GetBreakpointSize(lldb::addr_t, Status &) { return 4; }
+
+  virtual ~SingleStepBreakpointLocationsPredictor() = default;
+
+protected:
+  lldb::addr_t GetSequentiallyNextInstructionPC(Status &error);
+
+  lldb::addr_t GetBreakpointLocationAddress(lldb::addr_t entry_pc,
+Status &error);
+
+  std::unique_ptr m_emulator_up;
+  bool m_emulation_result = false;
+};
 
 /// \class EmulateInstruction EmulateInstruction.h
 /// "lldb/Core/EmulateInstruction.h"
@@ -497,7 +522,19 @@ class EmulateInstruction : public PluginInterface {
   static uint32_t GetInternalRegisterNumber(RegisterContext *reg_ctx,
 const RegisterInfo ®_info);
 
+  static std::unique_ptr
+  CreateBreakpointLocationPredictor(
+  std::unique_ptr emulator_up);
+
+  // Helper functions
+  std::optional ReadPC();
+  bool WritePC(lldb::addr_t addr);
+
 protected:
+  using BreakpointLocationsPredictorCreator =
+  std::function(
+  std::unique_ptr)>;
+
   ArchSpec m_arch;
   void *m_baton = nullptr;
   ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault;
@@ -508,6 +545,14 @@ class EmulateInstruction : public PluginInterface {
   Opcode m_opcode;
 
 private:
+  virtual BreakpointLocationsPredictorCreator
+  GetSingleStepBreakpointLocationsPredictorCreator() {
+return [](std::unique_ptr emulator_up) {
+  return std::make_unique(
+  std::move(emulator_up));
+};
+  }
+
   // For EmulateInstruction only
   EmulateInstruction(const EmulateInstruction &) = delete;
   const EmulateInstruction &operator=(const EmulateInstruction &) = delete;
diff --git a/lldb/source/Core/EmulateInstruction.cpp 
b/lldb/source/Core/EmulateInstruction.cpp
index d240b4d3b3310..3bc7beff8ac7f 100644
--- a/lldb/source/Core/EmulateInstruction.cpp
+++ b/lldb/source/Core/EmulateInstruction.cpp
@@ -588,7 +588,100 @@ 
EmulateInstruction::GetInternalRegisterNumber(RegisterContext *reg_ctx,
   return LLDB_INVALID_REGNUM;
 }
 
+std::unique_ptr
+EmulateInstruction::CreateBreakpointLocationPredictor(
+std::unique_ptr emulator_up) {
+  auto creator =
+  emulator_up->GetSingleStepBreakpointLocationsPredictorCreator();
+  return creator(std::move(emulator_up));
+}
+
+std::optional EmulateInstruction::ReadPC() {
+  bool success = false;
+  auto addr = ReadRegisterUnsigned(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_PC,
+   LLDB_INVALID_ADDRESS, &success);
+  return success ? std::optional(addr) : std::nullopt;
+}
+
+bool EmulateInstruction::WritePC(lldb::addr_t addr) {
+  EmulateInstruction::Context ctx;
+  ctx.type = eContextAdvancePC;
+  ctx.SetNoArgs();
+  return WriteRegisterUnsigned(ctx, eRegisterKindGeneric,
+   LLDB_REGNUM_GENERIC_PC, addr);
+}
+
 bool EmulateInstruction::CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) {
   unwind_plan.Clear();
   return false;
 }
+
+BreakpointLocations
+SingleStepBreakpointLocationsPredictor::GetBreakpointLocations(Status &status) 
{
+  if (!m_emulator_up->ReadInstruction()

[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread John Harrison via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Refactor away UB in SBValue::GetLoadAddress (PR #141799)

2025-05-29 Thread via lldb-commits

https://github.com/jimingham approved this pull request.

That worked out pretty well.

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


[Lldb-commits] [lldb] [LLDB] Add ifndef to platform linux (PR #141971)

2025-05-29 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

> Ummm... I should have caught this before, but this isn't correct because the 
> host system may (and some do) use different signal numbers for these 
> constants.

Are these actually different on Mac? These 4 are the same on BSD to my 
knowledge.

How do you think we should go about getting the value from UnixSignals?

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, attach tests. (PR #141981)

2025-05-29 Thread John Harrison via lldb-commits

https://github.com/ashgti created 
https://github.com/llvm/llvm-project/pull/141981

Trimming unused imports, adjusting the test to use the `DEFAULT_TIMEOUT` 
instead of a custom timeout and adjusting the flow to stopOnEntry for improving 
consistency.

>From 509b0a5643620b10e77216c7cde591b7e8ccb13d Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Thu, 29 May 2025 09:46:08 -0700
Subject: [PATCH] [lldb-dap] Test Gardening, attach tests.

Trimming unused imports, adjusting the test to use the `DEFAULT_TIMEOUT` 
instead of a custom timeout and adjusting the flow to stopOnEntry for improving 
consistency.
---
 .../attach/TestDAP_attachByPortNum.py | 61 ---
 1 file changed, 26 insertions(+), 35 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py 
b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
index 7c2b540195d15..edb87a9314d78 100644
--- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
+++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
@@ -2,26 +2,16 @@
 Test lldb-dap "port" configuration to "attach" request
 """
 
-import dap_server
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
 from lldbsuite.test import lldbplatformutil
 from lldbgdbserverutils import Pipe
 import lldbdap_testcase
-import os
-import shutil
-import subprocess
-import tempfile
-import threading
-import sys
-import socket
+import lldb
 
 
-@skip("https://github.com/llvm/llvm-project/issues/138803";)
+@skip(bugnumber="https://github.com/llvm/llvm-project/issues/138803";)
 class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase):
-default_timeout = 20
-
 def set_and_hit_breakpoint(self, continueToExit=True):
 self.dap_server.wait_for_stopped()
 
@@ -50,7 +40,7 @@ def get_debug_server_command_line_args(self):
 def get_debug_server_pipe(self):
 pipe = Pipe(self.getBuildDir())
 self.addTearDownHook(lambda: pipe.close())
-pipe.finish_connection(self.default_timeout)
+pipe.finish_connection(self.DEFAULT_TIMEOUT)
 return pipe
 
 @skipIfWindows
@@ -73,28 +63,33 @@ def test_by_port(self):
 )
 
 # Read the port number from the debug server pipe.
-port = pipe.read(10, self.default_timeout)
+port = pipe.read(10, self.DEFAULT_TIMEOUT)
 # Trim null byte, convert to int
 port = int(port[:-1])
 self.assertIsNotNone(
 port, " Failed to read the port number from debug server pipe"
 )
 
-self.attach(program=program, gdbRemotePort=port, sourceInitFile=True)
+self.attach(
+program=program,
+gdbRemotePort=port,
+sourceInitFile=True,
+stopOnEntry=True,
+)
 self.set_and_hit_breakpoint(continueToExit=True)
-self.process.terminate()
 
 @skipIfWindows
 @skipIfNetBSD
-def test_by_port_and_pid(self):
+def test_fails_if_both_port_and_pid_are_set(self):
 """
 Tests attaching to a process by process ID and port number.
 """
 program = self.build_and_create_debug_adapter_for_attach()
 
-# It is not necessary to launch "lldb-server" to obtain the actual 
port and pid for attaching.
-# However, when providing the port number and pid directly, "lldb-dap" 
throws an error message, which is expected.
-# So, used random pid and port numbers here.
+# It is not necessary to launch "lldb-server" to obtain the actual port
+# and pid for attaching. However, when providing the port number and 
pid
+# directly, "lldb-dap" throws an error message, which is expected. So,
+# used random pid and port numbers here.
 
 pid = 1354
 port = 1234
@@ -106,10 +101,9 @@ def test_by_port_and_pid(self):
 sourceInitFile=True,
 expectFailure=True,
 )
-if not (response and response["success"]):
-self.assertFalse(
-response["success"], "The user can't specify both pid and port"
-)
+self.assertFalse(
+response["success"], "The user can't specify both pid and port"
+)
 
 @skipIfWindows
 @skipIfNetBSD
@@ -123,11 +117,10 @@ def test_by_invalid_port(self):
 response = self.attach(
 program=program, gdbRemotePort=port, sourceInitFile=True, 
expectFailure=True
 )
-if not (response and response["success"]):
-self.assertFalse(
-response["success"],
-"The user can't attach with invalid port (%s)" % port,
-)
+self.assertFalse(
+response["success"],
+"The user can't attach with invalid port (%s)" % port,
+)
 
 @skipIfWindows
 @skipIfNetBSD
@@ -147,9 +140,7 @@ def test_by_illegal_port(self):
 response = self.attach(
 

[Lldb-commits] [lldb] [lldb-dap] Test Gardening, attach tests. (PR #141981)

2025-05-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)


Changes

Trimming unused imports, adjusting the test to use the `DEFAULT_TIMEOUT` 
instead of a custom timeout and adjusting the flow to stopOnEntry for improving 
consistency.

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


1 Files Affected:

- (modified) lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py 
(+26-35) 


``diff
diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py 
b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
index 7c2b540195d15..edb87a9314d78 100644
--- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
+++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
@@ -2,26 +2,16 @@
 Test lldb-dap "port" configuration to "attach" request
 """
 
-import dap_server
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
 from lldbsuite.test import lldbplatformutil
 from lldbgdbserverutils import Pipe
 import lldbdap_testcase
-import os
-import shutil
-import subprocess
-import tempfile
-import threading
-import sys
-import socket
+import lldb
 
 
-@skip("https://github.com/llvm/llvm-project/issues/138803";)
+@skip(bugnumber="https://github.com/llvm/llvm-project/issues/138803";)
 class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase):
-default_timeout = 20
-
 def set_and_hit_breakpoint(self, continueToExit=True):
 self.dap_server.wait_for_stopped()
 
@@ -50,7 +40,7 @@ def get_debug_server_command_line_args(self):
 def get_debug_server_pipe(self):
 pipe = Pipe(self.getBuildDir())
 self.addTearDownHook(lambda: pipe.close())
-pipe.finish_connection(self.default_timeout)
+pipe.finish_connection(self.DEFAULT_TIMEOUT)
 return pipe
 
 @skipIfWindows
@@ -73,28 +63,33 @@ def test_by_port(self):
 )
 
 # Read the port number from the debug server pipe.
-port = pipe.read(10, self.default_timeout)
+port = pipe.read(10, self.DEFAULT_TIMEOUT)
 # Trim null byte, convert to int
 port = int(port[:-1])
 self.assertIsNotNone(
 port, " Failed to read the port number from debug server pipe"
 )
 
-self.attach(program=program, gdbRemotePort=port, sourceInitFile=True)
+self.attach(
+program=program,
+gdbRemotePort=port,
+sourceInitFile=True,
+stopOnEntry=True,
+)
 self.set_and_hit_breakpoint(continueToExit=True)
-self.process.terminate()
 
 @skipIfWindows
 @skipIfNetBSD
-def test_by_port_and_pid(self):
+def test_fails_if_both_port_and_pid_are_set(self):
 """
 Tests attaching to a process by process ID and port number.
 """
 program = self.build_and_create_debug_adapter_for_attach()
 
-# It is not necessary to launch "lldb-server" to obtain the actual 
port and pid for attaching.
-# However, when providing the port number and pid directly, "lldb-dap" 
throws an error message, which is expected.
-# So, used random pid and port numbers here.
+# It is not necessary to launch "lldb-server" to obtain the actual port
+# and pid for attaching. However, when providing the port number and 
pid
+# directly, "lldb-dap" throws an error message, which is expected. So,
+# used random pid and port numbers here.
 
 pid = 1354
 port = 1234
@@ -106,10 +101,9 @@ def test_by_port_and_pid(self):
 sourceInitFile=True,
 expectFailure=True,
 )
-if not (response and response["success"]):
-self.assertFalse(
-response["success"], "The user can't specify both pid and port"
-)
+self.assertFalse(
+response["success"], "The user can't specify both pid and port"
+)
 
 @skipIfWindows
 @skipIfNetBSD
@@ -123,11 +117,10 @@ def test_by_invalid_port(self):
 response = self.attach(
 program=program, gdbRemotePort=port, sourceInitFile=True, 
expectFailure=True
 )
-if not (response and response["success"]):
-self.assertFalse(
-response["success"],
-"The user can't attach with invalid port (%s)" % port,
-)
+self.assertFalse(
+response["success"],
+"The user can't attach with invalid port (%s)" % port,
+)
 
 @skipIfWindows
 @skipIfNetBSD
@@ -147,9 +140,7 @@ def test_by_illegal_port(self):
 response = self.attach(
 program=program, gdbRemotePort=port, sourceInitFile=True, 
expectFailure=True
 )
-if not (response and response["success"]):
-self.assertFalse(
-response["success"],
-"The user can't attach with illegal port (%s)" % port,
-  

[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)

2025-05-29 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r HEAD~1...HEAD 
lldb/test/API/riscv/step/TestSoftwareStep.py
``





View the diff from darker here.


``diff
--- TestSoftwareStep.py 2025-05-29 16:49:47.00 +
+++ TestSoftwareStep.py 2025-05-29 16:52:50.901528 +
@@ -11,14 +11,14 @@
 class TestSoftwareStep(TestBase):
 @skipIf(archs=no_match(re.compile("rv*")))
 def test_cas(self):
 self.build()
 (target, process, cur_thread, bkpt) = lldbutil.run_to_name_breakpoint(
-self, "cas" 
+self, "cas"
 )
 entry_pc = cur_thread.GetFrameAtIndex(0).GetPC()
-
+
 self.runCmd("thread step-inst")
 self.expect(
 "thread list",
 substrs=["stopped", "stop reason = instruction step into"],
 )
@@ -31,28 +31,33 @@
 self.build(dictionary={"C_SOURCES": "branch.c", "EXE": "branch.x"})
 (target, process, cur_thread, bkpt) = lldbutil.run_to_name_breakpoint(
 self, "branch_cas", exe_name="branch.x"
 )
 entry_pc = cur_thread.GetFrameAtIndex(0).GetPC()
-
+
 self.runCmd("thread step-inst")
 self.expect(
 "thread list",
 substrs=["stopped", "stop reason = instruction step into"],
 )
 
 pc = cur_thread.GetFrameAtIndex(0).GetPC()
 self.assertTrue((pc - entry_pc) > 0x10)
-
+
 @skipIf(archs=no_match(re.compile("rv*")))
 def test_incomplete_sequence_without_lr(self):
-self.build(dictionary={"C_SOURCES": 
"incomplete_sequence_without_lr.c", "EXE": "incomplete_lr.x"})
+self.build(
+dictionary={
+"C_SOURCES": "incomplete_sequence_without_lr.c",
+"EXE": "incomplete_lr.x",
+}
+)
 (target, process, cur_thread, bkpt) = lldbutil.run_to_name_breakpoint(
 self, "incomplete_cas", exe_name="incomplete_lr.x"
 )
 entry_pc = cur_thread.GetFrameAtIndex(0).GetPC()
-
+
 self.runCmd("thread step-inst")
 
 self.expect(
 "thread list",
 substrs=["stopped", "stop reason = instruction step into"],
@@ -61,21 +66,25 @@
 pc = cur_thread.GetFrameAtIndex(0).GetPC()
 self.assertTrue((pc - entry_pc) == 0x4)
 
 @skipIf(archs=no_match(re.compile("rv*")))
 def test_incomplete_sequence_without_sc(self):
-self.build(dictionary={"C_SOURCES": 
"incomplete_sequence_without_sc.c", "EXE": "incomplete_sc.x"})
+self.build(
+dictionary={
+"C_SOURCES": "incomplete_sequence_without_sc.c",
+"EXE": "incomplete_sc.x",
+}
+)
 (target, process, cur_thread, bkpt) = lldbutil.run_to_name_breakpoint(
 self, "incomplete_cas", exe_name="incomplete_sc.x"
 )
 entry_pc = cur_thread.GetFrameAtIndex(0).GetPC()
-
+
 self.runCmd("thread step-inst")
-
+
 self.expect(
 "thread list",
 substrs=["stopped", "stop reason = instruction step into"],
 )
 
 pc = cur_thread.GetFrameAtIndex(0).GetPC()
 self.assertTrue((pc - entry_pc) == 0x4)
-

``




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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread John Harrison via lldb-commits

ashgti wrote:

Okay, the latest version of this worked on buildkit for linux. 

I'll submit this, but if we get reports of it failing with other specific 
versions of python we may need to tweak things a bit.

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, Breakpoints. (PR #141983)

2025-05-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)


Changes

Enabling the breakpoint tests, these have been stable for me locally and I 
think with the recent changes this should be stable again in the CI.

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


3 Files Affected:

- (modified) lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py 
(-1) 
- (modified) 
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py (-1) 
- (modified) 
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py (-1) 


``diff
diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
index 22470daac2887..831edd6494c1e 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
@@ -12,7 +12,6 @@
 import os
 
 
-@skip("Temporarily disable the breakpoint tests")
 class TestDAP_setBreakpoints(lldbdap_testcase.DAPTestCaseBase):
 def setUp(self):
 lldbdap_testcase.DAPTestCaseBase.setUp(self)
diff --git 
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py
index 4dc8c5b3c7ded..92ac66cd44c5d 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py
@@ -10,7 +10,6 @@
 import lldbdap_testcase
 
 
-@skip("Temporarily disable the breakpoint tests")
 class TestDAP_setExceptionBreakpoints(lldbdap_testcase.DAPTestCaseBase):
 @skipIfWindows
 def test_functionality(self):
diff --git 
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py
index baaca4d974d5d..946595f639edc 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py
@@ -10,7 +10,6 @@
 import lldbdap_testcase
 
 
-@skip("Temporarily disable the breakpoint tests")
 class TestDAP_setFunctionBreakpoints(lldbdap_testcase.DAPTestCaseBase):
 @skipIfWindows
 def test_set_and_clear(self):

``




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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, Breakpoints. (PR #141983)

2025-05-29 Thread John Harrison via lldb-commits

https://github.com/ashgti created 
https://github.com/llvm/llvm-project/pull/141983

Enabling the breakpoint tests, these have been stable for me locally and I 
think with the recent changes this should be stable again in the CI.

>From 60ca2ac18ccff832d2137107d3f5161614c02dd1 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Thu, 29 May 2025 09:55:42 -0700
Subject: [PATCH] [lldb-dap] Test Gardening, Breakpoints.

Enabling the breakpoint tests, these have been stable for me locally and I 
think with the recent changes this should be stable again in the CI.
---
 .../test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py | 1 -
 .../tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py | 1 -
 .../tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py  | 1 -
 3 files changed, 3 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
index 22470daac2887..831edd6494c1e 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
@@ -12,7 +12,6 @@
 import os
 
 
-@skip("Temporarily disable the breakpoint tests")
 class TestDAP_setBreakpoints(lldbdap_testcase.DAPTestCaseBase):
 def setUp(self):
 lldbdap_testcase.DAPTestCaseBase.setUp(self)
diff --git 
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py
index 4dc8c5b3c7ded..92ac66cd44c5d 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py
@@ -10,7 +10,6 @@
 import lldbdap_testcase
 
 
-@skip("Temporarily disable the breakpoint tests")
 class TestDAP_setExceptionBreakpoints(lldbdap_testcase.DAPTestCaseBase):
 @skipIfWindows
 def test_functionality(self):
diff --git 
a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py
index baaca4d974d5d..946595f639edc 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py
@@ -10,7 +10,6 @@
 import lldbdap_testcase
 
 
-@skip("Temporarily disable the breakpoint tests")
 class TestDAP_setFunctionBreakpoints(lldbdap_testcase.DAPTestCaseBase):
 @skipIfWindows
 def test_set_and_clear(self):

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


[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)

2025-05-29 Thread via lldb-commits

https://github.com/dlav-sc updated 
https://github.com/llvm/llvm-project/pull/127505

>From 2520b8d7884d320ed7923685b1a3e8652a7e8f5f Mon Sep 17 00:00:00 2001
From: Daniil Avdeev 
Date: Fri, 23 May 2025 13:27:46 +
Subject: [PATCH 1/2] [lldb][RISCV] handle lr/sc single step

lldb-server had limited support for single-stepping through the
lr/sc atomic sequence. This patch enhances that support for all
possible atomic sequences.
---
 lldb/include/lldb/Core/EmulateInstruction.h   |  45 +++
 lldb/source/Core/EmulateInstruction.cpp   |  93 +
 .../Instruction/ARM/EmulateInstructionARM.cpp |  11 ++
 .../Instruction/ARM/EmulateInstructionARM.h   |  18 +++
 .../LoongArch/EmulateInstructionLoongArch.cpp | 122 +++---
 .../LoongArch/EmulateInstructionLoongArch.h   |   2 -
 .../RISCV/EmulateInstructionRISCV.cpp | 117 ++---
 .../RISCV/EmulateInstructionRISCV.h   |  37 +-
 .../Process/FreeBSD/NativeProcessFreeBSD.cpp  |  14 +-
 .../NativeProcessSoftwareSingleStep.cpp   | 108 +++-
 .../Utility/NativeProcessSoftwareSingleStep.h |   2 +-
 .../LoongArch/TestLoongArchEmulator.cpp   |  36 +++---
 12 files changed, 422 insertions(+), 183 deletions(-)

diff --git a/lldb/include/lldb/Core/EmulateInstruction.h 
b/lldb/include/lldb/Core/EmulateInstruction.h
index b459476883fc5..0e3564206ccb8 100644
--- a/lldb/include/lldb/Core/EmulateInstruction.h
+++ b/lldb/include/lldb/Core/EmulateInstruction.h
@@ -32,6 +32,31 @@ class RegisterValue;
 class Stream;
 class Target;
 class UnwindPlan;
+class EmulateInstruction;
+
+using BreakpointLocations = std::vector;
+
+class SingleStepBreakpointLocationsPredictor {
+public:
+  SingleStepBreakpointLocationsPredictor(
+  std::unique_ptr emulator_up)
+  : m_emulator_up{std::move(emulator_up)} {}
+
+  virtual BreakpointLocations GetBreakpointLocations(Status &status);
+
+  virtual unsigned GetBreakpointSize(lldb::addr_t, Status &) { return 4; }
+
+  virtual ~SingleStepBreakpointLocationsPredictor() = default;
+
+protected:
+  lldb::addr_t GetSequentiallyNextInstructionPC(Status &error);
+
+  lldb::addr_t GetBreakpointLocationAddress(lldb::addr_t entry_pc,
+Status &error);
+
+  std::unique_ptr m_emulator_up;
+  bool m_emulation_result = false;
+};
 
 /// \class EmulateInstruction EmulateInstruction.h
 /// "lldb/Core/EmulateInstruction.h"
@@ -497,7 +522,19 @@ class EmulateInstruction : public PluginInterface {
   static uint32_t GetInternalRegisterNumber(RegisterContext *reg_ctx,
 const RegisterInfo ®_info);
 
+  static std::unique_ptr
+  CreateBreakpointLocationPredictor(
+  std::unique_ptr emulator_up);
+
+  // Helper functions
+  std::optional ReadPC();
+  bool WritePC(lldb::addr_t addr);
+
 protected:
+  using BreakpointLocationsPredictorCreator =
+  std::function(
+  std::unique_ptr)>;
+
   ArchSpec m_arch;
   void *m_baton = nullptr;
   ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault;
@@ -508,6 +545,14 @@ class EmulateInstruction : public PluginInterface {
   Opcode m_opcode;
 
 private:
+  virtual BreakpointLocationsPredictorCreator
+  GetSingleStepBreakpointLocationsPredictorCreator() {
+return [](std::unique_ptr emulator_up) {
+  return std::make_unique(
+  std::move(emulator_up));
+};
+  }
+
   // For EmulateInstruction only
   EmulateInstruction(const EmulateInstruction &) = delete;
   const EmulateInstruction &operator=(const EmulateInstruction &) = delete;
diff --git a/lldb/source/Core/EmulateInstruction.cpp 
b/lldb/source/Core/EmulateInstruction.cpp
index d240b4d3b3310..3bc7beff8ac7f 100644
--- a/lldb/source/Core/EmulateInstruction.cpp
+++ b/lldb/source/Core/EmulateInstruction.cpp
@@ -588,7 +588,100 @@ 
EmulateInstruction::GetInternalRegisterNumber(RegisterContext *reg_ctx,
   return LLDB_INVALID_REGNUM;
 }
 
+std::unique_ptr
+EmulateInstruction::CreateBreakpointLocationPredictor(
+std::unique_ptr emulator_up) {
+  auto creator =
+  emulator_up->GetSingleStepBreakpointLocationsPredictorCreator();
+  return creator(std::move(emulator_up));
+}
+
+std::optional EmulateInstruction::ReadPC() {
+  bool success = false;
+  auto addr = ReadRegisterUnsigned(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_PC,
+   LLDB_INVALID_ADDRESS, &success);
+  return success ? std::optional(addr) : std::nullopt;
+}
+
+bool EmulateInstruction::WritePC(lldb::addr_t addr) {
+  EmulateInstruction::Context ctx;
+  ctx.type = eContextAdvancePC;
+  ctx.SetNoArgs();
+  return WriteRegisterUnsigned(ctx, eRegisterKindGeneric,
+   LLDB_REGNUM_GENERIC_PC, addr);
+}
+
 bool EmulateInstruction::CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) {
   unwind_plan.Clear();
   return false;
 }
+
+BreakpointLocations
+SingleStepBreakpointLocationsPredictor::GetBreakpointLocations(Status &status) 
{
+  if (!m_emulator_up->ReadInstruction()

[Lldb-commits] [lldb] 8a49db3 - [lldb-dap] Test Gardening, improving DebugCommunication. (#141689)

2025-05-29 Thread via lldb-commits

Author: John Harrison
Date: 2025-05-29T09:51:27-07:00
New Revision: 8a49db35f45e56c92522c6079e51553e80c07aec

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

LOG: [lldb-dap] Test Gardening, improving DebugCommunication. (#141689)

Improving the readability and correctness of DebugCommunication by
adding type annotations to many parts of the library and trying to
improve the implementation of a few key areas of the code to better
handle correctness.

Specifically, this refactored the
`DebugCommunication._handle_recv_packet` function to ensure consistency
with the reader thread when handling state changes and improved the
`DebugCommunication._recv_packet` helper to make it easier to follow by
adding some additional helpers.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py
lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
lldb/test/API/tools/lldb-dap/console/TestDAP_redirection_to_console.py
lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py

Removed: 




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 4c8c51905e1d0..2b18ecc4056f6 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
@@ -12,14 +12,106 @@
 import sys
 import threading
 import time
-from typing import Any, Optional, Union, BinaryIO, TextIO
+from typing import (
+IO,
+Any,
+Optional,
+Union,
+List,  # required for python 3.8 compatibility
+Dict,  # required for python 3.8 compatibility
+Tuple,  # required for python 3.8 compatibility
+TextIO,
+TypedDict,
+Literal,
+Callable,
+TypeVar,
+cast,
+TYPE_CHECKING,
+)
+
+if TYPE_CHECKING:
+# FIXME: Add mypy and typing_extensions to the requirements.txt once all
+# build bots support the library.
+from typing_extensions import Unpack
 
 ## DAP type references
-Event = dict[str, Any]
-Request = dict[str, Any]
-Response = dict[str, Any]
+
+T = TypeVar("T")
+
+
+class Event(TypedDict):
+type: Literal["event"]
+seq: Literal[0]
+event: str
+body: Optional[dict]
+
+
+class Request(TypedDict):
+type: Literal["request"]
+seq: int
+command: str
+arguments: Optional[dict]
+
+
+class Response(TypedDict):
+type: Literal["response"]
+seq: Literal[0]
+request_seq: int
+success: bool
+command: str
+message: Optional[str]
+body: Optional[dict]
+
+
+class AttachOrLaunchArguments(TypedDict, total=False):
+stopOnEntry: bool
+disableASLR: bool
+disableSTDIO: bool
+enableAutoVariableSummaries: bool
+displayExtendedBacktrace: bool
+enableSyntheticChildDebugging: bool
+initCommands: List[str]
+preRunCommands: List[str]
+postRunCommands: List[str]
+stopCommands: List[str]
+exitCommands: List[str]
+terminateCommands: List[str]
+sourceMap: Union[List[Tuple[str, str]], Dict[str, str]]
+sourcePath: str
+debuggerRoot: str
+commandEscapePrefix: str
+customFrameFormat: str
+customThreadFormat: str
+
+
+class LaunchArguments(AttachOrLaunchArguments, total=False):
+program: str
+args: List[str]
+cwd: str
+env: Dict[str, str]
+shellExpandArguments: bool
+runInTerminal: bool
+launchCommands: List[str]
+
+
+class AttachArguments(AttachOrLaunchArguments, total=False):
+program: str
+pid: int
+waitFor: bool
+attachCommands: List[str]
+coreFile: str
+gdbRemotePort: int
+gdbRemoteHostname: str
+
+
 ProtocolMessage = Union[Event, Request, Response]
 
+# An internal type used for tracking protocol messages and an EOF sentinel
+# value. 'None' cannot easily be used as a sentinel because it is a falsy
+# value. When returned outside of DebugCommunication an EOFError is typically
+# converted into 'None'.
+_InternalProtocolMessage = Union[Event, Request, Response, EOFError]
+
 
 def dump_memory(base_addr, data, num_per_line, outfile):
 data_len = len(data)
@@ -58,44 +150,42 @@ def dump_memory(base_addr, data, num_per_line, outfile):
 outfile.write("\n")
 
 
-def read_packet(f, verbose=False, trace_file=None):
+def read_packet(
+f: IO[bytes], verbose=False, trace_file=None
+) -> _InternalProtocolMessage:
 """Decode a JSON packet that starts with the content length and is
 followed by the JSON bytes from a file 'f'. Returns None on EOF.
 """
-line = f.readline().decode("utf-8")
+line = f.readline().decode()
 if len(line) == 0:
-r

[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread John Harrison via lldb-commits

ashgti wrote:

Looking into the failure on the buildbot.

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-aarch64-ubuntu` 
running on `linaro-lldb-aarch64-ubuntu` while building `lldb` at step 6 "test".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/59/builds/18540


Here is the relevant piece of the build log for the reference

```
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/breakpoint/TestDAP_setFunctionBreakpoints.py (1170 of 2194)
PASS: lldb-api :: python_api/watchpoint/watchlocation/TestSetWatchlocation.py 
(1171 of 2194)
PASS: lldb-api :: tools/lldb-dap/commands/TestDAP_commands.py (1172 of 2194)
PASS: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_logpoints.py (1173 of 2194)
PASS: lldb-api :: python_api/process/cancel_attach/TestCancelAttach.py (1174 of 
2194)
PASS: lldb-api :: tools/lldb-dap/cancel/TestDAP_cancel.py (1175 of 2194)
PASS: lldb-api :: tools/lldb-dap/console/TestDAP_redirection_to_console.py 
(1176 of 2194)
PASS: lldb-api :: tools/lldb-dap/completions/TestDAP_completions.py (1177 of 
2194)
PASS: lldb-api :: tools/lldb-dap/coreFile/TestDAP_coreFile.py (1178 of 2194)
PASS: lldb-api :: tools/lldb-dap/console/TestDAP_console.py (1179 of 2194)
FAIL: lldb-api :: tools/lldb-dap/disassemble/TestDAP_disassemble.py (1180 of 
2194)
 TEST 'lldb-api :: 
tools/lldb-dap/disassemble/TestDAP_disassemble.py' FAILED 
Script:
--
/usr/bin/python3.10 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include 
--env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--arch aarch64 --build-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil 
--make /usr/bin/gmake --llvm-tools-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type 
Release 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/disassemble
 -p TestDAP_disassemble.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
8a49db35f45e56c92522c6079e51553e80c07aec)
  clang revision 8a49db35f45e56c92522c6079e51553e80c07aec
  llvm revision 8a49db35f45e56c92522c6079e51553e80c07aec
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 
'debugserver', 'objc']

--
Command Output (stderr):
--
= DEBUG ADAPTER PROTOCOL LOGS =
1748538209.713754892 --> (stdio) 
{"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1}
1748538209.715912819 <-- (stdio) {"body":{"$__lldb_version":"lldb version 
21.0.0git (https://github.com/llvm/llvm-project.git revision 
8a49db35f45e56c92522c6079e51553e80c07aec)\n  clang revision 
8a49db35f45e56c92522c6079e51553e80c07aec\n  llvm revision 
8a49db35f45e56c92522c6079e51553e80c07aec","completionTriggerCharacters":["."," 
","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++
 Catch"},{"default":false,"filter":"cpp_throw","label":"C++ 
Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C 
Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C 
Throw"}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsReadMemoryRequest":true,"supportsRestartRequest":true,"supportsSetVariable":

[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-29 Thread John Harrison via lldb-commits

ashgti wrote:

I'm surprised by some of these failures, since it passed on buildkite and the 
premerge check that are also on linux x86_64. Trying to understand the reason 
for these failures.

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


[Lldb-commits] [lldb] 9ca41b6 - [LLDB][Minidump] Fix bug in generating 64b memory minidumps (#141995)

2025-05-29 Thread via lldb-commits

Author: Jacob Lalonde
Date: 2025-05-29T11:06:56-07:00
New Revision: 9ca41b6b65680c9eceb938c0e27d8d054114e680

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

LOG: [LLDB][Minidump] Fix bug in generating 64b memory minidumps (#141995)

In #129307, we introduced read write in chunks, and during the final
revision of the PR I changed the behavior for 64b memory regions and did
not test an actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region. 

64b regions has been a problem in testing for some time as it's a waste
of test resources to generation a 5gb+ Minidump. I will work with
@clayborg and @labath to come up with a way to specify creating a 64b
list instead of a 32b list (likely via the yamilizer).

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 2818d31eb2301..806f256d9da48 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -1170,7 +1170,6 @@ 
MinidumpFileBuilder::AddMemoryList_64(std::vector &ranges,
   "(%" PRIx64 "bytes) "
   "[%" PRIx64 ", %" PRIx64 ")",
   region_index, ranges.size(), size, addr, addr + size);
-++region_index;
 
 progress.Increment(1, "Adding Memory Range " + core_range.Dump());
 uint64_t bytes_read = 0;
@@ -1186,6 +1185,8 @@ 
MinidumpFileBuilder::AddMemoryList_64(std::vector &ranges,
   cleanup_required = true;
   descriptors[region_index].DataSize = bytes_read;
 }
+
+++region_index;
   }
 
   // Early return if there is no cleanup needed.



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


[Lldb-commits] [lldb] [LLDB][Minidump] Fix bug in generating 64b memory minidumps (PR #141995)

2025-05-29 Thread Jacob Lalonde via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-29 Thread John Harrison via lldb-commits


@@ -58,6 +59,9 @@ class LLDB_API SBAddress {
   // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
   lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);
 
+  lldb::SBSymbolContext GetSymbolContext(const SBTarget &target,
+ uint32_t resolve_scope);

ashgti wrote:

Should we fix `SBTarget::ResolveSymbolContextForAddress` to set the 
`sc.target_sp` instead of introducing a new API? Without reading the source, I 
would have expected the SBTarget API to handle the source mapping correctly. 

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


[Lldb-commits] [lldb] [NFC][lldb][lldb-dap][test] show the expected value in the error message. (PR #142030)

2025-05-29 Thread Jonas Devlieghere via lldb-commits


@@ -45,9 +45,14 @@ def test_optimized_variable(self):
 self.continue_to_breakpoints(breakpoint_ids)
 optimized_variable = self.dap_server.get_local_variable("argc")
 
-self.assertTrue(optimized_variable["value"].startswith("https://github.com/llvm/llvm-project/pull/142030
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] fix config value comparison (PR #142017)

2025-05-29 Thread John Harrison via lldb-commits

https://github.com/ashgti approved this pull request.


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


[Lldb-commits] [lldb] [lldb] Refactor away UB in SBValue::GetLoadAddress (PR #141799)

2025-05-29 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/141799

>From bbef9674f7e5cf9fbc488e27dfd0e35fed23608a Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Wed, 28 May 2025 18:25:46 +0200
Subject: [PATCH 1/2] [lldb] Refactor away UB in SBValue::GetLoadAddress

The problem was in calling GetLoadAddress on a value in the error state,
where `ValueObject::GetLoadAddress` could end up accessing the
uninitialized "address type" by-ref return value from `GetAddressOf`.
This probably happened because each function expected the other to
initialize it.

We can guarantee initialization by turning this into a proper return
value.

I've added a test, but it only (reliably) crashes if lldb is built with
ubsan.
---
 lldb/include/lldb/ValueObject/ValueObject.h   |  6 +-
 .../lldb/ValueObject/ValueObjectConstResult.h |  4 +-
 .../ValueObject/ValueObjectConstResultChild.h |  4 +-
 .../ValueObject/ValueObjectConstResultImpl.h  |  4 +-
 lldb/source/API/SBValue.cpp   |  6 +-
 .../Commands/CommandObjectWatchpoint.cpp  |  2 +-
 .../DataFormatters/CXXFunctionPointer.cpp |  3 +-
 .../DataFormatters/FormattersHelpers.cpp  |  8 +-
 lldb/source/DataFormatters/TypeFormat.cpp |  2 +-
 .../DataFormatters/ValueObjectPrinter.cpp |  3 +-
 lldb/source/Expression/Materializer.cpp   |  4 +-
 .../Clang/ClangUserExpression.cpp |  2 +-
 .../Plugins/Language/CPlusPlus/Coroutines.cpp |  3 +-
 .../Plugins/Language/CPlusPlus/LibCxxList.cpp |  2 +-
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  | 18 +---
 .../ItaniumABI/ItaniumABILanguageRuntime.cpp  | 66 ++---
 .../AppleObjCRuntime/AppleObjCRuntimeV1.cpp   |  2 +-
 .../AppleObjCRuntime/AppleObjCRuntimeV2.cpp   |  4 +-
 .../ObjC/ObjCLanguageRuntime.cpp  |  2 +-
 lldb/source/ValueObject/ValueObject.cpp   | 93 +++
 lldb/source/ValueObject/ValueObjectChild.cpp  |  2 +-
 .../ValueObject/ValueObjectConstResult.cpp|  6 +-
 .../ValueObjectConstResultChild.cpp   |  7 +-
 .../ValueObjectConstResultImpl.cpp| 18 ++--
 lldb/source/ValueObject/ValueObjectVTable.cpp |  2 +-
 .../test/API/python_api/value/TestValueAPI.py | 11 ++-
 26 files changed, 121 insertions(+), 163 deletions(-)

diff --git a/lldb/include/lldb/ValueObject/ValueObject.h 
b/lldb/include/lldb/ValueObject/ValueObject.h
index 0add8ebeccdc8..5b78e57cb4996 100644
--- a/lldb/include/lldb/ValueObject/ValueObject.h
+++ b/lldb/include/lldb/ValueObject/ValueObject.h
@@ -573,10 +573,10 @@ class ValueObject {
   /// child as well.
   void SetName(ConstString name) { m_name = name; }
 
-  virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
-AddressType *address_type = nullptr);
+  virtual std::pair
+  GetAddressOf(bool scalar_is_load_address = true);
 
-  lldb::addr_t GetPointerValue(AddressType *address_type = nullptr);
+  std::pair GetPointerValue();
 
   lldb::ValueObjectSP GetSyntheticChild(ConstString key) const;
 
diff --git a/lldb/include/lldb/ValueObject/ValueObjectConstResult.h 
b/lldb/include/lldb/ValueObject/ValueObjectConstResult.h
index 2ee531f5858e1..3a11ab360649a 100644
--- a/lldb/include/lldb/ValueObject/ValueObjectConstResult.h
+++ b/lldb/include/lldb/ValueObject/ValueObjectConstResult.h
@@ -86,8 +86,8 @@ class ValueObjectConstResult : public ValueObject {
 
   lldb::ValueObjectSP AddressOf(Status &error) override;
 
-  lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
-AddressType *address_type = nullptr) override;
+  std::pair
+  GetAddressOf(bool scalar_is_load_address = true) override;
 
   size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
 uint32_t item_count = 1) override;
diff --git a/lldb/include/lldb/ValueObject/ValueObjectConstResultChild.h 
b/lldb/include/lldb/ValueObject/ValueObjectConstResultChild.h
index ad97b885684ee..09d62253e1bb0 100644
--- a/lldb/include/lldb/ValueObject/ValueObjectConstResultChild.h
+++ b/lldb/include/lldb/ValueObject/ValueObjectConstResultChild.h
@@ -48,8 +48,8 @@ class ValueObjectConstResultChild : public ValueObjectChild {
 
   lldb::ValueObjectSP AddressOf(Status &error) override;
 
-  lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
-AddressType *address_type = nullptr) override;
+  std::pair
+  GetAddressOf(bool scalar_is_load_address = true) override;
 
   size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
 uint32_t item_count = 1) override;
diff --git a/lldb/include/lldb/ValueObject/ValueObjectConstResultImpl.h 
b/lldb/include/lldb/ValueObject/ValueObjectConstResultImpl.h
index 5509886a8965d..3fc882ac782ec 100644
--- a/lldb/include/lldb/ValueObject/ValueObjectConstResultImpl.h
+++ b/lldb/include/lldb/ValueObject/ValueObjectConstResultImpl.h
@@ -58,8 +58,8 @@ class ValueObjectConstResultImpl {
 m_live_address_type = address_type;
   }
 
-  virt

[Lldb-commits] [lldb] [lldb] Refactor away UB in SBValue::GetLoadAddress (PR #141799)

2025-05-29 Thread Pavel Labath via lldb-commits

labath wrote:

Using a named struct now. I think it worked out pretty well. One thing you 
can't do (without additional goo) with this struct is to use `std::tie` to 
decompose it, but I think I managed to refactor stuff so that this is not 
needed.

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


[Lldb-commits] [lldb] [lldb-dap] Treat empty thread names as unset (PR #141529)

2025-05-29 Thread via lldb-commits

https://github.com/Nerixyz updated 
https://github.com/llvm/llvm-project/pull/141529

>From 2a79486c4d45a8b4251ad32cd0629473c4ce828d Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Mon, 26 May 2025 22:25:05 +0200
Subject: [PATCH] [lldb-dap] Treat empty thread names as unset

---
 lldb/test/API/tools/lldb-dap/threads/Makefile |  2 +-
 .../tools/lldb-dap/threads/TestDAP_threads.py | 27 ++-
 lldb/test/API/tools/lldb-dap/threads/main.c   | 21 ---
 lldb/test/API/tools/lldb-dap/threads/main.cpp | 18 +
 lldb/tools/lldb-dap/JSONUtils.cpp | 10 +++
 5 files changed, 44 insertions(+), 34 deletions(-)
 delete mode 100644 lldb/test/API/tools/lldb-dap/threads/main.c
 create mode 100644 lldb/test/API/tools/lldb-dap/threads/main.cpp

diff --git a/lldb/test/API/tools/lldb-dap/threads/Makefile 
b/lldb/test/API/tools/lldb-dap/threads/Makefile
index aa6b054685d61..c33ae5685efc7 100644
--- a/lldb/test/API/tools/lldb-dap/threads/Makefile
+++ b/lldb/test/API/tools/lldb-dap/threads/Makefile
@@ -1,4 +1,4 @@
-C_SOURCES := main.c
+CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
diff --git a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py 
b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
index a4658da58ac94..b9c8802144ebd 100644
--- a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
+++ b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
@@ -6,10 +6,10 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 import lldbdap_testcase
+import re
 
 
 class TestDAP_threads(lldbdap_testcase.DAPTestCaseBase):
-@skipIfWindows
 def test_correct_thread(self):
 """
 Tests that the correct thread is selected if we continue from
@@ -19,7 +19,7 @@ def test_correct_thread(self):
 """
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program)
-source = "main.c"
+source = "main.cpp"
 breakpoint_line = line_number(source, "// break here")
 lines = [breakpoint_line]
 # Set breakpoint in the thread function
@@ -42,8 +42,10 @@ def test_correct_thread(self):
 )
 self.assertFalse(stopped_event[0]["body"]["preserveFocusHint"])
 self.assertTrue(stopped_event[0]["body"]["threadCausedFocus"])
+# All threads should be named Thread {index}
+threads = self.dap_server.get_threads()
+self.assertTrue(all(re.match(r'^Thread \d+$', t["name"]) for t in 
threads))
 
-@skipIfWindows
 def test_thread_format(self):
 """
 Tests the support for custom thread formats.
@@ -54,7 +56,7 @@ def test_thread_format(self):
 customThreadFormat="This is thread index #${thread.index}",
 stopCommands=["thread list"],
 )
-source = "main.c"
+source = "main.cpp"
 breakpoint_line = line_number(source, "// break here")
 lines = [breakpoint_line]
 # Set breakpoint in the thread function
@@ -63,8 +65,19 @@ def test_thread_format(self):
 len(breakpoint_ids), len(lines), "expect correct number of 
breakpoints"
 )
 self.continue_to_breakpoints(breakpoint_ids)
-# We are stopped at the second thread
+# We are stopped at the first thread
 threads = self.dap_server.get_threads()
 print("got thread", threads)
-self.assertEqual(threads[0]["name"], "This is thread index #1")
-self.assertEqual(threads[1]["name"], "This is thread index #2")
+if self.getPlatform() == "windows":
+# Windows creates a thread pool once WaitForSingleObject is called
+# by thread.join(). As we are in the thread function, we can't be 
+# certain that join() has been called yet and a thread pool has 
+# been created, thus we only check for the first two threads.
+names = list(sorted(t["name"] for t in threads))[:2]
+self.assertEqual(names, [
+"This is thread index #1",
+"This is thread index #2"
+])
+else:
+self.assertEqual(threads[0]["name"], "This is thread index #1")
+self.assertEqual(threads[1]["name"], "This is thread index #2")
diff --git a/lldb/test/API/tools/lldb-dap/threads/main.c 
b/lldb/test/API/tools/lldb-dap/threads/main.c
deleted file mode 100644
index 3eeb1ef02cb87..0
--- a/lldb/test/API/tools/lldb-dap/threads/main.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include 
-#include 
-
-int state_var;
-
-void *thread(void *in) {
-  state_var++; // break here
-  return NULL;
-}
-
-int main(int argc, char **argv) {
-  pthread_t t1, t2;
-
-  pthread_create(&t1, NULL, *thread, NULL);
-  pthread_join(t1, NULL);
-  pthread_create(&t2, NULL, *thread, NULL);
-  pthread_join(t2, NULL);
-
-  printf("state_var is %d\n", state_var);
-  return 0;
-}
diff --git a/lldb/test/API/tools/lldb-dap/threads/main.cpp 
b/lldb/test/API/tools/lldb-dap/threads/main.c

[Lldb-commits] [lldb] [lldb-dap] Treat empty thread names as unset (PR #141529)

2025-05-29 Thread via lldb-commits

Nerixyz wrote:

> The launch sequence is in parallel. Is it possible that the two debug adapter 
> implements are handling them in different orders? It took me a while to 
> realize this. I found this diagram enlightening: [microsoft/vscode#4902 
> (comment)](https://github.com/microsoft/vscode/issues/4902#issuecomment-368583522)

Ah, thank you! This cleared things up for me. I was a bit confused why I saw a 
third thread when debugging, but it turns out that the launch sequence is fine 
and it's Windows creating a thread pool in the background when calling 
WaitForSingleObject ([according to this SO 
answer](https://stackoverflow.com/a/63098682/16300717)), which is called in 
`thread.join()`.

I converted the tests to C++ now, as C's `` isn't supported 
everywhere. Furthermore, I only ignore the order of threads on Windows.

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


[Lldb-commits] [lldb] [lldb-dap] Treat empty thread names as unset (PR #141529)

2025-05-29 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r HEAD~1...HEAD 
lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
``





View the diff from darker here.


``diff
--- TestDAP_threads.py  2025-05-29 10:30:33.00 +
+++ TestDAP_threads.py  2025-05-29 10:36:04.955100 +
@@ -42,11 +42,11 @@
 )
 self.assertFalse(stopped_event[0]["body"]["preserveFocusHint"])
 self.assertTrue(stopped_event[0]["body"]["threadCausedFocus"])
 # All threads should be named Thread {index}
 threads = self.dap_server.get_threads()
-self.assertTrue(all(re.match(r'^Thread \d+$', t["name"]) for t in 
threads))
+self.assertTrue(all(re.match(r"^Thread \d+$", t["name"]) for t in 
threads))
 
 def test_thread_format(self):
 """
 Tests the support for custom thread formats.
 """
@@ -68,16 +68,15 @@
 # We are stopped at the first thread
 threads = self.dap_server.get_threads()
 print("got thread", threads)
 if self.getPlatform() == "windows":
 # Windows creates a thread pool once WaitForSingleObject is called
-# by thread.join(). As we are in the thread function, we can't be 
-# certain that join() has been called yet and a thread pool has 
+# by thread.join(). As we are in the thread function, we can't be
+# certain that join() has been called yet and a thread pool has
 # been created, thus we only check for the first two threads.
 names = list(sorted(t["name"] for t in threads))[:2]
-self.assertEqual(names, [
-"This is thread index #1",
-"This is thread index #2"
-])
+self.assertEqual(
+names, ["This is thread index #1", "This is thread index #2"]
+)
 else:
 self.assertEqual(threads[0]["name"], "This is thread index #1")
 self.assertEqual(threads[1]["name"], "This is thread index #2")

``




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


[Lldb-commits] [lldb] [lldb-dap] Treat empty thread names as unset (PR #141529)

2025-05-29 Thread via lldb-commits

https://github.com/Nerixyz updated 
https://github.com/llvm/llvm-project/pull/141529

>From 2f597d5b2355d7b786d76457ca3435f6cd577e3e Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Mon, 26 May 2025 22:25:05 +0200
Subject: [PATCH] [lldb-dap] Treat empty thread names as unset

---
 lldb/test/API/tools/lldb-dap/threads/Makefile |  2 +-
 .../tools/lldb-dap/threads/TestDAP_threads.py | 26 ++-
 lldb/test/API/tools/lldb-dap/threads/main.c   | 21 ---
 lldb/test/API/tools/lldb-dap/threads/main.cpp | 18 +
 lldb/tools/lldb-dap/JSONUtils.cpp | 10 +++
 5 files changed, 43 insertions(+), 34 deletions(-)
 delete mode 100644 lldb/test/API/tools/lldb-dap/threads/main.c
 create mode 100644 lldb/test/API/tools/lldb-dap/threads/main.cpp

diff --git a/lldb/test/API/tools/lldb-dap/threads/Makefile 
b/lldb/test/API/tools/lldb-dap/threads/Makefile
index aa6b054685d61..c33ae5685efc7 100644
--- a/lldb/test/API/tools/lldb-dap/threads/Makefile
+++ b/lldb/test/API/tools/lldb-dap/threads/Makefile
@@ -1,4 +1,4 @@
-C_SOURCES := main.c
+CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
diff --git a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py 
b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
index a4658da58ac94..1c7be64f7ab33 100644
--- a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
+++ b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
@@ -6,10 +6,10 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 import lldbdap_testcase
+import re
 
 
 class TestDAP_threads(lldbdap_testcase.DAPTestCaseBase):
-@skipIfWindows
 def test_correct_thread(self):
 """
 Tests that the correct thread is selected if we continue from
@@ -19,7 +19,7 @@ def test_correct_thread(self):
 """
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program)
-source = "main.c"
+source = "main.cpp"
 breakpoint_line = line_number(source, "// break here")
 lines = [breakpoint_line]
 # Set breakpoint in the thread function
@@ -42,8 +42,10 @@ def test_correct_thread(self):
 )
 self.assertFalse(stopped_event[0]["body"]["preserveFocusHint"])
 self.assertTrue(stopped_event[0]["body"]["threadCausedFocus"])
+# All threads should be named Thread {index}
+threads = self.dap_server.get_threads()
+self.assertTrue(all(re.match(r"^Thread \d+$", t["name"]) for t in 
threads))
 
-@skipIfWindows
 def test_thread_format(self):
 """
 Tests the support for custom thread formats.
@@ -54,7 +56,7 @@ def test_thread_format(self):
 customThreadFormat="This is thread index #${thread.index}",
 stopCommands=["thread list"],
 )
-source = "main.c"
+source = "main.cpp"
 breakpoint_line = line_number(source, "// break here")
 lines = [breakpoint_line]
 # Set breakpoint in the thread function
@@ -63,8 +65,18 @@ def test_thread_format(self):
 len(breakpoint_ids), len(lines), "expect correct number of 
breakpoints"
 )
 self.continue_to_breakpoints(breakpoint_ids)
-# We are stopped at the second thread
+# We are stopped at the first thread
 threads = self.dap_server.get_threads()
 print("got thread", threads)
-self.assertEqual(threads[0]["name"], "This is thread index #1")
-self.assertEqual(threads[1]["name"], "This is thread index #2")
+if self.getPlatform() == "windows":
+# Windows creates a thread pool once WaitForSingleObject is called
+# by thread.join(). As we are in the thread function, we can't be
+# certain that join() has been called yet and a thread pool has
+# been created, thus we only check for the first two threads.
+names = list(sorted(t["name"] for t in threads))[:2]
+self.assertEqual(
+names, ["This is thread index #1", "This is thread index #2"]
+)
+else:
+self.assertEqual(threads[0]["name"], "This is thread index #1")
+self.assertEqual(threads[1]["name"], "This is thread index #2")
diff --git a/lldb/test/API/tools/lldb-dap/threads/main.c 
b/lldb/test/API/tools/lldb-dap/threads/main.c
deleted file mode 100644
index 3eeb1ef02cb87..0
--- a/lldb/test/API/tools/lldb-dap/threads/main.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include 
-#include 
-
-int state_var;
-
-void *thread(void *in) {
-  state_var++; // break here
-  return NULL;
-}
-
-int main(int argc, char **argv) {
-  pthread_t t1, t2;
-
-  pthread_create(&t1, NULL, *thread, NULL);
-  pthread_join(t1, NULL);
-  pthread_create(&t2, NULL, *thread, NULL);
-  pthread_join(t2, NULL);
-
-  printf("state_var is %d\n", state_var);
-  return 0;
-}
diff --git a/lldb/test/API/tools/lldb-dap/threads/main.cpp 
b/lldb/test/API/tools/lldb-dap/threads/main.cpp
new file mode 10

[Lldb-commits] [lldb] [lldb][SymbolFileDWARF] Don't search for DWP files on macOS (PR #139554)

2025-05-29 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-ubuntu` 
running on `as-builder-9` while building `lldb` at step 16 
"test-check-lldb-api".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/195/builds/9716


Here is the relevant piece of the build log for the reference

```
Step 16 (test-check-lldb-api) failure: Test just built components: 
check-lldb-api completed (failure)
...
PASS: lldb-api :: types/TestCharTypeExpr.py (1269 of 1278)
PASS: lldb-api :: types/TestIntegerType.py (1270 of 1278)
PASS: lldb-api :: types/TestRecursiveTypes.py (1271 of 1278)
UNSUPPORTED: lldb-api :: windows/launch/missing-dll/TestMissingDll.py (1272 of 
1278)
PASS: lldb-api :: types/TestIntegerTypeExpr.py (1273 of 1278)
PASS: lldb-api :: types/TestShortType.py (1274 of 1278)
PASS: lldb-api :: types/TestShortTypeExpr.py (1275 of 1278)
PASS: lldb-api :: types/TestLongTypes.py (1276 of 1278)
PASS: lldb-api :: types/TestLongTypesExpr.py (1277 of 1278)
TIMEOUT: lldb-api :: python_api/process/cancel_attach/TestCancelAttach.py (1278 
of 1278)
 TEST 'lldb-api :: 
python_api/process/cancel_attach/TestCancelAttach.py' FAILED 

Script:
--
/usr/bin/python3.12 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib
 --env 
LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include
 --env 
LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin
 --libcxx-include-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1
 --libcxx-include-target-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1
 --libcxx-library-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu
 --arch aarch64 --build-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex
 --lldb-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb 
--compiler 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang 
--dsymutil 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil
 --make /usr/bin/gmake --llvm-tools-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin 
--lldb-obj-root 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb 
--lldb-libs-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib 
--cmake-build-type Release --platform-url 
connect://jetson-agx-2198.lab.llvm.org:1234 --platform-working-dir 
/home/ubuntu/lldb-tests --sysroot /mnt/fs/jetson-agx-ubuntu --env 
ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux 
--skip-category=lldb-server 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/python_api/process/cancel_attach
 -p TestCancelAttach.py
--
Exit Code: -9
Timeout: Reached timeout of 600 seconds

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
f5c6b7bde984691b60edc8585d1065107e60b5f3)
  clang revision f5c6b7bde984691b60edc8585d1065107e60b5f3
  llvm revision f5c6b7bde984691b60edc8585d1065107e60b5f3

--
Command Output (stderr):
--
WARNING:root:Custom libc++ is not supported for remote runs: ignoring --libcxx 
arguments
FAIL: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_scripted_implementation 
(TestCancelAttach.AttachCancelTestCase.test_scripted_implementation)

--


Slowest Tests:
--
600.04s: lldb-api :: python_api/process/cancel_attach/TestCancelAttach.py
180.95s: lldb-api :: commands/command/script_alias/TestCommandScriptAlias.py
70.80s: lldb-api :: commands/process/attach/TestProcessAttach.py
39.57s: lldb-api :: 
functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
34.88s: lldb-api :: 
functionalities/single-thread-step/TestSingleThreadStepTimeout.py
34.86s: lldb-api :: functionalities/completion/TestCompletion.py
23.54s: lldb-api :: 
python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
21.92s: lldb-api :: commands/statistics/basic/TestStats.py
20.69s: lldb-api :: functionalities/gdb_remote_client/TestPlatformClient.py
18.98s: lldb-api :: functionalities/thread/state/TestThreadStates.py
18.14s: lldb-api :: commands/dwim-print/

[Lldb-commits] [lldb] [lldb][RPC] Upstream LLDB to RPC converstion Python script (PR #138028)

2025-05-29 Thread David Spickett via lldb-commits


@@ -0,0 +1,70 @@
+#!/usr/bin/env python3

DavidSpickett wrote:

Does this need a license header?

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


[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)

2025-05-29 Thread David Spickett via lldb-commits

DavidSpickett wrote:

@laverdet I've been told we need kernel changes to handle parts of this. Those 
are planned, and I will work on the lldb side once they are available.

In the meantime, this patch does prevent lldb crashing but I'm not comfortable 
merging it when other features won't work. If we get to the next release time 
and we don't have a complete solution we can consider whether to commit this as 
a temporary work around.

If you do use lldb with this patch, I've no doubt you'll find other problems so 
please add them to https://github.com/llvm/llvm-project/issues/138717 so I know 
to check them with the new changes.

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


[Lldb-commits] [lldb] [lldb-dap] Treat empty thread names as unset (PR #141529)

2025-05-29 Thread via lldb-commits

https://github.com/Nerixyz updated 
https://github.com/llvm/llvm-project/pull/141529

>From 0f5a95ebe67f54ba7dfe55ff8450226ba84f113d Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Mon, 26 May 2025 22:25:05 +0200
Subject: [PATCH] [lldb-dap] Treat empty thread names as unset

---
 lldb/test/API/tools/lldb-dap/threads/Makefile |  2 +-
 .../tools/lldb-dap/threads/TestDAP_threads.py | 27 +--
 lldb/test/API/tools/lldb-dap/threads/main.c   | 21 ---
 lldb/test/API/tools/lldb-dap/threads/main.cpp | 18 +
 lldb/tools/lldb-dap/JSONUtils.cpp | 10 +++
 5 files changed, 43 insertions(+), 35 deletions(-)
 delete mode 100644 lldb/test/API/tools/lldb-dap/threads/main.c
 create mode 100644 lldb/test/API/tools/lldb-dap/threads/main.cpp

diff --git a/lldb/test/API/tools/lldb-dap/threads/Makefile 
b/lldb/test/API/tools/lldb-dap/threads/Makefile
index aa6b054685d61..c33ae5685efc7 100644
--- a/lldb/test/API/tools/lldb-dap/threads/Makefile
+++ b/lldb/test/API/tools/lldb-dap/threads/Makefile
@@ -1,4 +1,4 @@
-C_SOURCES := main.c
+CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
diff --git a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py 
b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
index a4658da58ac94..acd6108853787 100644
--- a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
+++ b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
@@ -1,5 +1,5 @@
 """
-Test lldb-dap setBreakpoints request
+Test lldb-dap threads request
 """
 
 from lldbsuite.test.decorators import *
@@ -9,7 +9,6 @@
 
 
 class TestDAP_threads(lldbdap_testcase.DAPTestCaseBase):
-@skipIfWindows
 def test_correct_thread(self):
 """
 Tests that the correct thread is selected if we continue from
@@ -19,7 +18,7 @@ def test_correct_thread(self):
 """
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program)
-source = "main.c"
+source = "main.cpp"
 breakpoint_line = line_number(source, "// break here")
 lines = [breakpoint_line]
 # Set breakpoint in the thread function
@@ -42,8 +41,10 @@ def test_correct_thread(self):
 )
 self.assertFalse(stopped_event[0]["body"]["preserveFocusHint"])
 self.assertTrue(stopped_event[0]["body"]["threadCausedFocus"])
+# All threads should be named Thread {index}
+threads = self.dap_server.get_threads()
+self.assertTrue(all(len(t["name"]) > 0 for t in threads))
 
-@skipIfWindows
 def test_thread_format(self):
 """
 Tests the support for custom thread formats.
@@ -54,7 +55,7 @@ def test_thread_format(self):
 customThreadFormat="This is thread index #${thread.index}",
 stopCommands=["thread list"],
 )
-source = "main.c"
+source = "main.cpp"
 breakpoint_line = line_number(source, "// break here")
 lines = [breakpoint_line]
 # Set breakpoint in the thread function
@@ -63,8 +64,18 @@ def test_thread_format(self):
 len(breakpoint_ids), len(lines), "expect correct number of 
breakpoints"
 )
 self.continue_to_breakpoints(breakpoint_ids)
-# We are stopped at the second thread
+# We are stopped at the first thread
 threads = self.dap_server.get_threads()
 print("got thread", threads)
-self.assertEqual(threads[0]["name"], "This is thread index #1")
-self.assertEqual(threads[1]["name"], "This is thread index #2")
+if self.getPlatform() == "windows":
+# Windows creates a thread pool once WaitForSingleObject is called
+# by thread.join(). As we are in the thread function, we can't be
+# certain that join() has been called yet and a thread pool has
+# been created, thus we only check for the first two threads.
+names = list(sorted(t["name"] for t in threads))[:2]
+self.assertEqual(
+names, ["This is thread index #1", "This is thread index #2"]
+)
+else:
+self.assertEqual(threads[0]["name"], "This is thread index #1")
+self.assertEqual(threads[1]["name"], "This is thread index #2")
diff --git a/lldb/test/API/tools/lldb-dap/threads/main.c 
b/lldb/test/API/tools/lldb-dap/threads/main.c
deleted file mode 100644
index 3eeb1ef02cb87..0
--- a/lldb/test/API/tools/lldb-dap/threads/main.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include 
-#include 
-
-int state_var;
-
-void *thread(void *in) {
-  state_var++; // break here
-  return NULL;
-}
-
-int main(int argc, char **argv) {
-  pthread_t t1, t2;
-
-  pthread_create(&t1, NULL, *thread, NULL);
-  pthread_join(t1, NULL);
-  pthread_create(&t2, NULL, *thread, NULL);
-  pthread_join(t2, NULL);
-
-  printf("state_var is %d\n", state_var);
-  return 0;
-}
diff --git a/lldb/test/API/tools/lldb-dap/threads/main.cpp 
b/lldb/test/API/tools/lldb-dap/threads/main.cpp
new file mo

[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-29 Thread Dhruv Srivastava via lldb-commits

https://github.com/DhruvSrivastavaX approved this pull request.


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


[Lldb-commits] [lldb] f4e1ec5 - [lldb][AIX] get host info for AIX (cont..) (#138687)

2025-05-29 Thread via lldb-commits

Author: Hemang Gadhavi
Date: 2025-05-29T16:33:00+05:30
New Revision: f4e1ec55df92303b8ccd0d8475fc2ad3c1177bdc

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

LOG: [lldb][AIX] get host info for AIX (cont..) (#138687)

This PR is in reference to porting LLDB on AIX.

Link to discussions on llvm discourse and github:

1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640
2. https://github.com/llvm/llvm-project/issues/101657
The complete changes for porting are present in this draft PR:
https://github.com/llvm/llvm-project/pull/102601

- Added testcase for `GetProgramFileSpec()` & `FindProcesses()`
- Added changes to get the host information for AIX (info like
FindProcessesImpl() GetProgramFileSpec()),
continue from the PR https://github.com/llvm/llvm-project/pull/134354

Added: 


Modified: 
lldb/source/Host/aix/Host.cpp
lldb/source/Host/aix/HostInfoAIX.cpp
lldb/unittests/Host/HostInfoTest.cpp
lldb/unittests/Host/HostTest.cpp

Removed: 




diff  --git a/lldb/source/Host/aix/Host.cpp b/lldb/source/Host/aix/Host.cpp
index a812e061ccae2..b5572b93d93a9 100644
--- a/lldb/source/Host/aix/Host.cpp
+++ b/lldb/source/Host/aix/Host.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Utility/ProcessInfo.h"
 #include "lldb/Utility/Status.h"
 #include "llvm/BinaryFormat/XCOFF.h"
+#include 
 #include 
 #include 
 
@@ -133,7 +134,44 @@ static bool GetProcessAndStatInfo(::pid_t pid,
 
 uint32_t Host::FindProcessesImpl(const ProcessInstanceInfoMatch &match_info,
  ProcessInstanceInfoList &process_infos) {
-  return 0;
+  static const char procdir[] = "/proc/";
+
+  DIR *dirproc = opendir(procdir);
+  if (dirproc) {
+struct dirent *direntry = nullptr;
+const uid_t our_uid = getuid();
+const lldb::pid_t our_pid = getpid();
+bool all_users = match_info.GetMatchAllUsers();
+
+while ((direntry = readdir(dirproc)) != nullptr) {
+  lldb::pid_t pid;
+  // Skip non-numeric name directories
+  if (!llvm::to_integer(direntry->d_name, pid))
+continue;
+  // Skip this process.
+  if (pid == our_pid)
+continue;
+
+  ProcessState State;
+  ProcessInstanceInfo process_info;
+  if (!GetProcessAndStatInfo(pid, process_info, State))
+continue;
+
+  if (State == ProcessState::Zombie ||
+  State == ProcessState::TracedOrStopped)
+continue;
+
+  // Check for user match if we're not matching all users and not running
+  // as root.
+  if (!all_users && (our_uid != 0) && (process_info.GetUserID() != 
our_uid))
+continue;
+
+  if (match_info.Matches(process_info))
+process_infos.push_back(process_info);
+}
+closedir(dirproc);
+  }
+  return process_infos.size();
 }
 
 bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) {

diff  --git a/lldb/source/Host/aix/HostInfoAIX.cpp 
b/lldb/source/Host/aix/HostInfoAIX.cpp
index 61b47462dd647..aab3bf62a635f 100644
--- a/lldb/source/Host/aix/HostInfoAIX.cpp
+++ b/lldb/source/Host/aix/HostInfoAIX.cpp
@@ -7,6 +7,8 @@
 
//===--===//
 
 #include "lldb/Host/aix/HostInfoAIX.h"
+#include "lldb/Host/posix/Support.h"
+#include 
 
 using namespace lldb_private;
 
@@ -18,5 +20,17 @@ void HostInfoAIX::Terminate() { HostInfoBase::Terminate(); }
 
 FileSpec HostInfoAIX::GetProgramFileSpec() {
   static FileSpec g_program_filespec;
+  struct psinfo psinfoData;
+  auto BufferOrError = getProcFile(getpid(), "psinfo");
+  if (BufferOrError) {
+std::unique_ptr PsinfoBuffer =
+std::move(*BufferOrError);
+memcpy(&psinfoData, PsinfoBuffer->getBufferStart(), sizeof(psinfoData));
+llvm::StringRef exe_path(
+psinfoData.pr_psargs,
+strnlen(psinfoData.pr_psargs, sizeof(psinfoData.pr_psargs)));
+if (!exe_path.empty())
+  g_program_filespec.SetFile(exe_path, FileSpec::Style::native);
+  }
   return g_program_filespec;
 }

diff  --git a/lldb/unittests/Host/HostInfoTest.cpp 
b/lldb/unittests/Host/HostInfoTest.cpp
index 14941ee5a94b2..0b3bae5c56f2f 100644
--- a/lldb/unittests/Host/HostInfoTest.cpp
+++ b/lldb/unittests/Host/HostInfoTest.cpp
@@ -54,6 +54,11 @@ TEST_F(HostInfoTest, GetHostname) {
   EXPECT_TRUE(HostInfo::GetHostname(s));
 }
 
+TEST_F(HostInfoTest, GetProgramFileSpec) {
+  FileSpec filespec = HostInfo::GetProgramFileSpec();
+  EXPECT_TRUE(FileSystem::Instance().Exists(filespec));
+}
+
 #if defined(__APPLE__)
 TEST_F(HostInfoTest, GetXcodeSDK) {
   auto get_sdk = [](std::string sdk, bool error = false) -> llvm::StringRef {

diff  --git a/lldb/unittests/Host/HostTest.cpp 
b/lldb/unittests/Host/HostTest.cpp
index 52224bfd28e61..dca32c7547cf7 100644
--- a/lldb/unittests/Host/HostTest.cpp
+++ b/lldb/un

[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-29 Thread Dhruv Srivastava via lldb-commits

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


[Lldb-commits] [lldb] 7bd8e37 - Reland "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile (#141220)"

2025-05-29 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2025-05-29T12:06:29+01:00
New Revision: 7bd8e376fca22cac9593e93450a545573d3ff5f4

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

LOG: Reland "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile 
(#141220)"

This reverts commit 57f3151a3144259f4e830fc43a1424e4c1f15985.

LLDB was hitting an assert when compiling the `std` module. The `std`
module was being pulled in because we use `#import ` in the test
to set a breakpoint on `puts`. That's redundant and to work around the
crash we just remove that include. The underlying issue of compiling the
`std` module still exists and I'll investigate that separately. The
reason it started failing after the `ClangModulesDeclVendor` patch is that we 
would previously just fail to load the modulemap (and thus not load any of the 
modules). Now we do load the modulemap (and modules) when we prepare for 
parsing the expression.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index eb62cb618f254..c99ed9dd0a68d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -330,7 +330,7 @@ bool ClangModulesDeclVendorImpl::AddModule(const 
SourceModule &module,
   auto file = HS.lookupModuleMapFile(*dir, is_framework);
   if (!file)
 return error();
-  if (!HS.parseAndLoadModuleMapFile(*file, is_system))
+  if (HS.parseAndLoadModuleMapFile(*file, is_system))
 return error();
 }
   }

diff  --git 
a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
 
b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
index c3c0a707c0369..d40be55872eae 100644
--- 
a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
+++ 
b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
@@ -34,7 +34,7 @@ def setUp(self):
 
 @add_test_categories(["gmodules"])
 def test_same_template_arg(self):
-lldbutil.run_to_source_breakpoint(self, "Break here", 
self.main_source_file)
+lldbutil.run_to_source_breakpoint(self, "return 0", 
self.main_source_file)
 
 self.expect_expr(
 "FromMod1",
@@ -58,7 +58,7 @@ def test_same_template_arg(self):
 
 @add_test_categories(["gmodules"])
 def test_duplicate_decls(self):
-lldbutil.run_to_source_breakpoint(self, "Break here", 
self.main_source_file)
+lldbutil.run_to_source_breakpoint(self, "return 0", 
self.main_source_file)
 
 self.expect_expr("(intptr_t)&FromMod1 + (intptr_t)&FromMod2")
 

diff  --git a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp 
b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp
index 845e6b2c53432..1117b540f3ce0 100644
--- a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp
+++ b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp
@@ -1,8 +1,6 @@
 #include "module1.h"
 #include "module2.h"
 
-#include 
-
 int main() {
   ClassInMod1 FromMod1;
   ClassInMod2 FromMod2;
@@ -10,6 +8,5 @@ int main() {
   FromMod1.VecInMod1.Member = 137;
   FromMod2.VecInMod2.Member = 42;
 
-  std::puts("Break here");
   return 0;
 }



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


[Lldb-commits] [lldb] 57f3151 - Revert "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile (#141220)"

2025-05-29 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2025-05-29T01:30:02-07:00
New Revision: 57f3151a3144259f4e830fc43a1424e4c1f15985

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

LOG: Revert "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile 
(#141220)"

The TestTemplateWithSameArg.py API test is crashing on macOS with
this change.  Michael is going to look into it; reverting for now
to unblock the CI bots.

This reverts commit 052c70451afb7323ef72f321f3b0b5abb024b302.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index c99ed9dd0a68d..eb62cb618f254 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -330,7 +330,7 @@ bool ClangModulesDeclVendorImpl::AddModule(const 
SourceModule &module,
   auto file = HS.lookupModuleMapFile(*dir, is_framework);
   if (!file)
 return error();
-  if (HS.parseAndLoadModuleMapFile(*file, is_system))
+  if (!HS.parseAndLoadModuleMapFile(*file, is_system))
 return error();
 }
   }



___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread Pavel Labath via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)
+return lldb::eSymbolTypeData;
+  else if (sym_type == llvm::object::SymbolRef::ST_File)
+return lldb::eSymbolTypeSourceFile;
+  return lldb::eSymbolTypeInvalid;
+}
+
+void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
+  SectionList *sectionList = GetSectionList();
+
+  for (const auto &symbol_ref : m_binary->symbols()) {
+llvm::object::XCOFFSymbolRef xcoff_sym_ref(symbol_ref);
+llvm::Expected name_or_err = xcoff_sym_ref.getName();
+if (!name_or_err) {
+  consumeError(name_or_err.takeError());
+  continue;
+}
+llvm::StringRef symbolName = name_or_err.get();
+// Remove the dot prefix for demangle
+llvm::StringRef symbol_name =
+symbolName.starts_with(".") ? symbolName.drop_front() : symbolName;

labath wrote:

Using the same name with different capitalization styles is pretty confusing. 
I'd go with something like
```
StringRef name_no_dot = *name_or_err;
name_no_dot.consume_front(".");
```

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread Pavel Labath via lldb-commits

https://github.com/labath edited 
https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread Pavel Labath via lldb-commits


@@ -188,7 +188,74 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t 
file_addr) {
   return AddressClass::eUnknown;
 }
 
-void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
+lldb::SymbolType MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+  if (sym_type == llvm::object::SymbolRef::ST_Function)
+return lldb::eSymbolTypeCode;
+  else if (sym_type == llvm::object::SymbolRef::ST_Data)

labath wrote:

https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

https://github.com/llvm/llvm-project/pull/141577
___
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 ParseSymtab handling (PR #141577)

2025-05-29 Thread Pavel Labath via lldb-commits

https://github.com/labath commented:

The code seems okay. I don't know anything about the format, so I don't know 
which parts are "obvious" and which not, but I'd encourage you to add comments 
where you think it might be useful.

You're right that lldb-test doesn't dump symbols. You should be able to test 
these changes with something like `lldb %t -o "image dump symtab"`, but if you 
find that is missing some crucial piece of information, it would also be fine 
to extend lldb-test to dump the data you need.

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


[Lldb-commits] [lldb] [LLDB] Add bit extraction to DIL (PR #141422)

2025-05-29 Thread Pavel Labath via lldb-commits


@@ -62,7 +62,7 @@ def test_subscript(self):
 self.expect(
 "frame var 'int_arr[-1]'",
 error=True,
-substrs=["unrecognized token"],
+substrs=["failed to parse integer constant"],

labath wrote:

This is more of the previous PR, but I think this should actually work. Current 
"frame var" will happily access a pointer/array with negative indexes.

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


  1   2   >