[Lldb-commits] [PATCH] D137564: [ARM] Move Triple::getARMCPUForArch into ARMTargetParser

2022-11-09 Thread Tomas Matheson via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG103bbddde66f: [ARM] Move Triple::getARMCPUForArch into 
ARMTargetParser (authored by tmatheson).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137564/new/

https://reviews.llvm.org/D137564

Files:
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  lldb/source/Utility/ArchSpec.cpp
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/Support/ARMTargetParser.h
  llvm/lib/Support/ARMTargetParser.cpp
  llvm/lib/Support/Triple.cpp
  llvm/unittests/ADT/TripleTest.cpp
  llvm/unittests/Support/TargetParserTest.cpp

Index: llvm/unittests/Support/TargetParserTest.cpp
===
--- llvm/unittests/Support/TargetParserTest.cpp
+++ llvm/unittests/Support/TargetParserTest.cpp
@@ -6,12 +6,13 @@
 //
 //===--===//
 
+#include "llvm/Support/TargetParser.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/Support/AArch64TargetParser.h"
 #include "llvm/Support/ARMBuildAttributes.h"
 #include "llvm/Support/FormatVariadic.h"
-#include "llvm/Support/TargetParser.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
@@ -871,6 +872,70 @@
   EXPECT_EQ(5u, ARM::parseArchVersion(ARMArch[i]));
 }
 
+TEST(TargetParserTest, getARMCPUForArch) {
+  // Platform specific defaults.
+  {
+llvm::Triple Triple("arm--nacl");
+EXPECT_EQ("cortex-a8", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("arm--openbsd");
+EXPECT_EQ("cortex-a8", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("armv6-unknown-freebsd");
+EXPECT_EQ("arm1176jzf-s", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("thumbv6-unknown-freebsd");
+EXPECT_EQ("arm1176jzf-s", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("armebv6-unknown-freebsd");
+EXPECT_EQ("arm1176jzf-s", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("arm--win32");
+EXPECT_EQ("cortex-a9", ARM::getARMCPUForArch(Triple));
+EXPECT_EQ("generic", ARM::getARMCPUForArch(Triple, "armv8-a"));
+  }
+  // Some alternative architectures
+  {
+llvm::Triple Triple("armv7k-apple-ios9");
+EXPECT_EQ("cortex-a7", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("armv7k-apple-watchos3");
+EXPECT_EQ("cortex-a7", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("armv7k-apple-tvos9");
+EXPECT_EQ("cortex-a7", ARM::getARMCPUForArch(Triple));
+  }
+  // armeb is permitted, but armebeb is not
+  {
+llvm::Triple Triple("armeb-none-eabi");
+EXPECT_EQ("arm7tdmi", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("armebeb-none-eabi");
+EXPECT_EQ("", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("armebv6eb-none-eabi");
+EXPECT_EQ("", ARM::getARMCPUForArch(Triple));
+  }
+  // xscaleeb is permitted, but armebxscale is not
+  {
+llvm::Triple Triple("xscaleeb-none-eabi");
+EXPECT_EQ("xscale", ARM::getARMCPUForArch(Triple));
+  }
+  {
+llvm::Triple Triple("armebxscale-none-eabi");
+EXPECT_EQ("", ARM::getARMCPUForArch(Triple));
+  }
+}
+
 class AArch64CPUTestFixture
 : public ::testing::TestWithParam {};
 
Index: llvm/unittests/ADT/TripleTest.cpp
===
--- llvm/unittests/ADT/TripleTest.cpp
+++ llvm/unittests/ADT/TripleTest.cpp
@@ -1855,70 +1855,6 @@
 Triple::normalize("aarch64-linux-android21"));
 }
 
-TEST(TripleTest, getARMCPUForArch) {
-  // Platform specific defaults.
-  {
-llvm::Triple Triple("arm--nacl");
-EXPECT_EQ("cortex-a8", Triple.getARMCPUForArch());
-  }
-  {
-llvm::Triple Triple("arm--openbsd");
-EXPECT_EQ("cortex-a8", Triple.getARMCPUForArch());
-  }
-  {
-llvm::Triple Triple("armv6-unknown-freebsd");
-EXPECT_EQ("arm1176jzf-s", Triple.getARMCPUForArch());
-  }
-  {
-llvm::Triple Triple("thumbv6-unknown-freebsd");
-EXPECT_EQ("arm1176jzf-s", Triple.getARMCPUForArch());
-  }
-  {
-llvm::Triple Triple("armebv6-unknown-freebsd");
-EXPECT_EQ("arm1176jzf-s", Triple.getARMCPUForArch());
-  }
-  {
-llvm::Triple Triple("arm--win32");
-EXPECT_EQ("cortex-a9", Triple.getARMCPUForArch());
-EXPECT_EQ("generic", Triple.getARMCPUForArch("armv8-a"));
-  }
-  // Some alternative architectures
-  {
-llvm::Triple Triple("armv7k-apple-ios9");
-EXPECT_EQ("cortex-a7", Triple.getARMCPUForArch());
-  }
-  {
-llvm::Triple Triple("armv7k-apple-watchos3");
-EXPECT_EQ("cortex-a7", Triple.getARMCPUForArch());
-  }
-  {
-llvm::Triple Triple("armv7k-apple-tvos9");
-EXPECT_EQ("cortex-a7", Triple.getARMCPUForArch());
-  }
-  // armeb is permitted, but armebeb is not
-  {
-llvm::Triple Triple("armeb-none-eabi");
-EXPECT_EQ("arm7td

[Lldb-commits] [lldb] 103bbdd - [ARM] Move Triple::getARMCPUForArch into ARMTargetParser

2022-11-09 Thread Tomas Matheson via lldb-commits

Author: Tomas Matheson
Date: 2022-11-09T11:52:35Z
New Revision: 103bbddde66f4157b52c2b6d7532c1dd0dfcaf94

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

LOG: [ARM] Move Triple::getARMCPUForArch into ARMTargetParser

This is very backend specific so either belongs in Toolchains/ARM or in
ARMTargetParser. Since it is used in lldb, ARMTargetParser made more sense.

This is part of an effort to move information about ARM/AArch64 architecture
versions, extensions and CPUs into their respective TargetParsers.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/ARM.cpp
lldb/source/Utility/ArchSpec.cpp
llvm/include/llvm/ADT/Triple.h
llvm/include/llvm/Support/ARMTargetParser.h
llvm/lib/Support/ARMTargetParser.cpp
llvm/lib/Support/Triple.cpp
llvm/unittests/ADT/TripleTest.cpp
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp 
b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
index 67dec7cadada5..bbf466ba847de 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -938,7 +938,7 @@ StringRef arm::getARMCPUForMArch(StringRef Arch, const 
llvm::Triple &Triple) {
 
   // We need to return an empty string here on invalid MArch values as the
   // various places that call this function can't cope with a null result.
-  return Triple.getARMCPUForArch(MArch);
+  return llvm::ARM::getARMCPUForArch(Triple, MArch);
 }
 
 /// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting.
@@ -971,7 +971,8 @@ llvm::ARM::ArchKind arm::getLLVMArchKindForARM(StringRef 
CPU, StringRef Arch,
 if (ArchKind == llvm::ARM::ArchKind::INVALID)
   // In case of generic Arch, i.e. "arm",
   // extract arch from default cpu of the Triple
-  ArchKind = llvm::ARM::parseCPUArch(Triple.getARMCPUForArch(ARMArch));
+  ArchKind =
+  llvm::ARM::parseCPUArch(llvm::ARM::getARMCPUForArch(Triple, 
ARMArch));
   } else {
 // FIXME: horrible hack to get around the fact that Cortex-A7 is only an
 // armv7k triple if it's actually been specified via "-arch armv7k".

diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index 126bedc209232..e1d7ee3ee276d 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -16,6 +16,7 @@
 #include "llvm/BinaryFormat/COFF.h"
 #include "llvm/BinaryFormat/ELF.h"
 #include "llvm/BinaryFormat/MachO.h"
+#include "llvm/Support/ARMTargetParser.h"
 #include "llvm/Support/Compiler.h"
 
 using namespace lldb;
@@ -638,7 +639,7 @@ std::string ArchSpec::GetClangTargetCPU() const {
   }
 
   if (GetTriple().isARM())
-cpu = GetTriple().getARMCPUForArch("").str();
+cpu = llvm::ARM::getARMCPUForArch(GetTriple(), "").str();
   return cpu;
 }
 

diff  --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index dc96398dba999..5aba2730c5a8b 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -1024,12 +1024,6 @@ class Triple {
   ///  architecture if no such variant can be found.
   llvm::Triple getLittleEndianArchVariant() const;
 
-  /// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
-  ///
-  /// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
-  /// string then the triple's arch name is used.
-  StringRef getARMCPUForArch(StringRef Arch = StringRef()) const;
-
   /// Tests whether the target triple is little endian.
   ///
   /// \returns true if the triple is little endian, false otherwise.

diff  --git a/llvm/include/llvm/Support/ARMTargetParser.h 
b/llvm/include/llvm/Support/ARMTargetParser.h
index 5fb4090395c07..32cc31db5936a 100644
--- a/llvm/include/llvm/Support/ARMTargetParser.h
+++ b/llvm/include/llvm/Support/ARMTargetParser.h
@@ -296,6 +296,12 @@ unsigned parseArchVersion(StringRef Arch);
 void fillValidCPUArchList(SmallVectorImpl &Values);
 StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU);
 
+/// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
+///
+/// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
+/// string then the triple's arch name is used.
+StringRef getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch = {});
+
 } // namespace ARM
 } // namespace llvm
 

diff  --git a/llvm/lib/Support/ARMTargetParser.cpp 
b/llvm/lib/Support/ARMTargetParser.cpp
index a68244a5e38af..43cbb409b0f04 100644
--- a/llvm/lib/Support/ARMTargetParser.cpp
+++ b/llvm/lib/Support/ARMTargetParser.cpp
@@ -643,3 +643,72 @@ StringRef ARM::computeDefaultTargetABI(const Triple &TT, 
StringRef CPU) {
 return "aapcs";
   }
 }
+
+StringRef ARM::getARMC

[Lldb-commits] [PATCH] D137684: Make sure we are stopped before we try to install functions into the target

2022-11-09 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

This looks good to me, I like all of the added error messages in 
`FunctionCaller::WriteFunctionWrapper` in particular.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137684/new/

https://reviews.llvm.org/D137684

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


[Lldb-commits] [lldb] 1ca03a5 - Rename unique-types2/TestUniqueTypes.py to TestUniqueTypes2.py

2022-11-09 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2022-11-09T09:21:13-08:00
New Revision: 1ca03a5d591052b9f3f1571218eb04f2fb1d8a68

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

LOG: Rename unique-types2/TestUniqueTypes.py to TestUniqueTypes2.py

lang/cpp/unique-types/TestUniqueTypes.py already exists.

Added: 
lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes2.py

Modified: 


Removed: 
lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py



diff  --git a/lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py 
b/lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes2.py
similarity index 99%
rename from lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
rename to lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes2.py
index 8d04871f817e3..0fe078b2d1e3a 100644
--- a/lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
+++ b/lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes2.py
@@ -7,7 +7,7 @@
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
-class UniqueTypesTestCase(TestBase):
+class UniqueTypesTestCase2(TestBase):
 def do_test(self, debug_flags):
 """Test that we only display the requested Foo instantiation, not all 
Foo instantiations."""
 self.build(dictionary=debug_flags)



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


[Lldb-commits] [PATCH] D137682: Change IRMemoryMap's last-resort magic address to an inaddressable address so it doesn't conflict

2022-11-09 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda updated this revision to Diff 474297.
jasonmolenda added a comment.

Update the test to check all three members of the struct can be read at the 
different memory addresses, and CAN'T be read when it overlaps with 
IRMemoryMap's special address.  This final test, where we test that the values 
can't be accessed at this inaddressable location, is really only there to keep 
the test and IRMemoryMap in sync - if anyone changes how IRMemoryMap::FindSpace 
works with this setup, the test result changing will flag that this test needs 
to be revisited.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137682/new/

https://reviews.llvm.org/D137682

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Expression/IRMemoryMap.cpp
  lldb/test/API/lang/c/high-mem-global/Makefile
  lldb/test/API/lang/c/high-mem-global/TestHighMemGlobal.py
  lldb/test/API/lang/c/high-mem-global/main.c

Index: lldb/test/API/lang/c/high-mem-global/main.c
===
--- /dev/null
+++ lldb/test/API/lang/c/high-mem-global/main.c
@@ -0,0 +1,9 @@
+
+struct mystruct {
+  int c, d, e;
+} global = {1, 2, 3};
+
+int main ()
+{
+  return global.c; // break here
+}
Index: lldb/test/API/lang/c/high-mem-global/TestHighMemGlobal.py
===
--- /dev/null
+++ lldb/test/API/lang/c/high-mem-global/TestHighMemGlobal.py
@@ -0,0 +1,62 @@
+"""Look that lldb can display a global loaded in high memory at an addressable address."""
+
+
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+
+class TestHighMemGlobal(TestBase):
+
+NO_DEBUG_INFO_TESTCASE = True
+
+@skipUnlessDarwin  # hardcoding of __DATA segment name
+def test_command_line(self):
+"""Test that we can display a global variable loaded in high memory."""
+self.build()
+
+exe = self.getBuildArtifact("a.out")
+err = lldb.SBError()
+
+target = self.dbg.CreateTarget(exe, '', '', False, err)
+self.assertTrue(target.IsValid())
+module = target.GetModuleAtIndex(0)
+self.assertTrue(module.IsValid())
+data_segment = module.FindSection("__DATA")
+self.assertTrue(data_segment.IsValid())
+err.Clear()
+
+self.expect("p global.c", substrs=[' = 1'])
+self.expect("p global.d", substrs=[' = 2'])
+self.expect("p global.e", substrs=[' = 3'])
+
+err = target.SetSectionLoadAddress(data_segment, 0x)
+self.assertTrue(err.Success())
+self.expect("p global.c", substrs=[' = 1'])
+self.expect("p global.d", substrs=[' = 2'])
+self.expect("p global.e", substrs=[' = 3'])
+
+err = target.SetSectionLoadAddress(data_segment, 0x08814000)
+self.assertTrue(err.Success())
+self.expect("p global.c", substrs=[' = 1'])
+self.expect("p global.d", substrs=[' = 2'])
+self.expect("p global.e", substrs=[' = 3'])
+
+# This is an address in IRMemoryMap::FindSpace where it has an 
+# lldb-side buffer of memory that's used in IR interpreters when
+# memory cannot be allocated in the inferior / functions cannot
+# be jitted.
+err = target.SetSectionLoadAddress(data_segment, 0xdead0fff)
+self.assertTrue(err.Success())
+
+# The global variable `global` is now overlayed by this 
+# IRMemoryMap special buffer, and now we cannot see the variable.
+# If the IRInterpreter some day is able to distinguish between
+# an addr_t in its IRMemoryMap local buffer versus inferior process
+# memory, this test would no longer pass.  We may have uninitialized
+# data in the IRMemoryMap local buffer and one of the values could
+# come back as "correct" by chance - pass if any of them doesn't match.
+self.runCmd("p int $global_c = global.c")
+self.runCmd("p int $global_d = global.d")
+self.runCmd("p int $global_e = global.e")
+self.expect("p $global_c != 1 || $global_d != 2 || $global_e != 3", substrs=[' = true'])
Index: lldb/test/API/lang/c/high-mem-global/Makefile
===
--- /dev/null
+++ lldb/test/API/lang/c/high-mem-global/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
Index: lldb/source/Expression/IRMemoryMap.cpp
===
--- lldb/source/Expression/IRMemoryMap.cpp
+++ lldb/source/Expression/IRMemoryMap.cpp
@@ -143,7 +143,7 @@
 if (address_byte_size != UINT32_MAX) {
   switch (address_byte_size) {
   case 8:
-ret = 0xull;
+ret = 0xdead0fffull;
 break;
   case 4:
 ret = 0xee00ull;
Index: lldb/source/Expression/DWARFExpre

[Lldb-commits] [lldb] b565e7f - Don't try to create Expressions when the process is running.

2022-11-09 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2022-11-09T10:07:09-08:00
New Revision: b565e7f0c4cb1768f6c43499aed95adb8cc4f04a

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

LOG: Don't try to create Expressions when the process is running.

We generally prohibit this at a higher level - for instance requiring
the process to be stopped for "expr".  But when we trigger an expression
for internal purposes (e.g. to fetch types from the ObjC runtime) we weren't
checking the process state.  Now we explicitly check this at the very start
of the job so we don't get into bad states.

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

Added: 


Modified: 
lldb/source/Expression/FunctionCaller.cpp
lldb/source/Expression/UserExpression.cpp
lldb/source/Expression/UtilityFunction.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/source/Expression/FunctionCaller.cpp 
b/lldb/source/Expression/FunctionCaller.cpp
index 58c9d56b089c0..ffadbf9b32ec5 100644
--- a/lldb/source/Expression/FunctionCaller.cpp
+++ b/lldb/source/Expression/FunctionCaller.cpp
@@ -66,17 +66,31 @@ bool FunctionCaller::WriteFunctionWrapper(
 ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager) {
   Process *process = exe_ctx.GetProcessPtr();
 
-  if (!process)
+  if (!process) {
+diagnostic_manager.Printf(eDiagnosticSeverityError, "no process.");
 return false;
-
+  }
+  
   lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
 
-  if (process != jit_process_sp.get())
+  if (process != jit_process_sp.get()) {
+diagnostic_manager.Printf(eDiagnosticSeverityError,
+ "process does not match the stored process.");
 return false;
-
-  if (!m_compiled)
+  }
+
+  if (process->GetState() != lldb::eStateStopped) {
+diagnostic_manager.Printf(eDiagnosticSeverityError, 
+  "process is not stopped");
 return false;
+  }
 
+  if (!m_compiled) {
+diagnostic_manager.Printf(eDiagnosticSeverityError, 
+  "function not compiled");
+return false;
+  }
+  
   if (m_JITted)
 return true;
 
@@ -213,6 +227,17 @@ bool FunctionCaller::WriteFunctionArguments(
 bool FunctionCaller::InsertFunction(ExecutionContext &exe_ctx,
 lldb::addr_t &args_addr_ref,
 DiagnosticManager &diagnostic_manager) {
+  // Since we might need to call allocate memory and maybe call code to make
+  // the caller, we need to be stopped.
+  Process *process = exe_ctx.GetProcessPtr();
+  if (!process) {
+diagnostic_manager.PutString(eDiagnosticSeverityError, "no process");
+return false;
+  }
+  if (process->GetState() != lldb::eStateStopped) {
+diagnostic_manager.PutString(eDiagnosticSeverityError, "process running");
+return false;
+  }
   if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0)
 return false;
   if (!WriteFunctionWrapper(exe_ctx, diagnostic_manager))

diff  --git a/lldb/source/Expression/UserExpression.cpp 
b/lldb/source/Expression/UserExpression.cpp
index 186e414e68793..c1515b0ace817 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -194,16 +194,22 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
 
   Process *process = exe_ctx.GetProcessPtr();
 
-  if (process == nullptr || process->GetState() != lldb::eStateStopped) {
-if (execution_policy == eExecutionPolicyAlways) {
-  LLDB_LOG(log, "== [UserExpression::Evaluate] Expression may not run, but 
"
-"is not constant ==");
+  if (process == nullptr && execution_policy == eExecutionPolicyAlways) {
+LLDB_LOG(log, "== [UserExpression::Evaluate] No process, but the policy is 
"
+  "eExecutionPolicyAlways");
 
-  error.SetErrorString("expression needed to run but couldn't");
+error.SetErrorString("expression needed to run but couldn't: no process");
 
-  return execution_results;
-}
+return execution_results;
   }
+  // Since we might need to call allocate memory and maybe call code to make
+  // the caller, we need to be stopped.
+  if (process != nullptr && process->GetState() != lldb::eStateStopped) {
+error.SetErrorString("Can't make a function caller while the process is " 
+  "running");
+return execution_results;
+  }
+
 
   // Explicitly force the IR interpreter to evaluate the expression when the
   // there is no process that supports running the expression for us. Don't

diff  --git a/lldb/source/Expression/UtilityFunction.cpp 
b/lldb/source/Expression/UtilityFunction.cpp
index 1a4df97227065..5d55d9a5c2c1d 100644
--

[Lldb-commits] [PATCH] D137684: Make sure we are stopped before we try to install functions into the target

2022-11-09 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb565e7f0c4cb: Don't try to create Expressions when the 
process is running. (authored by jingham).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137684/new/

https://reviews.llvm.org/D137684

Files:
  lldb/source/Expression/FunctionCaller.cpp
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/source/Target/Process.cpp

Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1293,7 +1293,10 @@
 }
 
 StateType Process::GetState() {
-  return m_public_state.GetValue();
+  if (CurrentThreadIsPrivateStateThread())
+return m_private_state.GetValue();
+  else
+return m_public_state.GetValue();
 }
 
 void Process::SetPublicState(StateType new_state, bool restarted) {
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -99,6 +99,12 @@
 return false;
   }
 
+  // Since we might need to call allocate memory and maybe call code to make
+  // the caller, we need to be stopped.
+  if (process->GetState() != lldb::eStateStopped) {
+diagnostic_manager.PutString(eDiagnosticSeverityError, "process running");
+return false;
+  }
   //
   // Parse the expression
   //
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -64,6 +64,13 @@
 error.SetErrorString("Can't make a function caller without a process.");
 return nullptr;
   }
+  // Since we might need to call allocate memory and maybe call code to make
+  // the caller, we need to be stopped.
+  if (process_sp->GetState() != lldb::eStateStopped) {
+error.SetErrorString("Can't make a function caller while the process is " 
+ "running");
+return nullptr;
+  }
 
   Address impl_code_address;
   impl_code_address.SetOffset(StartAddress());
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -194,16 +194,22 @@
 
   Process *process = exe_ctx.GetProcessPtr();
 
-  if (process == nullptr || process->GetState() != lldb::eStateStopped) {
-if (execution_policy == eExecutionPolicyAlways) {
-  LLDB_LOG(log, "== [UserExpression::Evaluate] Expression may not run, but "
-"is not constant ==");
+  if (process == nullptr && execution_policy == eExecutionPolicyAlways) {
+LLDB_LOG(log, "== [UserExpression::Evaluate] No process, but the policy is "
+  "eExecutionPolicyAlways");
 
-  error.SetErrorString("expression needed to run but couldn't");
+error.SetErrorString("expression needed to run but couldn't: no process");
 
-  return execution_results;
-}
+return execution_results;
   }
+  // Since we might need to call allocate memory and maybe call code to make
+  // the caller, we need to be stopped.
+  if (process != nullptr && process->GetState() != lldb::eStateStopped) {
+error.SetErrorString("Can't make a function caller while the process is " 
+  "running");
+return execution_results;
+  }
+
 
   // Explicitly force the IR interpreter to evaluate the expression when the
   // there is no process that supports running the expression for us. Don't
Index: lldb/source/Expression/FunctionCaller.cpp
===
--- lldb/source/Expression/FunctionCaller.cpp
+++ lldb/source/Expression/FunctionCaller.cpp
@@ -66,17 +66,31 @@
 ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager) {
   Process *process = exe_ctx.GetProcessPtr();
 
-  if (!process)
+  if (!process) {
+diagnostic_manager.Printf(eDiagnosticSeverityError, "no process.");
 return false;
-
+  }
+  
   lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
 
-  if (process != jit_process_sp.get())
+  if (process != jit_process_sp.get()) {
+diagnostic_manager.Printf(eDiagnosticSeverityError,
+ "process does not match the stored process.");
 return false;
-
-  if (!m_compiled)
+  }
+
+  if (process->GetState() != lldb::eStateStopped) {
+diagnostic_manager.Printf(eDiagnosticSeverityError, 
+  "process is not stopped");
 return false;
+  }
 
+  if (!m_compiled) {
+diagnostic_manage

[Lldb-commits] [lldb] d518ed4 - Handle aliasing a non-top-level command.

2022-11-09 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2022-11-09T10:11:16-08:00
New Revision: d518ed42ae85786c371fd4578f72ab7eb286cb30

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

LOG: Handle aliasing a non-top-level command.

This didn't work previously because we had to check whether the incoming
command was an alias command, but if it wasn't we still used the result
of that lookup - which was by the command's node name.  That fails for
non-top-level commands.  In this case, the resolution is pretty simple since
we already have the node's CommandObject, so all we needed to do was turn
it into a shared pointer, for which I added enable_shared_from_this to the
CommandObject.

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

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandObject.h
lldb/source/Commands/CommandObjectCommands.cpp
lldb/test/API/commands/command/container/TestContainerCommands.py

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandObject.h 
b/lldb/include/lldb/Interpreter/CommandObject.h
index ad5884e207a17..fc058eb50a5e5 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -10,6 +10,7 @@
 #define LLDB_INTERPRETER_COMMANDOBJECT_H
 
 #include 
+#include 
 #include 
 #include 
 
@@ -64,7 +65,7 @@ size_t FindLongestCommandWord(std::map &dict) {
   return max_len;
 }
 
-class CommandObject {
+class CommandObject : public std::enable_shared_from_this {
 public:
   typedef llvm::StringRef(ArgumentHelpCallbackFunction)();
 

diff  --git a/lldb/source/Commands/CommandObjectCommands.cpp 
b/lldb/source/Commands/CommandObjectCommands.cpp
index 3d4893de29f69..9bf07f3eba780 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -485,29 +485,31 @@ rather than using a positional placeholder:"
 OptionArgVectorSP(new OptionArgVector);
 
 const bool include_aliases = true;
-if (CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact(
-cmd_obj.GetCommandName(), include_aliases)) {
-  if (m_interpreter.AliasExists(alias_command) ||
-  m_interpreter.UserCommandExists(alias_command)) {
-result.AppendWarningWithFormat(
-"Overwriting existing definition for '%s'.\n",
-alias_command.str().c_str());
-  }
-  if (CommandAlias *alias = m_interpreter.AddAlias(
-  alias_command, cmd_obj_sp, raw_command_string)) {
-if (m_command_options.m_help.OptionWasSet())
-  alias->SetHelp(m_command_options.m_help.GetCurrentValue());
-if (m_command_options.m_long_help.OptionWasSet())
-  alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
-result.SetStatus(eReturnStatusSuccessFinishNoResult);
-  } else {
-result.AppendError("Unable to create requested alias.\n");
-  }
+// Look up the command using command's name first.  This is to resolve
+// aliases when you are making nested aliases.  But if you don't find
+// it that way, then it wasn't an alias and we can just use the object
+// we were passed in.
+CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact(
+cmd_obj.GetCommandName(), include_aliases);
+if (!cmd_obj_sp)
+  cmd_obj_sp = cmd_obj.shared_from_this();
 
+if (m_interpreter.AliasExists(alias_command) ||
+m_interpreter.UserCommandExists(alias_command)) {
+  result.AppendWarningWithFormat(
+  "Overwriting existing definition for '%s'.\n",
+  alias_command.str().c_str());
+}
+if (CommandAlias *alias = m_interpreter.AddAlias(
+alias_command, cmd_obj_sp, raw_command_string)) {
+  if (m_command_options.m_help.OptionWasSet())
+alias->SetHelp(m_command_options.m_help.GetCurrentValue());
+  if (m_command_options.m_long_help.OptionWasSet())
+alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
+  result.SetStatus(eReturnStatusSuccessFinishNoResult);
 } else {
   result.AppendError("Unable to create requested alias.\n");
 }
-
 return result.Succeeded();
   }
 

diff  --git a/lldb/test/API/commands/command/container/TestContainerCommands.py 
b/lldb/test/API/commands/command/container/TestContainerCommands.py
index 2267b3528a558..76f981c7dd2af 100644
--- a/lldb/test/API/commands/command/container/TestContainerCommands.py
+++ b/lldb/test/API/commands/command/container/TestContainerCommands.py
@@ -55,6 +55,12 @@ def container_add(self):
 self.expect("test-multi test-multi-sub welcome friend", "Test command 
works",
 substrs=["Hello friend, welcome to LLDB"])
 
+# Make sure we can make an alias to this:
+self.runCmd("c

[Lldb-commits] [PATCH] D137662: Make aliases from a raw command that isn't a top-level command work

2022-11-09 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd518ed42ae85: Handle aliasing a non-top-level command. 
(authored by jingham).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137662/new/

https://reviews.llvm.org/D137662

Files:
  lldb/include/lldb/Interpreter/CommandObject.h
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/test/API/commands/command/container/TestContainerCommands.py


Index: lldb/test/API/commands/command/container/TestContainerCommands.py
===
--- lldb/test/API/commands/command/container/TestContainerCommands.py
+++ lldb/test/API/commands/command/container/TestContainerCommands.py
@@ -55,6 +55,12 @@
 self.expect("test-multi test-multi-sub welcome friend", "Test command 
works",
 substrs=["Hello friend, welcome to LLDB"])
 
+# Make sure we can make an alias to this:
+self.runCmd("command alias my-welcome test-multi test-multi-sub 
welcome", "We can make an alias to multi-word")
+self.expect("my-welcome friend", "Test command works",
+substrs=["Hello friend, welcome to LLDB"])
+self.runCmd("command unalias my-welcome")
+
 # Make sure overwriting works on the leaf command.  First using the
 # explicit option so we should not be able to remove extant commands 
by default:
 
Index: lldb/source/Commands/CommandObjectCommands.cpp
===
--- lldb/source/Commands/CommandObjectCommands.cpp
+++ lldb/source/Commands/CommandObjectCommands.cpp
@@ -485,29 +485,31 @@
 OptionArgVectorSP(new OptionArgVector);
 
 const bool include_aliases = true;
-if (CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact(
-cmd_obj.GetCommandName(), include_aliases)) {
-  if (m_interpreter.AliasExists(alias_command) ||
-  m_interpreter.UserCommandExists(alias_command)) {
-result.AppendWarningWithFormat(
-"Overwriting existing definition for '%s'.\n",
-alias_command.str().c_str());
-  }
-  if (CommandAlias *alias = m_interpreter.AddAlias(
-  alias_command, cmd_obj_sp, raw_command_string)) {
-if (m_command_options.m_help.OptionWasSet())
-  alias->SetHelp(m_command_options.m_help.GetCurrentValue());
-if (m_command_options.m_long_help.OptionWasSet())
-  alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
-result.SetStatus(eReturnStatusSuccessFinishNoResult);
-  } else {
-result.AppendError("Unable to create requested alias.\n");
-  }
+// Look up the command using command's name first.  This is to resolve
+// aliases when you are making nested aliases.  But if you don't find
+// it that way, then it wasn't an alias and we can just use the object
+// we were passed in.
+CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact(
+cmd_obj.GetCommandName(), include_aliases);
+if (!cmd_obj_sp)
+  cmd_obj_sp = cmd_obj.shared_from_this();
 
+if (m_interpreter.AliasExists(alias_command) ||
+m_interpreter.UserCommandExists(alias_command)) {
+  result.AppendWarningWithFormat(
+  "Overwriting existing definition for '%s'.\n",
+  alias_command.str().c_str());
+}
+if (CommandAlias *alias = m_interpreter.AddAlias(
+alias_command, cmd_obj_sp, raw_command_string)) {
+  if (m_command_options.m_help.OptionWasSet())
+alias->SetHelp(m_command_options.m_help.GetCurrentValue());
+  if (m_command_options.m_long_help.OptionWasSet())
+alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
+  result.SetStatus(eReturnStatusSuccessFinishNoResult);
 } else {
   result.AppendError("Unable to create requested alias.\n");
 }
-
 return result.Succeeded();
   }
 
Index: lldb/include/lldb/Interpreter/CommandObject.h
===
--- lldb/include/lldb/Interpreter/CommandObject.h
+++ lldb/include/lldb/Interpreter/CommandObject.h
@@ -10,6 +10,7 @@
 #define LLDB_INTERPRETER_COMMANDOBJECT_H
 
 #include 
+#include 
 #include 
 #include 
 
@@ -64,7 +65,7 @@
   return max_len;
 }
 
-class CommandObject {
+class CommandObject : public std::enable_shared_from_this {
 public:
   typedef llvm::StringRef(ArgumentHelpCallbackFunction)();
 


Index: lldb/test/API/commands/command/container/TestContainerCommands.py
===
--- lldb/test/API/commands/command/container/TestContainerCommands.py
+++ lldb/test/API/commands/command/container/TestContainerCommands.py
@@ -55,6 +55,12 @@
 self.expect("test-multi test-multi-sub welcome friend", "Test command works",
 substrs=["Hello friend, welcome to LLDB"])

[Lldb-commits] [PATCH] D137583: [lldb] Fix simple template names and template params with scope qualifiers

2022-11-09 Thread Aaron Ballman via Phabricator via lldb-commits
aaron.ballman added a comment.

> ...we expect template params to be fully qualified when comparing them for 
> simple template names

So lldb is not inspecting the AST, they're doing reflection (of a sort) on the 
pretty printed names? Or am I misunderstanding something?




Comment at: clang/include/clang/AST/PrettyPrinter.h:134
+  /// When SuppressScope is true, do not apply it to template parameters.
+  unsigned NoSuppressTemplateParamsScope : 1;
+

I think this should be expressed in the positive rather than in the negative 
(`SuppressTemplateParamScope`) so it's consistent with the rest of the options.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137583/new/

https://reviews.llvm.org/D137583

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


[Lldb-commits] [lldb] 5905246 - Move googletest to the third-party directory

2022-11-09 Thread Tom Stellard via lldb-commits

Author: Tom Stellard
Date: 2022-11-09T11:10:26-08:00
New Revision: 59052468c3e38cab15582cefbb5133fd4c2ffce5

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

LOG: Move googletest to the third-party directory

This will help improve the project's layering, so that sub-projects
that don't actually need any llvm code can still use googletest
without having to reference code in the llvm directory.

This will also make it easier to consolidate and simplify the standalone
build configurations.

Reviewed By: stellaraccident, lattner, probinson, phosek

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

Added: 
third-party/unittest/CMakeLists.txt
third-party/unittest/UnitTestMain/CMakeLists.txt
third-party/unittest/UnitTestMain/TestMain.cpp
third-party/unittest/googlemock/LICENSE.txt
third-party/unittest/googlemock/README.LLVM
third-party/unittest/googlemock/include/gmock/gmock-actions.h
third-party/unittest/googlemock/include/gmock/gmock-cardinalities.h
third-party/unittest/googlemock/include/gmock/gmock-function-mocker.h
third-party/unittest/googlemock/include/gmock/gmock-generated-actions.h

third-party/unittest/googlemock/include/gmock/gmock-generated-function-mockers.h
third-party/unittest/googlemock/include/gmock/gmock-generated-matchers.h
third-party/unittest/googlemock/include/gmock/gmock-matchers.h
third-party/unittest/googlemock/include/gmock/gmock-more-actions.h
third-party/unittest/googlemock/include/gmock/gmock-more-matchers.h
third-party/unittest/googlemock/include/gmock/gmock-nice-strict.h
third-party/unittest/googlemock/include/gmock/gmock-spec-builders.h
third-party/unittest/googlemock/include/gmock/gmock.h

third-party/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h

third-party/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h
third-party/unittest/googlemock/include/gmock/internal/custom/gmock-port.h

third-party/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h
third-party/unittest/googlemock/include/gmock/internal/gmock-port.h
third-party/unittest/googlemock/include/gmock/internal/gmock-pp.h
third-party/unittest/googlemock/src/gmock-all.cc
third-party/unittest/googlemock/src/gmock-cardinalities.cc
third-party/unittest/googlemock/src/gmock-internal-utils.cc
third-party/unittest/googlemock/src/gmock-matchers.cc
third-party/unittest/googlemock/src/gmock-spec-builders.cc
third-party/unittest/googlemock/src/gmock.cc
third-party/unittest/googletest/LICENSE.TXT
third-party/unittest/googletest/README.LLVM
third-party/unittest/googletest/include/gtest/gtest-death-test.h
third-party/unittest/googletest/include/gtest/gtest-matchers.h
third-party/unittest/googletest/include/gtest/gtest-message.h
third-party/unittest/googletest/include/gtest/gtest-param-test.h
third-party/unittest/googletest/include/gtest/gtest-printers.h
third-party/unittest/googletest/include/gtest/gtest-spi.h
third-party/unittest/googletest/include/gtest/gtest-test-part.h
third-party/unittest/googletest/include/gtest/gtest-typed-test.h
third-party/unittest/googletest/include/gtest/gtest.h
third-party/unittest/googletest/include/gtest/gtest_pred_impl.h
third-party/unittest/googletest/include/gtest/gtest_prod.h
third-party/unittest/googletest/include/gtest/internal/custom/gtest-port.h

third-party/unittest/googletest/include/gtest/internal/custom/gtest-printers.h
third-party/unittest/googletest/include/gtest/internal/custom/gtest.h
third-party/unittest/googletest/include/gtest/internal/custom/raw-ostream.h

third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h
third-party/unittest/googletest/include/gtest/internal/gtest-filepath.h
third-party/unittest/googletest/include/gtest/internal/gtest-internal.h
third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h
third-party/unittest/googletest/include/gtest/internal/gtest-port-arch.h
third-party/unittest/googletest/include/gtest/internal/gtest-port.h
third-party/unittest/googletest/include/gtest/internal/gtest-string.h
third-party/unittest/googletest/include/gtest/internal/gtest-type-util.h
third-party/unittest/googletest/src/gtest-all.cc
third-party/unittest/googletest/src/gtest-death-test.cc
third-party/unittest/googletest/src/gtest-filepath.cc
third-party/unittest/googletest/src/gtest-internal-inl.h
third-party/unittest/googletest/src/gtest-matchers.cc
third-party/unittest/googletest/src/gtest-port.cc
third-party/unittest/googletest/src/gtest-printers.cc
third-party/unittest/googletest/src/gtest-test-part.cc
third-party/unittest/googletest/src/gtest-typed-test.cc
third-party/unittest/google

[Lldb-commits] [PATCH] D137583: [lldb] Fix simple template names and template params with scope qualifiers

2022-11-09 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added a comment.

In D137583#3917706 , @aaron.ballman 
wrote:

>> ...we expect template params to be fully qualified when comparing them for 
>> simple template names
>
> So lldb is not inspecting the AST, they're doing reflection (of a sort) on 
> the pretty printed names? Or am I misunderstanding something?

Not reflection as such - but building names for the user, but partly from the 
AST - basically LLDB wants to be able to produce the same name that CGDebugInfo 
produces - so, maybe it should produce it the same way as CGDebugInfo, which 
isn't to use the pretty printer from scratch.

@aeubanks would this work for lldb's use case? 
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGDebugInfo.cpp#L5229
 it'd be identical to the original debug info generation, and looks like it 
doesn't require a printing policy change/feature. Sorry I didn't think of that 
earlier. I guess since `Qualified` would be `false` for lldb's use case, you 
could go down into the implementation and just call the unqualified side 
directly: `NamedDecl::printName(OS, Policy);` should print it unqualified for 
this name, but respect the qualified printing policy flag for any nested names, 
parameters, etc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137583/new/

https://reviews.llvm.org/D137583

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


[Lldb-commits] [lldb] 8a084f6 - Revert "Move googletest to the third-party directory"

2022-11-09 Thread Tom Stellard via lldb-commits

Author: Tom Stellard
Date: 2022-11-09T11:34:59-08:00
New Revision: 8a084f68c8a1cac99d9fa0fbcf490b53ab3b6e0c

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

LOG: Revert "Move googletest to the third-party directory"

This reverts commit 59052468c3e38cab15582cefbb5133fd4c2ffce5.

It looks like this patch breaks the build when compiler-rt is passed to
LLVM_ENABLE_PROJECTS instead of LLVM_ENABLE_RUNTIMES.

Added: 
llvm/utils/unittest/CMakeLists.txt
llvm/utils/unittest/UnitTestMain/CMakeLists.txt
llvm/utils/unittest/UnitTestMain/TestMain.cpp
llvm/utils/unittest/googlemock/LICENSE.txt
llvm/utils/unittest/googlemock/README.LLVM
llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h
llvm/utils/unittest/googlemock/include/gmock/gmock-cardinalities.h
llvm/utils/unittest/googlemock/include/gmock/gmock-function-mocker.h
llvm/utils/unittest/googlemock/include/gmock/gmock-generated-actions.h

llvm/utils/unittest/googlemock/include/gmock/gmock-generated-function-mockers.h
llvm/utils/unittest/googlemock/include/gmock/gmock-generated-matchers.h
llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
llvm/utils/unittest/googlemock/include/gmock/gmock-more-actions.h
llvm/utils/unittest/googlemock/include/gmock/gmock-more-matchers.h
llvm/utils/unittest/googlemock/include/gmock/gmock-nice-strict.h
llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h
llvm/utils/unittest/googlemock/include/gmock/gmock.h

llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h

llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-matchers.h
llvm/utils/unittest/googlemock/include/gmock/internal/custom/gmock-port.h
llvm/utils/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h
llvm/utils/unittest/googlemock/include/gmock/internal/gmock-port.h
llvm/utils/unittest/googlemock/include/gmock/internal/gmock-pp.h
llvm/utils/unittest/googlemock/src/gmock-all.cc
llvm/utils/unittest/googlemock/src/gmock-cardinalities.cc
llvm/utils/unittest/googlemock/src/gmock-internal-utils.cc
llvm/utils/unittest/googlemock/src/gmock-matchers.cc
llvm/utils/unittest/googlemock/src/gmock-spec-builders.cc
llvm/utils/unittest/googlemock/src/gmock.cc
llvm/utils/unittest/googletest/LICENSE.TXT
llvm/utils/unittest/googletest/README.LLVM
llvm/utils/unittest/googletest/include/gtest/gtest-death-test.h
llvm/utils/unittest/googletest/include/gtest/gtest-matchers.h
llvm/utils/unittest/googletest/include/gtest/gtest-message.h
llvm/utils/unittest/googletest/include/gtest/gtest-param-test.h
llvm/utils/unittest/googletest/include/gtest/gtest-printers.h
llvm/utils/unittest/googletest/include/gtest/gtest-spi.h
llvm/utils/unittest/googletest/include/gtest/gtest-test-part.h
llvm/utils/unittest/googletest/include/gtest/gtest-typed-test.h
llvm/utils/unittest/googletest/include/gtest/gtest.h
llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h
llvm/utils/unittest/googletest/include/gtest/gtest_prod.h
llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-port.h

llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h
llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest.h
llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h

llvm/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-filepath.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-internal.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-string.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-type-util.h
llvm/utils/unittest/googletest/src/gtest-all.cc
llvm/utils/unittest/googletest/src/gtest-death-test.cc
llvm/utils/unittest/googletest/src/gtest-filepath.cc
llvm/utils/unittest/googletest/src/gtest-internal-inl.h
llvm/utils/unittest/googletest/src/gtest-matchers.cc
llvm/utils/unittest/googletest/src/gtest-port.cc
llvm/utils/unittest/googletest/src/gtest-printers.cc
llvm/utils/unittest/googletest/src/gtest-test-part.cc
llvm/utils/unittest/googletest/src/gtest-typed-test.cc
llvm/utils/unittest/googletest/src/gtest.cc

Modified: 
clang/CMakeLists.txt
compiler-rt/CMakeLists.txt
lld/CMakeLists.txt
lldb/cmake/modules/LLDBStandalone.cmake
llvm/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
mlir/CMakeLists.txt
polly/CMakeLis

[Lldb-commits] [lldb] 97842fc - [LLDB] Add LoongArch software breakpoint trap opcode

2022-11-09 Thread Weining Lu via lldb-commits

Author: Teizhu Yang
Date: 2022-11-10T13:49:11+08:00
New Revision: 97842fcba9e3a3fa4db52a47215641f9141fea63

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

LOG: [LLDB] Add LoongArch software breakpoint trap opcode

Use `break 0x5` for LoongArch software breakpoint traps.
The magic number 0x5 means `BRK_SSTEPBP` as defined in
the kernel header `asm/break.h` on LoongArch.

Reviewed By: SixWeining, xen0n

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

Added: 


Modified: 
lldb/source/Host/common/NativeProcessProtocol.cpp
lldb/source/Target/Platform.cpp

Removed: 




diff  --git a/lldb/source/Host/common/NativeProcessProtocol.cpp 
b/lldb/source/Host/common/NativeProcessProtocol.cpp
index cdb59842e658b..21f382da2f229 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -507,6 +507,8 @@ 
NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
   static const uint8_t g_ppcle_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
   static const uint8_t g_riscv_opcode[] = {0x73, 0x00, 0x10, 0x00}; // ebreak
   static const uint8_t g_riscv_opcode_c[] = {0x02, 0x90};   // c.ebreak
+  static const uint8_t g_loongarch_opcode[] = {0x05, 0x00, 0x2a,
+   0x00}; // break 0x5
 
   switch (GetArchitecture().GetMachine()) {
   case llvm::Triple::aarch64:
@@ -541,6 +543,10 @@ 
NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
   : llvm::makeArrayRef(g_riscv_opcode);
   }
 
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64:
+return llvm::makeArrayRef(g_loongarch_opcode);
+
   default:
 return llvm::createStringError(llvm::inconvertibleErrorCode(),
"CPU type not supported!");
@@ -567,6 +573,8 @@ size_t 
NativeProcessProtocol::GetSoftwareBreakpointPCOffset() {
   case llvm::Triple::ppc64le:
   case llvm::Triple::riscv32:
   case llvm::Triple::riscv64:
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64:
 // On these architectures the PC doesn't get updated for breakpoint hits.
 return 0;
 

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 306ee99be5952..7bb2b1ccf7cbb 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1939,6 +1939,14 @@ size_t Platform::GetSoftwareBreakpointTrapOpcode(Target 
&target,
 }
   } break;
 
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64: {
+static const uint8_t g_loongarch_opcode[] = {0x05, 0x00, 0x2a,
+ 0x00}; // break 0x5
+trap_opcode = g_loongarch_opcode;
+trap_opcode_size = sizeof(g_loongarch_opcode);
+  } break;
+
   default:
 return 0;
   }



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


[Lldb-commits] [PATCH] D137519: [LLDB] Add LoongArch software breakpoint trap opcode

2022-11-09 Thread Lu Weining via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG97842fcba9e3: [LLDB] Add LoongArch software breakpoint trap 
opcode (authored by seehearfeel, committed by SixWeining).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137519/new/

https://reviews.llvm.org/D137519

Files:
  lldb/source/Host/common/NativeProcessProtocol.cpp
  lldb/source/Target/Platform.cpp


Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1939,6 +1939,14 @@
 }
   } break;
 
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64: {
+static const uint8_t g_loongarch_opcode[] = {0x05, 0x00, 0x2a,
+ 0x00}; // break 0x5
+trap_opcode = g_loongarch_opcode;
+trap_opcode_size = sizeof(g_loongarch_opcode);
+  } break;
+
   default:
 return 0;
   }
Index: lldb/source/Host/common/NativeProcessProtocol.cpp
===
--- lldb/source/Host/common/NativeProcessProtocol.cpp
+++ lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -507,6 +507,8 @@
   static const uint8_t g_ppcle_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
   static const uint8_t g_riscv_opcode[] = {0x73, 0x00, 0x10, 0x00}; // ebreak
   static const uint8_t g_riscv_opcode_c[] = {0x02, 0x90};   // c.ebreak
+  static const uint8_t g_loongarch_opcode[] = {0x05, 0x00, 0x2a,
+   0x00}; // break 0x5
 
   switch (GetArchitecture().GetMachine()) {
   case llvm::Triple::aarch64:
@@ -541,6 +543,10 @@
   : llvm::makeArrayRef(g_riscv_opcode);
   }
 
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64:
+return llvm::makeArrayRef(g_loongarch_opcode);
+
   default:
 return llvm::createStringError(llvm::inconvertibleErrorCode(),
"CPU type not supported!");
@@ -567,6 +573,8 @@
   case llvm::Triple::ppc64le:
   case llvm::Triple::riscv32:
   case llvm::Triple::riscv64:
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64:
 // On these architectures the PC doesn't get updated for breakpoint hits.
 return 0;
 


Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1939,6 +1939,14 @@
 }
   } break;
 
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64: {
+static const uint8_t g_loongarch_opcode[] = {0x05, 0x00, 0x2a,
+ 0x00}; // break 0x5
+trap_opcode = g_loongarch_opcode;
+trap_opcode_size = sizeof(g_loongarch_opcode);
+  } break;
+
   default:
 return 0;
   }
Index: lldb/source/Host/common/NativeProcessProtocol.cpp
===
--- lldb/source/Host/common/NativeProcessProtocol.cpp
+++ lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -507,6 +507,8 @@
   static const uint8_t g_ppcle_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
   static const uint8_t g_riscv_opcode[] = {0x73, 0x00, 0x10, 0x00}; // ebreak
   static const uint8_t g_riscv_opcode_c[] = {0x02, 0x90};   // c.ebreak
+  static const uint8_t g_loongarch_opcode[] = {0x05, 0x00, 0x2a,
+   0x00}; // break 0x5
 
   switch (GetArchitecture().GetMachine()) {
   case llvm::Triple::aarch64:
@@ -541,6 +543,10 @@
   : llvm::makeArrayRef(g_riscv_opcode);
   }
 
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64:
+return llvm::makeArrayRef(g_loongarch_opcode);
+
   default:
 return llvm::createStringError(llvm::inconvertibleErrorCode(),
"CPU type not supported!");
@@ -567,6 +573,8 @@
   case llvm::Triple::ppc64le:
   case llvm::Triple::riscv32:
   case llvm::Triple::riscv64:
+  case llvm::Triple::loongarch32:
+  case llvm::Triple::loongarch64:
 // On these architectures the PC doesn't get updated for breakpoint hits.
 return 0;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits