[Lldb-commits] [PATCH] D140368: [lldb] Consider all breakpoints in breakpoint detection

2022-12-20 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: jingham.
DavidSpickett added a subscriber: jingham.
DavidSpickett added a comment.

The intent makes sense. We should stop and report user breakpoints triggered 
while trying to execute some internal stepping plan, even if they overlap what 
lldb was planning to do in the first place.

Not totally sure how the change achieves that, this is quite the function. + 
@jingham who wrote the original changes.

> Currently in some cases lldb reports stop reason as "step out" or "step over" 
> (from thread plan completion) over "breakpoint"

This would be clearer if you said "(from thread plan completion) instead of 
"breakpoint"". Took me a while to work out that it wasn't over meaning step 
over a breakpoint.

I think the test naming could be clearer. 
`breakpoint/step_out_breakpoint/TestStepOutBreakpoint.py` implies it's just 
about stepping out. How about 
`breakpoint/thread_plan_user_breakpoint/TestThreadPlanUserBreakpoint.py` ? 
Something that is clear we're testing the interaction of automatic internal 
stepping plans and breakpoints the user puts in.

Is it worth checking that an unconditional user breakpoint is also reported?




Comment at: lldb/source/Target/StopInfo.cpp:540
 
+if (m_should_stop && !bp_loc_sp->GetBreakpoint().IsInternal())
+  internal_breakpoint = false;

I think the key here is the `m_should_stop` check (the rest looks equivalent to 
what is there already). What exactly does that achieve?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140368

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


[Lldb-commits] [PATCH] D140358: [lldb-vscode] Add support for disassembly view

2022-12-20 Thread Enrico Loparco via Phabricator via lldb-commits
eloparco added a comment.

That's how it currently looks like:
F25758029: image.png 

I plan on adding support for disassembly in multi-threaded applications (now I 
only track the stack frame for the main thread in `g_curr_frame`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140358

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary added a comment.

This caused an issue in the libc benchmarks, fix here: 2a261a7b5764 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D140385: [lldb] Add lldb-server targets to build docs

2022-12-20 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The current doc has people just do "ninja lldb" which is
not incorrect, it does build lldb. However it does not build lldb-server.
So you can't just "lldb some-binary" and expect it to work.

I've updated the instructions to reflect that most of the time
you'll want both lldb and lldb-server.

Though there is a use case for building just lldb. I'm assuming
Mac OS (where you have debugserver) and if you only wanted to do
remote debug.

Fixes #59575


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140385

Files:
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -169,8 +169,15 @@
 subprojects to build in addition to LLVM (for more options see
 :ref:`CommonCMakeOptions` and :ref:`CMakeCaches`). Parts of the LLDB test suite
 require ``lld``. Add it to the list in order to run all tests. Once CMake is 
done,
-run ninja to perform the actual build. We pass ``lldb`` here as the target, so
-it only builds what is necessary to run the lldb driver:
+run ninja to perform the actual build.
+
+::
+
+  $ ninja lldb lldb-server
+
+If you only want lldb, or are on a platform where lldb-server is not supported,
+you can pass just ``lldb``. Ninja will only build what is necessary to run the
+lldb driver:
 
 ::
 
@@ -210,7 +217,10 @@
   $ cmake -B /path/to/lldb-build -G Ninja \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   [] /path/to/llvm-project/lldb
-  $ ninja lldb
+  $ ninja lldb lldb-server
+
+If you do not require or cannot build ``lldb-server`` on your platform, simply
+remove it from the Ninja command.
 
 .. note::
 


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -169,8 +169,15 @@
 subprojects to build in addition to LLVM (for more options see
 :ref:`CommonCMakeOptions` and :ref:`CMakeCaches`). Parts of the LLDB test suite
 require ``lld``. Add it to the list in order to run all tests. Once CMake is done,
-run ninja to perform the actual build. We pass ``lldb`` here as the target, so
-it only builds what is necessary to run the lldb driver:
+run ninja to perform the actual build.
+
+::
+
+  $ ninja lldb lldb-server
+
+If you only want lldb, or are on a platform where lldb-server is not supported,
+you can pass just ``lldb``. Ninja will only build what is necessary to run the
+lldb driver:
 
 ::
 
@@ -210,7 +217,10 @@
   $ cmake -B /path/to/lldb-build -G Ninja \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   [] /path/to/llvm-project/lldb
-  $ ninja lldb
+  $ ninja lldb lldb-server
+
+If you do not require or cannot build ``lldb-server`` on your platform, simply
+remove it from the Ninja command.
 
 .. note::
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140385: [lldb] Add lldb-server targets to build docs

2022-12-20 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: JDevlieghere.
DavidSpickett added a comment.

Current page: https://lldb.llvm.org/resources/build.html
Github issue: https://github.com/llvm/llvm-project/issues/59575

This works for Linux but I don't know what happens on Mac OS. Would the 
equivalent be `ninja lldb debugserver`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140385

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sergei Barannikov via Phabricator via lldb-commits
barannikov88 added inline comments.



Comment at: llvm/include/llvm/ADT/Triple.h:11
+/// This header is deprecated in favour of
+/// `llvm/TargetParser/AArch64TargetParser.h`.
 ///

Invalid comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D140386: [LLDB][LoongArch] Add FP branch instructions for EmulateInstructionLoongArch

2022-12-20 Thread Hui Li via Phabricator via lldb-commits
lh03061238 created this revision.
lh03061238 added reviewers: SixWeining, wangleiat, xen0n, xry111, MaskRay, 
DavidSpickett, seehearfeel.
Herald added a subscriber: StephenFan.
Herald added a project: All.
lh03061238 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Add floating-point branch instructions for loongarch64. And do some tiny
adjustment for processing branch instruction in EmulateInstructionLoongArch


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140386

Files:
  lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
  lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h

Index: lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h
===
--- lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h
+++ lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h
@@ -73,6 +73,7 @@
 
   bool EmulateBEQZ(uint32_t inst);
   bool EmulateBNEZ(uint32_t inst);
+  bool EmulateBCXXZ(uint32_t inst);
   bool EmulateJIRL(uint32_t inst);
   bool EmulateB(uint32_t inst);
   bool EmulateBL(uint32_t inst);
@@ -86,6 +87,7 @@
 
   bool EmulateBEQZ64(uint32_t inst);
   bool EmulateBNEZ64(uint32_t inst);
+  bool EmulateBCXXZ64(uint32_t inst);
   bool EmulateJIRL64(uint32_t inst);
   bool EmulateB64(uint32_t inst);
   bool EmulateBL64(uint32_t inst);
Index: lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
===
--- lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
+++ lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
@@ -39,6 +39,8 @@
"beqz rj, offs21"},
   {0xfc00, 0x4400, &EmulateInstructionLoongArch::EmulateBNEZ,
"bnez rj, offs21"},
+  {0xfc00, 0x4800, &EmulateInstructionLoongArch::EmulateBCXXZ,
+   "bceqz/bcnez cj, offs21"},
   {0xfc00, 0x4c00, &EmulateInstructionLoongArch::EmulateJIRL,
"jirl rd, rj, offs16"},
   {0xfc00, 0x5000, &EmulateInstructionLoongArch::EmulateB,
@@ -199,80 +201,51 @@
 }
 
 bool EmulateInstructionLoongArch::EmulateBEQZ(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBEQZ64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBEQZ64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBNEZ(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBNEZ64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBNEZ64(inst) : false;
+}
+
+bool EmulateInstructionLoongArch::EmulateBCXXZ(uint32_t inst) {
+  return (IsLoongArch64()) ? EmulateBCXXZ64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateJIRL(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateJIRL64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateJIRL64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateB(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateB64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateB64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBL(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBL64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBL64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBEQ(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBEQ64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBEQ64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBNE(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateJIRL64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBNE64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBLT(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBLT64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBLT64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBGE(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBGE64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBGE64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBLTU(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBLTU64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBLTU64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateBGEU(uint32_t inst) {
-  if (IsLoongArch64())
-return EmulateBGEU64(inst);
-  else
-return false;
+  return (IsLoongArch64()) ? EmulateBGEU64(inst) : false;
 }
 
 bool EmulateInstructionLoongArch::EmulateNonJMP(uint32_t inst) { return false; }
@@ -281,20 +254,17 @@
 // if GR[rj] == 0:
 //   PC = PC + SignExtend({offs21, 2'b0}, GRLEN)
 bool EmulateInstructionLoongArch::EmulateBEQZ64(uint32_t inst) {
-  uint64_t next_pc, imm_sign_extend;
   bool success = false;
   uint3

[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary marked an inline comment as done.
lenary added inline comments.



Comment at: llvm/include/llvm/ADT/Triple.h:11
+/// This header is deprecated in favour of
+/// `llvm/TargetParser/AArch64TargetParser.h`.
 ///

barannikov88 wrote:
> Invalid comment.
Fixed in https://reviews.llvm.org/rG741396af16d1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D139973: [llvm] Make llvm::Any similar to std::any

2022-12-20 Thread Sebastian Neubauer via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb7940e25f6c: [llvm] Make llvm::Any similar to std::any 
(authored by sebastian-ne).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139973

Files:
  clang/unittests/Tooling/RefactoringTest.cpp
  clang/unittests/Tooling/TransformerTest.cpp
  lldb/include/lldb/Core/RichManglingContext.h
  llvm/include/llvm/ADT/Any.h
  llvm/lib/CodeGen/MachinePassManager.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
  llvm/lib/Transforms/Scalar/LoopPassManager.cpp
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/unittests/ADT/AnyTest.cpp
  llvm/unittests/IR/PassBuilderCallbacksTest.cpp

Index: llvm/unittests/IR/PassBuilderCallbacksTest.cpp
===
--- llvm/unittests/IR/PassBuilderCallbacksTest.cpp
+++ llvm/unittests/IR/PassBuilderCallbacksTest.cpp
@@ -290,17 +290,17 @@
   return std::string(name);
 }
 
-template <> std::string getName(const llvm::Any &WrappedIR) {
-  if (any_isa(WrappedIR))
-return any_cast(WrappedIR)->getName().str();
-  if (any_isa(WrappedIR))
-return any_cast(WrappedIR)->getName().str();
-  if (any_isa(WrappedIR))
-return any_cast(WrappedIR)->getName().str();
-  if (any_isa(WrappedIR))
-return any_cast(WrappedIR)->getName().str();
-  if (any_isa(WrappedIR))
-return any_cast(WrappedIR)->getName();
+template <> std::string getName(const Any &WrappedIR) {
+  if (const auto *const *M = any_cast(&WrappedIR))
+return (*M)->getName().str();
+  if (const auto *const *F = any_cast(&WrappedIR))
+return (*F)->getName().str();
+  if (const auto *const *L = any_cast(&WrappedIR))
+return (*L)->getName().str();
+  if (const auto *const *L = any_cast(&WrappedIR))
+return (*L)->getName().str();
+  if (const auto *const *C = any_cast(&WrappedIR))
+return (*C)->getName();
   return "";
 }
 /// Define a custom matcher for objects which support a 'getName' method.
Index: llvm/unittests/ADT/AnyTest.cpp
===
--- llvm/unittests/ADT/AnyTest.cpp
+++ llvm/unittests/ADT/AnyTest.cpp
@@ -24,55 +24,55 @@
 
   // An empty Any is not anything.
   EXPECT_FALSE(A.has_value());
-  EXPECT_FALSE(any_isa(A));
+  EXPECT_FALSE(any_cast(&A));
 
   // An int is an int but not something else.
   EXPECT_TRUE(B.has_value());
-  EXPECT_TRUE(any_isa(B));
-  EXPECT_FALSE(any_isa(B));
+  EXPECT_TRUE(any_cast(&B));
+  EXPECT_FALSE(any_cast(&B));
 
   EXPECT_TRUE(C.has_value());
-  EXPECT_TRUE(any_isa(C));
+  EXPECT_TRUE(any_cast(&C));
 
   // A const char * is a const char * but not an int.
   EXPECT_TRUE(D.has_value());
-  EXPECT_TRUE(any_isa(D));
-  EXPECT_FALSE(any_isa(D));
+  EXPECT_TRUE(any_cast(&D));
+  EXPECT_FALSE(any_cast(&D));
 
   // A double is a double but not a float.
   EXPECT_TRUE(E.has_value());
-  EXPECT_TRUE(any_isa(E));
-  EXPECT_FALSE(any_isa(E));
+  EXPECT_TRUE(any_cast(&E));
+  EXPECT_FALSE(any_cast(&E));
 
   // After copy constructing from an int, the new item and old item are both
   // ints.
   llvm::Any F(B);
   EXPECT_TRUE(B.has_value());
   EXPECT_TRUE(F.has_value());
-  EXPECT_TRUE(any_isa(F));
-  EXPECT_TRUE(any_isa(B));
+  EXPECT_TRUE(any_cast(&F));
+  EXPECT_TRUE(any_cast(&B));
 
   // After move constructing from an int, the new item is an int and the old one
   // isn't.
   llvm::Any G(std::move(C));
   EXPECT_FALSE(C.has_value());
   EXPECT_TRUE(G.has_value());
-  EXPECT_TRUE(any_isa(G));
-  EXPECT_FALSE(any_isa(C));
+  EXPECT_TRUE(any_cast(&G));
+  EXPECT_FALSE(any_cast(&C));
 
   // After copy-assigning from an int, the new item and old item are both ints.
   A = F;
   EXPECT_TRUE(A.has_value());
   EXPECT_TRUE(F.has_value());
-  EXPECT_TRUE(any_isa(A));
-  EXPECT_TRUE(any_isa(F));
+  EXPECT_TRUE(any_cast(&A));
+  EXPECT_TRUE(any_cast(&F));
 
   // After move-assigning from an int, the new item and old item are both ints.
   B = std::move(G);
   EXPECT_TRUE(B.has_value());
   EXPECT_FALSE(G.has_value());
-  EXPECT_TRUE(any_isa(B));
-  EXPECT_FALSE(any_isa(G));
+  EXPECT_TRUE(any_cast(&B));
+  EXPECT_FALSE(any_cast(&G));
 }
 
 TEST(AnyTest, GoodAnyCast) {
Index: llvm/lib/Transforms/Utils/Debugify.cpp
===
--- llvm/lib/Transforms/Utils/Debugify.cpp
+++ llvm/lib/Transforms/Utils/Debugify.cpp
@@ -1031,19 +1031,19 @@
   PIC.registerBeforeNonSkippedPassCallback([this](StringRef P, Any IR) {
 if (isIgnoredPass(P))
   return;
-if (any_isa(IR))
-  applyDebugify(*const_cast(any_cast(IR)),
+if (const auto **F = any_cast(&IR))
+  applyDebugify(*const_cast(*F),
 Mode, DebugInfoBeforePass, P);
-else if (any_isa(IR))
-  applyDebugify(*const_cast(

[Lldb-commits] [lldb] bb7940e - [llvm] Make llvm::Any similar to std::any

2022-12-20 Thread Sebastian Neubauer via lldb-commits

Author: Sebastian Neubauer
Date: 2022-12-20T13:28:30+01:00
New Revision: bb7940e25f6ca201ca57943544016390f1d2e504

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

LOG: [llvm] Make llvm::Any similar to std::any

This facilitates replacing llvm::Any with std::any.
- Deprecate any_isa in favor of using any_cast(Any*) and checking for
  nullptr because C++17 has no any_isa.
- Remove the assert from any_cast(Any*), so it returns nullptr if the
  type is not correct. This aligns it with std::any_cast(any*).

Use any_cast(Any*) throughout LLVM instead of checks with any_isa.

This is the first part outlined in
https://discourse.llvm.org/t/rfc-switching-from-llvm-any-to-std-any/67176

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

Added: 


Modified: 
clang/unittests/Tooling/RefactoringTest.cpp
clang/unittests/Tooling/TransformerTest.cpp
lldb/include/lldb/Core/RichManglingContext.h
llvm/include/llvm/ADT/Any.h
llvm/lib/CodeGen/MachinePassManager.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
llvm/lib/Transforms/Scalar/LoopPassManager.cpp
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/unittests/ADT/AnyTest.cpp
llvm/unittests/IR/PassBuilderCallbacksTest.cpp

Removed: 




diff  --git a/clang/unittests/Tooling/RefactoringTest.cpp 
b/clang/unittests/Tooling/RefactoringTest.cpp
index e38afc148a7b8..c7a02e195d04a 100644
--- a/clang/unittests/Tooling/RefactoringTest.cpp
+++ b/clang/unittests/Tooling/RefactoringTest.cpp
@@ -1288,7 +1288,7 @@ TEST_F(AtomicChangeTest, InsertAfterWithInvalidLocation) {
 TEST_F(AtomicChangeTest, Metadata) {
   AtomicChange Change(Context.Sources, DefaultLoc, 17);
   const llvm::Any &Metadata = Change.getMetadata();
-  ASSERT_TRUE(llvm::any_isa(Metadata));
+  ASSERT_TRUE(llvm::any_cast(&Metadata));
   EXPECT_EQ(llvm::any_cast(Metadata), 17);
 }
 

diff  --git a/clang/unittests/Tooling/TransformerTest.cpp 
b/clang/unittests/Tooling/TransformerTest.cpp
index 6d6ed33d8fd67..4d5e22d944988 100644
--- a/clang/unittests/Tooling/TransformerTest.cpp
+++ b/clang/unittests/Tooling/TransformerTest.cpp
@@ -806,7 +806,7 @@ TEST_F(TransformerTest, WithMetadata) {
   "clang-tool", std::make_shared(), {}));
   ASSERT_EQ(Changes.size(), 1u);
   const llvm::Any &Metadata = Changes[0].getMetadata();
-  ASSERT_TRUE(llvm::any_isa(Metadata));
+  ASSERT_TRUE(llvm::any_cast(&Metadata));
   EXPECT_THAT(llvm::any_cast(Metadata), 5);
 }
 

diff  --git a/lldb/include/lldb/Core/RichManglingContext.h 
b/lldb/include/lldb/Core/RichManglingContext.h
index 9636b7898f8f5..3b79924e88a9a 100644
--- a/lldb/include/lldb/Core/RichManglingContext.h
+++ b/lldb/include/lldb/Core/RichManglingContext.h
@@ -87,8 +87,8 @@ class RichManglingContext {
   /// can't access CPlusPlusLanguage::MethodName from within the header.
   template  static ParserT *get(llvm::Any parser) {
 assert(parser.has_value());
-assert(llvm::any_isa(parser));
-return llvm::any_cast(parser);
+assert(llvm::any_cast(&parser));
+return *llvm::any_cast(&parser);
   }
 };
 

diff  --git a/llvm/include/llvm/ADT/Any.h b/llvm/include/llvm/ADT/Any.h
index 934dfc142d376..acb7101a5145f 100644
--- a/llvm/include/llvm/ADT/Any.h
+++ b/llvm/include/llvm/ADT/Any.h
@@ -107,6 +107,13 @@ class LLVM_EXTERNAL_VISIBILITY Any {
   void reset() { Storage.reset(); }
 
 private:
+  // Only used for the internal llvm::Any implementation
+  template  bool isa() const {
+if (!Storage)
+  return false;
+return Storage->id() == &Any::TypeId>::Id;
+  }
+
   template  friend T any_cast(const Any &Value);
   template  friend T any_cast(Any &Value);
   template  friend T any_cast(Any &&Value);
@@ -119,36 +126,37 @@ class LLVM_EXTERNAL_VISIBILITY Any {
 
 template  char Any::TypeId::Id = 0;
 
-template  bool any_isa(const Any &Value) {
-  if (!Value.Storage)
-return false;
-  return Value.Storage->id() == &Any::TypeId>::Id;
+template 
+LLVM_DEPRECATED("Use any_cast(Any*) != nullptr instead", "any_cast")
+bool any_isa(const Any &Value) {
+  return Value.isa();
 }
 
 template  T any_cast(const Any &Value) {
+  assert(Value.isa() && "Bad any cast!");
   return static_cast(*any_cast>(&Value));
 }
 
 template  T any_cast(Any &Value) {
+  assert(Value.isa() && "Bad any cast!");
   return static_cast(*any_cast>(&Value));
 }
 
 template  T any_cast(Any &&Value) {
+  assert(Value.isa() && "Bad any cast!");
   return static_cast(std::move(*any_cast>(&Value)));
 }
 
 template  const T *any_cast(const Any *Value) {
   using U = remove_cvref_t;
-  assert(Value && any_isa(*Value) && "Bad any cast!");
-  if (!Value || !any_isa(*Value))
+  if (!Value || !Value->isa())
 return nullptr;
   return &static_cast &>(*Value-

[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary marked an inline comment as done.
lenary added a comment.

Another fixup for the llvm examples was required, landed in 
https://reviews.llvm.org/rG16c4c4e04c14


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary added a comment.

And a fixup for the compiler-rt symbolizer: 
https://reviews.llvm.org/rGecaab107e4d0


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D140386: [LLDB][LoongArch] Add FP branch instructions for EmulateInstructionLoongArch

2022-12-20 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

Please split this patch into 2:

- the cleanup of the existing branch instructions
- the addition of the new ones

The changes look good but let's keep each commit to doing 1 thing.

You are missing tests though, and this is my mistake for not asking for them in 
the previous patches. See https://reviews.llvm.org/D139294 for examples of how 
riscv is doing it. It doesn't need to be totally comprehensive. For example we 
can assume basic register operands are extracted correctly. So for a branch the 
tests would be one where it is supposed to branch and one where it isn't. The 
infrastructure for testing the emulation varies between arch but as before, 
riscv probably the best reference point.

Please add testing for the existing instructions as parent patches of this one 
(these 2 once you've split them), then these new ones should have tests too.

Note: I will be off for Christmas break from tomorrow until the 2nd week of 
January. So you can add any of the other common reviewers in lldb in the 
meantime. Or wait for me to be back, feel free to pile up reviews :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140386

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


[Lldb-commits] [PATCH] D139955: [LLDB] Change formatting to use llvm::formatv

2022-12-20 Thread Alexander Yermolovich via Phabricator via lldb-commits
ayermolo updated this revision to Diff 484259.
ayermolo added a comment.
Herald added subscribers: MaskRay, emaste.

pulled a trigger and changed all the call sites. I think less confusing then 
having two sets of APIs. One with printf symantics another with formatv.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139955

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Utility/Status.h
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/DWARFCallFrameInfo.cpp
  lldb/source/Target/SectionLoadList.cpp
  lldb/source/Utility/Status.cpp
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
  lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s

Index: lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
===
--- lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
+++ lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
@@ -2,7 +2,7 @@
 # RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit 2>%t.error | FileCheck %s
 # RUN: cat %t.error | FileCheck %s --check-prefix ERROR
 
-# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x47) attribute, but range extraction failed (No debug_ranges section),
+# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x0047) attribute, but range extraction failed (No debug_ranges section),
 # CHECK:  Function: id = {0x001c}, name = "ranges", range = [0x-0x0004)
 # CHECK:Blocks: id = {0x001c}, range = [0x-0x0004)
 
Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
===
--- lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -22,7 +22,7 @@
 # RUN: cat %t.error | FileCheck --check-prefix=ERROR %s
 
 # RNGLISTX-LABEL: image lookup -v -s lookup_rnglists
-# ERROR: error: {{.*}} {0x003f}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base for CU at 0x), please file a bug and attach the file at the start of this error message
+# ERROR: error: {{.*}} [0x003f]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x) attribute, but range extraction failed (DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base for CU at 0x), please file a bug and attach the file at the start of this error message
 
 # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
 # RUN:   --defsym RNGLISTX=0 --defsym RNGLISTBASE=0 %s > %t-rnglistbase
@@ -31,7 +31,7 @@
 # RUN: cat %t.error | FileCheck --check-prefix=ERRORBASE %s
 
 # RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
-# ERRORBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message
+# ERRORBASE: error: {{.*}}-rnglistbase [0x0043]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message
 
 .text
 rnglists:
Index: lldb/source/Utility/Status.cpp
===
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -51,14 +51,6 @@
   : eErrorTypeGeneric),
   m_string(EC.message()) {}
 
-Status::Status(const char *format, ...) : m_string() {
-  va_list args;
-  va_start(args, format);
-  SetErrorToGenericError();
-  SetErrorStringWithVarArg(format, args);
-  va

[Lldb-commits] [PATCH] D139955: [LLDB] Change formatting to use llvm::formatv

2022-12-20 Thread Alexander Yermolovich via Phabricator via lldb-commits
ayermolo updated this revision to Diff 484261.
ayermolo added a comment.

removed include that snuck in.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139955

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Utility/Status.h
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/DWARFCallFrameInfo.cpp
  lldb/source/Target/SectionLoadList.cpp
  lldb/source/Utility/Status.cpp
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
  lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s

Index: lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
===
--- lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
+++ lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
@@ -2,7 +2,7 @@
 # RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit 2>%t.error | FileCheck %s
 # RUN: cat %t.error | FileCheck %s --check-prefix ERROR
 
-# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x47) attribute, but range extraction failed (No debug_ranges section),
+# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x0047) attribute, but range extraction failed (No debug_ranges section),
 # CHECK:  Function: id = {0x001c}, name = "ranges", range = [0x-0x0004)
 # CHECK:Blocks: id = {0x001c}, range = [0x-0x0004)
 
Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
===
--- lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -22,7 +22,7 @@
 # RUN: cat %t.error | FileCheck --check-prefix=ERROR %s
 
 # RNGLISTX-LABEL: image lookup -v -s lookup_rnglists
-# ERROR: error: {{.*}} {0x003f}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base for CU at 0x), please file a bug and attach the file at the start of this error message
+# ERROR: error: {{.*}} [0x003f]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x) attribute, but range extraction failed (DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base for CU at 0x), please file a bug and attach the file at the start of this error message
 
 # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
 # RUN:   --defsym RNGLISTX=0 --defsym RNGLISTBASE=0 %s > %t-rnglistbase
@@ -31,7 +31,7 @@
 # RUN: cat %t.error | FileCheck --check-prefix=ERRORBASE %s
 
 # RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
-# ERRORBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message
+# ERRORBASE: error: {{.*}}-rnglistbase [0x0043]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message
 
 .text
 rnglists:
Index: lldb/source/Utility/Status.cpp
===
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -51,14 +51,6 @@
   : eErrorTypeGeneric),
   m_string(EC.message()) {}
 
-Status::Status(const char *format, ...) : m_string() {
-  va_list args;
-  va_start(args, format);
-  SetErrorToGenericError();
-  SetErrorStringWithVarArg(format, args);
-  va_end(args);
-}
-
 const Status &Status::operator=(llvm::Error error) {
   if (!error) {
 Clear();
Index: lldb/source/Target/SectionLoadList.cpp
===

[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

Thanks for the heads-up. I updated the GN build in 
4ac51dd53d93b8dd18c58093766483c657fe3a08 
 and 
2aa998d22fe09191cd6c1b697e373266c1131502 
. The 
latter commit has a python script in the commit message that might be useful to 
others who want to port this to other build systems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D137337: Replace LLVM_LIBDIR_SUFFIX by CMAKE_INSTALL_LIBDIR

2022-12-20 Thread Sergei Barannikov via Phabricator via lldb-commits
barannikov88 added inline comments.



Comment at: bolt/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in:17
 
-#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+#define CMAKE_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"

The prefix must remain LLVM_*
In other components accordingly


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

https://reviews.llvm.org/D137337

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


[Lldb-commits] [PATCH] D137337: Replace LLVM_LIBDIR_SUFFIX by CMAKE_INSTALL_LIBDIR

2022-12-20 Thread Sergei Barannikov via Phabricator via lldb-commits
barannikov88 added inline comments.



Comment at: bolt/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in:17
 
-#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+#define CMAKE_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"

barannikov88 wrote:
> The prefix must remain LLVM_*
> In other components accordingly
> The prefix must remain LLVM_*
> In other components accordingly

To clarify, I mean the C++ macro name and not CMake variable name


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

https://reviews.llvm.org/D137337

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


[Lldb-commits] [PATCH] D140240: [lldb] Prevent false positives with simple template names in SymbolFileDWARF::FindTypes

2022-12-20 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2521
+if (name_bracket_index == llvm::StringRef::npos &&
+matching_type->IsTemplateType())
+  return true;

You could consider using `CompilerType::GetTypeInfo` instead of introducing 
`CompilerType::IsTemplateType`. Though that function looks a bit chunky


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140240

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary added a comment.

In D137838#4007920 , @thakis wrote:

> Thanks for the heads-up. I updated the GN build in 
> 4ac51dd53d93b8dd18c58093766483c657fe3a08 
>  and 
> 2aa998d22fe09191cd6c1b697e373266c1131502 
> . The 
> latter commit has a python script in the commit message that might be useful 
> to others who want to port this to other build systems.

Thanks! Much appreciated!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Can you please update `llvm/include/llvm/module.modulemap` for this change or 
revert the patch? This is breaking all bots that build with 
`-DLLVM_ENABLE_MODULES=On`.

For example: 
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/lastFailedBuild/consoleFull#111065754949ba4694-19c4-4d7e-bec5-911270d8a58c

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D139250: [lldb] Add ScriptedPlatform python implementation

2022-12-20 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added inline comments.



Comment at: lldb/examples/python/scripted_process/scripted_platform.py:31
+def list_processes(self):
+""" Get a list of processes that can be ran on the platform.
+

labath wrote:
> mib wrote:
> > labath wrote:
> > > mib wrote:
> > > > mib wrote:
> > > > > mib wrote:
> > > > > > labath wrote:
> > > > > > > I am surprised that you want to go down the "run" path for this 
> > > > > > > functionality. I think most of the launch functionality does not 
> > > > > > > make sense for this use case (e.g., you can't provide arguments 
> > > > > > > to these processes, when you "run" them, can you?), and it is not 
> > > > > > > consistent with what the "process listing" functionality does for 
> > > > > > > regular platforms.
> > > > > > > 
> > > > > > > OTOH, the "attach" flow makes perfect sense here -- you take the 
> > > > > > > pid of an existing process, attach to it, and stop it at a random 
> > > > > > > point in its execution. You can't customize anything about how 
> > > > > > > that process is run (because it's already running) -- all you can 
> > > > > > > do is choose how you want to select the target process.
> > > > > > For now, there is no support for attaching to a scripted process, 
> > > > > > because we didn't have any use for it quite yet: cripted processes 
> > > > > > were mostly used for doing post-mortem debugging, so we "ran" them 
> > > > > > artificially in lldb by providing some launch options (the name of 
> > > > > > the class managing the process and an optional user-provided 
> > > > > > dictionary) through the command line or using an `SBLaunchInfo` 
> > > > > > object.
> > > > > > 
> > > > > > I guess I'll need to extend the `platform process launch/attach` 
> > > > > > commands and `SBAttachInfo` object to also support these options 
> > > > > > since they're required for the scripted process instantiation.
> > > > > > 
> > > > > > Note that we aren't really attaching to the real running process, 
> > > > > > we're creating a scripted process that knows how to read memory to 
> > > > > > mock the real process.
> > > > > @labath, I'll do that work on a follow-up patch
> > > > @labath here D139945 :) 
> > > Thanks. However, are you still planning to use the launch path for your 
> > > feature? Because if you're not, then I think this comment should say "Get 
> > > a list of processes that **are running**" (or that **can be attached 
> > > to**).
> > > 
> > > And if you are, then I'd like to hear your thoughts on the discrepancy 
> > > between what "launching" means for scripted and non-scripted platforms.
> > > 
> > The way I see it is that the scripted platform will create a process with 
> > the right process plugin. In the case of scripted processes, the 
> > `ProcessLaunchInfo` argument should have the script class name set (which 
> > automatically sets the process plugin name to "ScriptedProcess" in the 
> > launch info). Once the process is instantiated (before the launch), the 
> > scripted platform will need to redirect to process stop events through its 
> > event multiplexer. So the way I see it essentially, running a regular 
> > process with the scripted platform should be totally transparent.
> > 
> > Something that is also worth discussing IMO, is the discrepancy between 
> > launching and attaching from the scripted platform:
> > 
> > One possibility could be that `platform process launch` would launch all 
> > the scripted processes listed by the scripted platform and set them up with 
> > the multiplexer, whereas `platform process attach` would just create a 
> > scripted process individually. I know this doesn't match the current 
> > behavior of the platform commands so if you guys think we should preserve 
> > the expected behavior, I guess.
> > 
> > May be @jingham has some opinion about this ?
> Before we do that, maybe we could take a step back. Could you explain why you 
> chose to use the "launch" flow for this use case?
> 
> To me, it just seems confusing to be using "launching" for any of this, 
> particularly given that "attaching" looks like a much better match for what 
> is happening here:
> - launch allows you to specify process cmdline arguments, attach does not - I 
> don't think you will be able to specify cmdline arguments for these scripted 
> processes
> - launch allows you to specify env vars, attach does not -- ditto
> - launch allows you to stop-at-entry, attach does not -- you cannot stop at 
> entry for these processes, as they have been started already
> - attach allows you to specify a pid, launch does not -- you (I think) want 
> to be able to choose the process (pid) that you want to create a scripted 
> process for
> 
> For me, the choice is obvious, particularly considering that there *is* an 
> obvious equivalent for "launching" for the kernel co-debugging use case. One 
> could actually have the kernel create a new process --and then it **would** 
> make sen

[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary added a comment.

In D137838#4008443 , @aprantl wrote:

> Can you please update `llvm/include/llvm/module.modulemap` for this change or 
> revert the patch? This is breaking all bots that build with 
> `-DLLVM_ENABLE_MODULES=On`.
>
> For example: 
> https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/lastFailedBuild/consoleFull#111065754949ba4694-19c4-4d7e-bec5-911270d8a58c

Looking at this now. Thanks for pointing it out as I didn't get a notification 
for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

I think I fixed it in a685bb8e333e 
, but 
please take another look.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D140240: [lldb] Prevent false positives with simple template names in SymbolFileDWARF::FindTypes

2022-12-20 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2521
+if (name_bracket_index == llvm::StringRef::npos &&
+matching_type->IsTemplateType())
+  return true;

Michael137 wrote:
> You could consider using `CompilerType::GetTypeInfo` instead of introducing 
> `CompilerType::IsTemplateType`. Though that function looks a bit chunky
just tried this but it's recognizing the type as just a normal record instead 
of a template instantiation


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140240

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Sorry, I pasted in the wrong hash: 6bdf378dcd349d97152846bb687c1d1de511d138 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [lldb] d483d48 - [lldb] Prevent false positives with simple template names in SymbolFileDWARF::FindTypes

2022-12-20 Thread Arthur Eubanks via lldb-commits

Author: Arthur Eubanks
Date: 2022-12-20T10:10:07-08:00
New Revision: d483d488ca5d04534105b67d83f3c16d142e7a05

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

LOG: [lldb] Prevent false positives with simple template names in 
SymbolFileDWARF::FindTypes

The provided test case was crashing because of confusion attempting to find 
types for `ns::Foo` under -gsimple-template-names. (This looks broken normally 
because it's attempting to find `ns::Foo` rather than `ns::Foo`)

Looking up types can't give false positives, as opposed to looking up functions 
as mentioned in https://reviews.llvm.org/D137098.

Reviewed By: Michael137

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

Added: 
lldb/test/API/lang/cpp/unique-types4/Makefile
lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
lldb/test/API/lang/cpp/unique-types4/main.cpp

Modified: 
lldb/include/lldb/Symbol/CompilerType.h
lldb/include/lldb/Symbol/Type.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerType.cpp
lldb/source/Symbol/Type.cpp
lldb/source/Symbol/TypeSystem.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index 0de1bec4d733a..9a010c23aee2c 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -193,6 +193,8 @@ class CompilerType {
 
   bool IsScalarType() const;
 
+  bool IsTemplateType() const;
+
   bool IsTypedefType() const;
 
   bool IsVoidType() const;

diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 362db0ac054ad..ff0d0c3516da4 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -143,6 +143,9 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 
   bool IsAggregateType();
 
+  // Returns if the type is a templated decl. Does not look through typedefs.
+  bool IsTemplateType();
+
   bool IsValidType() { return m_encoding_uid_type != eEncodingInvalid; }
 
   bool IsTypedef() { return m_encoding_uid_type == eEncodingIsTypedefUID; }

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index 69682d121f2fd..02dafda67eec3 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -357,6 +357,8 @@ class TypeSystem : public PluginInterface,
 const char *name, bool omit_empty_base_classes,
 std::vector &child_indexes) = 0;
 
+  virtual bool IsTemplateType(lldb::opaque_compiler_type_t type);
+
   virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type,
  bool expand_pack);
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 4479f687823e8..3716e9e800d74 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2501,6 +2501,11 @@ void SymbolFileDWARF::FindTypes(
   if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
 return;
 
+  // Unlike FindFunctions(), FindTypes() following cannot produce false
+  // positives.
+
+  const llvm::StringRef name_ref = name.GetStringRef();
+  auto name_bracket_index = name_ref.find('<');
   m_index->GetTypes(name, [&](DWARFDIE die) {
 if (!DIEInDeclContext(parent_decl_ctx, die))
   return true; // The containing decl contexts don't match
@@ -2509,6 +2514,13 @@ void SymbolFileDWARF::FindTypes(
 if (!matching_type)
   return true;
 
+// With -gsimple-template-names, a templated type's DW_AT_name will not
+// contain the template parameters. Make sure that if the original query
+// didn't contain a '<', we filter out entries with template parameters.
+if (name_bracket_index == llvm::StringRef::npos &&
+matching_type->IsTemplateType())
+  return true;
+
 // We found a type pointer, now find the shared pointer form our type
 // list
 types.InsertUnique(matching_type->shared_from_this());
@@ -2519,11 +2531,11 @@ void SymbolFileDWARF::FindTypes(
   // contain the template parameters. Try again stripping '<' and anything
   // after, filtering out entries with template parameters that don't match.
   if (types.GetSize() < max_matches) {
-const llvm::StringRef name_ref = name.GetStringRef();
-auto it = name_ref.find('<');
-if (it != llvm::StringRef::npos) {
-  const llvm::StringRef name_no_template_params = name_ref.slice(0,

[Lldb-commits] [PATCH] D140240: [lldb] Prevent false positives with simple template names in SymbolFileDWARF::FindTypes

2022-12-20 Thread Arthur Eubanks via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd483d488ca5d: [lldb] Prevent false positives with simple 
template names in SymbolFileDWARF… (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140240

Files:
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/Type.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/source/Symbol/CompilerType.cpp
  lldb/source/Symbol/Type.cpp
  lldb/source/Symbol/TypeSystem.cpp
  lldb/test/API/lang/cpp/unique-types4/Makefile
  lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
  lldb/test/API/lang/cpp/unique-types4/main.cpp

Index: lldb/test/API/lang/cpp/unique-types4/main.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/unique-types4/main.cpp
@@ -0,0 +1,23 @@
+namespace ns {
+
+template  struct Foo {
+  static T value;
+};
+
+template  using Bar = Foo;
+
+using FooInt = Foo;
+using FooDouble = Foo;
+
+} // namespace ns
+
+ns::Foo a;
+ns::Foo b;
+ns::Bar c;
+ns::Bar d;
+ns::FooInt e;
+ns::FooDouble f;
+
+int main() {
+  // Set breakpoint here
+}
Index: lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
===
--- /dev/null
+++ lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
@@ -0,0 +1,31 @@
+"""
+Test that we return only the requested template instantiation.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class UniqueTypesTestCase4(TestBase):
+def do_test(self, debug_flags):
+"""Test that we display the correct template instantiation."""
+self.build(dictionary=debug_flags)
+lldbutil.run_to_source_breakpoint(self, "// Set breakpoint here", lldb.SBFileSpec("main.cpp"))
+# FIXME: these should successfully print the values
+self.expect("print ns::Foo::value", substrs=["no member named"], error=True)
+self.expect("print ns::Foo::value", substrs=["no member named"], error=True)
+self.expect("print ns::Bar::value", substrs=["no member named"], error=True)
+self.expect("print ns::Bar::value", substrs=["no member named"], error=True)
+self.expect("print ns::FooDouble::value", substrs=["Couldn't lookup symbols"], error=True)
+self.expect("print ns::FooInt::value", substrs=["Couldn't lookup symbols"], error=True)
+
+@skipIf(compiler=no_match("clang"))
+@skipIf(compiler_version=["<", "15.0"])
+def test_simple_template_names(self):
+self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names"))
+
+@skipIf(compiler=no_match("clang"))
+@skipIf(compiler_version=["<", "15.0"])
+def test_no_simple_template_names(self):
+self.do_test(dict(CFLAGS_EXTRAS="-gno-simple-template-names"))
Index: lldb/test/API/lang/cpp/unique-types4/Makefile
===
--- /dev/null
+++ lldb/test/API/lang/cpp/unique-types4/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
Index: lldb/source/Symbol/TypeSystem.cpp
===
--- lldb/source/Symbol/TypeSystem.cpp
+++ lldb/source/Symbol/TypeSystem.cpp
@@ -116,6 +116,10 @@
   return CompilerType(weak_from_this(), type);
 }
 
+bool TypeSystem::IsTemplateType(lldb::opaque_compiler_type_t type) {
+  return false;
+}
+
 size_t TypeSystem::GetNumTemplateArguments(lldb::opaque_compiler_type_t type,
bool expand_pack) {
   return 0;
Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -393,6 +393,10 @@
   return GetForwardCompilerType().IsAggregateType();
 }
 
+bool Type::IsTemplateType() {
+  return GetForwardCompilerType().IsTemplateType();
+}
+
 lldb::TypeSP Type::GetTypedefType() {
   lldb::TypeSP type_sp;
   if (IsTypedef()) {
Index: lldb/source/Symbol/CompilerType.cpp
===
--- lldb/source/Symbol/CompilerType.cpp
+++ lldb/source/Symbol/CompilerType.cpp
@@ -260,6 +260,13 @@
   return false;
 }
 
+bool CompilerType::IsTemplateType() const {
+  if (IsValid())
+if (auto type_system_sp = GetTypeSystem())
+  return type_system_sp->IsTemplateType(m_type);
+  return false;
+}
+
 bool CompilerType::IsTypedefType() const {
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
===
--- lldb/sou

[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Steven Wu via Phabricator via lldb-commits
steven_wu added a comment.

Also needed a follow up fix to completely fix module `9cd6fbee7ed8`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary added a comment.

I'm working on a follow-up, which should make the split a bit clearer, but I'm 
also not a modulemap expert and the `-DLLVM_ENABLE_MODULES=On` configuration is 
broken on my linux dev box. I'll post it for review if those two patches have 
at least made the build greener.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D139973: [llvm] Make llvm::Any similar to std::any

2022-12-20 Thread Joe Loser via Phabricator via lldb-commits
jloser added a comment.

Sorry for the delay here; this patch LGTM!  Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139973

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


[Lldb-commits] [PATCH] D137838: [Support] Move TargetParsers to new component

2022-12-20 Thread Sam Elliott via Phabricator via lldb-commits
lenary added a comment.

In D137838#4008605 , @lenary wrote:

> I'm working on a follow-up, which should make the split a bit clearer, but 
> I'm also not a modulemap expert and the `-DLLVM_ENABLE_MODULES=On` 
> configuration is broken on my linux dev box. I'll post it for review if those 
> two patches have at least made the build greener.

Here: https://reviews.llvm.org/D140420 - I'm not sure how urgent this is, if 
your patches did get your builds green. I think in e.g. the bazel build, 
there's still a bunch of places where TargetParser is closely entwined with 
Support that we can fix in the same way we intend to fix the forwarding headers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137838

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


[Lldb-commits] [PATCH] D138176: [dsymutil] Fix assertion: (Ref > InputDIE.getOffset()), function cloneDieReferenceAttribute

2022-12-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc9cbe6937b1f: [dsymutil] Track uncloned references in the 
DIEInfo. (authored by JDevlieghere).

Changed prior to commit:
  https://reviews.llvm.org/D138176?vs=483018&id=484357#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138176

Files:
  llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DWARFLinker/DWARFLinkerCompileUnit.cpp
  llvm/test/tools/dsymutil/odr-two-units-in-single-file.test

Index: llvm/test/tools/dsymutil/odr-two-units-in-single-file.test
===
--- /dev/null
+++ llvm/test/tools/dsymutil/odr-two-units-in-single-file.test
@@ -0,0 +1,199 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: echo '---' > %t2.map
+# RUN: echo "triple:  'x86_64-apple-darwin'" >> %t2.map
+# RUN: echo 'objects:'  >> %t2.map
+# RUN: echo " -  filename: '%t.o'" >> %t2.map
+# RUN: echo 'symbols:' >> %t2.map
+# RUN: echo '  - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x1, size: 0x10 }' >> %t2.map
+# RUN: echo '...' >> %t2.map
+# RUN: dsymutil -y -j 16 %t2.map -f -o - | llvm-dwarfdump -a - | FileCheck %s
+
+# CHECK: file format Mach-O 64-bit x86-64
+# CHECK: .debug_info contents:
+# CHECK: Compile Unit:
+# CHECK: DW_TAG_compile_unit
+# CHECK-NOT: DW_TAG_class_type
+# CHECK: Compile Unit:
+# CHECK: DW_TAG_compile_unit
+# CHECK: DW_TAG_class_type
+# CHECK: NULL
+
+
+--- !mach-o
+FileHeader:
+  magic:  0xFEEDFACF
+  cputype:0x0107
+  cpusubtype: 0x0003
+  filetype:   0x0001
+  ncmds:  2
+  sizeofcmds: 376
+  flags:  0x2000
+  reserved:   0x
+LoadCommands:
+  - cmd:  LC_SEGMENT_64
+cmdsize:  232
+segname:  ''
+vmaddr:   0x00
+vmsize:   0x300
+fileoff:  0x300
+filesize: 0x300
+maxprot:  7
+initprot: 7
+nsects:   2
+flags:0
+Sections:
+  - sectname:  __debug_abbrev
+segname:   __DWARF
+addr:  0x000F
+size:  0x4a
+offset:0x0380
+align: 0
+reloff:0x
+nreloc:0
+flags: 0x0200
+reserved1: 0x
+reserved2: 0x
+reserved3: 0x
+  - sectname:  __debug_info
+segname:   __DWARF
+addr:  0x100
+size:  0x6c
+offset:0x0410
+align: 0
+reloff:0x0600
+nreloc:1
+flags: 0x0200
+reserved1: 0x
+reserved2: 0x
+reserved3: 0x
+relocations:
+  - address: 0x1FC
+symbolnum:   1
+pcrel:   true
+length:  3
+extern:  true
+type:0
+scattered:   false
+value:   0
+  - cmd: LC_SYMTAB
+cmdsize: 24
+symoff:  0x700
+nsyms:   2
+stroff:  0x720
+strsize: 10
+LinkEditData:
+  NameList:
+- n_strx:  1
+  n_type:  0x0F
+  n_sect:  1
+  n_desc:  0
+  n_value: 0
+- n_strx:  1
+  n_type:  0x0F
+  n_sect:  1
+  n_desc:  0
+  n_value: 0
+  StringTable:
+- ''
+- '__Z3foov'
+- ''
+DWARF:
+  debug_abbrev:
+- Table:
+  - Tag:  DW_TAG_compile_unit
+Children: DW_CHILDREN_yes
+Attributes:
+  - Attribute: DW_AT_producer
+Form:  DW_FORM_string
+  - Attribute: DW_AT_language
+Form:  DW_FORM_data2
+  - Attribute: DW_AT_name
+Form:  DW_FORM_string
+  - Tag:  DW_TAG_class_type
+Children: DW_CHILDREN_no
+Attributes:
+  - Attribute: DW_AT_name
+Form:  DW_FORM_string
+  - Tag:  DW_TAG_variable
+Children: DW_CHILDREN_no
+Attributes:
+  - Attribute: DW_AT_name
+Form:  DW_FORM_string
+  - Attribute: DW_AT_const_value
+Form:  DW_FORM_data4
+  - Attribute: DW_AT_type
+Form:  DW_FORM_ref4
+  - Tag:  DW_TAG_pointer_type
+Children: DW_CHILDREN_no
+Attributes:
+  - Attribute: DW_AT_type
+Form:  DW_FORM_ref4
+- Table:
+  - Tag:  DW_TAG_compile_unit
+Children: DW_CHILDREN_yes
+Attributes:
+  - Attribute: DW_AT_producer
+Form:  DW_FORM_string
+  - Attribute: DW_AT_language
+Form:  DW_FORM_data2
+  - Attribute: DW_AT_name
+Form:  DW_FORM_string
+  - Tag:  DW_TAG_class_type
+Children: DW_CHILDREN_no
+Attributes:
+   

[Lldb-commits] [PATCH] D138618: [LLDB] Enable 64 bit debug/type offset

2022-12-20 Thread Alexander Yermolovich via Phabricator via lldb-commits
ayermolo added a comment.

In D138618#4004866 , @labath wrote:

> You, if I understand correctly, see the ID of a symbol file as a special case 
> of an all-encompassing user id -- essentially a user_id (or a DIERef) 
> pointing to the first byte of the symbol file. with this world view, the 
> entirety of user ID computation is a mess. :)

Ah I see. Thanks for providing context. Yeah that is kind of the way I see it 
after talking with Greg. Looking over your proposal it makes sense with the way 
you described how you see this. You and @clayborg  have a historical context 
for this code. He is on PTO right now, lets see what he thinks when he is back 
in a couple weeks? :)

In meantime what do you think about closing on D139955 
, so it can land? I think it is fully 
independent of design decision in this diff, and can land separately. Would be 
great to juggle one less diff on a stack.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138618

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


[Lldb-commits] [PATCH] D139955: [LLDB] Change formatting to use llvm::formatv

2022-12-20 Thread Alexander Yermolovich via Phabricator via lldb-commits
ayermolo updated this revision to Diff 484382.
ayermolo added a comment.

missed couple of Status uses.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139955

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Utility/Status.h
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/DWARFCallFrameInfo.cpp
  lldb/source/Target/SectionLoadList.cpp
  lldb/source/Utility/Status.cpp
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
  lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s

Index: lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
===
--- lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
+++ lldb/test/Shell/SymbolFile/DWARF/x86/debug_ranges-missing-section.s
@@ -2,7 +2,7 @@
 # RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit 2>%t.error | FileCheck %s
 # RUN: cat %t.error | FileCheck %s --check-prefix ERROR
 
-# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x47) attribute, but range extraction failed (No debug_ranges section),
+# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x0047) attribute, but range extraction failed (No debug_ranges section),
 # CHECK:  Function: id = {0x001c}, name = "ranges", range = [0x-0x0004)
 # CHECK:Blocks: id = {0x001c}, range = [0x-0x0004)
 
Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
===
--- lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -22,7 +22,7 @@
 # RUN: cat %t.error | FileCheck --check-prefix=ERROR %s
 
 # RNGLISTX-LABEL: image lookup -v -s lookup_rnglists
-# ERROR: error: {{.*}} {0x003f}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base for CU at 0x), please file a bug and attach the file at the start of this error message
+# ERROR: error: {{.*}} [0x003f]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x) attribute, but range extraction failed (DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base for CU at 0x), please file a bug and attach the file at the start of this error message
 
 # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
 # RUN:   --defsym RNGLISTX=0 --defsym RNGLISTBASE=0 %s > %t-rnglistbase
@@ -31,7 +31,7 @@
 # RUN: cat %t.error | FileCheck --check-prefix=ERRORBASE %s
 
 # RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
-# ERRORBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message
+# ERRORBASE: error: {{.*}}-rnglistbase [0x0043]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message
 
 .text
 rnglists:
Index: lldb/source/Utility/Status.cpp
===
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -51,14 +51,6 @@
   : eErrorTypeGeneric),
   m_string(EC.message()) {}
 
-Status::Status(const char *format, ...) : m_string() {
-  va_list args;
-  va_start(args, format);
-  SetErrorToGenericError();
-  SetErrorStringWithVarArg(format, args);
-  va_end(args);
-}
-
 const Status &Status::operator=(llvm::Error error) {
   if (!error) {
 Clear();
Index: lldb/source/Target/SectionLoadList.cpp

[Lldb-commits] [PATCH] D140332: [ADT] Alias llvm::Optional to std::optional

2022-12-20 Thread Kazu Hirata via Phabricator via lldb-commits
kazu added a comment.

Thank you for this patch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140332

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


[Lldb-commits] [PATCH] D140385: [lldb] Add lldb-server targets to build docs

2022-12-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140385

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


[Lldb-commits] [PATCH] D139250: [lldb] Add ScriptedPlatform python implementation

2022-12-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I'm happy with the launching/attaching discussion resolved. Similar to the 
deduplication I think it makes more sense to tackle that first instead of 
landing this "as is" and then fixing it after the fact.




Comment at: lldb/bindings/python/python-wrapper.swig:317
 
+PythonObject lldb_private::LLDBSwigPythonCreateScriptedPlatform(
+const char *python_class_name, const char *session_dictionary_name,

mib wrote:
> JDevlieghere wrote:
> > This looks pretty similar to `LLDBSwigPythonCreateScriptedThread` and 
> > `LLDBSwigPythonCreateScriptedProcess`. Can we factor out the common parts?
> True, but this need some refactor unrelated to this patch, so I'll do it in a 
> follow-up
Instead of adding a lot of duplicate code and factoring it out after, maybe it 
makes more sense to clean it up first and rebase this patch on top of that.


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

https://reviews.llvm.org/D139250

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


[Lldb-commits] [PATCH] D139945: [lldb] Add scripted process launch/attach option to platform commands

2022-12-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D139945#3999351 , @labath wrote:

> For a "plugin", the scripted process is sure getting a lot of special 
> handling in generic code. (I know this isn't being introduced here, but I 
> wasn't involved in the previous review -- and I'm not actually sure I want to 
> be involved here). I don't think that's necessarily a bad thing in this case, 
> but maybe we should not be calling it a plugin in that case? We already have 
> a couple of precedents for putting implementations of "pluggable" classes 
> into generic code -- ProcessTrace for instance. And just like in the case of 
> ProcessTrace (where the real plugin is the thing which handles the trace file 
> format), here the real plugin would the the scripting language backing the 
> scripted process?
>
> (Apart from that, this patch seems fine.)

Maybe one way around this is to have some generic metadata that gets passed to 
the plugin, that can be different per plugin?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139945

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