[llvm-branch-commits] [clang] [llvm] [AArch64] Add a check for invalid default features (PR #104752)

2024-08-19 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

This needs a summary on the impact of not including the change, for folks who 
are not familiar with Arm's extension details.

> This resulted in a bug where if a feature was marked as Implies but was not 
> added to DefaultExt, then for -march=base_arch+nofeat the Driver would 
> consider feat to have never been added and therefore would do nothing to 
> disable it (no -target-feature -feat would be added, but the backend would 
> enable the feature by default because of Implies). See
clang/test/Driver/aarch64-negative-modifiers-for-default-features.c.

So I think the impact is:
This could result in a binary including instructions from extensions that the 
user has explicitly requested be disabled. This binary will fault at runtime on 
hardware that does not have these extensions.

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


[llvm-branch-commits] [clang] [llvm] [AArch64] Add a check for invalid default features (PR #104752)

2024-08-19 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

> This adds a check that all ExtensionWithMArch which are marked as implied 
> features for an architecture are also present in the list of default features.

And do I understand correctly that though this PR is titled "Add a check", it 
also fixes instances that the check discovered? So the backport is primarily to 
include those fixes rather than the check itself.

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


[llvm-branch-commits] [lld] release/18.x: [LLD] [test] Avoid printing timestamps past INT32_MAX with llvm-readobj (#81463) (PR #81468)

2024-02-12 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

I've confirmed locally that this fixes the test as claimed, let's merge it.

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


[llvm-branch-commits] [lld] release/18.x: [LLD] [test] Avoid printing timestamps past INT32_MAX with llvm-readobj (#81463) (PR #81468)

2024-02-12 Thread David Spickett via llvm-branch-commits

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


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


[llvm-branch-commits] [lldb] 4be8a7b - [lldb] Fix TestVTableValue on 32 bit

2023-11-03 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2023-11-03T10:36:39Z
New Revision: 4be8a7bda55c5b50832b773b204f75cd26c5979d

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

LOG: [lldb] Fix TestVTableValue on 32 bit

7fbd427f5ebea4a4ebf25747758851875bb7e173 added a test that overwrites
a vtable entry but it uses and expects a 64 bit value. Add the 32 bit
equivalents.

Added: 


Modified: 
lldb/test/API/functionalities/vtable/TestVTableValue.py

Removed: 




diff  --git a/lldb/test/API/functionalities/vtable/TestVTableValue.py 
b/lldb/test/API/functionalities/vtable/TestVTableValue.py
index 5b243e0646f4c28..1c238ad60739bd9 100644
--- a/lldb/test/API/functionalities/vtable/TestVTableValue.py
+++ b/lldb/test/API/functionalities/vtable/TestVTableValue.py
@@ -132,13 +132,19 @@ def test_overwrite_vtable(self):
 # Overwrite the first entry in the vtable and make sure we can still
 # see the bogus value which should have no summary
 vtable_addr = vtable.GetValueAsUnsigned()
-data = str("\x01\x01\x01\x01\x01\x01\x01\x01")
+
+is_64bit = self.process().GetAddressByteSize() == 8
+data = str(
+"\x01\x01\x01\x01\x01\x01\x01\x01" if is_64bit else 
"\x01\x01\x01\x01"
+)
 error = lldb.SBError()
 process.WriteMemory(vtable_addr, data, error)
 
 scribbled_child = vtable.GetChildAtIndex(0)
-self.assertEquals(scribbled_child.GetValueAsUnsigned(0),
-  0x0101010101010101)
+self.assertEquals(
+scribbled_child.GetValueAsUnsigned(0),
+0x0101010101010101 if is_64bit else 0x01010101,
+)
 self.assertEquals(scribbled_child.GetSummary(), None)
 
 def expected_vtable_addr(self, var: lldb.SBValue) -> int:



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


[llvm-branch-commits] [llvm] [lld] [clang] [docs] Add release notes for Windows specific changes in 18.x (PR #80011)

2024-01-30 Thread David Spickett via llvm-branch-commits


@@ -41,9 +41,25 @@ COFF Improvements
 * Added support for ``--time-trace`` and associated 
``--time-trace-granularity``.
   This generates a .json profile trace of the linker execution.
 
+* Prefer library paths specified with ``-libpath:`` over the implicitly

DavidSpickett wrote:

This should be clarified. Is this telling me the reader that I should use 
-libpath instead of letting it be implicit?

Seems like it's missing a noun like " now prefers ".

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


[llvm-branch-commits] [llvm] [lld] [clang] [docs] Add release notes for Windows specific changes in 18.x (PR #80011)

2024-01-30 Thread David Spickett via llvm-branch-commits


@@ -41,9 +41,25 @@ COFF Improvements
 * Added support for ``--time-trace`` and associated 
``--time-trace-granularity``.
   This generates a .json profile trace of the linker execution.
 
+* Prefer library paths specified with ``-libpath:`` over the implicitly
+  detected toolchain paths.
+
 MinGW Improvements
 --
 
+* Added support for many LTO and ThinLTO options.

DavidSpickett wrote:

Dare I ask what options. If it's < 10 maybe just list them?

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


[llvm-branch-commits] [lld] [clang] [llvm] [docs] Add release notes for Windows specific changes in 18.x (PR #80011)

2024-01-30 Thread David Spickett via llvm-branch-commits


@@ -41,9 +41,25 @@ COFF Improvements
 * Added support for ``--time-trace`` and associated 
``--time-trace-granularity``.
   This generates a .json profile trace of the linker execution.
 
+* Prefer library paths specified with ``-libpath:`` over the implicitly
+  detected toolchain paths.
+
 MinGW Improvements
 --
 
+* Added support for many LTO and ThinLTO options.
+
+* LLD no longer tries to autodetect and pick up MSVC/WinSDK installations

DavidSpickett wrote:

"autodetect and use" maybe? "pick up" can mean noticing something as well as 
literally picking it up and using it.

Also, does a user have to now opt into this detection or supply their own paths 
or is this not needed for Mingw mode now?

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


[llvm-branch-commits] [lld] [clang] [llvm] [docs] Add release notes for Windows specific changes in 18.x (PR #80011)

2024-01-30 Thread David Spickett via llvm-branch-commits


@@ -319,6 +319,18 @@ Changes to the LLVM tools
 * llvm-objcopy now supports ``--gap-fill`` and ``--pad-to`` options, for
   ELF input and binary output files only.
 
+* llvm-rc and llvm-windres now accept file path references in ``.rc`` files
+  concatenated from multiple string literals.
+
+* The llvm-windres option ``--preprocessor`` now resolve its argument
+  in the PATH environment variable as expected, and options passed with
+  ``--preprocessor-arg`` are placed before the input file as they should.

DavidSpickett wrote:

"now resolves"
"as they should be."

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


[llvm-branch-commits] [clang] [llvm] [lld] [docs] Add release notes for Windows specific changes in 18.x (PR #80011)

2024-01-31 Thread David Spickett via llvm-branch-commits
Martin =?utf-8?q?Storsj=C3=B6?= 
Message-ID:
In-Reply-To: 


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

LGTM

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


[llvm-branch-commits] [llvm] [LoongArch] Optimize for immediate value materialization using BSTRINS_D instruction (PR #106332)

2024-08-30 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

We have some tests failing on our 32 bit single stage Arm builder. I'm looking 
into it locally. Usually this is some assumption about type sizes such as 
size_t.

https://lab.llvm.org/buildbot/#/builders/39/builds/1338

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


[llvm-branch-commits] [llvm] [LoongArch] Optimize for immediate value materialization using BSTRINS_D instruction (PR #106332)

2024-08-30 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

Fixed with 
https://github.com/llvm/llvm-project/commit/c55e24b8507d47a8cc04b5d9570e8e3d02be1ca3.

Some UL that should have been ULL, very easy mistake to make.

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


[llvm-branch-commits] [lldb] 45d9885 - [lldb] Add "memory tag write" command

2021-08-03 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-08-03T12:25:35Z
New Revision: 45d98857f8f979552d7e1e7e781d6ca92a5e9a48

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

LOG: [lldb] Add "memory tag write" command

This adds a new command for writing memory tags.
It is based on the existing "memory write" command.

Syntax: memory tag write   [ [...]]
(where "value" is a tag value)

(lldb) memory tag write mte_buf 1 2
(lldb) memory tag read mte_buf mte_buf+32
Logical tag: 0x0
Allocation tags:
[0xf7ff9000, 0xf7ff9010): 0x1
[0xf7ff9010, 0xf7ff9020): 0x2

The range you are writing to will be calculated by
aligning the address down to a granule boundary then
adding as many granules as there are tags.

(a repeating mode with an end address will be in a follow
up patch)

This is why "memory tag write" uses MakeTaggedRange but has
some extra steps to get this specific behaviour.

The command does all the usual argument validation:
* Address must evaluate
* You must supply at least one tag value
  (though lldb-server would just treat that as a nop anyway)
* Those tag values must be valid for your tagging scheme
  (e.g. for MTE the value must be > 0 and < 0xf)
* The calculated range must be memory tagged

That last error will show you the final range, not just
the start address you gave the command.

(lldb) memory tag write mte_buf_2+page_size-16 6
(lldb) memory tag write mte_buf_2+page_size-16 6 7
error: Address range 0xf7ffaff0:0xf7ffb010 is not in a memory tagged 
region

(note that we do not check if the region is writeable
since lldb can write to it anyway)

The read and write tag tests have been merged into
a single set of "tag access" tests as their test programs would
have been almost identical.
(also I have renamed some of the buffers to better
show what each one is used for)

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D105182

(cherry picked from commit 6a7a2ee8161da84d9a58a88b497b0b47c8df99f3)

Added: 
lldb/test/API/linux/aarch64/mte_tag_access/Makefile

lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py
lldb/test/API/linux/aarch64/mte_tag_access/main.c

Modified: 
lldb/source/Commands/CommandObjectMemoryTag.cpp
lldb/test/API/functionalities/memory/tag/TestMemoryTag.py

Removed: 
lldb/test/API/linux/aarch64/mte_tag_read/Makefile
lldb/test/API/linux/aarch64/mte_tag_read/TestAArch64LinuxMTEMemoryTagRead.py
lldb/test/API/linux/aarch64/mte_tag_read/main.c



diff  --git a/lldb/source/Commands/CommandObjectMemoryTag.cpp 
b/lldb/source/Commands/CommandObjectMemoryTag.cpp
index 1dfb32a92f3bb..7c244befe0da4 100644
--- a/lldb/source/Commands/CommandObjectMemoryTag.cpp
+++ b/lldb/source/Commands/CommandObjectMemoryTag.cpp
@@ -115,6 +115,114 @@ class CommandObjectMemoryTagRead : public 
CommandObjectParsed {
   }
 };
 
+#define LLDB_OPTIONS_memory_tag_write
+#include "CommandOptions.inc"
+
+class CommandObjectMemoryTagWrite : public CommandObjectParsed {
+public:
+  CommandObjectMemoryTagWrite(CommandInterpreter &interpreter)
+  : CommandObjectParsed(interpreter, "tag",
+"Write memory tags starting from the granule that "
+"contains the given address.",
+nullptr,
+eCommandRequiresTarget | eCommandRequiresProcess |
+eCommandProcessMustBePaused) {
+// Address
+m_arguments.push_back(
+
CommandArgumentEntry{CommandArgumentData(eArgTypeAddressOrExpression)});
+// One or more tag values
+m_arguments.push_back(CommandArgumentEntry{
+CommandArgumentData(eArgTypeValue, eArgRepeatPlus)});
+  }
+
+  ~CommandObjectMemoryTagWrite() override = default;
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+if (command.GetArgumentCount() < 2) {
+  result.AppendError("wrong number of arguments; expected "
+ "  [ [...]]");
+  return false;
+}
+
+Status error;
+addr_t start_addr = OptionArgParser::ToAddress(
+&m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
+if (start_addr == LLDB_INVALID_ADDRESS) {
+  result.AppendErrorWithFormatv("Invalid address expression, {0}",
+error.AsCString());
+  return false;
+}
+
+command.Shift(); // shift off start address
+
+std::vector tags;
+for (auto &entry : command) {
+  lldb::addr_t tag_value;
+  // getAsInteger returns true on failure
+  if (entry.ref().getAsInteger(0, tag_value)) {
+result.AppendErrorWithFormat(
+"'%s' is not a valid unsigned decimal string value.\n",
+entry.c_str());
+return 

[llvm-branch-commits] [lldb] dc00e19 - [lldb] Add "memory tag write" --end-addr option

2021-08-03 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-08-03T12:25:35Z
New Revision: dc00e1915e66533de4b9c778528e8dd7b4922a22

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

LOG: [lldb] Add "memory tag write" --end-addr option

The default mode of "memory tag write" is to calculate the
range from the start address and the number of tags given.
(just like "memory write" does)

(lldb) memory tag write mte_buf 1 2
(lldb) memory tag read mte_buf mte_buf+48
Logical tag: 0x0
Allocation tags:
[0xf7ff9000, 0xf7ff9010): 0x1
[0xf7ff9010, 0xf7ff9020): 0x2
[0xf7ff9020, 0xf7ff9030): 0x0

This new option allows you to set an end address and have
the tags repeat until that point.

(lldb) memory tag write mte_buf 1 2 --end-addr mte_buf+64
(lldb) memory tag read mte_buf mte_buf+80
Logical tag: 0x0
Allocation tags:
[0xf7ff9000, 0xf7ff9010): 0x1
[0xf7ff9010, 0xf7ff9020): 0x2
[0xf7ff9020, 0xf7ff9030): 0x1
[0xf7ff9030, 0xf7ff9040): 0x2
[0xf7ff9040, 0xf7ff9050): 0x0

This is implemented using the QMemTags packet previously
added. We skip validating the number of tags in lldb and send
them on to lldb-server, which repeats them as needed.

Apart from the number of tags, all the other client side checks
remain. Tag values, memory range must be tagged, etc.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D105183

(cherry picked from commit 6eded00e0c6b4e06225df74292c078030556b8ce)

Added: 


Modified: 
lldb/source/Commands/CommandObjectMemoryTag.cpp
lldb/source/Commands/Options.td

lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectMemoryTag.cpp 
b/lldb/source/Commands/CommandObjectMemoryTag.cpp
index 7c244befe0da4..76296bf4b49af 100644
--- a/lldb/source/Commands/CommandObjectMemoryTag.cpp
+++ b/lldb/source/Commands/CommandObjectMemoryTag.cpp
@@ -7,8 +7,11 @@
 
//===--===//
 
 #include "CommandObjectMemoryTag.h"
+#include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/OptionArgParser.h"
+#include "lldb/Interpreter/OptionGroupFormat.h"
+#include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Target/Process.h"
 
 using namespace lldb;
@@ -120,23 +123,64 @@ class CommandObjectMemoryTagRead : public 
CommandObjectParsed {
 
 class CommandObjectMemoryTagWrite : public CommandObjectParsed {
 public:
+  class OptionGroupTagWrite : public OptionGroup {
+  public:
+OptionGroupTagWrite() : OptionGroup(), m_end_addr(LLDB_INVALID_ADDRESS) {}
+
+~OptionGroupTagWrite() override = default;
+
+llvm::ArrayRef GetDefinitions() override {
+  return llvm::makeArrayRef(g_memory_tag_write_options);
+}
+
+Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+  ExecutionContext *execution_context) override {
+  Status status;
+  const int short_option =
+  g_memory_tag_write_options[option_idx].short_option;
+
+  switch (short_option) {
+  case 'e':
+m_end_addr = OptionArgParser::ToAddress(execution_context, 
option_value,
+LLDB_INVALID_ADDRESS, &status);
+break;
+  default:
+llvm_unreachable("Unimplemented option");
+  }
+
+  return status;
+}
+
+void OptionParsingStarting(ExecutionContext *execution_context) override {
+  m_end_addr = LLDB_INVALID_ADDRESS;
+}
+
+lldb::addr_t m_end_addr;
+  };
+
   CommandObjectMemoryTagWrite(CommandInterpreter &interpreter)
   : CommandObjectParsed(interpreter, "tag",
 "Write memory tags starting from the granule that "
 "contains the given address.",
 nullptr,
 eCommandRequiresTarget | eCommandRequiresProcess |
-eCommandProcessMustBePaused) {
+eCommandProcessMustBePaused),
+m_option_group(), m_tag_write_options() {
 // Address
 m_arguments.push_back(
 
CommandArgumentEntry{CommandArgumentData(eArgTypeAddressOrExpression)});
 // One or more tag values
 m_arguments.push_back(CommandArgumentEntry{
 CommandArgumentData(eArgTypeValue, eArgRepeatPlus)});
+
+m_option_group.Append(&m_tag_write_options);
+m_option_group.Finalize();
   }
 
   ~CommandObjectMemoryTagWrite() override = default;
 
+  Options *GetOptions() override { return &m_option_group; }
+
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 if (command.GetArgumentCount() < 2) {
@@

[llvm-branch-commits] [lldb] bc0cc10 - [lldb][AArch64] Annotate synchronous tag faults

2021-08-03 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-08-03T12:25:35Z
New Revision: bc0cc109dfa744090f7ba35fe91d5967f0ed4fc7

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

LOG: [lldb][AArch64] Annotate synchronous tag faults

In the latest Linux kernels synchronous tag faults
include the tag bits in their address.
This change adds logical and allocation tags to the
description of synchronous tag faults.
(asynchronous faults have no address)

Process 1626 stopped
* thread #1, name = 'a.out', stop reason = signal SIGSEGV: sync tag check fault 
(fault address: 0x900f7ff9010 logical tag: 0x9 allocation tag: 0x0)

This extends the existing description and will
show as much as it can on the rare occasion something
fails.

This change supports AArch64 MTE only but other
architectures could be added by extending the
switch at the start of AnnotateSyncTagCheckFault.
The rest of the function is generic code.

Tests have been added for synchronous and asynchronous
MTE faults.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D105178

(cherry picked from commit d510b5f199d6e7a3062b5a6ea43181c4cc00a605)

Added: 
lldb/test/API/linux/aarch64/mte_tag_faults/Makefile

lldb/test/API/linux/aarch64/mte_tag_faults/TestAArch64LinuxMTEMemoryTagFaults.py
lldb/test/API/linux/aarch64/mte_tag_faults/main.c

Modified: 
lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
lldb/source/Plugins/Process/Linux/NativeThreadLinux.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp 
b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index d8ba5415a983e..a7e4e9b13ff0a 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -26,6 +26,7 @@
 #include "llvm/ADT/SmallString.h"
 
 #include "Plugins/Process/POSIX/CrashReason.h"
+#include "Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h"
 
 #include 
 // Try to define a macro to encapsulate the tgkill syscall
@@ -299,11 +300,69 @@ void NativeThreadLinux::SetStoppedBySignal(uint32_t signo,
   ? CrashReason::eInvalidAddress
   : GetCrashReason(*info);
   m_stop_description = GetCrashReasonString(reason, *info);
+
+  if (reason == CrashReason::eSyncTagCheckFault) {
+AnnotateSyncTagCheckFault(info);
+  }
+
   break;
 }
   }
 }
 
+void NativeThreadLinux::AnnotateSyncTagCheckFault(const siginfo_t *info) {
+  int32_t allocation_tag_type = 0;
+  switch (GetProcess().GetArchitecture().GetMachine()) {
+  // aarch64_32 deliberately not here because there's no 32 bit MTE
+  case llvm::Triple::aarch64:
+  case llvm::Triple::aarch64_be:
+allocation_tag_type = MemoryTagManagerAArch64MTE::eMTE_allocation;
+break;
+  default:
+return;
+  }
+
+  auto details =
+  GetRegisterContext().GetMemoryTaggingDetails(allocation_tag_type);
+  if (!details) {
+llvm::consumeError(details.takeError());
+return;
+  }
+
+  // We assume that the stop description is currently:
+  // signal SIGSEGV: sync tag check fault (fault address: )
+  // Remove the closing )
+  m_stop_description.pop_back();
+
+  std::stringstream ss;
+  lldb::addr_t fault_addr = reinterpret_cast(info->si_addr);
+  std::unique_ptr manager(std::move(details->manager));
+
+  ss << " logical tag: 0x" << std::hex << manager->GetLogicalTag(fault_addr);
+
+  std::vector allocation_tag_data;
+  // The fault address may not be granule aligned. ReadMemoryTags will granule
+  // align any range you give it, potentially making it larger.
+  // To prevent this set len to 1. This always results in a range that is at
+  // most 1 granule in size and includes fault_addr.
+  Status status = GetProcess().ReadMemoryTags(allocation_tag_type, fault_addr,
+  1, allocation_tag_data);
+
+  if (status.Success()) {
+llvm::Expected> allocation_tag =
+manager->UnpackTagsData(allocation_tag_data, 1);
+if (allocation_tag) {
+  ss << " allocation tag: 0x" << std::hex << allocation_tag->front() << 
")";
+} else {
+  llvm::consumeError(allocation_tag.takeError());
+  ss << ")";
+}
+  } else
+ss << ")";
+
+  m_stop_description += ss.str();
+}
+
 bool NativeThreadLinux::IsStopped(int *signo) {
   if (!StateIsStoppedState(m_state, false))
 return false;

diff  --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h 
b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
index f03de755c7bf3..c18665b0107ef 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
@@ -102,6 +102,11 @@ class NativeThreadLinux : public NativeThreadProtocol {
 
   void SetStopped();
 
+  /// Extend m_stop_descri

[llvm-branch-commits] [lldb] c47d79b - [lldb] Correct format of qMemTags type field

2021-08-03 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-08-03T12:25:36Z
New Revision: c47d79b3b7a7cab21020ec69b66b5f48823f513f

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

LOG: [lldb] Correct format of qMemTags type field

The type field is a signed integer.
(https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html)

However it's not packed in the packet in the way
you might think. For example the type -1 should be:
qMemTags:,:
Instead of:
qMemTags:,:-1

This change makes lldb-server's parsing more strict
and adds more tests to check that we handle negative types
correctly in lldb and lldb-server.

We only support one tag type value at this point,
for AArch64 MTE, which is positive. So this doesn't change
any of those interactions. It just brings us in line with GDB.

Also check that the test target has MTE. Previously
we just checked that we were AArch64 with a toolchain
that supports MTE.

Finally, update the tag type check for QMemTags to use
the same conversion steps that qMemTags now does.
Using static_cast can invoke UB and though we do do a limit
check to avoid this, I think it's clearer with the new method.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D104914

(cherry picked from commit 555cd03193c9c098d787bec93eadfe43b179db9c)

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 5e69b5793f9f0..8e1f6bc29a6f8 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3474,15 +3474,31 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemTags(
   if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')
 return SendIllFormedResponse(packet, invalid_type_err);
 
-  int32_t type =
-  packet.GetS32(std::numeric_limits::max(), /*base=*/16);
-  if (type == std::numeric_limits::max() ||
+  // Type is a signed integer but packed into the packet as its raw bytes.
+  // However, our GetU64 uses strtoull which allows +/-. We do not want this.
+  const char *first_type_char = packet.Peek();
+  if (first_type_char && (*first_type_char == '+' || *first_type_char == '-'))
+return SendIllFormedResponse(packet, invalid_type_err);
+
+  // Extract type as unsigned then cast to signed.
+  // Using a uint64_t here so that we have some value outside of the 32 bit
+  // range to use as the invalid return value.
+  uint64_t raw_type =
+  packet.GetU64(std::numeric_limits::max(), /*base=*/16);
+
+  if ( // Make sure the cast below would be valid
+  raw_type > std::numeric_limits::max() ||
   // To catch inputs like "123aardvark" that will parse but clearly aren't
   // valid in this case.
   packet.GetBytesLeft()) {
 return SendIllFormedResponse(packet, invalid_type_err);
   }
 
+  // First narrow to 32 bits otherwise the copy into type would take
+  // the wrong 4 bytes on big endian.
+  uint32_t raw_type_32 = raw_type;
+  int32_t type = reinterpret_cast(raw_type_32);
+
   StreamGDBRemote response;
   std::vector tags;
   Status error = m_current_process->ReadMemoryTags(type, addr, length, tags);
@@ -3552,7 +3568,11 @@ GDBRemoteCommunicationServerLLGS::Handle_QMemTags(
   packet.GetU64(std::numeric_limits::max(), /*base=*/16);
   if (raw_type > std::numeric_limits::max())
 return SendIllFormedResponse(packet, invalid_type_err);
-  int32_t type = static_cast(raw_type);
+
+  // First narrow to 32 bits. Otherwise the copy below would get the wrong
+  // 4 bytes on big endian.
+  uint32_t raw_type_32 = raw_type;
+  int32_t type = reinterpret_cast(raw_type_32);
 
   // Tag data
   if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')

diff  --git 
a/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py 
b/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py
index d292f20993c66..983e1aa54b327 100644
--- 
a/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py
+++ 
b/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py
@@ -105,13 +105,20 @@ def test_qMemTags_packets(self):
 self.check_tag_read("{:x},10:".format(buf_address), "E03")
 # Types we don't support
 self.check_tag_read("{:x},10:FF".format(buf_address), "E01")
+# Types can also be negative, -1 in this case.
+# So this is E01 for not 

[llvm-branch-commits] [lldb] 0b8dc91 - [lldb][AArch64] Mark mismatched tags in tag read output

2021-08-03 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-08-03T12:25:36Z
New Revision: 0b8dc914e1bd02ed34b4b50d3de81f2162c4402f

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

LOG: [lldb][AArch64] Mark mismatched tags in tag read output

The "memory tag read" command will now tell you
when the allocation tag read does not match the logical
tag.

(lldb) memory tag read mte_buf+(8*16) mte_buf+(8*16)+48
Logical tag: 0x9
Allocation tags:
[0xf7ff7080, 0xf7ff7090): 0x8 (mismatch)
[0xf7ff7090, 0xf7ff70a0): 0x9
[0xf7ff70a0, 0xf7ff70b0): 0xa (mismatch)

The logical tag will be taken from the start address
so the end could have a different tag. You could for example
read from ptr_to_array_1 to ptr_to_array_2. Where the latter
is tagged differently to prevent buffer overflow.

The existing command will read 1 granule if you leave
off the end address. So you can also use it as a quick way
to check a single location.

(lldb) memory tag read mte_buf
Logical tag: 0x9
Allocation tags:
[0xf7ff7000, 0xf7ff7010): 0x0 (mismatch)

This avoids the need for a seperate "memory tag check" command.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D106880

(cherry picked from commit 98b5659b53ff93f3b68e48ea28ec54081196ae3b)

Added: 


Modified: 
lldb/source/Commands/CommandObjectMemoryTag.cpp

lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectMemoryTag.cpp 
b/lldb/source/Commands/CommandObjectMemoryTag.cpp
index 76296bf4b49af..840f81719d7dc 100644
--- a/lldb/source/Commands/CommandObjectMemoryTag.cpp
+++ b/lldb/source/Commands/CommandObjectMemoryTag.cpp
@@ -24,7 +24,8 @@ class CommandObjectMemoryTagRead : public CommandObjectParsed 
{
 public:
   CommandObjectMemoryTagRead(CommandInterpreter &interpreter)
   : CommandObjectParsed(interpreter, "tag",
-"Read memory tags for the given range of memory.",
+"Read memory tags for the given range of memory."
+" Mismatched tags will be marked.",
 nullptr,
 eCommandRequiresTarget | eCommandRequiresProcess |
 eCommandProcessMustBePaused) {
@@ -100,16 +101,17 @@ class CommandObjectMemoryTagRead : public 
CommandObjectParsed {
   return false;
 }
 
-result.AppendMessageWithFormatv("Logical tag: {0:x}",
-tag_manager->GetLogicalTag(start_addr));
+lldb::addr_t logical_tag = tag_manager->GetLogicalTag(start_addr);
+result.AppendMessageWithFormatv("Logical tag: {0:x}", logical_tag);
 result.AppendMessage("Allocation tags:");
 
 addr_t addr = tagged_range->GetRangeBase();
 for (auto tag : *tags) {
   addr_t next_addr = addr + tag_manager->GetGranuleSize();
   // Showing tagged adresses here until we have non address bit handling
-  result.AppendMessageWithFormatv("[{0:x}, {1:x}): {2:x}", addr, next_addr,
-  tag);
+  result.AppendMessageWithFormatv("[{0:x}, {1:x}): {2:x}{3}", addr,
+  next_addr, tag,
+  logical_tag == tag ? "" : " (mismatch)");
   addr = next_addr;
 }
 

diff  --git 
a/lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py
 
b/lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py
index 58ceb9c7348a9..b0ce9c1f55c44 100644
--- 
a/lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py
+++ 
b/lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py
@@ -81,20 +81,20 @@ def test_mte_tag_read(self):
 self.expect("memory tag read mte_buf",
 patterns=["Logical tag: 0x9\n"
   "Allocation tags:\n"
-  "\[0x[0-9A-Fa-f]+00, 0x[0-9A-Fa-f]+10\): 0x0$"])
+  "\[0x[0-9A-Fa-f]+00, 0x[0-9A-Fa-f]+10\): 0x0 
\(mismatch\)$"])
 
 # Range of <1 granule is rounded up to 1 granule
 self.expect("memory tag read mte_buf mte_buf+8",
 patterns=["Logical tag: 0x9\n"
   "Allocation tags:\n"
-  "\[0x[0-9A-Fa-f]+00, 0x[0-9A-Fa-f]+10\): 0x0$"])
+  "\[0x[0-9A-Fa-f]+00, 0x[0-9A-Fa-f]+10\): 0x0 
\(mismatch\)$"])
 
 # Start address is aligned down, end aligned up
 self.expect("memory tag read mte_buf+8 mte_buf+24",
 patterns=["Logical tag: 0x9\n"
   "Allocation tags:\n"
-  "\[0x[0-9A-Fa-f]+00, 0x[0-9A-Fa-f]+10\): 0x0\n"
-  

[llvm-branch-commits] [llvm] 11a0a68 - [llvm][Release notes] Add memory tagging support to lldb changes

2021-08-03 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-08-03T12:25:36Z
New Revision: 11a0a68f2eb8f419f2faab380c8af73dbea4035c

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

LOG: [llvm][Release notes] Add memory tagging support to lldb changes

Added: 


Modified: 
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index ddcdb322386ee..73c0450485d01 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -243,6 +243,12 @@ Changes to the LLVM tools
 Changes to LLDB
 -
 
+* LLDB now supports debugging programs on AArch64 Linux that use memory 
tagging (MTE).
+* Added ``memory tag read`` and ``memory tag write`` commands.
+* The ``memory region`` command will note when a region has memory tagging 
enabled.
+* Synchronous and asynchronous tag faults are recognised.
+* Synchronous tag faults have memory tag annotations in addition to the usual 
fault address.
+
 Changes to Sanitizers
 -
 



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


[llvm-branch-commits] [llvm] ce69b89 - [llvm][docs] Describe how to work with patch series on Phabricator

2021-12-16 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-12-16T15:30:39Z
New Revision: ce69b89471804542b57aa62c5c6ac1be9f2954ea

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

LOG: [llvm][docs] Describe how to work with patch series on Phabricator

Differential Revision: https://reviews.llvm.org/D115519

Added: 


Modified: 
llvm/docs/Phabricator.rst

Removed: 




diff  --git a/llvm/docs/Phabricator.rst b/llvm/docs/Phabricator.rst
index 21964d8227d91..40dab7e6d91e4 100644
--- a/llvm/docs/Phabricator.rst
+++ b/llvm/docs/Phabricator.rst
@@ -128,6 +128,95 @@ them to participate. Many people will see the email 
notification on cfe-commits
 or llvm-commits, and if the subject line suggests the patch is something they
 should look at, they will.
 
+.. _creating-a-patch-series:
+
+Creating a patch series
+---
+
+Chaining reviews together requires some manual work. There are two ways to do 
it
+(these are also described `here 
`_
+along with some screenshots of what to expect).
+
+.. _using-the-web-interface:
+
+Using the web interface
+^^^
+
+This assumes that you've already created a Phabricator review for each commit,
+using `arc` or the web interface.
+
+* Go to what will be the last review in the series (the most recent).
+* Click "Edit Related Revisions" then "Edit Parent Revisions".
+* This will open a dialog where you will enter the patch number of the parent 
patch
+  (or patches). The patch number is of the form D and you can find it 
by
+  looking at the URL for the review e.g. reviews.llvm/org/D12345.
+* Click "Save Parent Revisions" after entering them.
+* You should now see a "Stack" tab in the "Revision Contents" section of the 
web
+  interface, showing the parent patch that you added.
+
+Repeat this with each previous review until you reach the first in the series. 
This
+one won't have a parent since it's the start of the series.
+
+If you prefer to start with the first in the series and go forward, you can 
use the
+"Edit Child Revisions" option instead.
+
+.. _using-patch-summaries:
+
+Using patch summaries
+^
+
+This applies to new and existing reviews, uploaded with `arc` or the web 
interface.
+
+* Upload the first review and note its patch number, either with the web 
interface
+  or `arc`.
+* For each commit after that, add the following line to the commit message or 
patch
+  summary: "Depends on D", where "" is the patch number of the 
previous review.
+  This must be entirely on its own line, with a blank line before it.
+  For example::
+
+[llvm] Example commit
+
+Depends on D12345
+
+* If you want a single review to have multiple parent reviews then
+  add more with "and", for example: "Depends on D12344 and D12345".
+* Upload the commit with the web interface or `arc`
+  (``arc 
diff  --verbatim`` to update an existing review).
+* You will see a "Stack" tab in the "Revision Contents" section of the review
+  in the web interface, showing the parent review.
+* Repeat these steps until you've uploaded or updated all the patches in
+  your series.
+
+When you push the patches, please remove the "Depends on" lines from the
+commit messages, since they add noise and duplicate git's implicit ordering.
+
+One frequently used workflow for creating a series of patches using patch 
summaries
+is based on git's rebasing. These steps assume that you have a series of 
commits that
+you have not posted for review, but can be adapted to update existing reviews.
+
+* git interactive rebase back to the first commit you want to upload for 
review::
+
+git rebase -i HEAD~
+
+* Mark all commits for editing by changing "pick" to "edit" in the instructions
+  git shows.
+* Start the rebase (usually by writing and closing the instructions).
+* For the first commit:
+
+  - Upload the current commit for a review (with ``arc 
diff `` or the web
+interface).
+
+  - Continue to the next commit with ``git rebase --continue``
+
+* For the rest:
+
+  - Add the "Depends on..." line using ``git commit --amend``
+
+  - Upload for review.
+
+  - Continue the rebase.
+
+* Once the rebase is complete, you've created your patch series.
 
 .. _finding-potential-reviewers:
 



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


[llvm-branch-commits] [llvm] 1fc348c - Reland "[lldb] Remove non address bits when looking up memory regions"

2022-02-11 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2022-02-11T11:19:20Z
New Revision: 1fc348ce75aac296305d4d294d3423ab0e00e392

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

LOG: Reland "[lldb] Remove non address bits when looking up memory regions"

(cherry picked from 2937b282188bafb6bdb65ee87c70e9109aa910b7)

This reverts commit 0df522969a7a0128052bd79182c8d58e00556e2f.

Additional checks are added to fix the detection of the last memory region
in GetMemoryRegions or repeating the "memory region" command when the
target has non-address bits.

Normally you keep reading from address 0, looking up each region's end
address until you get LLDB_INVALID_ADDR as the region end address.
(0x)

This is what the remote will return once you go beyond the last mapped region:
[0xfffdf000-0x0001) rw- [stack]
[0x0001-0x) ---

Problem is that when we "fix" the lookup address, we remove some bits
from it. On an AArch64 system we have 48 bit virtual addresses, so when
we fix the end address of the [stack] region the result is 0.
So we loop back to the start.

[0xfffdf000-0x0001) rw- [stack]
[0x-0x0040) ---

To fix this I added an additional check for the last range.
If the end address of the region is different once you apply
FixDataAddress, we are at the last region.

Since the end of the last region will be the last valid mappable
address, plus 1. That 1 will be removed by the ABI plugin.

The only side effect is that on systems with non-address bits, you
won't get that last catch all unmapped region from the max virtual
address up to 0xf...f.

[0xf800-0xfffdf000) ---
[0xfffdf000-0x0001) rw- [stack]


Though in some way this is more correct because that region is not
just unmapped, it's not mappable at all.

No extra testing is needed because this is already covered by
TestMemoryRegion.py, I simply forgot to run it on system that had
both top byte ignore and pointer authentication.

This change has been tested on a qemu VM with top byte ignore,
memory tagging and pointer authentication enabled.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D115508

Added: 
lldb/test/API/linux/aarch64/tagged_memory_region/Makefile

lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py
lldb/test/API/linux/aarch64/tagged_memory_region/main.c

Modified: 
lldb/include/lldb/Target/Process.h
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.h
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/Process/scripted/ScriptedProcess.h
lldb/source/Target/Process.cpp
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 12ed1e09227cf..7911dac40b705 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1759,7 +1759,7 @@ class Process : public 
std::enable_shared_from_this,
   ///
   /// If load_addr is within the address space the process has mapped
   /// range_info will be filled in with the start and end of that range as
-  /// well as the permissions for that range and range_info.GetMapped will
+  /// well as the permissions for that range and range_info. GetMapped will
   /// return true.
   ///
   /// If load_addr is outside any mapped region then range_info will have its
@@ -1768,23 +1768,21 @@ class Process : public 
std::enable_shared_from_this,
   /// there are no valid mapped ranges between load_addr and the end of the
   /// process address space.
   ///
-  /// GetMemoryRegionInfo will only return an error if it is unimplemented for
-  /// the current process.
+  /// GetMemoryRegionInfo calls DoGetMemoryRegionInfo. Override that function 
in
+  /// process subclasses.
   ///
   /// \param[in] load_addr
-  /// The load address to query the range_info for.
+  /// The load address to query the range_info for. May include non
+  /// address bits, these will be removed by the the ABI plugin if there is
+  /// one.
   ///
   /// \param[out] range_in

[llvm-branch-commits] [lldb] 9a7672a - [lldb] Fix crash in "help memory read"

2021-01-19 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-01-19T09:54:17Z
New Revision: 9a7672ac4980bca8829814e1e49e1c201a5bf9b6

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

LOG: [lldb] Fix crash in "help memory read"

When a command option does not have a short version
(e.g. -f for --file), we use an arbitrary value in the
short_option field to mark it as invalid.
(though this value is unqiue to be used later for other
things)

We check that this short option is valid to print using
llvm::isPrint. This implicitly casts our int to char,
meaning we check the last char of any short_option value.

Since the arbitrary value we chose for these options is
some shortened hex version of the name, this returned true
even for invalid values.

Since llvm::isPrint returns true we later call std::islower
and/or std::isupper on the short_option value. (the int)

Calling these functions with something that cannot be validly
converted to unsigned char is undefined. Somehow we got/get
away with this but for me compiling with g++-9 I got a crash
for "help memory read".

The other command that uses this is "target variable" but that
didn't crash for unknown reasons.

Checking that short_option can fit into an unsigned char before
we call llvm::isPrint means we will not attempt to call islower/upper
on these options since we have no reason to print them.

This also fixes bogus short options being shown for "memory read"
and target variable.

For "target variable", before:
   -e  ( --file  )
   -b  ( --shlib  )
After:
   --file 
   --shlib 

(note that the bogus short options are just the bottom byte of our
arbitrary short_option value)

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D94917

Added: 


Modified: 
lldb/include/lldb/Utility/OptionDefinition.h
lldb/test/API/commands/help/TestHelp.py

Removed: 




diff  --git a/lldb/include/lldb/Utility/OptionDefinition.h 
b/lldb/include/lldb/Utility/OptionDefinition.h
index 725e0904f159..082f0f0aa3fa 100644
--- a/lldb/include/lldb/Utility/OptionDefinition.h
+++ b/lldb/include/lldb/Utility/OptionDefinition.h
@@ -12,6 +12,8 @@
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-types.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/MathExtras.h"
+#include 
 #include 
 
 namespace lldb_private {
@@ -47,7 +49,8 @@ struct OptionDefinition {
   /// Whether this has a short option character.
   bool HasShortOption() const {
 // See the short_option documentation for more.
-return llvm::isPrint(short_option);
+return llvm::isUInt(short_option) &&
+   llvm::isPrint(short_option);
   }
 };
 } // namespace lldb_private

diff  --git a/lldb/test/API/commands/help/TestHelp.py 
b/lldb/test/API/commands/help/TestHelp.py
index 2e849fb768a7..c6af3b1877e1 100644
--- a/lldb/test/API/commands/help/TestHelp.py
+++ b/lldb/test/API/commands/help/TestHelp.py
@@ -56,6 +56,11 @@ def test_help_should_not_crash_lldb(self):
 self.runCmd("help disasm", check=False)
 self.runCmd("help unsigned-integer")
 
+@no_debug_info_test
+def test_help_memory_read_should_not_crash_lldb(self):
+"""Command 'help memory read' should not crash lldb."""
+self.runCmd("help memory read", check=False)
+
 @no_debug_info_test
 def test_help_should_not_hang_emacsshell(self):
 """Command 'settings set term-width 0' should not hang the help 
command."""



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


[llvm-branch-commits] [lldb] 801c786 - [lldb][ARM/AArch64] Update disasm flags to latest v8.7a ISA

2021-01-07 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2021-01-07T10:51:47Z
New Revision: 801c7866e6d4fba81c97d27ca56c9e05ba7b157a

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

LOG: [lldb][ARM/AArch64] Update disasm flags to latest v8.7a ISA

Add optional memory tagging extension on AArch64.

Use isAArch64() instead of listing the AArch64 triples,
which fixes us not recognising aarch64_be.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D94084

Added: 


Modified: 
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index 6427d8d176c8..8a2d3232a39a 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1056,7 +1056,7 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &arch,
   thumb_arch_name.erase(0, 3);
   thumb_arch_name.insert(0, "thumb");
 } else {
-  thumb_arch_name = "thumbv8.2a";
+  thumb_arch_name = "thumbv8.7a";
 }
 thumb_arch.GetTriple().setArchName(llvm::StringRef(thumb_arch_name));
   }
@@ -1068,7 +1068,7 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &arch,
   // specified)
   if (triple.getArch() == llvm::Triple::arm &&
   triple.getSubArch() == llvm::Triple::NoSubArch)
-triple.setArchName("armv8.2a");
+triple.setArchName("armv8.7a");
 
   std::string features_str = "";
   const char *triple_str = triple.getTriple().c_str();
@@ -1137,16 +1137,13 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec 
&arch,
   features_str += "+dspr2,";
   }
 
-  // If any AArch64 variant, enable the ARMv8.5 ISA with SVE extensions so we
-  // can disassemble newer instructions.
-  if (triple.getArch() == llvm::Triple::aarch64 || 
-  triple.getArch() == llvm::Triple::aarch64_32)
-features_str += "+v8.5a,+sve2";
+  // If any AArch64 variant, enable latest ISA with any optional
+  // extensions like SVE.
+  if (triple.isAArch64()) {
+features_str += "+v8.7a,+sve2,+mte";
 
-  if ((triple.getArch() == llvm::Triple::aarch64 ||
-   triple.getArch() == llvm::Triple::aarch64_32)
-  && triple.getVendor() == llvm::Triple::Apple) {
-cpu = "apple-latest";
+if (triple.getVendor() == llvm::Triple::Apple)
+  cpu = "apple-latest";
   }
 
   // We use m_disasm_up.get() to tell whether we are valid or not, so if this



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


[llvm-branch-commits] [llvm] 282afda - Reland "[llvm][AArch64] Insert "bti j" after call to setjmp"

2022-04-12 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2022-04-12T08:34:56Z
New Revision: 282afda01b3e02b5fa7a3934e1188dbcde9d497c

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

LOG: Reland "[llvm][AArch64] Insert "bti j" after call to setjmp"

Cherry-picked from c3b98194df5572bc9b33024b48457538a7213b4c
which was originally reviewed as https://reviews.llvm.org/D121707.

This reverts commit edb7ba714acba1d18a20d9f4986d2e38aee1d109.

This changes BLR_BTI to take variable_ops meaning that we can accept
a register or a label. The pattern still expects one argument so we'll
never get more than one. Then later we can check the type of the operand
to choose BL or BLR to emit.

(this is what BLR_RVMARKER does but I missed this detail of it first time 
around)

Also require NoSLSBLRMitigation which I missed in the first version.

Added: 
llvm/test/CodeGen/AArch64/setjmp-bti-no-enforcement.ll
llvm/test/CodeGen/AArch64/setjmp-bti-outliner.ll
llvm/test/CodeGen/AArch64/setjmp-bti.ll

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
llvm/lib/Target/AArch64/AArch64FastISel.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.h
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AArch64Subtarget.h
llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 8ae7d7f49f168..e41d00c2d4c3c 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -3293,7 +3293,7 @@ Work around VLLDM erratum CVE-2021-35465 (ARM only)
 
 .. option:: -mno-bti-at-return-twice
 
-Do not add a BTI instruction after a setjmp or other return-twice construct 
(Arm only)
+Do not add a BTI instruction after a setjmp or other return-twice construct 
(AArch32/AArch64 only)
 
 .. option:: -mno-movt
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 5821e41fc7332..0c50e168bf48e 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -381,6 +381,11 @@ Arm and AArch64 Support in Clang
 - The ``attribute((target("branch-protection=...)))`` attributes will now also
   work for the ARM backend.
 
+- When using ``-mbranch-protection=bti`` with AArch64, calls to setjmp will
+  now be followed by a BTI instruction. This is done to be compatible with
+  setjmp implementations that return with a br instead of a ret. You can
+  disable this behaviour using the ``-mno-bti-at-return-twice`` option.
+
 SPIR-V Support in Clang
 ---
 
@@ -391,7 +396,6 @@ SPIR-V Support in Clang
 - Added linking of separate object files in SPIR-V format using external
   ``spirv-link`` tool.
 
-
 Floating Point Support in Clang
 ---
 - The default setting of FP contraction (FMA) is now -ffp-contract=on (for

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 602586f94603f..e0d2158407145 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3372,7 +3372,7 @@ def mmark_bti_property : Flag<["-"], 
"mmark-bti-property">,
 def mno_bti_at_return_twice : Flag<["-"], "mno-bti-at-return-twice">,
   Group,
   HelpText<"Do not add a BTI instruction after a setjmp or other"
-   " return-twice construct (Arm only)">;
+   " return-twice construct (Arm/AArch64 only)">;
 
 foreach i = {1-31} in
   def ffixed_x#i : Flag<["-"], "ffixed-x"#i>, Group,

diff  --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index ca0ca4bf4eeac..53610f0909a2a 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -592,4 +592,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
 // Enabled A53 errata (835769) workaround by default on android
 Features.push_back("+fix-cortex-a53-835769");
   }
+
+  if (Args.getLastArg(options::OPT_mno_bti_at_return_twice))
+Features.push_back("+no-bti-at-return-twice");
 }

diff  --git a/llvm/lib/Target/AArch64/AArch64.td 
b/llvm/lib/Target/AArch64/AArch64.td
index 70a79864d2c56..70c7b7b3f5dc7 100644
--- a/llvm/lib/Target/AArch64/AArch64.td
+++ b/llvm/lib/Target/AArch64/AArch64.td
@@ -464,6 +464,11 @@ def FeatureEL3 : SubtargetFeature<"el3", "HasEL3", "true",
 def FeatureFixCortexA53_835769 : SubtargetFeature<"fix-cortex-a53-835769",
   "FixCortexA53_835769", "true", "Mitigate Cortex-A53 Erratum 8

[llvm-branch-commits] [llvm] 7f8779e - [llvm][AArch64] Actually check expected FPU for CPUs

2020-12-17 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-12-17T09:15:51Z
New Revision: 7f8779e4e66b4eb3292386c1a214019f7a519c0e

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

LOG: [llvm][AArch64] Actually check expected FPU for CPUs

We were passing this as an argument but never using
it. ARM has always checked this.

Note that the FPU list is shared between ARM and AArch64
so there is no AArch64::getFPUName, just ARM::getFPUName.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D93387

Added: 


Modified: 
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/llvm/unittests/Support/TargetParserTest.cpp 
b/llvm/unittests/Support/TargetParserTest.cpp
index 2688f0ca3065..65f99df195dc 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -805,6 +805,9 @@ bool testAArch64CPU(StringRef CPUName, StringRef 
ExpectedArch,
   else
 pass &= (ExtKind == ExpectedFlags);
 
+  unsigned FPUKind = AArch64::getDefaultFPU(CPUName, AK);
+  pass &= ARM::getFPUName(FPUKind).equals(ExpectedFPU);
+
   pass &= AArch64::getCPUAttr(AK).equals(CPUAttr);
 
   return pass;



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


[llvm-branch-commits] [clang] 9a93f95 - [clang] Fix expected errors in plugin attribute example

2020-12-21 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-12-21T16:47:23Z
New Revision: 9a93f95fce91fb4616cee0f307b564b253789282

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

LOG: [clang] Fix expected errors in plugin attribute example

b2ba6867eac10874bd279c739639bdb9e60c1996 was landed
with updated error messages in the example file
but not in the test file.

Added: 


Modified: 
clang/test/Frontend/plugin-attribute.cpp

Removed: 




diff  --git a/clang/test/Frontend/plugin-attribute.cpp 
b/clang/test/Frontend/plugin-attribute.cpp
index 969105927be5..f02932d56c68 100644
--- a/clang/test/Frontend/plugin-attribute.cpp
+++ b/clang/test/Frontend/plugin-attribute.cpp
@@ -18,5 +18,5 @@ int var1 __attribute__((example("otherstring"))) = 1; // 
expected-warning {{'exa
 class Example {
   void __attribute__((example)) fn3(); // expected-error {{'example' attribute 
only allowed at file scope}}
 };
-void fn4() __attribute__((example(123))) { } // expected-error {{'example's 
first argument should be a string literal}}
-void fn5() __attribute__((example("a","b", 3, 4.0))) { } // expected-error 
{{'example' attribute only allowed at most three arguments}}
+void fn4() __attribute__((example(123))) { } // expected-error {{first 
argument to the 'example' attribute must be a string literal}}
+void fn5() __attribute__((example("a","b", 3, 4.0))) { } // expected-error 
{{'example' attribute only accepts at most three arguments}}



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


[llvm-branch-commits] [llvm] a6783cd - [llvm][ARM/AArch64] Convert Target Parser CPU tests to fixtures

2020-12-22 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-12-22T09:07:20Z
New Revision: a6783cd7b65d6c739c4dc20ec5191b2e862a4237

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

LOG: [llvm][ARM/AArch64] Convert Target Parser CPU tests to fixtures

Also convert the test function to use EXPECT_EQ and
remove the special case for the AEK_NONE extension.

This means that each test is marked as failing separatley
and the accumultated EXPECT failures are printed next
to that test, with its parameters.

Before they would be hidden by the "pass &=" pattern
and failures would print in one block since it was a
"single" test.

Example of the new failure messages:
```
ARMCPUTestsPart1/ARMCPUTestFixture.ARMCPUTests/6
[==] Running 1 test from 1 test case.
[--] Global test environment set-up.
[--] 1 test from ARMCPUTestsPart1/ARMCPUTestFixture
[ RUN  ] ARMCPUTestsPart1/ARMCPUTestFixture.ARMCPUTests/6
/work/open_source/nightly-llvm/llvm-project/llvm/unittests/Support/TargetParserTest.cpp:66:
Failure
  Expected: params.ExpectedFlags
  Which is: 3405705229
To be equal to: default_extensions
  Which is: 1
[  FAILED  ] ARMCPUTestsPart1/ARMCPUTestFixture.ARMCPUTests/6, where
GetParam() = "arm8", "armv4", "none", 0xcafef00d, "4" (0 ms)
```

Reviewed By: MarkMurrayARM

Differential Revision: https://reviews.llvm.org/D93392

Added: 


Modified: 
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/llvm/unittests/Support/TargetParserTest.cpp 
b/llvm/unittests/Support/TargetParserTest.cpp
index 8407397e4ed8..5208f6a75b02 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -31,308 +31,315 @@ const char *ARMArch[] = {
 "armv8m.main", "iwmmxt",   "iwmmxt2", "xscale",   
"armv8.1-m.main",
 };
 
-bool testARMCPU(StringRef CPUName, StringRef ExpectedArch,
-StringRef ExpectedFPU, uint64_t ExpectedFlags,
-StringRef CPUAttr) {
-  ARM::ArchKind AK = ARM::parseCPUArch(CPUName);
-  bool pass = ARM::getArchName(AK).equals(ExpectedArch);
-  unsigned FPUKind = ARM::getDefaultFPU(CPUName, AK);
-  pass &= ARM::getFPUName(FPUKind).equals(ExpectedFPU);
-
-  uint64_t ExtKind = ARM::getDefaultExtensions(CPUName, AK);
-  if (ExtKind > 1 && (ExtKind & ARM::AEK_NONE))
-pass &= ((ExtKind ^ ARM::AEK_NONE) == ExpectedFlags);
-  else
-pass &= (ExtKind == ExpectedFlags);
-  pass &= ARM::getCPUAttr(AK).equals(CPUAttr);
-
-  return pass;
+struct ARMCPUTestParams {
+  ARMCPUTestParams(StringRef CPUName, StringRef ExpectedArch,
+   StringRef ExpectedFPU, uint64_t ExpectedFlags,
+   StringRef CPUAttr)
+  : CPUName(CPUName), ExpectedArch(ExpectedArch), ExpectedFPU(ExpectedFPU),
+ExpectedFlags(ExpectedFlags), CPUAttr(CPUAttr) {}
+
+  friend std::ostream &operator<<(std::ostream &os,
+  const ARMCPUTestParams ¶ms) {
+return os << "\"" << params.CPUName.str() << "\", \""
+  << params.ExpectedArch.str() << "\", \""
+  << params.ExpectedFPU.str() << "\", 0x" << std::hex
+  << params.ExpectedFlags << ", \"" << params.CPUAttr.str() << 
"\"";
+  }
+
+  StringRef CPUName;
+  StringRef ExpectedArch;
+  StringRef ExpectedFPU;
+  uint64_t ExpectedFlags;
+  StringRef CPUAttr;
+};
+
+class ARMCPUTestFixture : public ::testing::TestWithParam {};
+
+TEST_P(ARMCPUTestFixture, ARMCPUTests) {
+  auto params = GetParam();
+
+  ARM::ArchKind AK = ARM::parseCPUArch(params.CPUName);
+  EXPECT_EQ(params.ExpectedArch, ARM::getArchName(AK));
+
+  unsigned FPUKind = ARM::getDefaultFPU(params.CPUName, AK);
+  EXPECT_EQ(params.ExpectedFPU, ARM::getFPUName(FPUKind));
+
+  uint64_t default_extensions = ARM::getDefaultExtensions(params.CPUName, AK);
+  EXPECT_EQ(params.ExpectedFlags, default_extensions);
+
+  EXPECT_EQ(params.CPUAttr, ARM::getCPUAttr(AK));
 }
 
-TEST(TargetParserTest, testARMCPU) {
-  EXPECT_TRUE(testARMCPU("invalid", "invalid", "invalid",
- ARM::AEK_NONE, ""));
-  EXPECT_TRUE(testARMCPU("generic", "invalid", "none",
- ARM::AEK_NONE, ""));
-
-  EXPECT_TRUE(testARMCPU("arm2", "armv2", "none",
- ARM::AEK_NONE, "2"));
-  EXPECT_TRUE(testARMCPU("arm3", "armv2a", "none",
- ARM::AEK_NONE, "2A"));
-  EXPECT_TRUE(testARMCPU("arm6", "armv3", "none",
- ARM::AEK_NONE, "3"));
-  EXPECT_TRUE(testARMCPU("arm7m", "armv3m", "none",
- ARM::AEK_NONE, "3M"));
-  EXPECT_TRUE(testARMCPU("arm8", "armv4", "none",
- ARM::AEK_NONE, "4"));
-  EXPECT_TRUE(testARMCPU("arm810", "armv4", "none",
- ARM::AEK_NONE, "4"));
-  EXPECT_TRU

[llvm-branch-commits] [llvm] 781a816 - [llvm][Arm/AArch64] Format extension flags in CPU test failures

2020-12-22 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-12-22T11:13:36Z
New Revision: 781a816d4cacbd0e73d36b12f82c87c0393b5a5b

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

LOG: [llvm][Arm/AArch64] Format extension flags in CPU test failures

Previously you just two hex numbers you had to decode manually.
This change adds a predicate formatter for extension flags
to produce failure messages like:
```
[ RUN  ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/2
<...>llvm/unittests/Support/TargetParserTest.cpp:862:
Failure
Expected extension flags: +fp-armv8, +crc, +crypto (0xe)
 Got extension flags: +fp-armv8, +neon, +crc, +crypto (0x1e)
[  FAILED  ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/2,
where GetParam() = "cortex-a34", "armv8-a", <...>
```

>From there you can take the feature name and map it back
to the enum in ARM/AArch64TargetParser.def.
(which isn't perfect but you've probably got both files
open if you're editing these tests)

Note that AEK_NONE is not meant to be user facing in the compiler
but here it is part of the tests. So failures may show an
extension "none" where the normal target parser wouldn't.

The formatter is implemented as a template on ARM::ISAKind
because the predicate formatters assume all parameters are used
for comparison.
(e.g. PRED_FORMAT3 is for comparing 3 values, not having 3
arguments in general)

Reviewed By: MarkMurrayARM

Differential Revision: https://reviews.llvm.org/D93448

Added: 


Modified: 
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/llvm/unittests/Support/TargetParserTest.cpp 
b/llvm/unittests/Support/TargetParserTest.cpp
index 5208f6a75b02..bc2fd6243aa5 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -8,7 +8,9 @@
 
 #include "llvm/Support/TargetParser.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/ARMBuildAttributes.h"
+#include "llvm/Support/FormatVariadic.h"
 #include "gtest/gtest.h"
 #include 
 
@@ -31,6 +33,47 @@ const char *ARMArch[] = {
 "armv8m.main", "iwmmxt",   "iwmmxt2", "xscale",   
"armv8.1-m.main",
 };
 
+template 
+std::string FormatExtensionFlags(uint64_t Flags) {
+  std::vector Features;
+
+  if (ISAKind == ARM::ISAKind::AARCH64) {
+// AEK_NONE is not meant to be shown to the user so the target parser
+// does not recognise it. It is relevant here though.
+if (Flags & AArch64::AEK_NONE)
+  Features.push_back("none");
+AArch64::getExtensionFeatures(Flags, Features);
+  } else {
+if (Flags & ARM::AEK_NONE)
+  Features.push_back("none");
+ARM::getExtensionFeatures(Flags, Features);
+  }
+
+  // The target parser also includes every extension you don't have.
+  // E.g. if AEK_CRC is not set then it adds "-crc". Not useful here.
+  Features.erase(std::remove_if(Features.begin(), Features.end(),
+[](StringRef extension) {
+  return extension.startswith("-");
+}),
+ Features.end());
+
+  return llvm::join(Features, ", ");
+}
+
+template 
+testing::AssertionResult
+AssertSameExtensionFlags(const char *m_expr, const char *n_expr,
+ uint64_t ExpectedFlags, uint64_t GotFlags) {
+  if (ExpectedFlags == GotFlags)
+return testing::AssertionSuccess();
+
+  return testing::AssertionFailure() << llvm::formatv(
+ "Expected extension flags: {0} ({1:x})\n"
+ " Got extension flags: {2} ({3:x})\n",
+ FormatExtensionFlags(ExpectedFlags), ExpectedFlags,
+ FormatExtensionFlags(GotFlags), GotFlags);
+}
+
 struct ARMCPUTestParams {
   ARMCPUTestParams(StringRef CPUName, StringRef ExpectedArch,
StringRef ExpectedFPU, uint64_t ExpectedFlags,
@@ -65,7 +108,8 @@ TEST_P(ARMCPUTestFixture, ARMCPUTests) {
   EXPECT_EQ(params.ExpectedFPU, ARM::getFPUName(FPUKind));
 
   uint64_t default_extensions = ARM::getDefaultExtensions(params.CPUName, AK);
-  EXPECT_EQ(params.ExpectedFlags, default_extensions);
+  EXPECT_PRED_FORMAT2(AssertSameExtensionFlags,
+  params.ExpectedFlags, default_extensions);
 
   EXPECT_EQ(params.CPUAttr, ARM::getCPUAttr(AK));
 }
@@ -816,7 +860,8 @@ TEST_P(AArch64CPUTestFixture, testAArch64CPU) {
 
   uint64_t default_extensions =
   AArch64::getDefaultExtensions(params.CPUName, AK);
-  EXPECT_EQ(params.ExpectedFlags, default_extensions);
+  EXPECT_PRED_FORMAT2(AssertSameExtensionFlags,
+  params.ExpectedFlags, default_extensions);
 
   unsigned FPUKind = AArch64::getDefaultFPU(params.CPUName, AK);
   EXPECT_EQ(params.ExpectedFPU, ARM::getFPUName(FPUKind));



_

[llvm-branch-commits] [clang] b5fbc60 - [clang-format] State where clang-format-diff.py should be run from

2020-11-30 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-11-30T10:00:49Z
New Revision: b5fbc60e4de45f2b56331281a706b78ff52bd286

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

LOG: [clang-format] State where clang-format-diff.py should be run from

At least with git, file paths in a diff will be relative
to the repo root. So if you are in "llvm-project/lldb"
and the diff shows "clang/foo" modified you get:
No such file or directory

>From clang-format-diff.py, since clang-format was
asked to read:
llvm-project/lldb/clang/foo

Add a note to the docs to explain this.

(there is `git diff --relative` but that excludes
changes outside of the current dir)

Reviewed By: sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D91799

Added: 


Modified: 
clang/docs/ClangFormat.rst

Removed: 




diff  --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index d396667ce10c..b746ed3453df 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -248,6 +248,9 @@ In an SVN client, you can do:
 The option `-U0` will create a 
diff  without context lines (the script would format
 those as well).
 
+These commands use the file paths shown in the 
diff  output
+so they will only work from the root of the repository.
+
 Current State of Clang Format for LLVM
 ==
 



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


[llvm-branch-commits] [lldb] 98e87f7 - [lldb] Error when there are no ports to launch a gdbserver on

2020-11-30 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-11-30T10:19:14Z
New Revision: 98e87f76d0f486122d76b334232102e0d7a9254d

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

LOG: [lldb] Error when there are no ports to launch a gdbserver on

Previously if you did:
$ lldb-server platform --server <...> --min-gdbserver-port 12346
--max-gdbserver-port 12347
(meaning only use port 12346 for gdbservers)

Then tried to launch two gdbservers on the same connection,
the second one would return port 65535. Which is a real port
number but it actually means lldb-server didn't find one it was
allowed to use.

send packet: $qLaunchGDBServer;<...>
read packet: $pid:1919;port:12346;#c0
<...>
send packet: $qLaunchGDBServer;<...>
read packet: $pid:1927;port:65535;#c7

This situation should be an error even if port 65535 does happen
to be available on the current machine.

To fix this make PortMap it's own class within
GDBRemoteCommunicationServerPlatform.

This almost the same as the old typedef but for
GetNextAvailablePort() returning an llvm::Expected.
This means we have to handle not finding a port,
by returning an error packet.

Also add unit tests for this new PortMap class.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D91634

Added: 
lldb/unittests/Process/gdb-remote/PortMapTest.cpp

Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/tools/lldb-server/lldb-platform.cpp
lldb/unittests/Process/gdb-remote/CMakeLists.txt

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
index 63567bb9b5de..a1cf70f9cd1a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
@@ -27,7 +27,6 @@ class ProcessGDBRemote;
 
 class GDBRemoteCommunicationServer : public GDBRemoteCommunication {
 public:
-  using PortMap = std::map;
   using PacketHandler =
   std::function;

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 7e94afb9ec68..ae1260221e56 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -42,6 +42,69 @@ using namespace lldb;
 using namespace lldb_private::process_gdb_remote;
 using namespace lldb_private;
 
+GDBRemoteCommunicationServerPlatform::PortMap::PortMap(uint16_t min_port,
+   uint16_t max_port) {
+  for (; min_port < max_port; ++min_port)
+m_port_map[min_port] = LLDB_INVALID_PROCESS_ID;
+}
+
+void GDBRemoteCommunicationServerPlatform::PortMap::AllowPort(uint16_t port) {
+  // Do not modify existing mappings
+  m_port_map.insert({port, LLDB_INVALID_PROCESS_ID});
+}
+
+llvm::Expected
+GDBRemoteCommunicationServerPlatform::PortMap::GetNextAvailablePort() {
+  if (m_port_map.empty())
+return 0; // Bind to port zero and get a port, we didn't have any
+  // limitations
+
+  for (auto &pair : m_port_map) {
+if (pair.second == LLDB_INVALID_PROCESS_ID) {
+  pair.second = ~(lldb::pid_t)LLDB_INVALID_PROCESS_ID;
+  return pair.first;
+}
+  }
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "No free port found in port map");
+}
+
+bool GDBRemoteCommunicationServerPlatform::PortMap::AssociatePortWithProcess(
+uint16_t port, lldb::pid_t pid) {
+  auto pos = m_port_map.find(port);
+  if (pos != m_port_map.end()) {
+pos->second = pid;
+return true;
+  }
+  return false;
+}
+
+bool GDBRemoteCommunicationServerPlatform::PortMap::FreePort(uint16_t port) {
+  std::map::iterator pos = m_port_map.find(port);
+  if (pos != m_port_map.end()) {
+pos->second = LLDB_INVALID_PROCESS_ID;
+return true;
+  }
+  return false;
+}
+
+bool GDBRemoteCommunicationServerPlatform::PortMap::FreePortForProcess(
+lldb::pid_t pid) {
+  if (!m_port_map.empty()) {
+for (auto &pair : m_port_map) {
+  if (pair.second == pid) {
+pair.second = LLDB_INVALID_PROCESS_ID;
+return true;
+  }
+}
+  }
+  return false;
+}
+
+bool GDBRemoteCommunicationServerPlatform::PortMap::empty() const {
+  return m_port_map.empty();
+}
+
 // GDBRemoteCommunicationServerPlatform constructor
 GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform(
 co

[llvm-branch-commits] [lldb] a7f8d96 - [lldb] Use llvm::Optional for port in LaunchGDBServer

2020-11-30 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-11-30T11:20:39Z
New Revision: a7f8d96b16a394a87230d592c727906f67a4ba07

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

LOG: [lldb] Use llvm::Optional for port in LaunchGDBServer

Previously we used UINT16_MAX to mean no port/no specifc
port. This leads to confusion because 65535 is a valid
port number.

Instead use an optional. If you want a specific port call
LaunchGDBServer as normal, otherwise pass an empty optional
and it will be set to the port that gets chosen.
(or left empty in the case where we fail to find a port)

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D92035

Added: 


Modified: 

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/tools/lldb-server/lldb-platform.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index ae1260221e56..4aa153460941 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -157,8 +157,8 @@ 
GDBRemoteCommunicationServerPlatform::~GDBRemoteCommunicationServerPlatform() {}
 
 Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
 const lldb_private::Args &args, std::string hostname, lldb::pid_t &pid,
-uint16_t &port, std::string &socket_name) {
-  if (port == UINT16_MAX) {
+llvm::Optional &port, std::string &socket_name) {
+  if (!port) {
 llvm::Expected available_port = 
m_port_map.GetNextAvailablePort();
 if (available_port)
   port = *available_port;
@@ -179,7 +179,7 @@ Status 
GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
   LLDB_LOGF(log, "Launching debugserver with: %s:%u...", hostname.c_str(),
-port);
+*port);
 
   // Do not run in a new session so that it can not linger after the platform
   // closes.
@@ -194,7 +194,7 @@ Status 
GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
 #if !defined(__APPLE__)
   url << m_socket_scheme << "://";
 #endif
-  uint16_t *port_ptr = &port;
+  uint16_t *port_ptr = port.getPointer();
   if (m_socket_protocol == Socket::ProtocolTcp) {
 llvm::StringRef platform_scheme;
 llvm::StringRef platform_ip;
@@ -205,7 +205,7 @@ Status 
GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
platform_port, platform_path);
 UNUSED_IF_ASSERT_DISABLED(ok);
 assert(ok);
-url << platform_ip.str() << ":" << port;
+url << platform_ip.str() << ":" << *port;
   } else {
 socket_name = GetDomainSocketPath("gdbserver").GetPath();
 url << socket_name;
@@ -219,11 +219,11 @@ Status 
GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
   if (pid != LLDB_INVALID_PROCESS_ID) {
 std::lock_guard guard(m_spawned_pids_mutex);
 m_spawned_pids.insert(pid);
-if (port > 0)
-  m_port_map.AssociatePortWithProcess(port, pid);
+if (*port > 0)
+  m_port_map.AssociatePortWithProcess(*port, pid);
   } else {
-if (port > 0)
-  m_port_map.FreePort(port);
+if (*port > 0)
+  m_port_map.FreePort(*port);
   }
   return error;
 }
@@ -243,12 +243,15 @@ 
GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
   packet.SetFilePos(::strlen("qLaunchGDBServer;"));
   llvm::StringRef name;
   llvm::StringRef value;
-  uint16_t port = UINT16_MAX;
+  llvm::Optional port;
   while (packet.GetNameColonValue(name, value)) {
 if (name.equals("host"))
   hostname = std::string(value);
-else if (name.equals("port"))
-  value.getAsInteger(0, port);
+else if (name.equals("port")) {
+  // Make the Optional valid so we can use its value
+  port = 0;
+  value.getAsInteger(0, port.getValue());
+}
   }
 
   lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID;
@@ -269,8 +272,9 @@ 
GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
 __FUNCTION__, debugserver_pid);
 
   StreamGDBRemote response;
+  assert(port);
   response.Printf("pid:%" PRIu64 ";port:%u;", debugserver_pid,
-  port + m_port_offset);
+  *port + m_port_offset);
   if (!socket_name.empty()) {
 response.PutCString("socket_name:");
 response.PutStringAsRawHex8(socket_name);

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
index 69261dd2ad64..6b964da4a279 100644
--- 
a/lldb/source/Plugins/Proces

[llvm-branch-commits] [llvm] c2ead57 - [llvm-objdump] Document --mattr=help in --help output

2020-11-30 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-11-30T12:52:54Z
New Revision: c2ead57ccf74900901fdda1cd0fbe9a7a0d1297a

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

LOG: [llvm-objdump] Document --mattr=help in --help output

This does the same as `--mcpu=help` but was only
documented in the user guide.

* Added a test for both options.
* Corrected the single dash in `-mcpu=help` text.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D92305

Added: 
llvm/test/tools/llvm-objdump/mattr-mcpu-help.test

Modified: 
llvm/docs/CommandGuide/llvm-objdump.rst
llvm/tools/llvm-objdump/llvm-objdump.cpp

Removed: 




diff  --git a/llvm/docs/CommandGuide/llvm-objdump.rst 
b/llvm/docs/CommandGuide/llvm-objdump.rst
index 4acb04833ab13..1ac7a05cbdb0a 100644
--- a/llvm/docs/CommandGuide/llvm-objdump.rst
+++ b/llvm/docs/CommandGuide/llvm-objdump.rst
@@ -156,7 +156,7 @@ OPTIONS
 
 .. option:: --mattr=
 
-  Enable/disable target-specific attributes. Specify ``--mcpu=help`` to display
+  Enable/disable target-specific attributes. Specify ``--mattr=help`` to 
display
   the available attributes.
 
 .. option:: --no-leading-addr

diff  --git a/llvm/test/tools/llvm-objdump/mattr-mcpu-help.test 
b/llvm/test/tools/llvm-objdump/mattr-mcpu-help.test
new file mode 100644
index 0..4c3198b0fbfed
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/mattr-mcpu-help.test
@@ -0,0 +1,15 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump -d %t --mattr=help 2>&1 | FileCheck %s
+# RUN: llvm-objdump -d %t --mcpu=help 2>&1 | FileCheck %s
+
+# CHECK: Available CPUs for this target:
+# CHECK: Available features for this target:
+## To check we still disassemble the file:
+# CHECK: file format elf64-x86-64
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64

diff  --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp 
b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index bc13b26b797d8..bb33d254370e6 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -226,13 +226,13 @@ static cl::alias MachOm("m", cl::desc("Alias for 
--macho"), cl::NotHidden,
 cl::Grouping, cl::aliasopt(MachOOpt));
 
 cl::opt objdump::MCPU(
-"mcpu", cl::desc("Target a specific cpu type (-mcpu=help for details)"),
+"mcpu", cl::desc("Target a specific cpu type (--mcpu=help for details)"),
 cl::value_desc("cpu-name"), cl::init(""), cl::cat(ObjdumpCat));
 
-cl::list objdump::MAttrs("mattr", cl::CommaSeparated,
-  cl::desc("Target specific attributes"),
-  cl::value_desc("a1,+a2,-a3,..."),
-  cl::cat(ObjdumpCat));
+cl::list objdump::MAttrs(
+"mattr", cl::CommaSeparated,
+cl::desc("Target specific attributes (--mattr=help for details)"),
+cl::value_desc("a1,+a2,-a3,..."), cl::cat(ObjdumpCat));
 
 cl::opt objdump::NoShowRawInsn(
 "no-show-raw-insn",



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


[llvm-branch-commits] [llvm] c3d4846 - [llvm-objdump] Require x86 target for mcpu/attr test

2020-11-30 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-11-30T13:55:31Z
New Revision: c3d484673fa70bb4b2284689db76d36bbdf12f38

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

LOG: [llvm-objdump] Require x86 target for mcpu/attr test

This fixes test failure on clang-cmake-armv7-quick bot
with change c2ead57ccf74900901fdda1cd0fbe9a7a0d1297a.

This bot only builds Arm/AArch64 targets.

Added: 


Modified: 
llvm/test/tools/llvm-objdump/mattr-mcpu-help.test

Removed: 




diff  --git a/llvm/test/tools/llvm-objdump/mattr-mcpu-help.test 
b/llvm/test/tools/llvm-objdump/mattr-mcpu-help.test
index 4c3198b0fbfe..65c426008fd6 100644
--- a/llvm/test/tools/llvm-objdump/mattr-mcpu-help.test
+++ b/llvm/test/tools/llvm-objdump/mattr-mcpu-help.test
@@ -1,6 +1,7 @@
 # RUN: yaml2obj %s -o %t
 # RUN: llvm-objdump -d %t --mattr=help 2>&1 | FileCheck %s
 # RUN: llvm-objdump -d %t --mcpu=help 2>&1 | FileCheck %s
+# REQUIRES: x86-registered-target
 
 # CHECK: Available CPUs for this target:
 # CHECK: Available features for this target:



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


[llvm-branch-commits] [llvm] aabaca3 - [llvm-objdump] Use "--" for long options in --help text

2020-12-14 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-12-14T13:11:29Z
New Revision: aabaca33635885e81baa79730b6b213fc96ac636

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

LOG: [llvm-objdump] Use "--" for long options in --help text

Single dash for these options is not recognised.

Changes found by running this on the --help output
and the user guide:
grep -e ' -[a-zA-Z]\{2,\}'

The user guide was updated in https://reviews.llvm.org/D92305
so no change there.

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D92310

Added: 


Modified: 
llvm/tools/llvm-objdump/MachODump.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp

Removed: 




diff  --git a/llvm/tools/llvm-objdump/MachODump.cpp 
b/llvm/tools/llvm-objdump/MachODump.cpp
index c1d330bae133..b3ec20f97c97 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -107,70 +107,70 @@ static cl::opt 
NoLeadingHeaders("no-leading-headers",
 
 cl::opt objdump::UniversalHeaders(
 "universal-headers",
-cl::desc("Print Mach-O universal headers (requires -macho)"),
+cl::desc("Print Mach-O universal headers (requires --macho)"),
 cl::cat(MachOCat));
 
 static cl::opt ArchiveMemberOffsets(
 "archive-member-offsets",
 cl::desc("Print the offset to each archive member for Mach-O archives "
- "(requires -macho and -archive-headers)"),
+ "(requires --macho and --archive-headers)"),
 cl::cat(MachOCat));
 
 cl::opt objdump::IndirectSymbols(
 "indirect-symbols",
 cl::desc(
-"Print indirect symbol table for Mach-O objects (requires -macho)"),
+"Print indirect symbol table for Mach-O objects (requires --macho)"),
 cl::cat(MachOCat));
 
 cl::opt objdump::DataInCode(
 "data-in-code",
 cl::desc(
-"Print the data in code table for Mach-O objects (requires -macho)"),
+"Print the data in code table for Mach-O objects (requires --macho)"),
 cl::cat(MachOCat));
 
 cl::opt
 objdump::LinkOptHints("link-opt-hints",
   cl::desc("Print the linker optimization hints for "
-   "Mach-O objects (requires -macho)"),
+   "Mach-O objects (requires --macho)"),
   cl::cat(MachOCat));
 
 cl::opt
 objdump::InfoPlist("info-plist",
cl::desc("Print the info plist section as strings for "
-"Mach-O objects (requires -macho)"),
+"Mach-O objects (requires --macho)"),
cl::cat(MachOCat));
 
 cl::opt
 objdump::DylibsUsed("dylibs-used",
 cl::desc("Print the shared libraries used for linked "
- "Mach-O files (requires -macho)"),
+ "Mach-O files (requires --macho)"),
 cl::cat(MachOCat));
 
 cl::opt objdump::DylibId("dylib-id",
cl::desc("Print the shared library's id for the 
"
-"dylib Mach-O file (requires -macho)"),
+"dylib Mach-O file (requires 
--macho)"),
cl::cat(MachOCat));
 
 static cl::opt
 NonVerbose("non-verbose",
cl::desc("Print the info for Mach-O objects in non-verbose or "
-"numeric form (requires -macho)"),
+"numeric form (requires --macho)"),
cl::cat(MachOCat));
 
 cl::opt
 objdump::ObjcMetaData("objc-meta-data",
   cl::desc("Print the Objective-C runtime meta data "
-   "for Mach-O files (requires -macho)"),
+   "for Mach-O files (requires --macho)"),
   cl::cat(MachOCat));
 
 static cl::opt DisSymName(
 "dis-symname",
-cl::desc("disassemble just this symbol's instructions (requires -macho)"),
+cl::desc("disassemble just this symbol's instructions (requires --macho)"),
 cl::cat(MachOCat));
 
 static cl::opt NoSymbolicOperands(
 "no-symbolic-operands",
-cl::desc("do not symbolic operands when disassembling (requires -macho)"),
+cl::desc("do not symbolic operands when disassembling (requires --macho)"),
 cl::cat(MachOCat));
 
 static cl::list

diff  --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp 
b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index bb33d254370e..96e936ec4e8f 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -101,7 +101,7 @@ static cl::alias AllHeadersShort("x", cl::desc("Alias for 
--all-headers"),
 static cl::opt
 ArchName("a

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-05 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-05 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett commented:

LGTM but a LoongArch expert should give the final approval.

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


[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,104 @@
+//===-- ABISysV_loongarch.h -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_SOURCE_PLUGINS_ABI_LOONGARCH_ABISYSV_LOONGARCH_H
+#define LLDB_SOURCE_PLUGINS_ABI_LOONGARCH_ABISYSV_LOONGARCH_H
+
+// Other libraries and framework includes
+#include "llvm/TargetParser/Triple.h"
+
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_loongarch : public lldb_private::RegInfoBasedABI {
+public:
+  ~ABISysV_loongarch() override = default;
+
+  size_t GetRedZoneSize() const override { return 0; }
+
+  bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread &thread,
+ lldb_private::ValueList &values) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP &frame_sp,
+   lldb::ValueObjectSP &new_value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   lldb_private::CompilerType &type) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) 
override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// The CFA must be 128 bit aligned.

DavidSpickett wrote:

128 bit or 128 byte? This mask doesn't seem to fit either.

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


[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),

DavidSpickett wrote:

If the second parameter is always nullptr, make the macros emit it instead of 
passing it in every time.

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


[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,664 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(str_name),   
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr, 
\
+  nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_loongarch, ABILoongArch)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  r0,
+  ra,
+  r1 = ra,
+  r2,
+  sp,
+  r3 = sp,
+  r4,
+  r5,
+  r6,
+  r7,
+  r8,
+  r9,
+  r10,
+  r11,
+  r12,
+  r13,
+  r14,
+  r15,
+  r16,
+  r17,
+  r18,
+  r19,
+  r20,
+  r21,
+  fp,
+  r22 = fp,
+  r23,
+  r24,
+  r25,
+  r26,
+  r27,
+  r28,
+  r29,
+  r30,
+  r31,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(r0, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r1, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_REGISTER_STUB(r2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r3, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_GENERIC_REGISTER_STUB(r4, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(r5, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(r6, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(r7, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(r8, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(r9, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(r10, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(r11, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ DEFINE_REGISTER_STUB(r12, nullptr),
+ DEFINE_REGISTER_STUB(r13, nullptr),
+ DEFINE_REGISTER_STUB(r14, nullptr),
+ DEFINE_REGISTER_STUB(r15, nullptr),
+ DEFINE_REGISTER_STUB(r16, nullptr),
+ DEFINE_REGISTER_STUB(r17, nullptr),
+ DEFINE_REGISTER_STUB(r18, nullptr),
+ DEFINE_REGISTER_STUB(r19, nullptr),
+ DEFINE_REGISTER_STUB(r20, nullptr),
+ DEFINE_REGISTER_STUB(r21, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(r22, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(r23, nullptr),
+ DEFINE_REGISTER_STUB(r24, nullptr),
+ DEFINE_REGISTER_STUB(r25, nullptr),
+ DEFINE_REGISTER_STUB(r26, nullptr),
+ DEFINE_REGISTER_STUB(r27, nullptr),
+ DEFINE_REGISTER_STUB(r28, nullptr),
+ DEFINE_REGISTER_STUB(r29, nullptr),
+ DEFINE_REGISTER_STUB(r30, nullptr),
+ DEFINE_REGISTER_STUB(r31, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(pc, nullptr, LLDB_REGNUM_GENERIC_PC)}};
+} // namespace dwarf
+} // namespace
+
+// Number of argument registers (the base integer calling convention
+// provides 8 argument registers, a0-a7)
+static constexpr size_t g_regs_for_args_count = 8U;
+
+const RegisterInfo *ABISysV_loongarch::GetRegisterInfoArray(uint32_t &count) {
+  count = dwarf::g_register_infos.size();
+  return dwarf::g_register_infos.data();
+}
+
+/

[llvm-branch-commits] [lldb] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-04 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,104 @@
+//===-- ABISysV_loongarch.h -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_SOURCE_PLUGINS_ABI_LOONGARCH_ABISYSV_LOONGARCH_H
+#define LLDB_SOURCE_PLUGINS_ABI_LOONGARCH_ABISYSV_LOONGARCH_H
+
+// Other libraries and framework includes
+#include "llvm/TargetParser/Triple.h"
+
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_loongarch : public lldb_private::RegInfoBasedABI {
+public:
+  ~ABISysV_loongarch() override = default;
+
+  size_t GetRedZoneSize() const override { return 0; }
+
+  bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread &thread,
+ lldb_private::ValueList &values) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP &frame_sp,
+   lldb::ValueObjectSP &new_value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   lldb_private::CompilerType &type) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) 
override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// The CFA must be 128 bit aligned.
+return (cfa & 0xfull) == 0;
+  }
+
+  void SetIsLA64(bool is_la64) { m_is_la64 = is_la64; }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+if (pc & (4ull - 1ull))
+  return false; // Not 4 byte aligned
+
+// Anything else if fair game..

DavidSpickett wrote:

The comment is redundant so remove it but it would be "is fair game" if you 
keep it.

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


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-05 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,170 @@
+//===-- NativeRegisterContextDBReg_loongarch.cpp 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "NativeRegisterContextDBReg_loongarch.h"
+
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/RegisterValue.h"
+
+using namespace lldb_private;
+
+uint32_t
+NativeRegisterContextDBReg_loongarch::SetHardwareBreakpoint(lldb::addr_t addr,

DavidSpickett wrote:

I'm surprised this is not in the base class.

I suppose it's like for Arm64 where the control value is the enable bit from 
the base class, plus some extra arch specific things.

Perhaps once you've added a generic MakeControlValue this can be removed. You 
might want a "ValidateBreakpoint" as well to handle size and alignment.

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


[llvm-branch-commits] [compiler-rt] [compiler-rt] Convert Maintainers.txt into Maintainers.md (PR #119169)

2024-12-27 Thread David Spickett via llvm-branch-commits

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

Nice! LGTM.

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


[llvm-branch-commits] [lldb] release/20.x: [lldb] Add support for gdb-style 'x' packet (#124733) (PR #125653)

2025-02-04 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

I agree with backporting this.

There should be a release note for it. I know we could get away without it 
because the relevant GDB has not been out (maybe not at all) at this point, but 
it'll be something easy to point to for us in a few years time, and GDB folks 
who want to confirm what we did without reading our source code.

I suggest:
```
* Support was added for handling the GDB Remote Protocol `x` packet in the 
format introduced by GDB . LLDB currently uses a different format for 
`x` and LLDB is now able to handle both formats. At some point in the future 
support for LLDB's format of `x` will be removed.
```

I think this can be done as a PR to the release branch? No need to complicate 
this one.

And it would be good to add a note to 
https://lldb.llvm.org/resources/lldbgdbremote.html#x-binary-memory-read (just 
on `main`) that says something like:
```
The format of this packet was decided before GDB  introduced its own 
format for x. Future versions of LLDB may not support the following format, and 
new code should produce and expect the format used by GDB.
```

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


[llvm-branch-commits] [mlir] [mlir][cmake] Add missing MLIRTestDialect dependencies (PR #125834)

2025-02-05 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/125834

This cherry picks
[mlir][cmake] Add missing MLIRTestDialect dependency (#125004) 
(72b73c9af694198096b2e0c47a1625e5b94c76a5) and
[mlir] Fix build race condition in Pass Manager tests 
(d906da5ead2764579395e5006c517f2ec9afd46f) to the 20.x release branch.

Both of these are addressing issues that started with 
https://github.com/llvm/llvm-project/pull/123910, which is already on the 20.x 
branch.

In each case the cherry-picked changes correct problems that would otherwise be 
a race condition in certain builds. Linaro noticed this on our flang dylib 
(shared library) build bot.

Failures look like:
In file included from 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/Pass/TestPassManager.cpp:10:
 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/Pass/../Dialect/Test/TestOps.h:148:10:
 fatal error: 'TestOps.h.inc' file not found
  148 | #include "TestOps.h.inc"
  |  ^~~

We have tested these changes on the buildbot for the last 2 days and had no 
problems. Whereas before it was failing maybe 1 in 10 builds, enough that 
multiple people in the community noticed it.

Reported in https://github.com/llvm/llvm-project/issues/124485 and 
https://github.com/llvm/llvm-project/issues/124335.

>From ab3bc7eeb7ff89ec53a262ad9b52ab46599c Mon Sep 17 00:00:00 2001
From: Diego Caballero 
Date: Thu, 30 Jan 2025 16:09:19 -0800
Subject: [PATCH] [mlir][cmake] Add missing MLIRTestDialect dependencies

This cherry picks
[mlir][cmake] Add missing MLIRTestDialect dependency (#125004) 
(72b73c9af694198096b2e0c47a1625e5b94c76a5)
and
[mlir] Fix build race condition in Pass Manager tests 
(d906da5ead2764579395e5006c517f2ec9afd46f)
to the 20.x release branch.

Both of these are addressing issues that started with
https://github.com/llvm/llvm-project/pull/123910, which is already on the 20.x 
branch.

In each case the cherry-picked changes correct problems that would otherwise be
a race condition in certain builds. Linaro noticed this on our flang dylib 
(shared library)
build bot.

Failures look like:
In file included from 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/Pass/TestPassManager.cpp:10:
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/Pass/../Dialect/Test/TestOps.h:148:10:
 fatal error: 'TestOps.h.inc' file not found
  148 | #include "TestOps.h.inc"
  |  ^~~

We have tested these changes on the buildbot for the last 2 days and had no 
problems.
Whereas before it was failing maybe 1 in 10 builds, enough that multiple people
in the community noticed it.

Reported in https://github.com/llvm/llvm-project/issues/124485 and
https://github.com/llvm/llvm-project/issues/124335.

Co-authored-by: Diego Caballero 
---
 mlir/test/lib/IR/CMakeLists.txt   | 4 
 mlir/test/lib/Pass/CMakeLists.txt | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/mlir/test/lib/IR/CMakeLists.txt b/mlir/test/lib/IR/CMakeLists.txt
index e5416da70d50080..eeb9cf1e34fc8c0 100644
--- a/mlir/test/lib/IR/CMakeLists.txt
+++ b/mlir/test/lib/IR/CMakeLists.txt
@@ -27,7 +27,11 @@ add_mlir_library(MLIRTestIR
   TestVisitorsGeneric.cpp
 
   EXCLUDE_FROM_LIBMLIR
+
+  DEPENDS
+  MLIRTestDialect
   )
+
 mlir_target_link_libraries(MLIRTestIR PUBLIC
   MLIRPass
   MLIRBytecodeReader
diff --git a/mlir/test/lib/Pass/CMakeLists.txt 
b/mlir/test/lib/Pass/CMakeLists.txt
index 6698af86b8ae66d..c5d0bab8ec74946 100644
--- a/mlir/test/lib/Pass/CMakeLists.txt
+++ b/mlir/test/lib/Pass/CMakeLists.txt
@@ -10,12 +10,14 @@ add_mlir_library(MLIRTestPass
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
+
+  LINK_LIBS PUBLIC
+  MLIRTestDialect
   )
 mlir_target_link_libraries(MLIRTestPass PUBLIC
   ${conversion_libs}
   MLIRIR
   MLIRPass
-  MLIRTestDialect
   )
 
 target_include_directories(MLIRTestPass

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


[llvm-branch-commits] [mlir] [mlir][cmake] Add missing MLIRTestDialect dependencies (PR #125834)

2025-02-05 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

These would be clean cherry-picks but I put them into one commit so I could 
include the details of what it fixes. I hope that's ok.

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


[llvm-branch-commits] [mlir] [mlir][cmake] Add missing MLIRTestDialect dependencies (PR #125834)

2025-02-05 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett milestoned 
https://github.com/llvm/llvm-project/pull/125834
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] [mlir][cmake] Add missing MLIRTestDialect dependencies (PR #125834)

2025-02-05 Thread David Spickett via llvm-branch-commits


@@ -27,7 +27,11 @@ add_mlir_library(MLIRTestIR
   TestVisitorsGeneric.cpp
 
   EXCLUDE_FROM_LIBMLIR
+
+  DEPENDS

DavidSpickett wrote:

I do, in fact - ad152f4bcfe465b57562fa003b93f44e1a3b2287.

Will pick this too.

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


[llvm-branch-commits] [mlir] [mlir][cmake] Add missing MLIRTestDialect dependencies (PR #125834)

2025-02-05 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

Actually, I see @nikic doing more fixes. So I will wait for you to finish your 
work and we can coordinate what needs to go into 20.x.

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


[llvm-branch-commits] [mlir] [mlir][cmake] Add missing MLIRTestDialect dependencies (PR #125834)

2025-02-05 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett updated 
https://github.com/llvm/llvm-project/pull/125834

>From 0e17c1507085e0d2efb87e6d4064ef2482854804 Mon Sep 17 00:00:00 2001
From: Diego Caballero 
Date: Thu, 30 Jan 2025 16:09:19 -0800
Subject: [PATCH] [mlir][cmake] Add missing MLIRTestDialect dependencies

This cherry picks
[mlir] Fix build race condition in Pass Manager tests 
(d906da5ead2764579395e5006c517f2ec9afd46f)
to the 20.x release branch.

This addresses issues that started with
https://github.com/llvm/llvm-project/pull/123910, which is already on the 20.x 
branch.

Linaro noticed this on our flang dylib (shared library) build bot.

In file included from 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/Pass/TestPassManager.cpp:10:
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/Pass/../Dialect/Test/TestOps.h:148:10:
 fatal error: 'TestOps.h.inc' file not found
  148 | #include "TestOps.h.inc"
  |  ^~~

We have tested these changes on the buildbot for the last 2 days and had no 
problems.
Whereas before it was failing maybe 1 in 10 builds, enough that multiple people
in the community noticed it.

Reported in https://github.com/llvm/llvm-project/issues/124485.
---
 mlir/test/lib/Pass/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mlir/test/lib/Pass/CMakeLists.txt 
b/mlir/test/lib/Pass/CMakeLists.txt
index 6698af86b8ae66d..c5d0bab8ec74946 100644
--- a/mlir/test/lib/Pass/CMakeLists.txt
+++ b/mlir/test/lib/Pass/CMakeLists.txt
@@ -10,12 +10,14 @@ add_mlir_library(MLIRTestPass
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
+
+  LINK_LIBS PUBLIC
+  MLIRTestDialect
   )
 mlir_target_link_libraries(MLIRTestPass PUBLIC
   ${conversion_libs}
   MLIRIR
   MLIRPass
-  MLIRTestDialect
   )
 
 target_include_directories(MLIRTestPass

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


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-10 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,34 @@
+//===-- NativeRegisterContextDBReg_loongarch.h --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef lldb_NativeRegisterContextDBReg_loongarch_h
+#define lldb_NativeRegisterContextDBReg_loongarch_h
+
+#include "Plugins/Process/Utility/NativeRegisterContextDBReg.h"
+
+namespace lldb_private {
+
+class NativeRegisterContextDBReg_loongarch : public NativeRegisterContextDBReg 
{
+public:
+  explicit NativeRegisterContextDBReg_loongarch(uint32_t enable_bit)

DavidSpickett wrote:

Maybe I should give more context so we are on the same page:
```
class NativeRegisterContextDBReg_loongarch : public NativeRegisterContextDBReg {
public:
  explicit NativeRegisterContextDBReg_loongarch()
 : NativeRegisterContextDBReg() {}
```
Though the `explicit` is probably redundant or invalid when there are no 
constructor arguments.

The point is that all calls to `NativeRegisterContextDBReg_loongarch(` would be 
passing the same value for enable_it.

Is doing that giving you the same error? I will try it locally, maybe I have 
misunderstood the code.

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


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-10 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,34 @@
+//===-- NativeRegisterContextDBReg_loongarch.h --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef lldb_NativeRegisterContextDBReg_loongarch_h
+#define lldb_NativeRegisterContextDBReg_loongarch_h
+
+#include "Plugins/Process/Utility/NativeRegisterContextDBReg.h"
+
+namespace lldb_private {
+
+class NativeRegisterContextDBReg_loongarch : public NativeRegisterContextDBReg 
{
+public:
+  explicit NativeRegisterContextDBReg_loongarch(uint32_t enable_bit)

DavidSpickett wrote:

Actually I'm not sure how to do that with these stacked branches, and I see 
that in the arm64 code you already pass the value in this way.

So I likely have mixed up something here.

So if you notice that you're repeating the enable bit value multiple times, try 
to mitigate that. But otherwise, I'm fine with how it is.

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


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-10 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/118770
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-10 Thread David Spickett via llvm-branch-commits


@@ -58,10 +59,21 @@ 
NativeRegisterContextLinux_loongarch64::NativeRegisterContextLinux_loongarch64(
 std::unique_ptr register_info_up)
 : NativeRegisterContextRegisterInfo(native_thread,
 register_info_up.release()),
-  NativeRegisterContextLinux(native_thread) {
+  NativeRegisterContextLinux(native_thread),
+  NativeRegisterContextDBReg_arm64(/*CTRL_PLV3_ENABLE=*/0x10U) {

DavidSpickett wrote:

I like adding these comments but really it should be the name of the parameter 
in the first part. You could do:
```
/*whatever_the_parameter_name_is=*/0x10U /*CTRL_PLV3_ENABLE/*
```
This is a bit more useful and also any tool like clang-tidy that checks these 
comments won't complain that `CTRL_PLV3_ENABLE` isn't a prameter.

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


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-10 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,34 @@
+//===-- NativeRegisterContextDBReg_loongarch.h --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef lldb_NativeRegisterContextDBReg_loongarch_h
+#define lldb_NativeRegisterContextDBReg_loongarch_h
+
+#include "Plugins/Process/Utility/NativeRegisterContextDBReg.h"
+
+namespace lldb_private {
+
+class NativeRegisterContextDBReg_loongarch : public NativeRegisterContextDBReg 
{
+public:
+  explicit NativeRegisterContextDBReg_loongarch(uint32_t enable_bit)

DavidSpickett wrote:

Does this need to be a parameter to `NativeRegisterContextDBReg_loongarch` 
given that it's always the same value?

You could just do:
```
: NativeRegisterContextDBReg(0xwhatever)
```


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


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-10 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett commented:

Some small comments but otherwise fine. As usual, approval should come from the 
architecture expert, which I assume is @SixWeining.

Please do not land this right after 
https://github.com/llvm/llvm-project/pull/118043, wait at least a day to see if 
anything breaks in LLDB. Then you can land this.

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


[llvm-branch-commits] [lldb][Process] Introduce LoongArch64 hw break/watchpoint support (PR #118770)

2024-12-12 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

Linux Arm and AArch64, Windows on Arm and x86 bots are fine with the 
refactoring PR before this. If you haven't had any complaints from the Apple 
bots (it's native code, so I'd hope not), then this can land.

Thanks for putting in the work on the refactoring!

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


[llvm-branch-commits] [lldb] release/20.x: [lldb] Use correct path for lldb-server executable (#131519) (PR #134072)

2025-04-05 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

My justification to backport: this was fixing a regression introduced by lldb 
20, and https://github.com/llvm/llvm-project/issues/132024 is a separate report 
of what I think is the same issue.

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


[llvm-branch-commits] [CI] Add rich build information for github workflows (PR #133197)

2025-03-27 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

TIL that 
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-job-summary
 exists, very cool.

The title of the PR implies that you are adding more than test results, but the 
PR description says you are deliberately not adding anything more than test 
results right now. I would clarify the title.

I agree with the strategy, have 2 distinct entry points for a time, stick to 
test results only. Once Buildkite is removed you can start using all sorts of 
GitHub data to link log files and whatever we want to do. Without worrying 
about Buildkite.

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


[llvm-branch-commits] [CI] Add rich build information for github workflows (PR #133197)

2025-03-27 Thread David Spickett via llvm-branch-commits


@@ -0,0 +1,23 @@
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+"""Script to generate a build report for Github."""
+
+import argparse
+
+import generate_test_report_lib
+
+if __name__ == "__main___":
+parser = argparse.ArgumentParser()
+parser.add_argument(
+"title", help="Title of the test report, without Markdown formatting."
+)
+parser.add_argument("return_code", help="The build's return code.", 
type=int)
+parser.add_argument("junit_files", help="Paths to JUnit report files.", 
nargs="*")
+args = parser.parse_args()
+
+report, style = generate_test_report_lib.generate_report_from_files(

DavidSpickett wrote:

Minor thing: use `_` for `style`, to be clear it is deliberately not used here.

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


[llvm-branch-commits] [CI] Add rich build information for github workflows (PR #133197)

2025-03-27 Thread David Spickett via llvm-branch-commits

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

LGTM.

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


[llvm-branch-commits] [CI] Add rich build information for github workflows (PR #133197)

2025-03-27 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/133197
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] Revert "[clang] [ARM] Explicitly enable NEON for Windows/Darwin targets (#122095)" (PR #134407)

2025-04-07 Thread David Spickett via llvm-branch-commits

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


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


[llvm-branch-commits] [lldb] [lldb] Fix SBTarget::ReadInstruction with flavor (PR #136034)

2025-04-22 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

One of the release managers will do that for us at some point.

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


[llvm-branch-commits] [libcxx] release/20.x: [libc++][test] extend XFAIL clauses to cover Amazon Linux too (#129377) (PR #129566)

2025-03-08 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

That's expected, PRs to release branches can only be merged by a release 
manager. They'll do that if they judge it to be valid and the timing is right.

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


[llvm-branch-commits] [lldb] release/20.x: [lldb] Respect LaunchInfo::SetExecutable in ProcessLauncherPosixFork (#133093) (PR #134079)

2025-04-02 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

My justification for this: this is 1 part (2nd part is 
https://github.com/llvm/llvm-project/pull/134072) of fixing 
https://github.com/llvm/llvm-project/issues/132024. Which was a bug introduced 
in lldb 20.

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


[llvm-branch-commits] [lldb] release/20.x: [lldb] Use correct path for lldb-server executable (#131519) (PR #134072)

2025-04-02 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

> I think it's fine, but I believe you'll also need 
> https://github.com/llvm/llvm-project/pull/133093 for this to make a 
> difference.

Thanks for pointing that out, I've reproduced the issue and confirmed that we 
need both changes.

https://github.com/llvm/llvm-project/pull/134079 for the second change.

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


[llvm-branch-commits] [CI] Use Github Native Groups in monolithic-* scripts (PR #143481)

2025-06-10 Thread David Spickett via llvm-branch-commits

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

LGTM

Looking forward to the other things we can do once there is only GitHub to 
think about.

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


[llvm-branch-commits] [llvm] [CI] Cleanup buildkite test report script (PR #143480)

2025-06-10 Thread David Spickett via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [CI] Explicitly compute needed runtime targets (PR #142695)

2025-06-04 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett commented:

Agree that `_compute_runtimes_to_test` is a confusing name but if it's going to 
change anyway, this LGTM.

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


[llvm-branch-commits] [CI] Explicitly compute needed runtime targets (PR #142695)

2025-06-04 Thread David Spickett via llvm-branch-commits

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


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


[llvm-branch-commits] [CI] Use LLVM_ENABLE_RUNTIMES for runtimes builds on Linux (PR #142694)

2025-06-04 Thread David Spickett via llvm-branch-commits

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

CMake once with the runtimes enabled. Modify the test parameters each time.

Looks good to me.

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


[llvm-branch-commits] [clang] release/20.x: [clang][Interpreter] Disable part of lambda test on Windows (PR #143851)

2025-06-12 Thread David Spickett via llvm-branch-commits


@@ -1,7 +1,10 @@
 // REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix
 // RUN: cat %s | clang-repl | FileCheck %s
-// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
+// At -O2, somehow "x = 42" appears first when piped into FileCheck,
+// see https://github.com/llvm/llvm-project/issues/143547.
+// RUN: %if !system-windows %{ cat %s | clang-repl -Xcc -Xclang -Xcc -verify 
-Xcc -O2 | FileCheck %s %}

DavidSpickett wrote:

Sure, had to make my own branch to do that: 
https://github.com/llvm/llvm-project/pull/143893

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


[llvm-branch-commits] [clang] release/20.x: [clang][Interpreter] Disable part of lambda test on Windows (PR #143851)

2025-06-12 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

Closing this in favour of https://github.com/llvm/llvm-project/pull/143893, 
where I am able to address the reviewer feedback.

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


[llvm-branch-commits] [clang] release/20.x: [clang][Interpreter] Disable part of lambda test on Windows (PR #143851)

2025-06-12 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett closed 
https://github.com/llvm/llvm-project/pull/143851
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clan-reply] Backport PTU error recovery to 20.x (PR #143893)

2025-06-12 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/143893
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clan-reply] Backport PTU error recovery to 20.x (PR #143893)

2025-06-12 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/143893

This cherry-picks 3b4c51bb3243a02526313c51207a674139b67a00 and 
beffd1509af7b12eeab0d5ae85b2f8322e039287 to 20.x.

Which are:
[clang-repl] Fix error recovery while PTU cleanup (#127467) 
[clang][Interpreter] Disable part of lambda test on Windows

The latter commit avoids a test failure seen in Windows builds. On main, I 
turned off one of the RUN lines for Windows, but reviewers on the cherry-pick 
preferred UNSUPPORTED to disable the whole test.

So I have used UNSUPPORTED in this version for 20.x.

>From c8f6fda8e223e39fafb5670c466bfc95f753d714 Mon Sep 17 00:00:00 2001
From: Anutosh Bhat 
Date: Mon, 2 Jun 2025 20:14:28 +0530
Subject: [PATCH] [clan-reply] Backport PTU error recovery to 20.x

This cherry-picks 3b4c51bb3243a02526313c51207a674139b67a00 and
beffd1509af7b12eeab0d5ae85b2f8322e039287 to 20.x.

Which are:
[clang-repl] Fix error recovery while PTU cleanup (#127467)
[clang][Interpreter] Disable part of lambda test on Windows

The latter commit avoids a test failure seen in Windows builds.
On main, I turned off one of the RUN lines for Windows, but reviewers
on the cherry-pick preferred UNSUPPORTED to disable the whole test.

So I have used UNSUPPORTED in this version for 20.x.
---
 clang/lib/Interpreter/IncrementalParser.cpp |  2 +-
 clang/test/Interpreter/lambda.cpp   | 18 --
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Interpreter/IncrementalParser.cpp 
b/clang/lib/Interpreter/IncrementalParser.cpp
index e43cea1baf43a..1d223e230669c 100644
--- a/clang/lib/Interpreter/IncrementalParser.cpp
+++ b/clang/lib/Interpreter/IncrementalParser.cpp
@@ -175,7 +175,7 @@ void IncrementalParser::CleanUpPTU(TranslationUnitDecl 
*MostRecentTU) {
   // FIXME: We should de-allocate MostRecentTU
   for (Decl *D : MostRecentTU->decls()) {
 auto *ND = dyn_cast(D);
-if (!ND)
+if (!ND || ND->getDeclName().isEmpty())
   continue;
 // Check if we need to clean up the IdResolver chain.
 if (ND->getDeclName().getFETokenInfo() && !D->getLangOpts().ObjC &&
diff --git a/clang/test/Interpreter/lambda.cpp 
b/clang/test/Interpreter/lambda.cpp
index df75274a050b2..fee6c73bf95cb 100644
--- a/clang/test/Interpreter/lambda.cpp
+++ b/clang/test/Interpreter/lambda.cpp
@@ -1,7 +1,11 @@
 // REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix
+// At -O2, somehow "x = 42" appears first when piped into FileCheck,
+// see https://github.com/llvm/llvm-project/issues/143547.
+// UNSUPPORTED: system-windows
 // RUN: cat %s | clang-repl | FileCheck %s
-// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
+// RUN: cat %s | clang-repl -Xcc -Xclang -Xcc -verify -Xcc -O2 | FileCheck %s
+
 extern "C" int printf(const char *, ...);
 
 auto l1 = []() { printf("ONE\n"); return 42; };
@@ -14,4 +18,14 @@ auto r2 = l2();
 auto r3 = l2();
 // CHECK: TWO
 
-%quit
+// Verify non-local lambda capture error is correctly reported
+int x = 42;
+
+// expected-error {{non-local lambda expression cannot have a capture-default}}
+auto capture = [&]() { return x * 2; };
+
+// Ensure interpreter continues and x is still valid
+printf("x = %d\n", x);
+// CHECK: x = 42
+
+%quit
\ No newline at end of file

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


[llvm-branch-commits] [clang] [clan-reply] Backport PTU error recovery to 20.x (PR #143893)

2025-06-12 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett milestoned 
https://github.com/llvm/llvm-project/pull/143893
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/20.x: [clang][Interpreter] Disable part of lambda test on Windows (PR #143851)

2025-06-12 Thread David Spickett via llvm-branch-commits


@@ -1,7 +1,10 @@
 // REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix
 // RUN: cat %s | clang-repl | FileCheck %s
-// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
+// At -O2, somehow "x = 42" appears first when piped into FileCheck,
+// see https://github.com/llvm/llvm-project/issues/143547.
+// RUN: %if !system-windows %{ cat %s | clang-repl -Xcc -Xclang -Xcc -verify 
-Xcc -O2 | FileCheck %s %}

DavidSpickett wrote:

Good question:
* It did not fail in pre-commit Windows CI. Which implies there are some 
Windows systems where it would not fail and would become a UPASS if we XFAIL'd 
it, but we could UNSUPPORTED instead.
* The first RUN line does work consistently on all Windows machines we know of. 
XFAIL would disable the entire test. Which isn't a big loss given that we know 
the feature does work on Windows, but I tried to retain as much coverage as we 
could.

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


[llvm-branch-commits] [clang] release/20.x: [clang-repl] Fix error recovery while PTU cleanup (#127467) (PR #142445)

2025-06-12 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

https://github.com/llvm/llvm-project/pull/143851 has both.

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


[llvm-branch-commits] [CI] Remove Style from generate_test_report_lib (PR #147791)

2025-07-10 Thread David Spickett via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [llvm] [lldb] Add a release note for MCP support (PR #149143)

2025-07-17 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

Not sure that this has to have the 21 milestone but I added it anyway to be 
safe.

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


[llvm-branch-commits] [llvm] [lldb] Add a release note for MCP support (PR #149143)

2025-07-17 Thread David Spickett via llvm-branch-commits


@@ -315,6 +315,8 @@ Changes to LLDB
   nothing at all
 * Changed the format of opcode bytes to match llvm-objdump when disassembling
   RISC-V code with `disassemble`'s `--byte` option.
+* LLDB added native support for the Model Context Protocol  (MCP). An MCP

DavidSpickett wrote:

There's an extra space in "Protocol  (MCP)"

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


[llvm-branch-commits] [llvm] [lldb] Add a release note for MCP support (PR #149143)

2025-07-17 Thread David Spickett via llvm-branch-commits

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

LGTM

Context for the release managers is that the MCP support is already in the 21 
branch, and there is a backport request for the documentation also opened.

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


[llvm-branch-commits] [lldb] release/21.x: [lldb] Document MCP tools & resources (#148708) (PR #149146)

2025-07-17 Thread David Spickett via llvm-branch-commits

DavidSpickett wrote:

> Sounds good to me

``

> let's hear from @DavidSpickett who suggested the backport.

It's true the vast majority of people will go to the website no matter what, 
but I consider documentation part of a feature and this completes the MCP 
feature for 21 so I'd like it to be included.

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


[llvm-branch-commits] [llvm] [lldb] Add a release note for MCP support (PR #149143)

2025-07-17 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/149143
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [lldb] Add a release note for MCP support (PR #149143)

2025-07-17 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett milestoned 
https://github.com/llvm/llvm-project/pull/149143
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [lldb] Add a release note for MCP support (PR #149143)

2025-07-17 Thread David Spickett via llvm-branch-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/149143
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits