[Lldb-commits] [lldb] [lldb] add RISCV target specific info in API tests (PR #99039)

2024-07-18 Thread David Spickett via lldb-commits

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


https://github.com/llvm/llvm-project/pull/99039
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] cbd2559 - [lldb] add RISCV target specific info in API tests (#99039)

2024-07-18 Thread via lldb-commits

Author: dlav-sc
Date: 2024-07-18T09:09:52+01:00
New Revision: cbd255942b52c3576aa0dca444811512fff43714

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

LOG: [lldb] add RISCV target specific info in API tests (#99039)

Add information about RISCV first register in python API testsuite, that
is used to check register readability in tests.

Fixed tests on RISCV target:

TestBreakpointByFileColonLine.BreakpointByLineAndColumnTestCase
TestAddressBreakpoints.AddressBreakpointTestCase
TestBreakpointAutoContinue.BreakpointAutoContinue
TestInterruptBacktrace.TestInterruptingBacktrace
TestBadAddressBreakpoints.BadAddressBreakpointTestCase
TestScriptedResolver.TestScriptedResolver
TestStopHookScripted.TestStopHooks
TestBreakpointConditions.BreakpointConditionsTestCase
TestLocalVariables.LocalVariablesTestCase
TestFindLineEntry.FindLineEntry
TestScriptedResolver.TestScriptedResolver
TestInlineSourceFiles.InlineSourceFilesTestCase
TestModuleAndSection.ModuleAndSectionAPIsTestCase
TestFrameVar.TestFrameVar
TestInferiorAssert.AssertingInferiorTestCase
TestInferiorCrashing.CrashingInferiorTestCase
TestInferiorCrashingStep.CrashingInferiorStepTestCase
TestRegistersIterator.RegistersIteratorTestCase
TestCoroutineHandle.TestCoroutineHandle
TestWithLimitDebugInfo.TestWithLimitDebugInfo
TestLLDBIterator.LLDBIteratorTestCase
TestMemoryWrite.MemoryWriteTestCase
TestNestedTemplate.NestedTemplateTestCase
TestParrayVrsCharArrayChild.TestParrayVrsCharArrayChild
TestRecursiveInferior.CrashingRecursiveInferiorTestCase
TestRecursiveInferiorStep.CrashingRecursiveInferiorStepTestCase
TestRunLocker.TestRunLocker
TestSampleTest.RenameThisSampleTestTestCase
TestUniqueTypes3.UniqueTypesTestCase3
TestPrintStackTraces.ThreadsStackTracesTestCase
TestUnicodeSymbols.TestUnicodeSymbols
TestUnusedInlinedParameters.TestUnusedInlinedParameters
TestValueVarUpdate.ValueVarUpdateTestCase
TestPtrRef2Typedef.PtrRef2TypedefTestCase
TestDataFormatterStdIterator.StdIteratorDataFormatterTestCase
TestDataFormatterStdString.StdStringDataFormatterTestCase
TestDataFormatterStdVBool.StdVBoolDataFormatterTestCase

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index 818fdf0e6b5c5..b7e6f240f59f6 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -34,6 +34,8 @@ def check_first_register_readable(test_case):
 test_case.expect("register read r0", substrs=["r0 = 0x"])
 elif arch in ["powerpc64le"]:
 test_case.expect("register read r0", substrs=["r0 = 0x"])
+elif re.match("^rv(32|64)", arch):
+test_case.expect("register read zero", substrs=["zero = 0x"])
 else:
 # TODO: Add check for other architectures
 test_case.fail(



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add RISCV target specific info in API tests (PR #99039)

2024-07-18 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett closed 
https://github.com/llvm/llvm-project/pull/99039
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add RISCV target specific info in API tests (PR #99039)

2024-07-18 Thread via lldb-commits

github-actions[bot] wrote:



@dlav-sc Congratulations on having your first Pull Request (PR) merged into the 
LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested
by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with 
a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself.
This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


https://github.com/llvm/llvm-project/pull/99039
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][tests] Add ability to run API tests with qemu-user simulator (PR #89765)

2024-07-18 Thread via lldb-commits

ita-sc wrote:

Sorry for huge delay, could you please merge this? (I do not have write access 
yet)

https://github.com/llvm/llvm-project/pull/89765
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fixed the error `unable to launch a GDB server` in API tests (PR #98833)

2024-07-18 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I tested this with the port mapping I usually use for simulator development and 
it works fine.

Thanks for the fix.

https://github.com/llvm/llvm-project/pull/98833
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] d097f43 - [lldb] Fixed the error `unable to launch a GDB server` in API tests (#98833)

2024-07-18 Thread via lldb-commits

Author: Dmitry Vasilyev
Date: 2024-07-18T10:04:49+01:00
New Revision: d097f430a172a5d798a39b416b1af84f4ec572e1

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

LOG: [lldb] Fixed the error `unable to launch a GDB server` in API tests 
(#98833)

TestPlatformLaunchGDBServer.py runs `ldb-server` w/o parameters
`--min-gdbserver-port`, `--max-gdbserver-port` or `--gdbserver-port`. So
`gdbserver_portmap` is empty and
`gdbserver_portmap.GetNextAvailablePort()` will return 0. Do not call
`portmap_for_child.AllowPort(0)` in this case. Otherwise
`portmap_for_child.GetNextAvailablePort()` will allocate and never free
the port 0 and next call `portmap_for_child.GetNextAvailablePort()` will
fail.

Added few asserts in `GDBRemoteCommunicationServerPlatform::PortMap` to
avoid such issue in the future.

This patch fixes a bug added in #88845. The behaviour is very close to
#97537 w/o parameters `--min-gdbserver-port`, `--max-gdbserver-port` and
`--gdbserver-port`.

Added: 


Modified: 

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
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 5285ec1d3db4e..65f1cc12ba307 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -46,11 +46,13 @@ using namespace lldb_private;
 
 GDBRemoteCommunicationServerPlatform::PortMap::PortMap(uint16_t min_port,
uint16_t max_port) {
+  assert(min_port);
   for (; min_port < max_port; ++min_port)
 m_port_map[min_port] = LLDB_INVALID_PROCESS_ID;
 }
 
 void GDBRemoteCommunicationServerPlatform::PortMap::AllowPort(uint16_t port) {
+  assert(port);
   // Do not modify existing mappings
   m_port_map.insert({port, LLDB_INVALID_PROCESS_ID});
 }

diff  --git a/lldb/tools/lldb-server/lldb-platform.cpp 
b/lldb/tools/lldb-server/lldb-platform.cpp
index cfd0a3797d810..7148a1d2a3094 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -313,9 +313,11 @@ int main_platform(int argc, char *argv[]) {
   GDBRemoteCommunicationServerPlatform::PortMap portmap_for_child;
   llvm::Expected available_port =
   gdbserver_portmap.GetNextAvailablePort();
-  if (available_port)
-portmap_for_child.AllowPort(*available_port);
-  else {
+  if (available_port) {
+// GetNextAvailablePort() may return 0 if gdbserver_portmap is empty.
+if (*available_port)
+  portmap_for_child.AllowPort(*available_port);
+  } else {
 llvm::consumeError(available_port.takeError());
 fprintf(stderr,
 "no available gdbserver port for connection - dropping...\n");
@@ -352,7 +354,7 @@ int main_platform(int argc, char *argv[]) {
 if (platform.IsConnected()) {
   if (inferior_arguments.GetArgumentCount() > 0) {
 lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
-std::optional port = 0;
+std::optional port;
 std::string socket_name;
 Status error = platform.LaunchGDBServer(inferior_arguments,
 "", // hostname



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fixed the error `unable to launch a GDB server` in API tests (PR #98833)

2024-07-18 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett closed 
https://github.com/llvm/llvm-project/pull/98833
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Michael Buch via lldb-commits

https://github.com/Michael137 edited 
https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Michael Buch via lldb-commits


@@ -153,19 +127,89 @@ void TypeQuery::SetLanguages(LanguageSet languages) {
 
 bool TypeQuery::ContextMatches(
 llvm::ArrayRef context_chain) const {
-  if (GetExactMatch() || context_chain.size() == m_context.size())
-return ::contextMatches(context_chain, m_context);
-
-  // We don't have an exact match, we need to bottom m_context.size() items to
-  // match for a successful lookup.
-  if (context_chain.size() < m_context.size())
-return false; // Not enough items in context_chain to allow for a match.
-
-  size_t compare_count = context_chain.size() - m_context.size();
-  return ::contextMatches(
-  llvm::ArrayRef(context_chain.data() + compare_count,
-  m_context.size()),
-  m_context);
+  auto ctx = context_chain.rbegin(), ctx_end = context_chain.rend();
+  for (auto pat = m_context.rbegin(), pat_end = m_context.rend();
+   pat != pat_end;) {
+
+// Handle AnyModule matches. These are tricky as they can match any number

Michael137 wrote:

Do we know why `AnyModule` allows for this wildcard behaviour? I don't see it 
used anywhere, only exact `Module` matches

https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Michael Buch via lldb-commits

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

LGTM (left some minor questions)

I've also recently bumped into the issue of `FindTypes`/`FindNamespace`/etc. 
failing to find matches due to presence of `(anonymous namespace)` entries in 
the context, so thanks for fixing that

https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Michael Buch via lldb-commits


@@ -153,19 +127,89 @@ void TypeQuery::SetLanguages(LanguageSet languages) {
 
 bool TypeQuery::ContextMatches(
 llvm::ArrayRef context_chain) const {
-  if (GetExactMatch() || context_chain.size() == m_context.size())
-return ::contextMatches(context_chain, m_context);
-
-  // We don't have an exact match, we need to bottom m_context.size() items to
-  // match for a successful lookup.
-  if (context_chain.size() < m_context.size())
-return false; // Not enough items in context_chain to allow for a match.
-
-  size_t compare_count = context_chain.size() - m_context.size();
-  return ::contextMatches(
-  llvm::ArrayRef(context_chain.data() + compare_count,
-  m_context.size()),
-  m_context);
+  auto ctx = context_chain.rbegin(), ctx_end = context_chain.rend();
+  for (auto pat = m_context.rbegin(), pat_end = m_context.rend();
+   pat != pat_end;) {
+
+// Handle AnyModule matches. These are tricky as they can match any number
+// of modules.
+if (pat->kind == CompilerContextKind::AnyModule) {
+  // Successive wildcards are equivalent to a single wildcard.
+  while (pat->kind == CompilerContextKind::AnyModule)
+++pat;
+
+  // [ctx, ctx_module_end) is the range of entries that may be matched by
+  // our wildcard.
+  auto ctx_module_end =
+  std::find_if(ctx, ctx_end, [](const CompilerContext &c) {
+return c.kind != CompilerContextKind::Module;
+  });
+
+  // [pat, exact_pat_end) is the range of exact module match patterns. If
+  // it's not empty, we need to make sure our wildcard does not consume
+  // entries matched by those.
+  auto exact_pat_end =
+  std::find_if(pat, pat_end, [](const CompilerContext &p) {
+return (p.kind & CompilerContextKind::AnyModule) !=
+   CompilerContextKind::Module;

Michael137 wrote:

Couldn't this just be:
```suggestion
  std::find_if(pat, pat_end, [](const CompilerContext &p) {
return p.kind != CompilerContextKind::Module;
```
Since we've already skipped all the `AnyModule` patterns before we get here?

https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Michael Buch via lldb-commits

https://github.com/Michael137 commented:

Should we disallow certain `CompilerContextKind` combinations from being used 
in a query? E.g., `AnyModule | Type`, etc. shouldn't be something we need to 
worry about supporting?

https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)

2024-07-18 Thread Michael Buch via lldb-commits

Michael137 wrote:

Thanks for the patches (if we end up going down this route you'll probably want 
to split out the LLVM JIT changes into a separate PR).

Not very familiar with RISCV. Could you elaborate on the exact failures you 
were seeing and why we need the extra IR pass?

https://github.com/llvm/llvm-project/pull/99336
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)

2024-07-18 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> Thanks for the patches (if we end up going down this route you'll probably 
> want to split out the LLVM JIT changes into a separate PR).

I know little about the JIT side but this is my first reaction too. I wonder if 
that has its own tests that need adding, and it'll get more expert eyes on it.

> without RISCV large code model, which has not been implemented yet

I presume the work to do this is much greater than the work shown here?

https://github.com/llvm/llvm-project/pull/99336
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Support new libc++ __compressed_pair layout (PR #96538)

2024-07-18 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/96538

>From 231e0ddc5834ac7fe8e4860c79504f6ce8666db5 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Mon, 29 Jan 2024 16:23:16 +
Subject: [PATCH 1/3] [lldb] Support new libc++ __compressed_pair layout

---
 lldb/examples/synthetic/libcxx.py |  26 ++-
 .../Plugins/Language/CPlusPlus/LibCxx.cpp |  85 ++---
 .../Plugins/Language/CPlusPlus/LibCxx.h   |   3 +-
 .../Plugins/Language/CPlusPlus/LibCxxList.cpp |  72 +---
 .../Plugins/Language/CPlusPlus/LibCxxMap.cpp  |  41 +++--
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp | 166 +++---
 .../Language/CPlusPlus/LibCxxVector.cpp   |  38 ++--
 .../list/TestDataFormatterGenericList.py  |   2 +-
 .../libcxx/string/simulator/main.cpp  |   1 +
 9 files changed, 283 insertions(+), 151 deletions(-)

diff --git a/lldb/examples/synthetic/libcxx.py 
b/lldb/examples/synthetic/libcxx.py
index 474aaa428fa23..060ff90100849 100644
--- a/lldb/examples/synthetic/libcxx.py
+++ b/lldb/examples/synthetic/libcxx.py
@@ -721,6 +721,12 @@ def _get_value_of_compressed_pair(self, pair):
 def update(self):
 logger = lldb.formatters.Logger.Logger()
 try:
+has_compressed_pair_layout = True
+alloc_valobj = self.valobj.GetChildMemberWithName("__alloc_")
+size_valobj = self.valobj.GetChildMemberWithName("__size_")
+if alloc_valobj.IsValid() and size_valobj.IsValid():
+has_compressed_pair_layout = False
+
 # A deque is effectively a two-dim array, with fixed width.
 # 'map' contains pointers to the rows of this array. The
 # full memory area allocated by the deque is delimited
@@ -734,9 +740,13 @@ def update(self):
 # variable tells which element in this NxM array is the 0th
 # one, and the 'size' element gives the number of elements
 # in the deque.
-count = self._get_value_of_compressed_pair(
-self.valobj.GetChildMemberWithName("__size_")
-)
+if has_compressed_pair_layout:
+count = self._get_value_of_compressed_pair(
+self.valobj.GetChildMemberWithName("__size_")
+)
+else:
+count = size_valobj.GetValueAsUnsigned(0)
+
 # give up now if we cant access memory reliably
 if self.block_size < 0:
 logger.write("block_size < 0")
@@ -748,9 +758,13 @@ def update(self):
 self.map_begin = map_.GetChildMemberWithName("__begin_")
 map_begin = self.map_begin.GetValueAsUnsigned(0)
 map_end = 
map_.GetChildMemberWithName("__end_").GetValueAsUnsigned(0)
-map_endcap = self._get_value_of_compressed_pair(
-map_.GetChildMemberWithName("__end_cap_")
-)
+
+if has_compressed_pair_layout:
+map_endcap = self._get_value_of_compressed_pair(
+map_.GetChildMemberWithName("__end_cap_")
+)
+else:
+map_endcap = 
map_.GetChildMemberWithName("__end_cap_").GetValueAsUnsigned(0)
 
 # check consistency
 if not map_first <= map_begin <= map_end <= map_endcap:
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index feaa51a96843a..7d3b2410a7296 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -27,6 +27,7 @@
 #include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
 #include 
 #include 
 
@@ -34,6 +35,32 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+static void consumeInlineNamespace(llvm::StringRef &name) {
+  // Delete past an inline namespace, if any: __[a-zA-Z0-9_]+::
+  auto scratch = name;
+  if (scratch.consume_front("__") && std::isalnum(scratch[0])) {
+scratch = scratch.drop_while([](char c) { return std::isalnum(c); });
+if (scratch.consume_front("::")) {
+  // Successfully consumed a namespace.
+  name = scratch;
+}
+  }
+}
+
+bool lldb_private::formatters::isOldCompressedPairLayout(
+ValueObject &pair_obj) {
+  return isStdTemplate(pair_obj.GetTypeName(), "__compressed_pair");
+}
+
+bool lldb_private::formatters::isStdTemplate(ConstString type_name,
+ llvm::StringRef type) {
+  llvm::StringRef name = type_name.GetStringRef();
+  // The type name may be prefixed with `std::__::`.
+  if (name.consume_front("std::"))
+consumeInlineNamespace(name);
+  return name.consume_front(type) && name.starts_with("<");
+}
+
 lldb::ValueObjectSP lldb_private::formatters::GetChildMemberWithName(
  

[Lldb-commits] [lldb] [lldb] Support new libc++ __compressed_pair layout (PR #96538)

2024-07-18 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/96538

>From 0358143d3bf98d66c1e7112b9e07109eb7b852a1 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Mon, 29 Jan 2024 16:23:16 +
Subject: [PATCH 1/3] [lldb] Support new libc++ __compressed_pair layout

---
 lldb/examples/synthetic/libcxx.py |  26 ++-
 .../Plugins/Language/CPlusPlus/LibCxx.cpp |  85 ++---
 .../Plugins/Language/CPlusPlus/LibCxx.h   |   3 +-
 .../Plugins/Language/CPlusPlus/LibCxxList.cpp |  72 +---
 .../Plugins/Language/CPlusPlus/LibCxxMap.cpp  |  41 +++--
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp | 166 +++---
 .../Language/CPlusPlus/LibCxxVector.cpp   |  38 ++--
 .../list/TestDataFormatterGenericList.py  |   2 +-
 8 files changed, 282 insertions(+), 151 deletions(-)

diff --git a/lldb/examples/synthetic/libcxx.py 
b/lldb/examples/synthetic/libcxx.py
index 474aaa428fa23..060ff90100849 100644
--- a/lldb/examples/synthetic/libcxx.py
+++ b/lldb/examples/synthetic/libcxx.py
@@ -721,6 +721,12 @@ def _get_value_of_compressed_pair(self, pair):
 def update(self):
 logger = lldb.formatters.Logger.Logger()
 try:
+has_compressed_pair_layout = True
+alloc_valobj = self.valobj.GetChildMemberWithName("__alloc_")
+size_valobj = self.valobj.GetChildMemberWithName("__size_")
+if alloc_valobj.IsValid() and size_valobj.IsValid():
+has_compressed_pair_layout = False
+
 # A deque is effectively a two-dim array, with fixed width.
 # 'map' contains pointers to the rows of this array. The
 # full memory area allocated by the deque is delimited
@@ -734,9 +740,13 @@ def update(self):
 # variable tells which element in this NxM array is the 0th
 # one, and the 'size' element gives the number of elements
 # in the deque.
-count = self._get_value_of_compressed_pair(
-self.valobj.GetChildMemberWithName("__size_")
-)
+if has_compressed_pair_layout:
+count = self._get_value_of_compressed_pair(
+self.valobj.GetChildMemberWithName("__size_")
+)
+else:
+count = size_valobj.GetValueAsUnsigned(0)
+
 # give up now if we cant access memory reliably
 if self.block_size < 0:
 logger.write("block_size < 0")
@@ -748,9 +758,13 @@ def update(self):
 self.map_begin = map_.GetChildMemberWithName("__begin_")
 map_begin = self.map_begin.GetValueAsUnsigned(0)
 map_end = 
map_.GetChildMemberWithName("__end_").GetValueAsUnsigned(0)
-map_endcap = self._get_value_of_compressed_pair(
-map_.GetChildMemberWithName("__end_cap_")
-)
+
+if has_compressed_pair_layout:
+map_endcap = self._get_value_of_compressed_pair(
+map_.GetChildMemberWithName("__end_cap_")
+)
+else:
+map_endcap = 
map_.GetChildMemberWithName("__end_cap_").GetValueAsUnsigned(0)
 
 # check consistency
 if not map_first <= map_begin <= map_end <= map_endcap:
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index feaa51a96843a..7d3b2410a7296 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -27,6 +27,7 @@
 #include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
 #include 
 #include 
 
@@ -34,6 +35,32 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+static void consumeInlineNamespace(llvm::StringRef &name) {
+  // Delete past an inline namespace, if any: __[a-zA-Z0-9_]+::
+  auto scratch = name;
+  if (scratch.consume_front("__") && std::isalnum(scratch[0])) {
+scratch = scratch.drop_while([](char c) { return std::isalnum(c); });
+if (scratch.consume_front("::")) {
+  // Successfully consumed a namespace.
+  name = scratch;
+}
+  }
+}
+
+bool lldb_private::formatters::isOldCompressedPairLayout(
+ValueObject &pair_obj) {
+  return isStdTemplate(pair_obj.GetTypeName(), "__compressed_pair");
+}
+
+bool lldb_private::formatters::isStdTemplate(ConstString type_name,
+ llvm::StringRef type) {
+  llvm::StringRef name = type_name.GetStringRef();
+  // The type name may be prefixed with `std::__::`.
+  if (name.consume_front("std::"))
+consumeInlineNamespace(name);
+  return name.consume_front(type) && name.starts_with("<");
+}
+
 lldb::ValueObjectSP lldb_private::formatters::GetChildMemberWithName(
 ValueObject &obj, llvm::ArrayRef alternative_names) 

[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Pavel Labath via lldb-commits


@@ -153,19 +127,89 @@ void TypeQuery::SetLanguages(LanguageSet languages) {
 
 bool TypeQuery::ContextMatches(
 llvm::ArrayRef context_chain) const {
-  if (GetExactMatch() || context_chain.size() == m_context.size())
-return ::contextMatches(context_chain, m_context);
-
-  // We don't have an exact match, we need to bottom m_context.size() items to
-  // match for a successful lookup.
-  if (context_chain.size() < m_context.size())
-return false; // Not enough items in context_chain to allow for a match.
-
-  size_t compare_count = context_chain.size() - m_context.size();
-  return ::contextMatches(
-  llvm::ArrayRef(context_chain.data() + compare_count,
-  m_context.size()),
-  m_context);
+  auto ctx = context_chain.rbegin(), ctx_end = context_chain.rend();
+  for (auto pat = m_context.rbegin(), pat_end = m_context.rend();
+   pat != pat_end;) {
+
+// Handle AnyModule matches. These are tricky as they can match any number

labath wrote:

That's a very good question actually. I'm pretty sure we're not using it. I 
assumed it was being used for some Apple thing with -gmodules or whatever, but 
now mention that, it doesn't appear to be actually used except for some 
specialized tests.

So, as much as I loved implementing a glob algorithm, I would love even more to 
delete it.

https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Pavel Labath via lldb-commits

labath wrote:

> LGTM (left some minor questions)
> 
> I've also recently bumped into the issue of `FindTypes`/`FindNamespace`/etc. 
> failing to find matches due to presence of `(anonymous namespace)` entries in 
> the context, so thanks for fixing that

We're not there yet. :)

https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

2024-07-18 Thread Michael Buch via lldb-commits


@@ -153,19 +127,89 @@ void TypeQuery::SetLanguages(LanguageSet languages) {
 
 bool TypeQuery::ContextMatches(
 llvm::ArrayRef context_chain) const {
-  if (GetExactMatch() || context_chain.size() == m_context.size())
-return ::contextMatches(context_chain, m_context);
-
-  // We don't have an exact match, we need to bottom m_context.size() items to
-  // match for a successful lookup.
-  if (context_chain.size() < m_context.size())
-return false; // Not enough items in context_chain to allow for a match.
-
-  size_t compare_count = context_chain.size() - m_context.size();
-  return ::contextMatches(
-  llvm::ArrayRef(context_chain.data() + compare_count,
-  m_context.size()),
-  m_context);
+  auto ctx = context_chain.rbegin(), ctx_end = context_chain.rend();
+  for (auto pat = m_context.rbegin(), pat_end = m_context.rend();
+   pat != pat_end;) {
+
+// Handle AnyModule matches. These are tricky as they can match any number

Michael137 wrote:

Actually just grepped for this in the `apple/llvm-project` fork and looks like 
we're using it in the Swift plugin: 
https://github.com/swiftlang/llvm-project/blob/ee8bc8b8d30eb99807adbcd3c1f044e00af66cdd/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp#L219-L225

@adrian-prantl @augusto2112 @kastiglione could you elaborate on the usage of 
this lookup-type here and why it's needed? An unfortunate side-effect of only 
having it be exercised in the Swift plugin is that we need to support this 
non-trivial matching algorithm while having the tests in a different repo.

That being said, I don't want to block this PR on this question, since the 
change itself LGTM

https://github.com/llvm/llvm-project/pull/99305
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

dzhidzhoev wrote:

> What exactly does it help with? Given that you're canonicalizing to a forward 
> slash, does that mean that some of the tools you use don't accept backslashes 
> (perhaps because they come from cygwin or the like)?

As far as I understand, MinGW make, on which Chocolatey build is based, prefers 
\ or / slashes.
Also, some include/library paths passed to clang seem to be ignored/incorrectly 
processed, when they have mixed path separators like C:\\..\..\foo/bar  

I get errors like 

```
make.exe 'VPATH=C:\lldb\test\API\commands\expression\call-function' -C 
'C:\build-lldb\lldb-test-build.noindex\commands\expression\call-function\TestCallBuiltinFunction.test'
 -I 'C:\lldb\test\API\commands\expression\call-function' -I 
'C:\lldb\packages\Python\lldbsuite\test\make' -f 
'C:\lldb\test\API\commands\expression\call-function\Makefile' all ARCH=aarch64 
'CC="C:\build-lldb\bin\clang.exe"' SDKROOT=c:/buildslave/fs/jetson-agx-ubuntu 
'CLANG_MODULE_CACHE_DIR=C://build-lldb/lldb-test-build.noindex/module-cache-clang\lldb-api'
 LLDB_OBJ_ROOT=C://build-lldb/tools/lldb OS=Linux HOST_OS=Windows_NT



Build Command Output:

make-wfix: Entering directory 
'C://build-lldb/lldb-test-build.noindex/commands/expression/call-function/TestCallBuiltinFunction.test'

"C:\build-lldb\bin\clang.exe"  -std=c++11 -g -O0 --sysroot 
"c:/buildslave/fs/jetson-agx-ubuntu"  
-IC:\lldb\packages\Python\lldbsuite\test\make/../../../../..//include 
-IC://build-lldb/tools/lldb/include 
-IC:\lldb\test\API\commands\expression\call-function 
-IC:\lldb\packages\Python\lldbsuite\test\make -include 
C:\lldb\packages\Python\lldbsuite\test\make/test_common.h  -MT main.o -MD 
-MP -MF main.d -c -o main.o 
C:\lldb\test\API\commands\expression\call-function/main.cpp

"C:\build-lldb\bin\clang.exe" main.o -g -O0 --sysroot 
"c:/buildslave/fs/jetson-agx-ubuntu"  
-IC:\lldb\packages\Python\lldbsuite\test\make/../../../../..//include 
-IC://build-lldb/tools/lldb/include 
-IC:\lldb\test\API\commands\expression\call-function 
-IC:\lldb\packages\Python\lldbsuite\test\make -include 
C:\lldb\packages\Python\lldbsuite\test\make/test_common.h  -o "a.out"

ld.lld: error: undefined symbol: std::__1::basic_string, std::__1::allocator>::~basic_string()

>>> referenced by main.cpp:34 
>>> (C:\lldb\test\API\commands\expression\call-function\main.cpp:34)

>>>   main.o:(main)



ld.lld: error: undefined symbol: std::__1::basic_string, std::__1::allocator>::__init(char const*, 
unsigned long)

>>> referenced by string:990 (C:\build-lldb\bin\..\include\c++\v1\string:990)

>>>   main.o:(std::__1::basic_string>> std::__1::char_traits, 
>>> std::__1::allocator>::basic_string[abi:ne19]<0>(char const*))

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make-wfix: *** [Makefile.rules:675: a.out] Error 1

make-wfix: Leaving directory 
'C://build-lldb/lldb-test-build.noindex/commands/expression/call-function/TestCallBuiltinFunction.test'


```

https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

dzhidzhoev wrote:

> It may be better to split this into smaller patches, given the fragility of 
> this code. (Basically, one patch for each of your bullet points).

I was thinking about that, but for me it looked like path_wrapper thing and 
cross-compilation/sdkroot fixes should have been sent in the same commit since 
each of them is insufficient for setting this configuration up on Windows.

https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits


@@ -263,9 +280,9 @@ CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS)
 
 # Use this one if you want to build one part of the result without debug 
information:
 ifeq "$(OS)" "Darwin"
-   CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) 
$(ARCH_CFLAGS) $(CFLAGS_EXTRAS) -isysroot "$(SDKROOT)"
+   CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) 
$(ARCH_CFLAGS) $(CFLAGS_EXTRAS) $(SYSROOT_FLAGS)

dzhidzhoev wrote:

The difference is between "$(ARCHFLAG) $(ARCH)" and "$(ARCHFLAG)$(ARCH)"
In the case of Darwin, we should add space between the flag and its argument, 
which doesn't work on Windows x86_64, for example:
```
"D:\lldb\build-lldb-win\bin\clang.exe" -O0 -m 64 -c 
D:\lldb\llvm-project-mainline\lldb\test\API\functionalities\step-avoids-no-debug/without-debug.c

clang: error: unknown argument: '-m'

clang: error: no such file or directory: '64'


```

https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev edited 
https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Fix cmd.exe detection on recent Windows versions (PR #99532)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev created 
https://github.com/llvm/llvm-project/pull/99532

Since Windows 10 the case of 'windir' env variable was changed. Such error 
appears without that change:

```
make: \system32\cmd.exe: Command not found

Makefile.rules:628: recipe for target 'main.o' failed
```

>From 3ed6eecbb10421ada4b9e8e4355b91b21b31909b Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev 
Date: Thu, 18 Jul 2024 19:27:55 +0200
Subject: [PATCH] [LLDB][test] Fix cmd.exe detection on recent Windows
 versions.

Since Windows 10 the case of 'windir' env variable was changed.
Such error appears without that change:

```
make: \system32\cmd.exe: Command not found

Makefile.rules:628: recipe for target 'main.o' failed
```
---
 lldb/packages/Python/lldbsuite/test/make/Makefile.rules | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 3d562285ce9cc..4ade8c16b8e6f 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -80,8 +80,9 @@ endif
 # Also reset BUILDDIR value because "pwd" returns cygwin or msys path
 # which needs to be converted to windows path.
 #--
-ifeq "$(OS)" "Windows_NT"
-   SHELL = $(WINDIR)\system32\cmd.exe
+ifeq "$(HOST_OS)" "Windows_NT"
+   # Windows 10 and later has the lower-case 'windir' env variable.
+   SHELL := $(or $(windir),$(WINDIR),C:\WINDOWS)\system32\cmd.exe
BUILDDIR := $(shell echo %cd%)
 endif
 

___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Fix cmd.exe detection on recent Windows versions (PR #99532)

2024-07-18 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vladislav Dzhidzhoev (dzhidzhoev)


Changes

Since Windows 10 the case of 'windir' env variable was changed. Such error 
appears without that change:

```
make: \system32\cmd.exe: Command not found

Makefile.rules:628: recipe for target 'main.o' failed
```

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


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (+3-2) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 3d562285ce9cc..4ade8c16b8e6f 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -80,8 +80,9 @@ endif
 # Also reset BUILDDIR value because "pwd" returns cygwin or msys path
 # which needs to be converted to windows path.
 #--
-ifeq "$(OS)" "Windows_NT"
-   SHELL = $(WINDIR)\system32\cmd.exe
+ifeq "$(HOST_OS)" "Windows_NT"
+   # Windows 10 and later has the lower-case 'windir' env variable.
+   SHELL := $(or $(windir),$(WINDIR),C:\WINDOWS)\system32\cmd.exe
BUILDDIR := $(shell echo %cd%)
 endif
 

``




https://github.com/llvm/llvm-project/pull/99532
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

dzhidzhoev wrote:

Moved SHELL variable change to a separate commit 
https://github.com/llvm/llvm-project/pull/99532.

https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Drop OS/HOST_OS detection code from Makefile.rules (PR #99535)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev created 
https://github.com/llvm/llvm-project/pull/99535

Remove commands for OS/HOST_OS detection from Makefile.rules to simplify it, 
since logic for these variables has been implemented in 
`lldb/packages/Python/lldbsuite/test/lldbplatformutil.py` 
(https://github.com/llvm/llvm-project/commit/7021e44b2f0e11717c0d82456bad0fed4a0b48f9).

>From 3125526d8eb256974ccc92650c8d3e3dfcaeeca9 Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev 
Date: Thu, 18 Jul 2024 18:28:20 +0200
Subject: [PATCH] [LLDB][test] Drop OS/HOST_OS detection code from
 Makefile.rules

Remove commands for OS/HOST_OS detection from Makefile.rules
to simplify it, since logic for these variables has been implemented in
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
(https://github.com/llvm/llvm-project/commit/7021e44b2f0e11717c0d82456bad0fed4a0b48f9).
---
 .../Python/lldbsuite/test/make/Makefile.rules | 25 ---
 1 file changed, 25 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 3d562285ce9cc..597aa94566c24 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -46,31 +46,6 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 # according to variable values).
 .DEFAULT_GOAL := all
 
-#--
-# If OS is not defined, use 'uname -s' to determine the OS name.
-#
-# GNUWin32 uname gives "windows32" or "server version windows32" while
-# some versions of MSYS uname return "MSYS_NT*", but most environments
-# standardize on "Windows_NT", so we'll make it consistent here. 
-# When running tests from Visual Studio, the environment variable isn't
-# inherited all the way down to the process spawned for make.
-#--
-ifeq "$(HOST_OS)" ""
-  HOST_OS := $(shell uname -s)
-endif
-
-ifneq (,$(findstring windows32,$(HOST_OS)))
-   HOST_OS := Windows_NT
-endif
-
-ifneq (,$(findstring MSYS_NT,$(HOST_OS)))
-   HOST_OS := Windows_NT
-endif
-
-ifeq "$(OS)" ""
-   OS := $(HOST_OS)
-endif
-
 #--
 # If OS is Windows, force SHELL to be cmd
 #

___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Drop OS/HOST_OS detection code from Makefile.rules (PR #99535)

2024-07-18 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vladislav Dzhidzhoev (dzhidzhoev)


Changes

Remove commands for OS/HOST_OS detection from Makefile.rules to simplify it, 
since logic for these variables has been implemented in 
`lldb/packages/Python/lldbsuite/test/lldbplatformutil.py` 
(https://github.com/llvm/llvm-project/commit/7021e44b2f0e11717c0d82456bad0fed4a0b48f9).

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


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (-25) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 3d562285ce9cc..597aa94566c24 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -46,31 +46,6 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 # according to variable values).
 .DEFAULT_GOAL := all
 
-#--
-# If OS is not defined, use 'uname -s' to determine the OS name.
-#
-# GNUWin32 uname gives "windows32" or "server version windows32" while
-# some versions of MSYS uname return "MSYS_NT*", but most environments
-# standardize on "Windows_NT", so we'll make it consistent here. 
-# When running tests from Visual Studio, the environment variable isn't
-# inherited all the way down to the process spawned for make.
-#--
-ifeq "$(HOST_OS)" ""
-  HOST_OS := $(shell uname -s)
-endif
-
-ifneq (,$(findstring windows32,$(HOST_OS)))
-   HOST_OS := Windows_NT
-endif
-
-ifneq (,$(findstring MSYS_NT,$(HOST_OS)))
-   HOST_OS := Windows_NT
-endif
-
-ifeq "$(OS)" ""
-   OS := $(HOST_OS)
-endif
-
 #--
 # If OS is Windows, force SHELL to be cmd
 #

``




https://github.com/llvm/llvm-project/pull/99535
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits


@@ -56,15 +57,12 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 # inherited all the way down to the process spawned for make.
 #--
 ifeq "$(HOST_OS)" ""
-  HOST_OS := $(shell uname -s)
-endif
-
-ifneq (,$(findstring windows32,$(HOST_OS)))
-   HOST_OS := Windows_NT
-endif
-
-ifneq (,$(findstring MSYS_NT,$(HOST_OS)))
-   HOST_OS := Windows_NT
+HOST_OS := $(shell uname -s)
+ifneq (,$(or \
+$(findstring windows32,$(HOST_OS)),\
+$(findstring MSYS_NT,$(HOST_OS
+HOST_OS := Windows_NT
+endif

dzhidzhoev wrote:

I think that 
https://github.com/llvm/llvm-project/commit/7021e44b2f0e11717c0d82456bad0fed4a0b48f9
 is sufficient, though I didn't want to remove that from this commit.
Created https://github.com/llvm/llvm-project/pull/99535.

https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Drop OS/HOST_OS detection code from Makefile.rules (PR #99535)

2024-07-18 Thread Jonas Devlieghere via lldb-commits

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


https://github.com/llvm/llvm-project/pull/99535
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 78e3bfc - [LLDB][test] Drop OS/HOST_OS detection code from Makefile.rules (#99535)

2024-07-18 Thread via lldb-commits

Author: Vladislav Dzhidzhoev
Date: 2024-07-18T20:04:21+02:00
New Revision: 78e3bfc120c8a23e246f544a5e9fb122828a21a7

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

LOG: [LLDB][test] Drop OS/HOST_OS detection code from Makefile.rules (#99535)

Remove commands for OS/HOST_OS detection from Makefile.rules to simplify
it, since logic for these variables has been implemented in
`lldb/packages/Python/lldbsuite/test/lldbplatformutil.py`
(7021e44b2f0e11717c0d82456bad0fed4a0b48f9).

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 3d562285ce9cc..597aa94566c24 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -46,31 +46,6 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 # according to variable values).
 .DEFAULT_GOAL := all
 
-#--
-# If OS is not defined, use 'uname -s' to determine the OS name.
-#
-# GNUWin32 uname gives "windows32" or "server version windows32" while
-# some versions of MSYS uname return "MSYS_NT*", but most environments
-# standardize on "Windows_NT", so we'll make it consistent here. 
-# When running tests from Visual Studio, the environment variable isn't
-# inherited all the way down to the process spawned for make.
-#--
-ifeq "$(HOST_OS)" ""
-  HOST_OS := $(shell uname -s)
-endif
-
-ifneq (,$(findstring windows32,$(HOST_OS)))
-   HOST_OS := Windows_NT
-endif
-
-ifneq (,$(findstring MSYS_NT,$(HOST_OS)))
-   HOST_OS := Windows_NT
-endif
-
-ifeq "$(OS)" ""
-   OS := $(HOST_OS)
-endif
-
 #--
 # If OS is Windows, force SHELL to be cmd
 #



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Drop OS/HOST_OS detection code from Makefile.rules (PR #99535)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev closed 
https://github.com/llvm/llvm-project/pull/99535
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond edited 
https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond edited 
https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

Just two quick things and this is good to go!

https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Greg Clayton via lldb-commits

https://github.com/clayborg edited 
https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Greg Clayton via lldb-commits


@@ -0,0 +1,69 @@
+//===-- SBSaveCoreOptions.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_API_SBSaveCoreOPTIONS_H
+#define LLDB_API_SBSaveCoreOPTIONS_H

clayborg wrote:

this should be all upper case

https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Greg Clayton via lldb-commits


@@ -1216,13 +1217,26 @@ bool SBProcess::IsInstrumentationRuntimePresent(
 
 lldb::SBError SBProcess::SaveCore(const char *file_name) {
   LLDB_INSTRUMENT_VA(this, file_name);
-  return SaveCore(file_name, "", SaveCoreStyle::eSaveCoreFull);
+  SBSaveCoreOptions options;
+  options.SetOutputFile(SBFileSpec(file_name));
+  options.SetStyle(SaveCoreStyle::eSaveCoreFull);
+  return SaveCore(options);
 }
 
 lldb::SBError SBProcess::SaveCore(const char *file_name,
   const char *flavor,
   SaveCoreStyle core_style) {
   LLDB_INSTRUMENT_VA(this, file_name, flavor, core_style);
+  SBSaveCoreOptions options;
+  options.SetOutputFile(SBFileSpec(file_name));
+  options.SetPluginName(flavor);

clayborg wrote:

Check the error from SetPluginName here and return an error if it fails. 
Otherwise the option won't get set due to the error and it will try to default 
to the default plug-in.

https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Greg Clayton via lldb-commits

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

Thanks for sticking with me, this looks really good now

https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Fix cmd.exe detection on recent Windows versions (PR #99532)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev updated 
https://github.com/llvm/llvm-project/pull/99532

>From 17f92b90fff5132960037997b0ace4c17aaf93df Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev 
Date: Thu, 18 Jul 2024 19:27:55 +0200
Subject: [PATCH] [LLDB][test] Improve SHELL detection on Windows in
 Makefile.rules

In MinGW make, %windir% variable has a lowercase name $(windir) when
launched from cmd.exe, and $(WINDIR) name when launched from MSYS2,
since MSYS2 represents standard Windows environment variables in upper
case.

This commit makes Makefile.rules consider both run variants.
---
 lldb/packages/Python/lldbsuite/test/make/Makefile.rules | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 597aa94566c24..be3ad684dd736 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -55,8 +55,10 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 # Also reset BUILDDIR value because "pwd" returns cygwin or msys path
 # which needs to be converted to windows path.
 #--
-ifeq "$(OS)" "Windows_NT"
-   SHELL = $(WINDIR)\system32\cmd.exe
+ifeq "$(HOST_OS)" "Windows_NT"
+   # MinGW make gets $(windir) variable if launched from cmd.exe
+   # and $(WINDIR) if launched from MSYS2.
+   SHELL := $(or $(windir),$(WINDIR),C:\WINDOWS)\system32\cmd.exe
BUILDDIR := $(shell echo %cd%)
 endif
 

___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Improve SHELL detection on Windows in Makefile.rules (PR #99532)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev edited 
https://github.com/llvm/llvm-project/pull/99532
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Improve SHELL detection on Windows in Makefile.rules (PR #99532)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev edited 
https://github.com/llvm/llvm-project/pull/99532
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Improve SHELL detection on Windows in Makefile.rules (PR #99532)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

dzhidzhoev wrote:

Sorry, the initial issue this commit resolves was identified wrongly, fixed the 
commit description.

https://github.com/llvm/llvm-project/pull/99532
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Improve SHELL detection on Windows in Makefile.rules (PR #99532)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev edited 
https://github.com/llvm/llvm-project/pull/99532
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Improve SHELL detection on Windows in Makefile.rules (PR #99532)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev edited 
https://github.com/llvm/llvm-project/pull/99532
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev edited 
https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [HLSL] Implement intangible AST type (PR #97362)

2024-07-18 Thread Joshua Batista via lldb-commits

bob80905 wrote:

Just an FYI, the syntax for adding a resource_class attribute as currently 
implemented looks like this:
`[[hlsl::resource_class(SRV)]]`
In your description, you may want to update this and other similar attributes.

https://github.com/llvm/llvm-project/pull/97362
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 4120570 - [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (#98403)

2024-07-18 Thread via lldb-commits

Author: Jacob Lalonde
Date: 2024-07-18T17:10:15-07:00
New Revision: 4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7

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

LOG: [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() 
overload (#98403)

This PR adds `SBSaveCoreOptions`, which is a container class for options
when LLDB is taking coredumps. For this first iteration this container
just keeps parity with the extant API of `file, style, plugin`. In the
future this options object can be extended to allow users to take a
subset of their core dumps.

Added: 
lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i
lldb/include/lldb/API/SBSaveCoreOptions.h
lldb/include/lldb/Symbol/SaveCoreOptions.h
lldb/source/API/SBSaveCoreOptions.cpp
lldb/source/Symbol/SaveCoreOptions.cpp
lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py

Modified: 
lldb/bindings/headers.swig
lldb/bindings/interfaces.swig
lldb/include/lldb/API/LLDB.h
lldb/include/lldb/API/SBDefines.h
lldb/include/lldb/API/SBError.h
lldb/include/lldb/API/SBFileSpec.h
lldb/include/lldb/API/SBProcess.h
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/API/CMakeLists.txt
lldb/source/API/SBProcess.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
lldb/source/Symbol/CMakeLists.txt
lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py

lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py

Removed: 




diff  --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig
index c91504604b6ac..c0dde905f986b 100644
--- a/lldb/bindings/headers.swig
+++ b/lldb/bindings/headers.swig
@@ -21,6 +21,7 @@
 #include "lldb/API/SBCommandReturnObject.h"
 #include "lldb/API/SBCommunication.h"
 #include "lldb/API/SBCompileUnit.h"
+#include "lldb/API/SBSaveCoreOptions.h"
 #include "lldb/API/SBData.h"
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBDeclaration.h"

diff  --git a/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i 
b/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i
new file mode 100644
index 0..e69de29bb2d1d

diff  --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig
index 0953f4c72a910..8a6fed95f0b72 100644
--- a/lldb/bindings/interfaces.swig
+++ b/lldb/bindings/interfaces.swig
@@ -25,6 +25,7 @@
 %include "./interface/SBCommandReturnObjectDocstrings.i"
 %include "./interface/SBCommunicationDocstrings.i"
 %include "./interface/SBCompileUnitDocstrings.i"
+%include "./interface/SBSaveCoreOptionsDocstrings.i"
 %include "./interface/SBDataDocstrings.i"
 %include "./interface/SBDebuggerDocstrings.i"
 %include "./interface/SBDeclarationDocstrings.i"
@@ -101,6 +102,7 @@
 %include "lldb/API/SBCommandReturnObject.h"
 %include "lldb/API/SBCommunication.h"
 %include "lldb/API/SBCompileUnit.h"
+%include "lldb/API/SBSaveCoreOptions.h"
 %include "lldb/API/SBData.h"
 %include "lldb/API/SBDebugger.h"
 %include "lldb/API/SBDeclaration.h"

diff  --git a/lldb/include/lldb/API/LLDB.h b/lldb/include/lldb/API/LLDB.h
index d8cc9f5067fe9..40368e036e0e4 100644
--- a/lldb/include/lldb/API/LLDB.h
+++ b/lldb/include/lldb/API/LLDB.h
@@ -57,6 +57,7 @@
 #include "lldb/API/SBQueue.h"
 #include "lldb/API/SBQueueItem.h"
 #include "lldb/API/SBReproducer.h"
+#include "lldb/API/SBSaveCoreOptions.h"
 #include "lldb/API/SBSection.h"
 #include "lldb/API/SBSourceManager.h"
 #include "lldb/API/SBStatisticsOptions.h"

diff  --git a/lldb/include/lldb/API/SBDefines.h 
b/lldb/include/lldb/API/SBDefines.h
index 87c0a1c3661ca..f42e2be558d2e 100644
--- a/lldb/include/lldb/API/SBDefines.h
+++ b/lldb/include/lldb/API/SBDefines.h
@@ -61,6 +61,7 @@ class LLDB_API SBCommandPluginInterface;
 class LLDB_API SBCommandReturnObject;
 class LLDB_API SBCommunication;
 class LLDB_API SBCompileUnit;
+class LLDB_API SBSaveCoreOptions;
 class LLDB_API SBData;
 class LLDB_API SBDebugger;
 class LLDB_API SBDeclaration;

diff  --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h
index 1a720a479d9a6..17f2c6c3027af 100644
--- a/lldb/include/lldb/API/SBError.h
+++ b/lldb/include/lldb/API/SBError.h
@@ -77,6 +77,7 @@ cla

[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond closed 
https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add ABI library to Makefile.rules link flags (PR #99589)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits

https://github.com/dzhidzhoev created 
https://github.com/llvm/llvm-project/pull/99589

This commit fixes an undefined reference linking problem with cross-compilation 
and remote testing on Linux host-Linux target configuration, that occurs when 
libcxx is linked statically.

Many tests fail with errors similar to that:
```
ERROR: test_with_run_command 
(TestValueObjectRecursion.ValueObjectRecursionTestCase.test_with_run_command)
   Test that deeply nested ValueObjects still work.
--
Error when building test subject.

ld.lld: error: undefined symbol: __gxx_personality_v0
>>> referenced by main.cpp
>>>   main.o:(DW.ref.__gxx_personality_v0)

ld.lld: error: undefined symbol: __cxa_allocate_exception
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive 
>>> /home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a

ld.lld: error: undefined symbol: std::bad_alloc::bad_alloc()
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive 
>>> /home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a

ld.lld: error: undefined symbol: typeinfo for std::bad_alloc
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive 
>>> /home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in archive 
>>> /home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a

...
```

>From 029115b811c149edb316719d7735cc1b4a850c43 Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev 
Date: Fri, 19 Jul 2024 02:14:03 +0200
Subject: [PATCH] [lldb][test] Add ABI library to Makefile.rules link flags

This commit fixes an undefined reference linking problem
with cross-compilation and remote testing on Linux host-Linux target
configuration, that occurs when libcxx is linked statically.
---
 lldb/packages/Python/lldbsuite/test/make/Makefile.rules | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 597aa94566c24..092632ecc3a07 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -390,7 +390,7 @@ ifeq (1,$(USE_LIBCPP))
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
CXXFLAGS += -cxx-isystem 
$(LIBCPP_INCLUDE_TARGET_DIR)
endif
-   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
+   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++ -lc++abi
else
ifeq "$(OS)" "Android"
# Nothing to do, this is already handled in
@@ -413,7 +413,7 @@ ifeq (1, $(USE_SYSTEM_STDLIB))
  $(error "SDKROOT must be set on Darwin to use the system libcxx")
 endif
 CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem 
$(SDKROOT)/usr/include/c++/v1
-LDFLAGS += -L$(SDKROOT)/usr/lib -Wl,-rpath,$(SDKROOT)/usr/lib -lc++
+LDFLAGS += -L$(SDKROOT)/usr/lib -Wl,-rpath,$(SDKROOT)/usr/lib -lc++ 
-lc++abi
 endif
 endif
 
@@ -425,7 +425,7 @@ ifeq ($(or $(USE_LIBSTDCPP), $(USE_LIBCPP), 
$(USE_SYSTEM_STDLIB)),)
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
CXXFLAGS += -cxx-isystem 
$(LIBCPP_INCLUDE_TARGET_DIR)
endif
-   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
+   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++ -lc++abi
endif
 endif
 

___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][test] Update Makefile.rules to support Windows host+Linux target (PR #99266)

2024-07-18 Thread Vladislav Dzhidzhoev via lldb-commits


@@ -432,18 +468,18 @@ ifeq (1,$(USE_LIBCPP))
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
CXXFLAGS += -cxx-isystem 
$(LIBCPP_INCLUDE_TARGET_DIR)
endif
-   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
+   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++ -lc++abi
else
ifeq "$(OS)" "Android"
# Nothing to do, this is already handled in
# Android.rules.
else
CXXFLAGS += -stdlib=libc++
-   LDFLAGS += -stdlib=libc++
+   LDFLAGS += -stdlib=libc++ -lc++abi

dzhidzhoev wrote:

Yes. Moved to https://github.com/llvm/llvm-project/pull/99589 for clarity.

https://github.com/llvm/llvm-project/pull/99266
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

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

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

Here is the relevant piece of the build log for the reference:
```
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: 
commands/frame/diagnose/bad-reference/TestBadReference.py (107 of 2633)
PASS: lldb-api :: commands/command/backticks/TestBackticksInAlias.py (108 of 
2633)
UNSUPPORTED: lldb-api :: 
commands/frame/diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py
 (109 of 2633)
PASS: lldb-api :: api/command-return-object/TestSBCommandReturnObject.py (110 
of 2633)
UNSUPPORTED: lldb-api :: 
commands/frame/diagnose/dereference-this/TestDiagnoseDereferenceThis.py (111 of 
2633)
PASS: lldb-api :: 
commands/expression/call-function/TestCallStdStringFunction.py (112 of 2633)
UNSUPPORTED: lldb-api :: 
commands/frame/diagnose/inheritance/TestDiagnoseInheritance.py (113 of 2633)
UNSUPPORTED: lldb-api :: 
commands/frame/diagnose/local-variable/TestLocalVariable.py (114 of 2633)
PASS: lldb-api :: 
commands/expression/call-function/TestCallUserDefinedFunction.py (115 of 2633)
UNRESOLVED: lldb-api :: api/multiple-targets/TestMultipleTargets.py (116 of 
2633)
 TEST 'lldb-api :: 
api/multiple-targets/TestMultipleTargets.py' FAILED 
Script:
--
/usr/bin/python3 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u 
CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/bin/ar --env OBJCOPY=/usr/bin/objcopy 
--env LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env 
LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env 
LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 
--build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --llvm-tools-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root 
/home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir 
/home/worker/2.0.1/lldb-x86_64-debian/build/./lib -t 
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/api/multiple-targets
 -p TestMultipleTargets.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision 
4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7)
  clang revision 4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7
  llvm revision 4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 
'debugserver', 'objc']
Building LLDB Driver 
(/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/api/multiple-targets/TestMultipleTargets.test_multiple_targets/multi-target)
 from sources main.cpp

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

output: 

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

output: 

runCmd: settings set target.inherit-tcc true

output: 

runCmd: settings set target.disable-aslr false

output: 

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

output: 


```

https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

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

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

Here is the relevant piece of the build log for the reference:
```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: 
commands/expression/codegen-crash-import-def-arraytype-element/TestImportDefinitionArrayType.py
 (55 of 1994)
PASS: lldb-api :: 
commands/expression/completion-crash-incomplete-record/TestCompletionCrashIncompleteRecord.py
 (56 of 1994)
UNSUPPORTED: lldb-api :: 
commands/expression/context-object-objc/TestContextObjectObjc.py (57 of 1994)
PASS: lldb-api :: 
commands/expression/completion-in-lambda-and-unnamed-class/TestCompletionInLambdaAndUnnamedClass.py
 (58 of 1994)
PASS: lldb-api :: 
commands/expression/deleting-implicit-copy-constructor/TestDeletingImplicitCopyConstructor.py
 (59 of 1994)
PASS: lldb-api :: commands/expression/completion/TestExprCompletion.py (60 of 
1994)
PASS: lldb-api :: commands/expression/context-object/TestContextObject.py (61 
of 1994)
PASS: lldb-api :: commands/expression/char/TestExprsChar.py (62 of 1994)
PASS: lldb-api :: commands/expression/diagnostics/TestExprDiagnostics.py (63 of 
1994)
UNRESOLVED: lldb-api :: api/multithreaded/TestMultithreaded.py (64 of 1994)
 TEST 'lldb-api :: api/multithreaded/TestMultithreaded.py' 
FAILED 
Script:
--
/usr/bin/python3.8 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/local/bin/llvm-ar --env 
OBJCOPY=/usr/bin/llvm-objcopy --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include 
--env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--arch aarch64 --build-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil 
--llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb 
--lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/api/multithreaded
 -p TestMultithreaded.py
--
Exit Code: 1

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

--
Command Output (stderr):
--
FAIL: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_breakpoint_callback (TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_breakpoint_location_callback (TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_python_stop_hook (TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_sb_api_listener_event_description 
(TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_sb_api_listener_event_process_state 
(TestMultithreaded.SBBreakpointCallbackCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_sb_api_listener_resume (TestMultithreaded.SBBreakpointCallbackCase) 
(skipping due to the following parameter(s): target o/s) 
==
ERROR: test_breakpoint_callback (TestMultithreaded.SBBreakpointCallbackCase)
   Test the that SBBreakpoint callback is invoked when a breakpoint is hit.
--
Error when building test subject.

Build Command:
make 
VPATH=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/api/multithreaded
 -C 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/api/multithreaded/TestMultithreaded.test_breakpoint_callback
 -I 
/home/tcwg-bui

[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

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

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

Here is the relevant piece of the build log for the reference:
```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: 
commands/command/script/import/rdar-12586188/TestRdar12586188.py (35 of 2753)
PASS: lldb-api :: commands/command/script_alias/TestCommandScriptAlias.py (36 
of 2753)
PASS: lldb-api :: commands/command/source/TestCommandSource.py (37 of 2753)
PASS: lldb-api :: commands/disassemble/basic/TestDisassembleBreakpoint.py (38 
of 2753)
PASS: lldb-api :: commands/disassemble/basic/TestFrameDisassemble.py (39 of 
2753)
PASS: lldb-api :: commands/command/script/TestCommandScript.py (40 of 2753)
PASS: lldb-api :: 
commands/expression/anonymous-struct/TestCallUserAnonTypedef.py (41 of 2753)
PASS: lldb-api :: 
commands/expression/argument_passing_restrictions/TestArgumentPassingRestrictions.py
 (42 of 2753)
PASS: lldb-api :: commands/expression/bitfield_enums/TestBitfieldEnums.py (43 
of 2753)
UNRESOLVED: lldb-api :: api/multithreaded/TestMultithreaded.py (44 of 2753)
 TEST 'lldb-api :: api/multithreaded/TestMultithreaded.py' 
FAILED 
Script:
--
/usr/bin/python3.8 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py 
-u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/local/bin/llvm-ar --env 
OBJCOPY=/usr/bin/llvm-objcopy --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env 
LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch 
armv8l --build-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil 
--llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin 
--lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb 
--lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/api/multithreaded
 -p TestMultithreaded.py
--
Exit Code: 1

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

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: 
test_breakpoint_callback (TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: 
test_breakpoint_location_callback (TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: 
test_python_stop_hook (TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: 
test_sb_api_listener_event_description 
(TestMultithreaded.SBBreakpointCallbackCase)
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: 
test_sb_api_listener_event_process_state 
(TestMultithreaded.SBBreakpointCallbackCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: 
test_sb_api_listener_resume (TestMultithreaded.SBBreakpointCallbackCase) 
(skipping due to the following parameter(s): target o/s) 
==
ERROR: test_breakpoint_callback (TestMultithreaded.SBBreakpointCallbackCase)
   Test the that SBBreakpoint callback is invoked when a breakpoint is hit.
--
Error when building test subject.

Build Command:
make 
VPATH=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/api/multithreaded
 -C 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/api/multithreaded/TestMultithreaded.test_breakpoint_callback
 -I 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/api/multithreaded
 -I 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make
 -f 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/api/multithreaded/

[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

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

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

Here is the relevant piece of the build log for the reference:
```
Step 6 (test) failure: build (failure)
...
224.853 [3/2/286] Building CXX object 
tools\lldb\unittests\Thread\CMakeFiles\ThreadTests.dir\ThreadTest.cpp.obj
llvm-lit.py: 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:57:
 note: using lit tools: C:\Users\tcwg\scoop\apps\git\2.39.0.windows.2\usr\bin
llvm-lit.py: 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508:
 note: using clang: 
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe
llvm-lit.py: 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508:
 note: using ld.lld: 
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld.lld.exe
llvm-lit.py: 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508:
 note: using lld-link: 
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lld-link.exe
llvm-lit.py: 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508:
 note: using ld64.lld: 
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\ld64.lld.exe
llvm-lit.py: 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\utils\lit\lit\llvm\config.py:508:
 note: using wasm-ld: 
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\wasm-ld.exe
225.468 [2/2/287] Building CXX object 
tools\lldb\unittests\ValueObject\CMakeFiles\LLDBValueObjectTests.dir\DumpValueObjectOptionsTests--
 Testing: 1990 tests, 2 workers --
Testing: 
UNRESOLVED: lldb-api :: api/multiple-targets/TestMultipleTargets.py (6 of 1990)
 TEST 'lldb-api :: 
api/multiple-targets/TestMultipleTargets.py' FAILED 
Script:
--
C:/Users/tcwg/AppData/Local/Programs/Python/Python311-arm64/python.exe 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py
 -u CXXFLAGS -u CFLAGS --env 
OBJCOPY=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/llvm-objcopy.exe
 --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib 
--env 
LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include 
--env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin 
--arch aarch64 --build-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api
 --clang-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api
 --executable 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe 
--llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin 
--lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb 
--lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib 
--skip-category=watchpoint 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\api\multiple-targets
 -p TestMultipleTargets.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision 
4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7)
  clang revision 4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7
  llvm revision 4120570dc408a6ccc7133b4bdbaf5cf6c4af9db7
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 
'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
FAIL: LLDB 
(C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: 
test_multiple_targets 
(TestMultipleTargets.TestMultipleTargets.test_multiple_targets)

==

ERROR: test_multiple_targets 
(TestMultipleTargets.TestMultipleTargets.test_multiple_targets)

--

Error when building test subject.



Build Command:

make 
'VPATH=C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\api\multiple-targets'
 -C 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\api\multiple-targets\TestMultipleTargets.test_multiple_targets'
 -I 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\api\multiple-targets'
 -I 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\m

[Lldb-commits] [lldb] [lldb] SHT_NOBITS sections type (PR #99044)

2024-07-18 Thread via lldb-commits

dlav-sc wrote:

> > I have also removed `.Cases(".bss", ".tbss", eSectionTypeZeroFill)`.
> > To be honest, I'm not sure about that. .bss and .tbss have SHT_NOBITS type 
> > and SHF_ALLOC flag by [Linux 
> > Specification](https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/specialsections.html),
> >  but anyway I have doubts.
> 
> I know what you mean -- you can find very strange elf files out there. 
> However, most elf tools operate on section flags (that's what they're for) 
> and not their names, so I really doubt that e.g. treating a 
> SHT_PROGBITS+SHF_ALLOC section that happens to be called ".bss" as 
> `eSectionTypeZeroFill` is the right behavior.
> 
> So, until proven otherwise, this looks good to me.

Well, sounds reasonable.
Thanks for the review.

https://github.com/llvm/llvm-project/pull/99044
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (PR #98403)

2024-07-18 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

Reverted locally and still got consistent failures. @jimingham should I file an 
issue here?

https://github.com/llvm/llvm-project/pull/98403
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add ABI library to Makefile.rules link flags (PR #99589)

2024-07-18 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vladislav Dzhidzhoev (dzhidzhoev)


Changes

This commit fixes an undefined reference linking problem with cross-compilation 
and remote testing on Linux host-Linux target configuration, that occurs when 
libcxx is linked statically.

Many tests fail with errors similar to that:
```
ERROR: test_with_run_command 
(TestValueObjectRecursion.ValueObjectRecursionTestCase.test_with_run_command)
   Test that deeply nested ValueObjects still work.
--
Error when building test subject.

ld.lld: error: undefined symbol: __gxx_personality_v0
>>> referenced by main.cpp
>>>   main.o:(DW.ref.__gxx_personality_v0)

ld.lld: error: undefined symbol: __cxa_allocate_exception
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in 
archive 
/home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a

ld.lld: error: undefined symbol: std::bad_alloc::bad_alloc()
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in 
archive 
/home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a

ld.lld: error: undefined symbol: typeinfo for std::bad_alloc
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in 
archive 
/home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a
>>> referenced by new_helpers.cpp
>>>   new_helpers.cpp.o:(std::__throw_bad_alloc()) in 
archive 
/home/parallels/llvm-build-release/./lib/aarch64-unknown-linux-gnu/libc++.a

...
```

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


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (+3-3) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 597aa94566c24..092632ecc3a07 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -390,7 +390,7 @@ ifeq (1,$(USE_LIBCPP))
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
CXXFLAGS += -cxx-isystem 
$(LIBCPP_INCLUDE_TARGET_DIR)
endif
-   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
+   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++ -lc++abi
else
ifeq "$(OS)" "Android"
# Nothing to do, this is already handled in
@@ -413,7 +413,7 @@ ifeq (1, $(USE_SYSTEM_STDLIB))
  $(error "SDKROOT must be set on Darwin to use the system libcxx")
 endif
 CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem 
$(SDKROOT)/usr/include/c++/v1
-LDFLAGS += -L$(SDKROOT)/usr/lib -Wl,-rpath,$(SDKROOT)/usr/lib -lc++
+LDFLAGS += -L$(SDKROOT)/usr/lib -Wl,-rpath,$(SDKROOT)/usr/lib -lc++ 
-lc++abi
 endif
 endif
 
@@ -425,7 +425,7 @@ ifeq ($(or $(USE_LIBSTDCPP), $(USE_LIBCPP), 
$(USE_SYSTEM_STDLIB)),)
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
CXXFLAGS += -cxx-isystem 
$(LIBCPP_INCLUDE_TARGET_DIR)
endif
-   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
+   LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) 
-Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++ -lc++abi
endif
 endif
 

``




https://github.com/llvm/llvm-project/pull/99589
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [clang] Split ObjectFilePCHContainerReader from ObjectFilePCHContainerWriter (PR #99599)

2024-07-18 Thread Chuanqi Xu via lldb-commits

https://github.com/ChuanqiXu9 created 
https://github.com/llvm/llvm-project/pull/99599

Close https://github.com/llvm/llvm-project/issues/99479

See https://github.com/llvm/llvm-project/issues/99479 for details

>From 36e24bd88649e9d5771f1dbb668632d33ffe52d7 Mon Sep 17 00:00:00 2001
From: Chuanqi Xu 
Date: Fri, 19 Jul 2024 11:02:36 +0800
Subject: [PATCH] [clang] Split ObjectFilePCHContainerReader from
 ObjectFilePCHContainerWriter

Close https://github.com/llvm/llvm-project/issues/99479

See https://github.com/llvm/llvm-project/issues/99479 for details
---
 ...tions.h => ObjectFilePCHContainerWriter.h} | 10 +---
 .../ObjectFilePCHContainerReader.h| 26 +
 clang/lib/CodeGen/CMakeLists.txt  |  2 +-
 ...s.cpp => ObjectFilePCHContainerWriter.cpp} | 47 +---
 clang/lib/Interpreter/Interpreter.cpp |  3 +-
 clang/lib/Interpreter/InterpreterUtils.h  |  1 -
 clang/lib/Serialization/CMakeLists.txt|  2 +
 .../ObjectFilePCHContainerReader.cpp  | 56 +++
 .../Tooling/DependencyScanning/CMakeLists.txt |  1 -
 .../DependencyScanningWorker.cpp  |  2 +-
 clang/tools/c-index-test/CMakeLists.txt   |  1 -
 clang/tools/c-index-test/core_main.cpp|  2 +-
 clang/tools/clang-check/ClangCheck.cpp|  1 -
 clang/tools/driver/cc1_main.cpp   |  3 +-
 lldb/source/Commands/CommandObjectTarget.cpp  |  2 +-
 lldb/tools/lldb-instr/Instrument.cpp  |  3 +-
 16 files changed, 97 insertions(+), 65 deletions(-)
 rename clang/include/clang/CodeGen/{ObjectFilePCHContainerOperations.h => 
ObjectFilePCHContainerWriter.h} (73%)
 create mode 100644 
clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
 rename clang/lib/CodeGen/{ObjectFilePCHContainerOperations.cpp => 
ObjectFilePCHContainerWriter.cpp} (89%)
 create mode 100644 clang/lib/Serialization/ObjectFilePCHContainerReader.cpp

diff --git a/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h 
b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
similarity index 73%
rename from clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h
rename to clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
index 7a02d8725885a..5aef4a2d23de0 100644
--- a/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h
+++ b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
@@ -1,4 +1,4 @@
-//===-- CodeGen/ObjectFilePCHContainerOperations.h - *- C++ 
-*-===//
+//===-- CodeGen/ObjectFilePCHContainerWriter.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.
@@ -29,14 +29,6 @@ class ObjectFilePCHContainerWriter : public 
PCHContainerWriter {
   std::shared_ptr Buffer) const 
override;
 };
 
-/// A PCHContainerReader implementation that uses LLVM to
-/// wraps Clang modules inside a COFF, ELF, or Mach-O container.
-class ObjectFilePCHContainerReader : public PCHContainerReader {
-  ArrayRef getFormats() const override;
-
-  /// Returns the serialized AST inside the PCH container Buffer.
-  StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const override;
-};
 }
 
 #endif
diff --git a/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h 
b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
new file mode 100644
index 0..65b90299545f7
--- /dev/null
+++ b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
@@ -0,0 +1,26 @@
+//===-- Serialization/ObjectFilePCHContainerReader.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 LLVM_CLANG_SERIALIZATION_OBJECTFILEPCHCONTAINERREADER_H
+#define LLVM_CLANG_SERIALIZATION_OBJECTFILEPCHCONTAINERREADER_H
+
+#include "clang/Frontend/PCHContainerOperations.h"
+
+namespace clang {
+/// A PCHContainerReader implementation that uses LLVM to
+/// wraps Clang modules inside a COFF, ELF, or Mach-O container.
+class ObjectFilePCHContainerReader : public PCHContainerReader {
+  ArrayRef getFormats() const override;
+
+  /// Returns the serialized AST inside the PCH container Buffer.
+  StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const override;
+};
+}
+
+#endif
\ No newline at end of file
diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt
index 2a179deddcc31..deb7b27266d73 100644
--- a/clang/lib/CodeGen/CMakeLists.txt
+++ b/clang/lib/CodeGen/CMakeLists.txt
@@ -110,7 +110,7 @@ add_clang_library(clangCodeGen
   MacroPPCallbacks.cpp
   MicrosoftCXXABI.cpp
   ModuleBuilder.cpp
-  ObjectFilePCHContainerOperations.cpp
+  ObjectFilePCHContainerWriter.cpp
   PatternInit.cpp
   

[Lldb-commits] [clang] [lldb] [clang] Split ObjectFilePCHContainerReader from ObjectFilePCHContainerWriter (PR #99599)

2024-07-18 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-modules

Author: Chuanqi Xu (ChuanqiXu9)


Changes

Close https://github.com/llvm/llvm-project/issues/99479

See https://github.com/llvm/llvm-project/issues/99479 for details

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


16 Files Affected:

- (renamed) clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h (+1-9) 
- (added) clang/include/clang/Serialization/ObjectFilePCHContainerReader.h 
(+26) 
- (modified) clang/lib/CodeGen/CMakeLists.txt (+1-1) 
- (renamed) clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp (+2-45) 
- (modified) clang/lib/Interpreter/Interpreter.cpp (+2-1) 
- (modified) clang/lib/Interpreter/InterpreterUtils.h (-1) 
- (modified) clang/lib/Serialization/CMakeLists.txt (+2) 
- (added) clang/lib/Serialization/ObjectFilePCHContainerReader.cpp (+56) 
- (modified) clang/lib/Tooling/DependencyScanning/CMakeLists.txt (-1) 
- (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp 
(+1-1) 
- (modified) clang/tools/c-index-test/CMakeLists.txt (-1) 
- (modified) clang/tools/c-index-test/core_main.cpp (+1-1) 
- (modified) clang/tools/clang-check/ClangCheck.cpp (-1) 
- (modified) clang/tools/driver/cc1_main.cpp (+2-1) 
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+1-1) 
- (modified) lldb/tools/lldb-instr/Instrument.cpp (+2-1) 


``diff
diff --git a/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h 
b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
similarity index 73%
rename from clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h
rename to clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
index 7a02d8725885a..5aef4a2d23de0 100644
--- a/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h
+++ b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
@@ -1,4 +1,4 @@
-//===-- CodeGen/ObjectFilePCHContainerOperations.h - *- C++ 
-*-===//
+//===-- CodeGen/ObjectFilePCHContainerWriter.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.
@@ -29,14 +29,6 @@ class ObjectFilePCHContainerWriter : public 
PCHContainerWriter {
   std::shared_ptr Buffer) const 
override;
 };
 
-/// A PCHContainerReader implementation that uses LLVM to
-/// wraps Clang modules inside a COFF, ELF, or Mach-O container.
-class ObjectFilePCHContainerReader : public PCHContainerReader {
-  ArrayRef getFormats() const override;
-
-  /// Returns the serialized AST inside the PCH container Buffer.
-  StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const override;
-};
 }
 
 #endif
diff --git a/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h 
b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
new file mode 100644
index 0..65b90299545f7
--- /dev/null
+++ b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
@@ -0,0 +1,26 @@
+//===-- Serialization/ObjectFilePCHContainerReader.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 LLVM_CLANG_SERIALIZATION_OBJECTFILEPCHCONTAINERREADER_H
+#define LLVM_CLANG_SERIALIZATION_OBJECTFILEPCHCONTAINERREADER_H
+
+#include "clang/Frontend/PCHContainerOperations.h"
+
+namespace clang {
+/// A PCHContainerReader implementation that uses LLVM to
+/// wraps Clang modules inside a COFF, ELF, or Mach-O container.
+class ObjectFilePCHContainerReader : public PCHContainerReader {
+  ArrayRef getFormats() const override;
+
+  /// Returns the serialized AST inside the PCH container Buffer.
+  StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const override;
+};
+}
+
+#endif
\ No newline at end of file
diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt
index 2a179deddcc31..deb7b27266d73 100644
--- a/clang/lib/CodeGen/CMakeLists.txt
+++ b/clang/lib/CodeGen/CMakeLists.txt
@@ -110,7 +110,7 @@ add_clang_library(clangCodeGen
   MacroPPCallbacks.cpp
   MicrosoftCXXABI.cpp
   ModuleBuilder.cpp
-  ObjectFilePCHContainerOperations.cpp
+  ObjectFilePCHContainerWriter.cpp
   PatternInit.cpp
   SanitizerMetadata.cpp
   SwiftCallingConv.cpp
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp 
b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
similarity index 89%
rename from clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
rename to clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index ee543e40b4609..3a1f745d9ed77 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -1,4 +1,4 @@
-//===--- ObjectFilePCHContainerOperations.

[Lldb-commits] [clang] [lldb] [clang] Split ObjectFilePCHContainerReader from ObjectFilePCHContainerWriter (PR #99599)

2024-07-18 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 962d018234cb8c94e387fe3950cd030658850541 
36e24bd88649e9d5771f1dbb668632d33ffe52d7 --extensions cpp,h -- 
clang/include/clang/Serialization/ObjectFilePCHContainerReader.h 
clang/lib/Serialization/ObjectFilePCHContainerReader.cpp 
clang/lib/Interpreter/Interpreter.cpp clang/lib/Interpreter/InterpreterUtils.h 
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp 
clang/tools/c-index-test/core_main.cpp clang/tools/clang-check/ClangCheck.cpp 
clang/tools/driver/cc1_main.cpp lldb/source/Commands/CommandObjectTarget.cpp 
lldb/tools/lldb-instr/Instrument.cpp 
clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h 
clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h 
b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
index 5aef4a2d23..6a75a6552f 100644
--- a/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
+++ b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
@@ -29,6 +29,6 @@ class ObjectFilePCHContainerWriter : public 
PCHContainerWriter {
   std::shared_ptr Buffer) const 
override;
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h 
b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
index 65b9029954..6d8c1f6a2a 100644
--- a/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
+++ b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
@@ -6,7 +6,6 @@
 //
 
//===--===//
 
-
 #ifndef LLVM_CLANG_SERIALIZATION_OBJECTFILEPCHCONTAINERREADER_H
 #define LLVM_CLANG_SERIALIZATION_OBJECTFILEPCHCONTAINERREADER_H
 
@@ -21,6 +20,6 @@ class ObjectFilePCHContainerReader : public 
PCHContainerReader {
   /// Returns the serialized AST inside the PCH container Buffer.
   StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const override;
 };
-}
+} // namespace clang
 
 #endif
\ No newline at end of file

``




https://github.com/llvm/llvm-project/pull/99599
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)

2024-07-18 Thread Jason Molenda via lldb-commits


@@ -0,0 +1,58 @@
+//===--- DirectToIndirectFCR.h - RISC-V specific pass 
-===//
+//
+// 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
+//
+//===--===//
+
+#pragma once
+
+#include "lldb/lldb-types.h"
+
+#include "llvm/IR/Instructions.h"
+#include "llvm/Pass.h"
+
+namespace lldb_private {
+
+class ExecutionContext;
+
+// During the lldb expression execution lldb wraps a user expression, jittes
+// fabricated code and then puts it into the stack memory. Thus, if user tried
+// to make a function call there will be a jump from a stack address to a code
+// sections's address. RISC-V Architecture doesn't have a large code model yet
+// and can make only a +-2GiB jumps, but in 64-bit architecture a distance
+// between stack addresses and code sections's addresses is longer. Therefore,
+// relocations resolver obtains an invalid address. To avoid such problem, this
+// pass should be used. It replaces function calls with appropriate function's
+// addresses explicitly. By doing so it removes relocations related to function
+// calls. This pass should be cosidered as temprorary solution until a large

jasonmolenda wrote:

tiny nit: "cosidered", "temprorary".  I do this all the time myself, just 
happened to see them.

https://github.com/llvm/llvm-project/pull/99336
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] IRMemoryMap zero address mapping fix (PR #99045)

2024-07-18 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

I'd describe this patch as handling the case where a remote stub cannot jit 
memory and has a qMemoryRegion info packet which does not specify permissions.  
The patch you reference makes jitted code expressions work, but I think 
IRMemoryMap::FindSpec only needs to find space in the inferior virtual address 
space -- allocate memory -- and that was already working, wasn't it?  Also, 
your before & after packets show that you've got permissions returned for your 
qMemoryRegionInfo responses now, which you don't before -- you won't hit this 
failure because of that change.

One thing I'd say is that this patch is looking for "is this a region with 
read, write, or execute permissions", so it can skip that.  It does this with, 

```
if (region_info.GetReadable() != MemoryRegionInfo::OptionalBool::eNo ||
region_info.GetWritable() != MemoryRegionInfo::OptionalBool::eNo ||
region_info.GetExecutable() !=
MemoryRegionInfo::OptionalBool::eNo) {
ret = region_info.GetRange().GetRangeEnd();
 /// keep iterating
```

but `MemoryRegionInfo::OptionalBool` can be `eDontKnow` which it is here.  I 
think this conditional would be more clearly expressed as

```
   bool all_permissions_unknown = region_info.GetReadable() == 
MemoryRegionInfo::OptionalBool::eDontKnow &&

region_info.GetWritable() == MemoryRegionInfo::OptionalBool::eDontKnow &&
 
region_info.GetExecutable() == MemoryRegionInfo::OptionalBool::eDontKnow;
   bool any_permissions_yes = region_info.GetReadable() == 
MemoryRegionInfo::OptionalBool::eYes

region_info.GetWritable() == MemoryRegionInfo::OptionalBool::eYes
 
region_info.GetExecutable() ==  MemoryRegionInfo::OptionalBool::eYes;
if (all_permissions_unknown || any_permissions_yes)
ret = region_info.GetRange().GetRangeEnd();
 /// keep iterating
```

or more simply, change the while (true) loop to first check if all permissions 
are No in a region,

```
if (region_info.GetReadable() != MemoryRegionInfo::OptionalBool::eNo &&
region_info.GetWritable() != MemoryRegionInfo::OptionalBool::eNo &&
region_info.GetExecutable() !=
MemoryRegionInfo::OptionalBool::eNo) {
   if (ret + size < region_info.GetRange().GetRangeEnd())
return ret;
   else 
 ret = region_info.GetRange().GetRangeEnd();
 // keep searching
```



https://github.com/llvm/llvm-project/pull/99045
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)

2024-07-18 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

A quick look at the RISCV ISA and it says that the JAL instruction is pc 
relative and can jump +/- 1MB.  JALR is also pc-relative but it gets the upper 
20 bits from a general purpose register and it includes 12 low bits in its 
instruction encoding.  I know almost nothing about rv32, but is this what you 
mean by a Large Memory Model, the use of the JALR instruction? I didn't find 
the part that talks about how JALR works in rv64, but it seems likely it can 
specify an arbitrary 64-bit address?

https://github.com/llvm/llvm-project/pull/99336
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)

2024-07-18 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

As for getting to the jitted code, of course lldb sets the pc directly so that 
initial switch from user code to jitted code region is fine.  But getting from 
the jitted wrapper function to the user functions we need to call would require 
JALR instructions?

https://github.com/llvm/llvm-project/pull/99336
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits