[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

FWIW when I was testing this locally, I was seeing paths like

  (lldb) p uuid_view
  (lldb_private::FileSpec) $0 = file: "AndroidModule.so" dir: 
"/var/folders/1b/976z5_5513l64wvrj15vkt80gn/T/lldb/49966/LocateModuleCallbackTest-GetOrCreateModuleWithCachedModuleAndSymbol/remote-android/.cache/80008338-82A0-51E5-5922-C905D23890DA-BDDEFECC"
  
  (lldb) p module_sp->GetFileSpec()
  (const lldb_private::FileSpec) $1 = file: "AndroidModule.so" dir: 
"/var/folders/1b/976z5_5513l64wvrj15vkt80gn/T/lldb/49966/LocateModuleCallbackTest-GetOrCreateModuleWithCachedModuleAndSymbol/remote-android/.cache/80008338-82A0-51E5-5922-C905D23890DA-BDDEFECC"

and I'm betting the real issue is that the arm64 bot account has something 
funky about TMPRDIR, so one of these is realpath'ed to a different filepath and 
the comparison failed.  It would be a lot easier to understand what was 
actually happening on that bot if we could see the paths, but I don't think 
we're addressing the actual issue here.  (we need to fix the printing first, 
then we can see what is going on with the bot)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155333

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


[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Like reading third-party/unittest/googletest/include/gtest/gtest-printers.h, I 
thought I could add a static PrintTo method?  but

  index 6eb5b805d9d..93d98baa5be 100644
  --- a/lldb/include/lldb/Utility/FileSpec.h
  +++ b/lldb/include/lldb/Utility/FileSpec.h
  @@ -12,4 +12,5 @@
   #include 
   #include 
  +#include 
   #include 
   
  @@ -198,4 +199,8 @@ public:
 static std::optional

[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

My first thought was, but what about all the other unit tests doing this, and 
git grepping around, I think there's one in Interpreter/TestOptionValue.cpp and 
one in Interpreter/TestOptionValueFileColonLine.cpp.   I'd like to see what 
@JDevlieghere thinks, this patch is fine to me but it is an unfortunate - 
surely there is some method we could implement in FileSpec to get the gtest 
stuff to print the path when there's a failure, but I didn't see it when I 
tried to read through the code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155333

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


[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Kazuki Sakamoto via Phabricator via lldb-commits
splhack updated this revision to Diff 540594.
splhack added a comment.

Use GetPath() instead of Compare().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155333

Files:
  lldb/unittests/Target/LocateModuleCallbackTest.cpp

Index: lldb/unittests/Target/LocateModuleCallbackTest.cpp
===
--- lldb/unittests/Target/LocateModuleCallbackTest.cpp
+++ lldb/unittests/Target/LocateModuleCallbackTest.cpp
@@ -148,11 +148,15 @@
   return module_spec;
 }
 
+void CheckFileSpecs(const FileSpec &a_file_spec, const FileSpec &b_file_spec) {
+  ASSERT_EQ(a_file_spec.GetPath(), b_file_spec.GetPath());
+}
+
 void CheckModule(const ModuleSP &module_sp) {
   ASSERT_TRUE(module_sp);
   ASSERT_EQ(module_sp->GetUUID().GetAsString(), k_module_uuid);
   ASSERT_EQ(module_sp->GetObjectOffset(), 0U);
-  ASSERT_EQ(module_sp->GetPlatformFileSpec(), GetRemotePath());
+  CheckFileSpecs(module_sp->GetPlatformFileSpec(), GetRemotePath());
 }
 
 SymbolContextList FindFunctions(const ModuleSP &module_sp,
@@ -263,11 +267,6 @@
 } // namespace
 
 TEST_F(LocateModuleCallbackTest, GetOrCreateModuleWithCachedModule) {
-  // Disable test on arm64 because of failures in the lldb incremental arm64
-  // bot.
-#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
-  GTEST_SKIP() << "broken on arm64.";
-#endif
   // The module file is cached, and the locate module callback is not set.
   // GetOrCreateModule should succeed to return the module from the cache.
   FileSpec uuid_view = BuildCacheDir(m_test_dir);
@@ -277,7 +276,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_sp);
 }
@@ -286,12 +285,6 @@
   // The module and symbol files are cached, and the locate module callback is
   // not set. GetOrCreateModule should succeed to return the module from the
   // cache with the symbol.
-
-  // Disable test on arm64 because of failures in the lldb incremental arm64
-  // bot.
-#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
-  GTEST_SKIP() << "broken on arm64.";
-#endif
   FileSpec uuid_view = BuildCacheDirWithSymbol(m_test_dir);
 
   CheckNoCallback();
@@ -299,8 +292,8 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
-  ASSERT_EQ(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
   CheckUnstrippedSymbol(module_sp);
 }
 
@@ -316,8 +309,8 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
-  ASSERT_EQ(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
   CheckUnstrippedSymbol(module_sp);
 }
 
@@ -368,7 +361,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_sp);
 }
@@ -391,7 +384,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_sp);
 }
@@ -413,7 +406,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_sp);
 }
@@ -438,7 +431,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_TRUE(module_sp->GetSymbolFileFileSpec().GetPath().empty());
   CheckStrippedSymbol(module_sp);
 }
@@ -459,8 +452,8 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(),
-FileSpec(GetInputFilePath(k_modu

[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Kazuki Sakamoto via Phabricator via lldb-commits
splhack added a comment.

thanks @JDevlieghere @jasonmolenda, yeah `GetPath()` makes sense it could show 
the mismatch in human readable form.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155333

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


[Lldb-commits] [PATCH] D155332: [lldb][NFC] Factor out CommandObject code filtering results based on scope

2023-07-14 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.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155332

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


[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

I ran the TargetTests under lldb to see (this test doesn't fail on my arm64 mac 
desktop ftr).   ASSERT_EQ calls `template  
AssertionResult CmpHelperEQ()` and that calls `FileSpec::operator==` on my 
desktop.  Jonas suggested that we get the binary data dump of the FileSpec 
objects because there wasn't a method implemented in FileSpec that gtest knew 
to call to print the objects.  I originally thought ASSERT_EQ might be doing a 
binary comparison of the object bytes when I saw the failing msg on the arm64 
macos bot.

Would it be better to pass the `GetPath()` method on both of the FileSpec's we 
send to ASSERT_EQ so it is working with std::string's which it will know how to 
print if there is a comparison mismatch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155333

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


[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

`ASSERT_EQ` should call `operator==` under the hood. Why would that be flakey 
on arm64? Can we achieve this by changing the implementation to reimplement 
this with `FileSpec::Compare`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155333

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


[Lldb-commits] [PATCH] D155269: [lldb][AArch64] Add SME streaming vector length pseudo register

2023-07-14 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Just curious -- would it be better to have a single `vg` register shown to the 
user which is the vector length in non-streaming mode when the processor is in 
non-streaming mode, and the vector length in streaming mode when the processor 
is in streaming mode? I haven't worked with a target supporting SSVE mode, but 
if I'm following correctly we can show the SVE registers in non-streaming mode 
(and vg) and we can show the SSVE registers in streaming mode (and svg).  As 
you say above, we can show svg when in non-streaming mode but we can't show vg 
when in streaming mode.  Should we only show a single vg for the 
currently-available registers?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155269

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


[Lldb-commits] [PATCH] D153734: [lldb][LocateModuleCallback] Call locate module callback

2023-07-14 Thread Kazuki Sakamoto via Phabricator via lldb-commits
splhack added a comment.

D155333  should fix the flaky arm64 tests by 
replacing `ASSERT_EQ(FileSpec, FileSpec)` with 
`ASSERT_EQ(FileSpec::Compare(FileSpec, FileSpec, true), 0)`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153734

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


[Lldb-commits] [PATCH] D155334: [lldb] Make frame var --regex always search globals

2023-07-14 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve created this revision.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Currently frame var --regex sometimes searches globals, sometimes it doesn't.
This happens because `StackFrame::GetVariableList` always returns the biggest
list it has, regardless of whether only globals were requested or not. In other
words, if a previous call to `GetVariableList` requested globals, all subsequent
calls will see them.

The implication here is that users of `StackFrame::GetVariableList` are expected
to filter the results of this function. This is what we do for a vanilla
`frame var` command. But it is not what we do when `--regex` is used. This
commit solves the issue by:

1. Making `--regex` imply `--globals`. This matches the behavior of `frame var

`, which will also search the global scope.

2. Making the `--regex` search respect the command object options.

See the added test for an example of the oddities this patch addresses. Without
the patch, the test fails. However it could be made to pass by calling a plain
`frame var` before calling `frame var --regex A::`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155334

Files:
  lldb/include/lldb/Symbol/VariableList.h
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/test/API/commands/frame/var/TestFrameVar.py

Index: lldb/test/API/commands/frame/var/TestFrameVar.py
===
--- lldb/test/API/commands/frame/var/TestFrameVar.py
+++ lldb/test/API/commands/frame/var/TestFrameVar.py
@@ -58,6 +58,16 @@
 command_result = lldb.SBCommandReturnObject()
 interp = self.dbg.GetCommandInterpreter()
 
+# Ensure --regex can find globals if it is the very first frame var command.
+result = interp.HandleCommand("frame var --regex g_", command_result)
+self.assertEqual(
+result,
+lldb.eReturnStatusSuccessFinishResult,
+"frame var --regex g_ didn't succeed",
+)
+output = command_result.GetOutput()
+self.assertIn("g_var", output, "g_var not found with regex g_")
+
 # Just get args:
 result = interp.HandleCommand("frame var -l", command_result)
 self.assertEqual(
Index: lldb/source/Commands/CommandObjectFrame.cpp
===
--- lldb/source/Commands/CommandObjectFrame.cpp
+++ lldb/source/Commands/CommandObjectFrame.cpp
@@ -499,6 +499,31 @@
 }
   }
 
+  /// Finds all variables in `all_variables` whose name matches `regex`,
+  /// inserting them into `matches`. Variables already contained in `matches`
+  /// are not inserted again.
+  /// Nullopt is returned in case of no matches.
+  /// A sub-range of `matches` with all newly added variables is returned. This
+  /// may be empty if all matches were already contained in `matches`.
+  std::optional>
+  findUniqueRegexMatches(RegularExpression ®ex,
+ VariableList &matches,
+ const VariableList &all_variables) {
+bool any_matches = false;
+const size_t previous_num_vars = matches.GetSize();
+
+for (const VariableSP &var : all_variables) {
+  if (!var->NameMatches(regex) || !ScopeRequested(var->GetScope()))
+continue;
+  any_matches = true;
+  matches.AddVariableIfUnique(var);
+}
+
+if (any_matches)
+  return matches.toArrayRef().drop_front(previous_num_vars);
+return std::nullopt;
+  }
+
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 // No need to check "frame" for validity as eCommandRequiresFrame ensures
 // it is valid
@@ -506,6 +531,10 @@
 
 Stream &s = result.GetOutputStream();
 
+// Using a regex should behave like looking for an exact name match: it
+// also finds globals.
+m_option_variable.show_globals |= m_option_variable.use_regex;
+
 // Be careful about the stack frame, if any summary formatter runs code, it
 // might clear the StackFrameList for the thread.  So hold onto a shared
 // pointer to the frame so it stays alive.
@@ -518,7 +547,6 @@
   result.AppendError(error.AsCString());
 
 }
-VariableSP var_sp;
 ValueObjectSP valobj_sp;
 
 TypeSummaryImplSP summary_format_sp;
@@ -551,46 +579,38 @@
 // objects from them...
 for (auto &entry : command) {
   if (m_option_variable.use_regex) {
-const size_t regex_start_index = regex_var_list.GetSize();
 llvm::StringRef name_str = entry.ref();
 RegularExpression regex(name_str);
 if (regex.IsValid()) {
-  size_t num_matches = 0;
-  const size_t num_new_regex_vars =
-  variable_list->AppendVariablesIfUnique(regex, regex_var_list,
- num_matches);
-  if (num_new_regex_vars 

[Lldb-commits] [PATCH] D155333: [lldb][LocateModuleCallback] Fix FileSpec compare

2023-07-14 Thread Kazuki Sakamoto via Phabricator via lldb-commits
splhack created this revision.
splhack added reviewers: clayborg, jingham, bulbazord, jasonmolenda, 
JDevlieghere, rastogishubham.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
splhack requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

ASSERT_EQ FileSpec is flaky on arm64. Use FileSpec::Compare instead.

- 
https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/2260/testReport/junit/lldb-unit/Target___TargetTests_LocateModuleCallbackTest/GetOrCreateModuleWithCachedModule/
- 
https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/2260/testReport/junit/lldb-unit/Target___TargetTests_LocateModuleCallbackTest/GetOrCreateModuleWithCachedModuleAndSymbol/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155333

Files:
  lldb/unittests/Target/LocateModuleCallbackTest.cpp

Index: lldb/unittests/Target/LocateModuleCallbackTest.cpp
===
--- lldb/unittests/Target/LocateModuleCallbackTest.cpp
+++ lldb/unittests/Target/LocateModuleCallbackTest.cpp
@@ -148,11 +148,15 @@
   return module_spec;
 }
 
+void CheckFileSpecs(const FileSpec &a_file_spec, const FileSpec &b_file_spec) {
+  ASSERT_EQ(FileSpec::Compare(a_file_spec, b_file_spec, /*full=*/true), 0);
+}
+
 void CheckModule(const ModuleSP &module_sp) {
   ASSERT_TRUE(module_sp);
   ASSERT_EQ(module_sp->GetUUID().GetAsString(), k_module_uuid);
   ASSERT_EQ(module_sp->GetObjectOffset(), 0U);
-  ASSERT_EQ(module_sp->GetPlatformFileSpec(), GetRemotePath());
+  CheckFileSpecs(module_sp->GetPlatformFileSpec(), GetRemotePath());
 }
 
 SymbolContextList FindFunctions(const ModuleSP &module_sp,
@@ -263,11 +267,6 @@
 } // namespace
 
 TEST_F(LocateModuleCallbackTest, GetOrCreateModuleWithCachedModule) {
-  // Disable test on arm64 because of failures in the lldb incremental arm64
-  // bot.
-#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
-  GTEST_SKIP() << "broken on arm64.";
-#endif
   // The module file is cached, and the locate module callback is not set.
   // GetOrCreateModule should succeed to return the module from the cache.
   FileSpec uuid_view = BuildCacheDir(m_test_dir);
@@ -277,7 +276,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_sp);
 }
@@ -286,12 +285,6 @@
   // The module and symbol files are cached, and the locate module callback is
   // not set. GetOrCreateModule should succeed to return the module from the
   // cache with the symbol.
-
-  // Disable test on arm64 because of failures in the lldb incremental arm64
-  // bot.
-#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
-  GTEST_SKIP() << "broken on arm64.";
-#endif
   FileSpec uuid_view = BuildCacheDirWithSymbol(m_test_dir);
 
   CheckNoCallback();
@@ -299,8 +292,8 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
-  ASSERT_EQ(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
   CheckUnstrippedSymbol(module_sp);
 }
 
@@ -316,8 +309,8 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
-  ASSERT_EQ(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetSymbolFileFileSpec(), GetSymFileSpec(uuid_view));
   CheckUnstrippedSymbol(module_sp);
 }
 
@@ -368,7 +361,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_sp);
 }
@@ -391,7 +384,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_sp);
 }
@@ -413,7 +406,7 @@
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   CheckModule(module_sp);
-  ASSERT_EQ(module_sp->GetFileSpec(), uuid_view);
+  CheckFileSpecs(module_sp->GetFileSpec(), uuid_view);
   ASSERT_FALSE(module_sp->GetSymbolFileFileSpec());
   CheckStrippedSymbol(module_s

[Lldb-commits] [PATCH] D155332: [lldb][NFC] Factor out CommandObject code filtering results based on scope

2023-07-14 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve created this revision.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We will need this code in a subsequent commit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155332

Files:
  lldb/source/Commands/CommandObjectFrame.cpp


Index: lldb/source/Commands/CommandObjectFrame.cpp
===
--- lldb/source/Commands/CommandObjectFrame.cpp
+++ lldb/source/Commands/CommandObjectFrame.cpp
@@ -480,6 +480,25 @@
 return llvm::StringRef();
   }
 
+  /// Returns true if `scope` matches any of the options in 
`m_option_variable`.
+  bool ScopeRequested(lldb::ValueType scope) {
+switch (scope) {
+case eValueTypeVariableGlobal:
+case eValueTypeVariableStatic:
+  return m_option_variable.show_globals;
+case eValueTypeVariableArgument:
+  return m_option_variable.show_args;
+case eValueTypeVariableLocal:
+  return m_option_variable.show_locals;
+case eValueTypeInvalid:
+case eValueTypeRegister:
+case eValueTypeRegisterSet:
+case eValueTypeConstResult:
+case eValueTypeVariableThreadLocal:
+  return false;
+}
+  }
+
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 // No need to check "frame" for validity as eCommandRequiresFrame ensures
 // it is valid
@@ -630,27 +649,8 @@
 if (num_variables > 0) {
   for (size_t i = 0; i < num_variables; i++) {
 var_sp = variable_list->GetVariableAtIndex(i);
-switch (var_sp->GetScope()) {
-case eValueTypeVariableGlobal:
-  if (!m_option_variable.show_globals)
-continue;
-  break;
-case eValueTypeVariableStatic:
-  if (!m_option_variable.show_globals)
+if (!ScopeRequested(var_sp->GetScope()))
 continue;
-  break;
-case eValueTypeVariableArgument:
-  if (!m_option_variable.show_args)
-continue;
-  break;
-case eValueTypeVariableLocal:
-  if (!m_option_variable.show_locals)
-continue;
-  break;
-default:
-  continue;
-  break;
-}
 std::string scope_string;
 if (m_option_variable.show_scope)
   scope_string = GetScopeString(var_sp).str();


Index: lldb/source/Commands/CommandObjectFrame.cpp
===
--- lldb/source/Commands/CommandObjectFrame.cpp
+++ lldb/source/Commands/CommandObjectFrame.cpp
@@ -480,6 +480,25 @@
 return llvm::StringRef();
   }
 
+  /// Returns true if `scope` matches any of the options in `m_option_variable`.
+  bool ScopeRequested(lldb::ValueType scope) {
+switch (scope) {
+case eValueTypeVariableGlobal:
+case eValueTypeVariableStatic:
+  return m_option_variable.show_globals;
+case eValueTypeVariableArgument:
+  return m_option_variable.show_args;
+case eValueTypeVariableLocal:
+  return m_option_variable.show_locals;
+case eValueTypeInvalid:
+case eValueTypeRegister:
+case eValueTypeRegisterSet:
+case eValueTypeConstResult:
+case eValueTypeVariableThreadLocal:
+  return false;
+}
+  }
+
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 // No need to check "frame" for validity as eCommandRequiresFrame ensures
 // it is valid
@@ -630,27 +649,8 @@
 if (num_variables > 0) {
   for (size_t i = 0; i < num_variables; i++) {
 var_sp = variable_list->GetVariableAtIndex(i);
-switch (var_sp->GetScope()) {
-case eValueTypeVariableGlobal:
-  if (!m_option_variable.show_globals)
-continue;
-  break;
-case eValueTypeVariableStatic:
-  if (!m_option_variable.show_globals)
+if (!ScopeRequested(var_sp->GetScope()))
 continue;
-  break;
-case eValueTypeVariableArgument:
-  if (!m_option_variable.show_args)
-continue;
-  break;
-case eValueTypeVariableLocal:
-  if (!m_option_variable.show_locals)
-continue;
-  break;
-default:
-  continue;
-  break;
-}
 std::string scope_string;
 if (m_option_variable.show_scope)
   scope_string = GetScopeString(var_sp).str();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149213: [lldb] Add basic support to Rust enums in TypeSystemClang

2023-07-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

LGTM




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:3968
+  layout_info.field_offsets.insert({inner_field, 0});
+}

Add a newline


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

https://reviews.llvm.org/D149213

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


[Lldb-commits] [PATCH] D153734: [lldb][LocateModuleCallback] Call locate module callback

2023-07-14 Thread Kazuki Sakamoto via Phabricator via lldb-commits
splhack added a comment.

ok, sounds like ASSERT_EQ FileSpec does not work on Linux aarch64.
will use FileSpec::Compare and double check on Linux aarch64.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153734

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


[Lldb-commits] [PATCH] D155035: [lldb][NFCI] Remove unneeded temporary std::string allocations in SBAPI

2023-07-14 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7ee633a24b8c: [lldb][NFCI] Remove unneeded temporary 
std::string allocations in SBAPI (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155035

Files:
  lldb/include/lldb/API/SBStringList.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBStringList.cpp
  lldb/source/API/SBStructuredData.cpp
  lldb/source/API/SBThread.cpp


Index: lldb/source/API/SBThread.cpp
===
--- lldb/source/API/SBThread.cpp
+++ lldb/source/API/SBThread.cpp
@@ -457,7 +457,7 @@
 info_root_sp->GetObjectForDotSeparatedPath(path);
 if (node) {
   if (node->GetType() == eStructuredDataTypeString) {
-strm.Printf("%s", node->GetAsString()->GetValue().str().c_str());
+strm.ref() << node->GetAsString()->GetValue();
 success = true;
   }
   if (node->GetType() == eStructuredDataTypeInteger) {
Index: lldb/source/API/SBStructuredData.cpp
===
--- lldb/source/API/SBStructuredData.cpp
+++ lldb/source/API/SBStructuredData.cpp
@@ -16,6 +16,7 @@
 #include "lldb/Utility/Event.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StringList.h"
 #include "lldb/Utility/StructuredData.h"
 
 using namespace lldb;
@@ -138,9 +139,9 @@
   StructuredData::Array *key_arr = array_sp->GetAsArray();
   assert(key_arr);
 
-  key_arr->ForEach([&keys] (StructuredData::Object *object) -> bool {
+  key_arr->ForEach([&keys](StructuredData::Object *object) -> bool {
 llvm::StringRef key = object->GetStringValue("");
-keys.AppendString(key.str().c_str());
+keys->AppendString(key);
 return true;
   });
   return true;
Index: lldb/source/API/SBStringList.cpp
===
--- lldb/source/API/SBStringList.cpp
+++ lldb/source/API/SBStringList.cpp
@@ -37,6 +37,13 @@
 
 SBStringList::~SBStringList() = default;
 
+lldb_private::StringList *SBStringList::operator->() {
+  if (!IsValid())
+m_opaque_up = std::make_unique();
+
+  return m_opaque_up.get();
+}
+
 const lldb_private::StringList *SBStringList::operator->() const {
   return m_opaque_up.get();
 }
Index: lldb/source/API/SBDebugger.cpp
===
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -1399,9 +1399,9 @@
 
   Log *log = GetLog(LLDBLog::API);
 
-  LLDB_LOGF(log, "SBDebugger(%p)::GetPrompt () => \"%s\"",
-static_cast(m_opaque_sp.get()),
-(m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : ""));
+  LLDB_LOG(log, "SBDebugger({0:x})::GetPrompt () => \"{1}\"",
+   static_cast(m_opaque_sp.get()),
+   (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
 
   return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
   : nullptr);
Index: lldb/include/lldb/API/SBStringList.h
===
--- lldb/include/lldb/API/SBStringList.h
+++ lldb/include/lldb/API/SBStringList.h
@@ -47,11 +47,14 @@
   friend class SBBreakpoint;
   friend class SBBreakpointLocation;
   friend class SBBreakpointName;
+  friend class SBStructuredData;
 
   SBStringList(const lldb_private::StringList *lldb_strings);
 
   void AppendList(const lldb_private::StringList &strings);
 
+  lldb_private::StringList *operator->();
+
   const lldb_private::StringList *operator->() const;
 
   const lldb_private::StringList &operator*() const;


Index: lldb/source/API/SBThread.cpp
===
--- lldb/source/API/SBThread.cpp
+++ lldb/source/API/SBThread.cpp
@@ -457,7 +457,7 @@
 info_root_sp->GetObjectForDotSeparatedPath(path);
 if (node) {
   if (node->GetType() == eStructuredDataTypeString) {
-strm.Printf("%s", node->GetAsString()->GetValue().str().c_str());
+strm.ref() << node->GetAsString()->GetValue();
 success = true;
   }
   if (node->GetType() == eStructuredDataTypeInteger) {
Index: lldb/source/API/SBStructuredData.cpp
===
--- lldb/source/API/SBStructuredData.cpp
+++ lldb/source/API/SBStructuredData.cpp
@@ -16,6 +16,7 @@
 #include "lldb/Utility/Event.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StringList.h"
 #include "lldb/Utility/StructuredData.h"
 
 using namespace lldb;
@@ -138,9 +139,9 @@
   StructuredData::Array *key_arr = array_sp->GetAsArray();
   assert(key_arr);
 
-  key_arr->ForEach([&keys] (StructuredData::Object *object) -> bool {
+  key_arr->ForEach([&keys](StructuredData::Objec

[Lldb-commits] [lldb] 7ee633a - [lldb][NFCI] Remove unneeded temporary std::string allocations in SBAPI

2023-07-14 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-07-14T10:46:42-07:00
New Revision: 7ee633a24b8ce87b3a9b2f0f4bd1aace634cd2a1

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

LOG: [lldb][NFCI] Remove unneeded temporary std::string allocations in SBAPI

This uses some friend class trickery to avoid some unneeded temporary
std::string allocations.

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

Added: 


Modified: 
lldb/include/lldb/API/SBStringList.h
lldb/source/API/SBDebugger.cpp
lldb/source/API/SBStringList.cpp
lldb/source/API/SBStructuredData.cpp
lldb/source/API/SBThread.cpp

Removed: 




diff  --git a/lldb/include/lldb/API/SBStringList.h 
b/lldb/include/lldb/API/SBStringList.h
index 4842c162bd6efd..5d4f4db63f8418 100644
--- a/lldb/include/lldb/API/SBStringList.h
+++ b/lldb/include/lldb/API/SBStringList.h
@@ -47,11 +47,14 @@ class LLDB_API SBStringList {
   friend class SBBreakpoint;
   friend class SBBreakpointLocation;
   friend class SBBreakpointName;
+  friend class SBStructuredData;
 
   SBStringList(const lldb_private::StringList *lldb_strings);
 
   void AppendList(const lldb_private::StringList &strings);
 
+  lldb_private::StringList *operator->();
+
   const lldb_private::StringList *operator->() const;
 
   const lldb_private::StringList &operator*() const;

diff  --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 9641e2f9c8a089..9cf46466064847 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -1399,9 +1399,9 @@ const char *SBDebugger::GetPrompt() const {
 
   Log *log = GetLog(LLDBLog::API);
 
-  LLDB_LOGF(log, "SBDebugger(%p)::GetPrompt () => \"%s\"",
-static_cast(m_opaque_sp.get()),
-(m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : ""));
+  LLDB_LOG(log, "SBDebugger({0:x})::GetPrompt () => \"{1}\"",
+   static_cast(m_opaque_sp.get()),
+   (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
 
   return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
   : nullptr);

diff  --git a/lldb/source/API/SBStringList.cpp 
b/lldb/source/API/SBStringList.cpp
index 27799c744184c7..350c58b61634c3 100644
--- a/lldb/source/API/SBStringList.cpp
+++ b/lldb/source/API/SBStringList.cpp
@@ -37,6 +37,13 @@ const SBStringList &SBStringList::operator=(const 
SBStringList &rhs) {
 
 SBStringList::~SBStringList() = default;
 
+lldb_private::StringList *SBStringList::operator->() {
+  if (!IsValid())
+m_opaque_up = std::make_unique();
+
+  return m_opaque_up.get();
+}
+
 const lldb_private::StringList *SBStringList::operator->() const {
   return m_opaque_up.get();
 }

diff  --git a/lldb/source/API/SBStructuredData.cpp 
b/lldb/source/API/SBStructuredData.cpp
index 439921fa0f19f0..acc7c35eeef96c 100644
--- a/lldb/source/API/SBStructuredData.cpp
+++ b/lldb/source/API/SBStructuredData.cpp
@@ -16,6 +16,7 @@
 #include "lldb/Utility/Event.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StringList.h"
 #include "lldb/Utility/StructuredData.h"
 
 using namespace lldb;
@@ -138,9 +139,9 @@ bool SBStructuredData::GetKeys(lldb::SBStringList &keys) 
const {
   StructuredData::Array *key_arr = array_sp->GetAsArray();
   assert(key_arr);
 
-  key_arr->ForEach([&keys] (StructuredData::Object *object) -> bool {
+  key_arr->ForEach([&keys](StructuredData::Object *object) -> bool {
 llvm::StringRef key = object->GetStringValue("");
-keys.AppendString(key.str().c_str());
+keys->AppendString(key);
 return true;
   });
   return true;

diff  --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index a1f8a39dbbbe5a..bd316ddf54a92e 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -457,7 +457,7 @@ bool SBThread::GetInfoItemByPathAsString(const char *path, 
SBStream &strm) {
 info_root_sp->GetObjectForDotSeparatedPath(path);
 if (node) {
   if (node->GetType() == eStructuredDataTypeString) {
-strm.Printf("%s", node->GetAsString()->GetValue().str().c_str());
+strm.ref() << node->GetAsString()->GetValue();
 success = true;
   }
   if (node->GetType() == eStructuredDataTypeInteger) {



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


[Lldb-commits] [lldb] ce22598 - Disable GetOrCreateModuleWithCachedModule and GetOrCreateModuleWithCachedModuleAndSymbol tests on arm64, because of test failures

2023-07-14 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2023-07-14T13:41:27-04:00
New Revision: ce225982af734bdb68dc054017fc4411c179591c

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

LOG: Disable GetOrCreateModuleWithCachedModule and 
GetOrCreateModuleWithCachedModuleAndSymbol tests on arm64, because of test 
failures

Added: 


Modified: 
lldb/unittests/Target/LocateModuleCallbackTest.cpp

Removed: 




diff  --git a/lldb/unittests/Target/LocateModuleCallbackTest.cpp 
b/lldb/unittests/Target/LocateModuleCallbackTest.cpp
index 42a0790bca58f2..ad96adb32a471a 100644
--- a/lldb/unittests/Target/LocateModuleCallbackTest.cpp
+++ b/lldb/unittests/Target/LocateModuleCallbackTest.cpp
@@ -263,6 +263,11 @@ class LocateModuleCallbackTest : public testing::Test {
 } // namespace
 
 TEST_F(LocateModuleCallbackTest, GetOrCreateModuleWithCachedModule) {
+  // Disable test on arm64 because of failures in the lldb incremental arm64
+  // bot.
+#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
+  GTEST_SKIP() << "broken on arm64.";
+#endif
   // The module file is cached, and the locate module callback is not set.
   // GetOrCreateModule should succeed to return the module from the cache.
   FileSpec uuid_view = BuildCacheDir(m_test_dir);
@@ -281,6 +286,12 @@ TEST_F(LocateModuleCallbackTest, 
GetOrCreateModuleWithCachedModuleAndSymbol) {
   // The module and symbol files are cached, and the locate module callback is
   // not set. GetOrCreateModule should succeed to return the module from the
   // cache with the symbol.
+
+  // Disable test on arm64 because of failures in the lldb incremental arm64
+  // bot.
+#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
+  GTEST_SKIP() << "broken on arm64.";
+#endif
   FileSpec uuid_view = BuildCacheDirWithSymbol(m_test_dir);
 
   CheckNoCallback();
@@ -642,4 +653,4 @@ TEST_F(LocateModuleCallbackTest,
   ModuleSP module_sp =
   m_target_sp->GetOrCreateModule(m_module_spec, /*notify=*/false);
   ASSERT_FALSE(module_sp);
-}
+}
\ No newline at end of file



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


[Lldb-commits] [PATCH] D155124: [lldb][Windows] Fix TestLocateModuleCallback

2023-07-14 Thread Kazuki Sakamoto via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG43b9d62018fe: [lldb][Windows] Fix TestLocateModuleCallback 
(authored by splhack).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155124

Files:
  lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py


Index: lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
===
--- lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
+++ lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
@@ -49,7 +49,9 @@
 
 self.assertEqual(MODULE_TRIPLE, module_spec.GetTriple())
 
-self.assertEqual(MODULE_PLATFORM_PATH, 
module_spec.GetFileSpec().fullpath)
+self.assertEqual(
+MODULE_PLATFORM_PATH, 
Path(module_spec.GetFileSpec().fullpath).as_posix()
+)
 
 def check_module(self, module: lldb.SBModule, symbol_file: str, 
symbol_kind: str):
 self.assertTrue(module.IsValid())
@@ -61,16 +63,20 @@
 
 self.assertEqual(MODULE_RESOLVED_TRIPLE, module.GetTriple())
 
-self.assertEqual(MODULE_PLATFORM_PATH, 
module.GetPlatformFileSpec().fullpath)
-
 self.assertEqual(
-str(self.input_dir / MODULE_FILE),
-module.GetFileSpec().fullpath,
+MODULE_PLATFORM_PATH, 
Path(module.GetPlatformFileSpec().fullpath).as_posix()
 )
 
-self.assertEqual(
-str(self.input_dir / symbol_file),
-module.GetSymbolFileSpec().fullpath,
+self.assertTrue(
+(self.input_dir / MODULE_FILE)
+.resolve()
+.samefile(Path(module.GetFileSpec().fullpath).resolve())
+)
+
+self.assertTrue(
+(self.input_dir / symbol_file)
+.resolve()
+.samefile(Path(module.GetSymbolFileSpec().fullpath).resolve())
 )
 
 sc_list = module.FindFunctions(MODULE_FUNCTION, lldb.eSymbolTypeCode)


Index: lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
===
--- lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
+++ lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
@@ -49,7 +49,9 @@
 
 self.assertEqual(MODULE_TRIPLE, module_spec.GetTriple())
 
-self.assertEqual(MODULE_PLATFORM_PATH, module_spec.GetFileSpec().fullpath)
+self.assertEqual(
+MODULE_PLATFORM_PATH, Path(module_spec.GetFileSpec().fullpath).as_posix()
+)
 
 def check_module(self, module: lldb.SBModule, symbol_file: str, symbol_kind: str):
 self.assertTrue(module.IsValid())
@@ -61,16 +63,20 @@
 
 self.assertEqual(MODULE_RESOLVED_TRIPLE, module.GetTriple())
 
-self.assertEqual(MODULE_PLATFORM_PATH, module.GetPlatformFileSpec().fullpath)
-
 self.assertEqual(
-str(self.input_dir / MODULE_FILE),
-module.GetFileSpec().fullpath,
+MODULE_PLATFORM_PATH, Path(module.GetPlatformFileSpec().fullpath).as_posix()
 )
 
-self.assertEqual(
-str(self.input_dir / symbol_file),
-module.GetSymbolFileSpec().fullpath,
+self.assertTrue(
+(self.input_dir / MODULE_FILE)
+.resolve()
+.samefile(Path(module.GetFileSpec().fullpath).resolve())
+)
+
+self.assertTrue(
+(self.input_dir / symbol_file)
+.resolve()
+.samefile(Path(module.GetSymbolFileSpec().fullpath).resolve())
 )
 
 sc_list = module.FindFunctions(MODULE_FUNCTION, lldb.eSymbolTypeCode)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 43b9d62 - [lldb][Windows] Fix TestLocateModuleCallback

2023-07-14 Thread Kazuki Sakamoto via lldb-commits

Author: Kazuki Sakamoto
Date: 2023-07-14T10:36:57-07:00
New Revision: 43b9d62018fe53278dfcd2c46f4937a1664745bd

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

LOG: [lldb][Windows] Fix TestLocateModuleCallback

D153735 added the tests but it is failing due to POSIX path vs Windows path.
https://lab.llvm.org/buildbot/#/builders/219/builds/4084

Fix it.
- MODULE_PLATFORM_PATH is POSIX path.
- Normalize self.input_dir, FileSpec and SymbolFileSpec fullpath.

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

Added: 


Modified: 
lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py

Removed: 




diff  --git a/lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py 
b/lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
index 672795fd742c79..0e3bdf50124bbe 100644
--- a/lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
+++ b/lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py
@@ -49,7 +49,9 @@ def check_module_spec(self, module_spec: lldb.SBModuleSpec):
 
 self.assertEqual(MODULE_TRIPLE, module_spec.GetTriple())
 
-self.assertEqual(MODULE_PLATFORM_PATH, 
module_spec.GetFileSpec().fullpath)
+self.assertEqual(
+MODULE_PLATFORM_PATH, 
Path(module_spec.GetFileSpec().fullpath).as_posix()
+)
 
 def check_module(self, module: lldb.SBModule, symbol_file: str, 
symbol_kind: str):
 self.assertTrue(module.IsValid())
@@ -61,16 +63,20 @@ def check_module(self, module: lldb.SBModule, symbol_file: 
str, symbol_kind: str
 
 self.assertEqual(MODULE_RESOLVED_TRIPLE, module.GetTriple())
 
-self.assertEqual(MODULE_PLATFORM_PATH, 
module.GetPlatformFileSpec().fullpath)
-
 self.assertEqual(
-str(self.input_dir / MODULE_FILE),
-module.GetFileSpec().fullpath,
+MODULE_PLATFORM_PATH, 
Path(module.GetPlatformFileSpec().fullpath).as_posix()
 )
 
-self.assertEqual(
-str(self.input_dir / symbol_file),
-module.GetSymbolFileSpec().fullpath,
+self.assertTrue(
+(self.input_dir / MODULE_FILE)
+.resolve()
+.samefile(Path(module.GetFileSpec().fullpath).resolve())
+)
+
+self.assertTrue(
+(self.input_dir / symbol_file)
+.resolve()
+.samefile(Path(module.GetSymbolFileSpec().fullpath).resolve())
 )
 
 sc_list = module.FindFunctions(MODULE_FUNCTION, lldb.eSymbolTypeCode)



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


[Lldb-commits] [PATCH] D153734: [lldb][LocateModuleCallback] Call locate module callback

2023-07-14 Thread Kazuki Sakamoto via Phabricator via lldb-commits
splhack added a comment.

@rastogishubham let me check.

btw I'll commit D155124  to fix Windows tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153734

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


[Lldb-commits] [PATCH] D153734: [lldb][LocateModuleCallback] Call locate module callback

2023-07-14 Thread Shubham Sandeep Rastogi via Phabricator via lldb-commits
rastogishubham added a comment.

In D153734#4501034 , @rastogishubham 
wrote:

> I am reverting both fb087c17c8230 
>  and 
> 7f1028e9df52b 
>  to see 
> if the bot becomes green again. I apologize for any incovenience

Okay, so reverting those two changes cause other build failures, and I don't 
think it is a good idea to revert a bunch of changes, I am not sure what a good 
way to disable the test for arm64 is? Since these failures only appear on arm64

Would it be just adding a

  #if !defined(__aarch64__)

to the top of the file work?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153734

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


[Lldb-commits] [lldb] 55147ce - Revert "Revert "[lldb][LocateModuleCallback] Call locate module callback""

2023-07-14 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2023-07-14T11:19:16-04:00
New Revision: 55147ceb62020633cd7e7d403120d3915f4be3b6

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

LOG: Revert "Revert "[lldb][LocateModuleCallback] Call locate module callback""

This reverts commit df054499c35cdda02b196b2ca5c0a326abdc0a29.

Reverting because of build errors

In file included from 
/Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/source/API/SBPlatform.cpp:19:
/Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/include/lldb/Target/Target.h:1035:18:
 warning: parameter 'merged' not found in the function declaration 
[-Wdocumentation]

Added: 
lldb/unittests/Target/Inputs/AndroidModule.c
lldb/unittests/Target/Inputs/AndroidModule.so
lldb/unittests/Target/Inputs/AndroidModule.so.sym
lldb/unittests/Target/Inputs/AndroidModule.unstripped.so
lldb/unittests/Target/LocateModuleCallbackTest.cpp

Modified: 
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/Target/Target.h
lldb/source/Target/Platform.cpp
lldb/source/Target/Target.cpp
lldb/unittests/Target/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index 35227429b126ae..a5a78fe0f86983 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -881,6 +881,19 @@ class Platform : public PluginInterface {
   
   virtual Args GetExtraStartupCommands();
 
+  typedef std::function
+  LocateModuleCallback;
+
+  /// Set locate module callback. This allows users to implement their own
+  /// module cache system. For example, to leverage artifacts of build system,
+  /// to bypass pulling files from remote platform, or to search symbol files
+  /// from symbol servers.
+  void SetLocateModuleCallback(LocateModuleCallback callback);
+
+  LocateModuleCallback GetLocateModuleCallback() const;
+
 protected:
   /// Create a list of ArchSpecs with the given OS and a architectures. The
   /// vendor field is left as an "unspecified unknown".
@@ -928,6 +941,7 @@ class Platform : public PluginInterface {
   std::vector m_trap_handlers;
   bool m_calculated_trap_handlers;
   const std::unique_ptr m_module_cache;
+  LocateModuleCallback m_locate_module_callback;
 
   /// Ask the Platform subclass to fill in the list of trap handler names
   ///

diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index ed0ecbbddbf814..d5b4b8e18c2d2d 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1625,6 +1625,12 @@ class Target : public 
std::enable_shared_from_this,
 
   Target(const Target &) = delete;
   const Target &operator=(const Target &) = delete;
+
+private:
+  void CallLocateModuleCallbackIfSet(const ModuleSpec &module_spec,
+ lldb::ModuleSP &module_sp,
+ FileSpec &symbol_file_spec,
+ bool &did_create_module);
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index eedf596f1977f3..11a123fb6d583d 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1971,6 +1971,14 @@ Args Platform::GetExtraStartupCommands() {
   return {};
 }
 
+void Platform::SetLocateModuleCallback(LocateModuleCallback callback) {
+  m_locate_module_callback = callback;
+}
+
+Platform::LocateModuleCallback Platform::GetLocateModuleCallback() const {
+  return m_locate_module_callback;
+}
+
 PlatformSP PlatformList::GetOrCreate(llvm::StringRef name) {
   std::lock_guard guard(m_mutex);
   for (const PlatformSP &platform_sp : m_platforms) {

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 06867d359a3c0f..f0c57ef83c4a14 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2129,19 +2129,46 @@ ModuleSP Target::GetOrCreateModule(const ModuleSpec 
&module_spec, bool notify,
  // of the library
 bool did_create_module = false;
 FileSpecList search_paths = GetExecutableSearchPaths();
-// If there are image search path entries, try to use them first to acquire
-// a suitable image.
-if (m_image_search_paths.GetSize()) {
-  ModuleSpec transformed_spec(module_spec);
-  ConstString transformed_dir;
-  if (m_image_search_paths.RemapPath(
-  module_spec.GetFileSpec().GetDirectory(), transformed_dir)) {
-transformed_spec.GetFileSpec().SetDirectory(transformed_dir);
-transformed_spec.GetFileSpec().SetFilename(
-  module_spec.GetFileSpec().GetFilename());
-error = ModuleList::GetSharedModule(transformed_spec, 

[Lldb-commits] [lldb] a76b3be - Revert "Revert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest""

2023-07-14 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2023-07-14T11:19:16-04:00
New Revision: a76b3bec6c29f473fa0727c8aef01c7b31d400fd

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

LOG: Revert "Revert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest""

This reverts commit 668a3efd42e7fea19a0d331f73345f2ac13cdf4f.

Reverting because of build errors:

In file included from 
/Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/source/API/SBPlatform.cpp:19:
/Users/buildslave/jenkins/workspace/as-lldb-cmake/llvm-project/lldb/include/lldb/Target/Target.h:1035:18:
 warning: parameter 'merged' not found in the function declaration 
[-Wdocumentation]

Added: 


Modified: 
lldb/unittests/Target/LocateModuleCallbackTest.cpp

Removed: 




diff  --git a/lldb/unittests/Target/LocateModuleCallbackTest.cpp 
b/lldb/unittests/Target/LocateModuleCallbackTest.cpp
index cd5eb4473473bb..42a0790bca58f2 100644
--- a/lldb/unittests/Target/LocateModuleCallbackTest.cpp
+++ b/lldb/unittests/Target/LocateModuleCallbackTest.cpp
@@ -22,6 +22,7 @@
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::platform_android;
+using namespace lldb_private::platform_linux;
 using namespace lldb_private::breakpad;
 using namespace testing;
 
@@ -190,7 +191,8 @@ ProcessSP MockProcessCreateInstance(TargetSP target_sp, 
ListenerSP listener_sp,
 
 class LocateModuleCallbackTest : public testing::Test {
   SubsystemRAII
+PlatformAndroid, PlatformLinux, SymbolFileBreakpad,
+SymbolFileSymtab>
   subsystems;
 
 public:
@@ -202,6 +204,9 @@ class LocateModuleCallbackTest : public testing::Test {
 m_test_dir);
 
 // Create Debugger.
+ArchSpec host_arch("i386-pc-linux");
+Platform::SetHostPlatform(
+platform_linux::PlatformLinux::CreateInstance(true, &host_arch));
 m_debugger_sp = Debugger::CreateInstance();
 EXPECT_TRUE(m_debugger_sp);
 



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


[Lldb-commits] [lldb] 668a3ef - Revert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest"

2023-07-14 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2023-07-14T11:05:01-04:00
New Revision: 668a3efd42e7fea19a0d331f73345f2ac13cdf4f

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

LOG: Revert "[lldb][LocateModuleCallback] Fix LocateModuleCallbackTest"

This reverts commit fb087c17c82309404fe0ebf3505c186642a719f7.

This is because of test failures:

lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModule
lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModuleAndBreakpadSymbol

Added: 


Modified: 
lldb/unittests/Target/LocateModuleCallbackTest.cpp

Removed: 




diff  --git a/lldb/unittests/Target/LocateModuleCallbackTest.cpp 
b/lldb/unittests/Target/LocateModuleCallbackTest.cpp
index 42a0790bca58f2..cd5eb4473473bb 100644
--- a/lldb/unittests/Target/LocateModuleCallbackTest.cpp
+++ b/lldb/unittests/Target/LocateModuleCallbackTest.cpp
@@ -22,7 +22,6 @@
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::platform_android;
-using namespace lldb_private::platform_linux;
 using namespace lldb_private::breakpad;
 using namespace testing;
 
@@ -191,8 +190,7 @@ ProcessSP MockProcessCreateInstance(TargetSP target_sp, 
ListenerSP listener_sp,
 
 class LocateModuleCallbackTest : public testing::Test {
   SubsystemRAII
+PlatformAndroid, SymbolFileBreakpad, SymbolFileSymtab>
   subsystems;
 
 public:
@@ -204,9 +202,6 @@ class LocateModuleCallbackTest : public testing::Test {
 m_test_dir);
 
 // Create Debugger.
-ArchSpec host_arch("i386-pc-linux");
-Platform::SetHostPlatform(
-platform_linux::PlatformLinux::CreateInstance(true, &host_arch));
 m_debugger_sp = Debugger::CreateInstance();
 EXPECT_TRUE(m_debugger_sp);
 



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


[Lldb-commits] [lldb] df05449 - Revert "[lldb][LocateModuleCallback] Call locate module callback"

2023-07-14 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2023-07-14T11:05:01-04:00
New Revision: df054499c35cdda02b196b2ca5c0a326abdc0a29

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

LOG: Revert "[lldb][LocateModuleCallback] Call locate module callback"

This reverts commit 7f1028e9df52b4e7246f189a24684b1ca8c9bfbe.

This is because test failures

lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModule
lldb-unit.Target/_/TargetTests/LocateModuleCallbackTest.GetOrCreateModuleWithCachedModuleAndBreakpadSymbol

Added: 


Modified: 
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/Target/Target.h
lldb/source/Target/Platform.cpp
lldb/source/Target/Target.cpp
lldb/unittests/Target/CMakeLists.txt

Removed: 
lldb/unittests/Target/Inputs/AndroidModule.c
lldb/unittests/Target/Inputs/AndroidModule.so
lldb/unittests/Target/Inputs/AndroidModule.so.sym
lldb/unittests/Target/Inputs/AndroidModule.unstripped.so
lldb/unittests/Target/LocateModuleCallbackTest.cpp



diff  --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index a5a78fe0f86983..35227429b126ae 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -881,19 +881,6 @@ class Platform : public PluginInterface {
   
   virtual Args GetExtraStartupCommands();
 
-  typedef std::function
-  LocateModuleCallback;
-
-  /// Set locate module callback. This allows users to implement their own
-  /// module cache system. For example, to leverage artifacts of build system,
-  /// to bypass pulling files from remote platform, or to search symbol files
-  /// from symbol servers.
-  void SetLocateModuleCallback(LocateModuleCallback callback);
-
-  LocateModuleCallback GetLocateModuleCallback() const;
-
 protected:
   /// Create a list of ArchSpecs with the given OS and a architectures. The
   /// vendor field is left as an "unspecified unknown".
@@ -941,7 +928,6 @@ class Platform : public PluginInterface {
   std::vector m_trap_handlers;
   bool m_calculated_trap_handlers;
   const std::unique_ptr m_module_cache;
-  LocateModuleCallback m_locate_module_callback;
 
   /// Ask the Platform subclass to fill in the list of trap handler names
   ///

diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index d5b4b8e18c2d2d..ed0ecbbddbf814 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1625,12 +1625,6 @@ class Target : public 
std::enable_shared_from_this,
 
   Target(const Target &) = delete;
   const Target &operator=(const Target &) = delete;
-
-private:
-  void CallLocateModuleCallbackIfSet(const ModuleSpec &module_spec,
- lldb::ModuleSP &module_sp,
- FileSpec &symbol_file_spec,
- bool &did_create_module);
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 11a123fb6d583d..eedf596f1977f3 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1971,14 +1971,6 @@ Args Platform::GetExtraStartupCommands() {
   return {};
 }
 
-void Platform::SetLocateModuleCallback(LocateModuleCallback callback) {
-  m_locate_module_callback = callback;
-}
-
-Platform::LocateModuleCallback Platform::GetLocateModuleCallback() const {
-  return m_locate_module_callback;
-}
-
 PlatformSP PlatformList::GetOrCreate(llvm::StringRef name) {
   std::lock_guard guard(m_mutex);
   for (const PlatformSP &platform_sp : m_platforms) {

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index f0c57ef83c4a14..06867d359a3c0f 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2129,46 +2129,19 @@ ModuleSP Target::GetOrCreateModule(const ModuleSpec 
&module_spec, bool notify,
  // of the library
 bool did_create_module = false;
 FileSpecList search_paths = GetExecutableSearchPaths();
-FileSpec symbol_file_spec;
-
-// Call locate module callback if set. This allows users to implement their
-// own module cache system. For example, to leverage build system 
artifacts,
-// to bypass pulling files from remote platform, or to search symbol files
-// from symbol servers.
-CallLocateModuleCallbackIfSet(module_spec, module_sp, symbol_file_spec,
-  did_create_module);
-
-// The result of this CallLocateModuleCallbackIfSet is one of the 
following.
-// 1. module_sp:loaded, symbol_file_spec:set
-//  The callback found a module file and a symbol file for the
-//  module_spec. We will call module_sp->SetSymbolFileFileSpec with
-

[Lldb-commits] [PATCH] D153734: [lldb][LocateModuleCallback] Call locate module callback

2023-07-14 Thread Shubham Sandeep Rastogi via Phabricator via lldb-commits
rastogishubham added a comment.

I am reverting both fb087c17c8230 
 and 
7f1028e9df52b 
 to see if 
the bot becomes green again


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153734

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


[Lldb-commits] [PATCH] D153734: [lldb][LocateModuleCallback] Call locate module callback

2023-07-14 Thread Shubham Sandeep Rastogi via Phabricator via lldb-commits
rastogishubham added a comment.

The unit test LocateModuleCallbackTest.cpp is very flaky and is failing on the 
lldb arm64 incremental bot

Notice build https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/2259/ 
passes
and https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/2260/ fails, 
even though the changes in 2260 have nothing to do with lldb.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153734

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


[Lldb-commits] [PATCH] D149213: [lldb] Add basic support to Rust enums in TypeSystemClang

2023-07-14 Thread Vladimir Makaev via Phabricator via lldb-commits
VladimirMakaev added a comment.

I've reached out to Rust wg-debugging for additional feedback 
(https://rust-lang.zulipchat.com/#narrow/stream/317568-t-compiler.2Fwg-debugging/topic/Feedback.20on.20DW_TAG_variant_part.20support.20in.20LLDB)

There a couple of edge cases (when using u128 enums) that not working properly 
so I'm going fix them and add more tests.

Additionally an issue was raised:

> Another comment: Checking the language of the CU might not be reliable 
> because of cross-language inlining. That is, if some Rust code gets inlined 
> into a C++ CU, then the CU will probably still say it is C++ even though it 
> might contain DW_TAG_variant_part DIEs. Just something to be aware of an 
> handle gracefully.

What do you guys think on not gating it behind CU check, maybe there is another 
way? My opinion probably is that there is more risk to CLang users / potential 
conflict with CLang evolution than benefit of having LLDB working for Rust code 
in this niche scenario?


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

https://reviews.llvm.org/D149213

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


[Lldb-commits] [PATCH] D155124: [lldb][Windows] Fix TestLocateModuleCallback

2023-07-14 Thread Leandro Lupori via Phabricator via lldb-commits
luporl accepted this revision.
luporl added a comment.
This revision is now accepted and ready to land.

LGTM. It should fix the buildbot failure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155124

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


[Lldb-commits] [PATCH] D154705: [lldb][AArch64] Fix flakiness in TestSVEThreadedDynamic

2023-07-14 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid accepted this revision.
omjavaid added a comment.
This revision is now accepted and ready to land.

Sounds ok to me. We can always fix it if starts to cause trouble.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154705

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


[Lldb-commits] [PATCH] D155269: [lldb][AArch64] Add SME streaming vector length pseudo register

2023-07-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added subscribers: ctetreau, kristof.beyls.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Reading the SVE registers of streaming mode from non-streaming mode,
and vice versa, returns invalid data. As their state is reset each
time you switch between them.

However, the vector length is distinct between the two modes.

The existing register "vg" will always report the vector length for
the current mode and this change adds "svg" which will always return
the streaming vector length.

non-streaming mode: vg  = non-streaming vector length

  svg = streaming vector length
  streaming mode: vg  = streaming vector length
  svg = streaming vector length

The content of svg is read from the NT_ARM_SSVE header, even if
we are in non-streaming mode. Which we are allowed to do
(the result is just missing the register data in this situation).

It is read only for the moment. It may be made writeable in future
patches. It has been added to the SME register set and I've converted
that into a struct for easier handling.

The SVE dynamic size test has been updated to check the expected
svg values as it is already setup to break just after a mode switch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155269

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
  
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/TestSVEThreadedDynamic.py

Index: lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/TestSVEThreadedDynamic.py
===
--- lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/TestSVEThreadedDynamic.py
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/TestSVEThreadedDynamic.py
@@ -96,6 +96,12 @@
 
 self.expect("register read ffr", substrs=[p_regs_value])
 
+def build_for_mode(self, mode):
+cflags = "-march=armv8-a+sve -lpthread"
+if mode == Mode.SSVE:
+cflags += " -DUSE_SSVE"
+self.build(dictionary={"CFLAGS_EXTRAS": cflags})
+
 def run_sve_test(self, mode):
 if (mode == Mode.SVE) and not self.isAArch64SVE():
 self.skipTest("SVE registers must be supported.")
@@ -103,12 +109,8 @@
 if (mode == Mode.SSVE) and not self.isAArch64SME():
 self.skipTest("Streaming SVE registers must be supported.")
 
-cflags = "-march=armv8-a+sve -lpthread"
-if mode == Mode.SSVE:
-cflags += " -DUSE_SSVE"
-self.build(dictionary={"CFLAGS_EXTRAS": cflags})
+self.build_for_mode(mode)
 
-self.build()
 supported_vg = self.get_supported_vg()
 
 if not (2 in supported_vg and 4 in supported_vg):
@@ -198,3 +200,62 @@
 def test_ssve_registers_dynamic_config(self):
 """Test AArch64 SSVE registers multi-threaded dynamic resize."""
 self.run_sve_test(Mode.SSVE)
+
+def setup_svg_test(self, mode):
+# Even when running in SVE mode, we need access to SVG for these tests.
+if not self.isAArch64SME():
+self.skipTest("Streaming SVE registers must be supported.")
+
+self.build_for_mode(mode)
+
+supported_vg = self.get_supported_vg()
+
+main_thread_stop_line = line_number("main.c", "// Break in main thread")
+lldbutil.run_break_set_by_file_and_line(self, "main.c", main_thread_stop_line)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+process = self.dbg.GetSelectedTarget().GetProcess()
+
+self.expect(
+"thread info 1",
+STOPPED_DUE_TO_BREAKPOINT,
+substrs=["stop reason = breakpoint"],
+)
+
+target = self.dbg.GetSelectedTarget()
+process = target.GetProcess()
+
+return process, supported_vg
+
+def read_vg(self, process):
+registerSets = process.GetThreadAtIndex(0).GetFrameAtIndex(0).GetRegisters()
+sve_registers = registerSets.GetFirstValueByName("Scalable Vector Extension Registers")
+return sve_registers.GetChildMemberWithName("vg").GetValueAsUnsigned()
+
+def read_svg(self, process):
+registerSets = process.GetThreadAtIndex(0).GetFrameAtIndex(0).GetRegisters()
+sve_registers = registerSets.GetFirstValueByName("Scalable Matrix Extension Registers")
+return sve_registers.GetChildMemberWithName("svg").GetValueAsUnsigned()
+
+def do_svg_test(self, process, vgs, expected_svgs):
+for vg, svg in zip(vgs, expected_svgs):
+self.runCmd("register write vg {}".format(vg))
+self.assertEqual(svg, se