[Lldb-commits] [PATCH] D119915: Replace use of double underscore in identifiers

2022-02-16 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Yeah, we shouldn't be using these. Personally, I think the names are now 
unnecessarily long, and I'd go with something shorter. E.g. replacing the 
double underscore (btw, in python land they abbreviate that to "dunder", so 
that would be another option) with a single 
(`g_double_underscore_kCFBooleanFalse` -> `g_kCFBooleanFalse`), but I don't 
think this is worth bikeshedding over.




Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp:370
   GetValueOffset(iterated_sp);
-  auto child_sp = iterated_sp->GetChildMemberWithName(g___value_, true);
+  auto child_sp = 
iterated_sp->GetChildMemberWithName(g_double_underscore_value_, true);
   if (child_sp)

this line is now way above the length limit.


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

https://reviews.llvm.org/D119915

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


[Lldb-commits] [PATCH] D119857: [lldb] Don't rely on unsigned integer wrapping in PutRawBytes and PutBytesAsRawHex8

2022-02-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Another option would be to go full-STL and do something like

  ArrayRef data(ptr, len);
  if (reverse)
for (uint8_t byte: llvm::reverse(data))
  ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119857

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


[Lldb-commits] [lldb] 1ccfef1 - Add a case for Rust in LLDB's PDB reader

2022-02-16 Thread David Chisnall via lldb-commits

Author: Arlo Siemsen
Date: 2022-02-16T09:58:05Z
New Revision: 1ccfef14e57e3ccdf9bb796142225dad8ae08168

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

LOG: Add a case for Rust in LLDB's PDB reader

D115300 added Rust as a new PDB language type.

This change allows LLDB to recognize the new language type.

Reviewed By: rnk

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index cda9d42129d43..8ecfadf777169 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -80,6 +80,8 @@ static lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
 return lldb::LanguageType::eLanguageTypeC;
   case PDB_Lang::Swift:
 return lldb::LanguageType::eLanguageTypeSwift;
+  case PDB_Lang::Rust:
+return lldb::LanguageType::eLanguageTypeRust;
   default:
 return lldb::LanguageType::eLanguageTypeUnknown;
   }

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index bdfc397d94a4c..7f450af703331 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -74,6 +74,8 @@ lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
 return lldb::LanguageType::eLanguageTypeC;
   case PDB_Lang::Swift:
 return lldb::LanguageType::eLanguageTypeSwift;
+  case PDB_Lang::Rust:
+return lldb::LanguageType::eLanguageTypeRust;
   default:
 return lldb::LanguageType::eLanguageTypeUnknown;
   }



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


[Lldb-commits] [PATCH] D119044: Add a case for Rust in LLDB's PDB reader

2022-02-16 Thread David Chisnall via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ccfef14e57e: Add a case for Rust in LLDB's PDB reader 
(authored by arlosi, committed by theraven).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119044

Files:
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp


Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -74,6 +74,8 @@
 return lldb::LanguageType::eLanguageTypeC;
   case PDB_Lang::Swift:
 return lldb::LanguageType::eLanguageTypeSwift;
+  case PDB_Lang::Rust:
+return lldb::LanguageType::eLanguageTypeRust;
   default:
 return lldb::LanguageType::eLanguageTypeUnknown;
   }
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -80,6 +80,8 @@
 return lldb::LanguageType::eLanguageTypeC;
   case PDB_Lang::Swift:
 return lldb::LanguageType::eLanguageTypeSwift;
+  case PDB_Lang::Rust:
+return lldb::LanguageType::eLanguageTypeRust;
   default:
 return lldb::LanguageType::eLanguageTypeUnknown;
   }


Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -74,6 +74,8 @@
 return lldb::LanguageType::eLanguageTypeC;
   case PDB_Lang::Swift:
 return lldb::LanguageType::eLanguageTypeSwift;
+  case PDB_Lang::Rust:
+return lldb::LanguageType::eLanguageTypeRust;
   default:
 return lldb::LanguageType::eLanguageTypeUnknown;
   }
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -80,6 +80,8 @@
 return lldb::LanguageType::eLanguageTypeC;
   case PDB_Lang::Swift:
 return lldb::LanguageType::eLanguageTypeSwift;
+  case PDB_Lang::Rust:
+return lldb::LanguageType::eLanguageTypeRust;
   default:
 return lldb::LanguageType::eLanguageTypeUnknown;
   }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 9bde881 - [lldb] Enable TestThreadStepOut on linux

2022-02-16 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-02-16T11:18:13+01:00
New Revision: 9bde88182317325bb95c13190a4cf303d3ce4b54

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

LOG: [lldb] Enable TestThreadStepOut on linux

After applying the same for as in TestThreadBacktraceRepeat, the test
appears to pass reliably. The skip decorator was added many years ago,
so it's not clear whether this is what caused it to hang.

Added: 


Modified: 
lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py 
b/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py
index adce28dc3f7f6..71a7e60333907 100644
--- a/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py
+++ b/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py
@@ -14,11 +14,6 @@ class ThreadStepOutTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-# Test occasionally times out on the Linux build bot
-@skipIfLinux
-@expectedFailureAll(
-oslist=["linux"],
-bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux 
build bot")
 @expectedFailureAll(
 oslist=["freebsd"],
 bugnumber="llvm.org/pr18066 inferior does not exit")
@@ -30,11 +25,6 @@ def test_step_single_thread(self):
 self.build()
 self.step_out_test(self.step_out_single_thread_with_cmd)
 
-# Test occasionally times out on the Linux build bot
-@skipIfLinux
-@expectedFailureAll(
-oslist=["linux"],
-bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux 
build bot")
 @expectedFailureAll(
 oslist=["freebsd"],
 bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint")
@@ -47,11 +37,6 @@ def test_step_all_threads(self):
 self.build()
 self.step_out_test(self.step_out_all_threads_with_cmd)
 
-# Test occasionally times out on the Linux build bot
-@skipIfLinux
-@expectedFailureAll(
-oslist=["linux"],
-bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux 
build bot")
 @expectedFailureAll(
 oslist=["freebsd"],
 bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint")
@@ -143,9 +128,9 @@ def step_out_test(self, step_out_func):
 if len(breakpoint_threads) == 1:
 success = thread.Suspend()
 self.assertTrue(success, "Couldn't suspend a thread")
-bkpt_threads = lldbutil.continue_to_breakpoint(self.process,
+breakpoint_threads = lldbutil.continue_to_breakpoint(self.process,
bkpt)
-self.assertEqual(len(bkpt_threads), 1, "Second thread stopped")
+self.assertEqual(len(breakpoint_threads), 2, "Second thread 
stopped")
 success = thread.Resume()
 self.assertTrue(success, "Couldn't resume a thread")
 



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


[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "system-wide" lldbinit file

2022-02-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D119831#3324830 , @clayborg wrote:

> This looks good to me. Just a few things to possibly think about:
>
> - Maybe we would want addition system init files for different workflows and 
> then we would start lldb with a new option like "lldb --workflow qemu" and it 
> would load the system ".lldbinit-qemu" init file. That way we could have many 
> supported workflows from one distribution. Here at Facebook we would have at 
> least 3 that I know of: "fb-ios", "fb-android" and "fb-server". We would 
> still have a system ".lldbinit" for global settings of course.

You are correctly guessing that this is motivated (at least partially, anyway) 
by the qemu patchset, but the idea there is to have a plain "lldb" just work. 
So, I don't think this would be interesting for us right now.

Nonetheless, I do find that idea intriguing. We would need to reconciliate this 
somehow with the existing concept of application-specific lldbinit files -- I 
think having both would be too much. Perhaps if we rename the app-specific 
files to "workflow-specific init files", and have the default workflow be 
derived from the application name... I don't think this would work right now, 
as we probably `realpath` everything, but if we avoided that then we could even 
allow using symlinks to automatically choose different workflows (`ln -s lldb 
lldb.qemu; ./lldb.qemu` could launch a "qemu" workflow).

(Of course, at that point, one could just make `lldb.qemu` a shell script which 
effectively does a `exec lldb -S qemu.lldbinit "$@"`, and avoid all this extra 
infrastructure.)

> - We were currently doing stuff like this in python where it would auto 
> import some of our facebook specific python modules when the debugger starts 
> up, would that be useful as well? It wouldn't really be needed here because 
> we could just "command script import" in the init files

Right now, it looks like all of our setup will be done in python as well, and 
our lldbinit file will probably consist of a single `command script import 
--relative-to-command-file` line. Going straight to python would probably make 
things easier for us, but this seemed to fit in better into the existing lldb 
feature set.




Comment at: lldb/include/lldb/Interpreter/CommandInterpreter.h:256
   void SourceInitFileHome(CommandReturnObject &result, bool is_repl);
+  void SourceSystemInitFile(CommandReturnObject &result);
 

wallace wrote:
> JDevlieghere wrote:
> > `SourceInitFileSystem` for consistency with the other two? Or maybe you 
> > were planning to change the other two in another patch?
> calling it SourceInitFileSystem is a bit confusing. What about using Global 
> instead of System to avoid naming issues?
Yeah, that was the reason why I changed the word order. We can just call it 
"global" instead.



Comment at: lldb/source/Interpreter/CommandInterpreter.cpp:2385-2393
+#ifdef LLDB_SYSTEM_INIT_PATH
+FileSpec init_file(LLDB_SYSTEM_INIT_PATH);
+if (init_file) {
+  init_file.MakeAbsolute(HostInfo::GetShlibDir());
+}
+
+SourceInitFile(init_file, result);

JDevlieghere wrote:
> Why not put the ifdef around the `m_skip_lldbinit_files` check?
It just happened to fall out that way. I agree switching the order looks better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119831

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


[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "system-wide" lldbinit file

2022-02-16 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 409196.
labath added a comment.

Use the term "global" and rename functions to make it more consistent with
existing code.

It's worth noting that (as a part of the consistency), I have changed the cmake
variable to point to a directory instead of a file. This means that the init
file name is currently hardcoded -- currently it's "lldbinit", but we could
change that into something more complex to support the workflow feature.

In particular, I note the fact that the file name does not include a leading
dot, as I believe is the practice for global configuration files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119831

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/include/lldb/API/SBCommandInterpreter.h
  lldb/include/lldb/Host/Config.h.cmake
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/API/SBDebugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -452,9 +452,14 @@
 
   SBCommandInterpreter sb_interpreter = m_debugger.GetCommandInterpreter();
 
-  // Before we handle any options from the command line, we parse the
-  // REPL init file or the default file in the user's home directory.
+  // Process lldbinit files before handling any options from the command line.
   SBCommandReturnObject result;
+  sb_interpreter.SourceInitFileInGlobalDirectory(result);
+  if (m_option_data.m_debug_mode) {
+result.PutError(m_debugger.GetErrorFile());
+result.PutOutput(m_debugger.GetOutputFile());
+  }
+
   sb_interpreter.SourceInitFileInHomeDirectory(result, m_option_data.m_repl);
   if (m_option_data.m_debug_mode) {
 result.PutError(m_debugger.GetErrorFile());
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2380,6 +2380,21 @@
   SourceInitFile(FileSpec(init_file.str()), result);
 }
 
+void CommandInterpreter::SourceInitFileGlobal(CommandReturnObject &result) {
+#ifdef LLDB_GLOBAL_INIT_DIRECTORY
+  if (!m_skip_lldbinit_files) {
+FileSpec init_file(LLDB_GLOBAL_INIT_DIRECTORY);
+if (init_file)
+  init_file.MakeAbsolute(HostInfo::GetShlibDir());
+
+init_file.AppendPathComponent("lldbinit");
+SourceInitFile(init_file, result);
+return;
+  }
+#endif
+  result.SetStatus(eReturnStatusSuccessFinishNoResult);
+}
+
 const char *CommandInterpreter::GetCommandPrefix() {
   const char *prefix = GetDebugger().GetIOHandlerCommandPrefix();
   return prefix == nullptr ? "" : prefix;
Index: lldb/source/API/SBDebugger.cpp
===
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -236,6 +236,7 @@
 interp.get()->SkipLLDBInitFiles(false);
 interp.get()->SkipAppInitFiles(false);
 SBCommandReturnObject result;
+interp.SourceInitFileInGlobalDirectory(result);
 interp.SourceInitFileInHomeDirectory(result, false);
   } else {
 interp.get()->SkipLLDBInitFiles(true);
Index: lldb/source/API/SBCommandInterpreter.cpp
===
--- lldb/source/API/SBCommandInterpreter.cpp
+++ lldb/source/API/SBCommandInterpreter.cpp
@@ -417,6 +417,21 @@
   m_opaque_ptr = interpreter;
 }
 
+void SBCommandInterpreter::SourceInitFileInGlobalDirectory(
+SBCommandReturnObject &result) {
+  LLDB_INSTRUMENT_VA(this, result);
+  result.Clear();
+  if (IsValid()) {
+TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
+std::unique_lock lock;
+if (target_sp)
+  lock = std::unique_lock(target_sp->GetAPIMutex());
+m_opaque_ptr->SourceInitFileGlobal(result.ref());
+  } else {
+result->AppendError("SBCommandInterpreter is not valid");
+  }
+}
+
 void SBCommandInterpreter::SourceInitFileInHomeDirectory(
 SBCommandReturnObject &result) {
   LLDB_INSTRUMENT_VA(this, result);
Index: lldb/include/lldb/Interpreter/CommandInterpreter.h
===
--- lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -253,6 +253,7 @@
 
   void SourceInitFileCwd(CommandReturnObject &result);
   void SourceInitFileHome(CommandReturnObject &result, bool is_repl);
+  void SourceInitFileGlobal(CommandReturnObject &result);
 
   bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
   bool can_replace);
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Confi

[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "global" lldbinit file

2022-02-16 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 409197.
labath marked 4 inline comments as done.
labath edited the summary of this revision.
labath added a comment.

And add the extra blank line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119831

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/include/lldb/API/SBCommandInterpreter.h
  lldb/include/lldb/Host/Config.h.cmake
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/API/SBDebugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -452,9 +452,14 @@
 
   SBCommandInterpreter sb_interpreter = m_debugger.GetCommandInterpreter();
 
-  // Before we handle any options from the command line, we parse the
-  // REPL init file or the default file in the user's home directory.
+  // Process lldbinit files before handling any options from the command line.
   SBCommandReturnObject result;
+  sb_interpreter.SourceInitFileInGlobalDirectory(result);
+  if (m_option_data.m_debug_mode) {
+result.PutError(m_debugger.GetErrorFile());
+result.PutOutput(m_debugger.GetOutputFile());
+  }
+
   sb_interpreter.SourceInitFileInHomeDirectory(result, m_option_data.m_repl);
   if (m_option_data.m_debug_mode) {
 result.PutError(m_debugger.GetErrorFile());
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2380,6 +2380,21 @@
   SourceInitFile(FileSpec(init_file.str()), result);
 }
 
+void CommandInterpreter::SourceInitFileGlobal(CommandReturnObject &result) {
+#ifdef LLDB_GLOBAL_INIT_DIRECTORY
+  if (!m_skip_lldbinit_files) {
+FileSpec init_file(LLDB_GLOBAL_INIT_DIRECTORY);
+if (init_file)
+  init_file.MakeAbsolute(HostInfo::GetShlibDir());
+
+init_file.AppendPathComponent("lldbinit");
+SourceInitFile(init_file, result);
+return;
+  }
+#endif
+  result.SetStatus(eReturnStatusSuccessFinishNoResult);
+}
+
 const char *CommandInterpreter::GetCommandPrefix() {
   const char *prefix = GetDebugger().GetIOHandlerCommandPrefix();
   return prefix == nullptr ? "" : prefix;
Index: lldb/source/API/SBDebugger.cpp
===
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -236,6 +236,7 @@
 interp.get()->SkipLLDBInitFiles(false);
 interp.get()->SkipAppInitFiles(false);
 SBCommandReturnObject result;
+interp.SourceInitFileInGlobalDirectory(result);
 interp.SourceInitFileInHomeDirectory(result, false);
   } else {
 interp.get()->SkipLLDBInitFiles(true);
Index: lldb/source/API/SBCommandInterpreter.cpp
===
--- lldb/source/API/SBCommandInterpreter.cpp
+++ lldb/source/API/SBCommandInterpreter.cpp
@@ -417,6 +417,22 @@
   m_opaque_ptr = interpreter;
 }
 
+void SBCommandInterpreter::SourceInitFileInGlobalDirectory(
+SBCommandReturnObject &result) {
+  LLDB_INSTRUMENT_VA(this, result);
+
+  result.Clear();
+  if (IsValid()) {
+TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
+std::unique_lock lock;
+if (target_sp)
+  lock = std::unique_lock(target_sp->GetAPIMutex());
+m_opaque_ptr->SourceInitFileGlobal(result.ref());
+  } else {
+result->AppendError("SBCommandInterpreter is not valid");
+  }
+}
+
 void SBCommandInterpreter::SourceInitFileInHomeDirectory(
 SBCommandReturnObject &result) {
   LLDB_INSTRUMENT_VA(this, result);
Index: lldb/include/lldb/Interpreter/CommandInterpreter.h
===
--- lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -253,6 +253,7 @@
 
   void SourceInitFileCwd(CommandReturnObject &result);
   void SourceInitFileHome(CommandReturnObject &result, bool is_repl);
+  void SourceInitFileGlobal(CommandReturnObject &result);
 
   bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
   bool can_replace);
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Config.h.cmake
+++ lldb/include/lldb/Host/Config.h.cmake
@@ -53,4 +53,6 @@
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
 
+#cmakedefine LLDB_GLOBAL_INIT_DIRECTORY R"(${LLDB_GLOBAL_INIT_DIRECTORY})"
+
 #endif // #ifndef LLDB_HOST_CONFIG_H
Index: lldb/include/lldb/API/SBCommandInterpreter.h
===
--- lldb/include/lldb/API/SBCommandInterpreter.h
+++ lldb/incl

[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

2022-02-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Doing it in the common code is a great idea, and it will make the code more 
robust. However, instead of "sneaking" the listener through a member variable, 
it would be better to pass it through function arguments instead (normally in 
the LaunchInfo struct, and as a probably as separate argument for the last 
mile). I believe this is what Jim had in mind as well.

See inline comments for details.




Comment at: lldb/source/Target/Process.cpp:2538-2539
 RestoreProcessEvents();
+// Releasing the scope guard to avoid double restoring.
+on_exit.release();
 SetPublicState(state, false);

It would be better if this could be achieved by restructuring the code so that 
the hijacking is really scope-based. E.g., moving the "file doesn't exist" 
check up front and making it an early exit, moving some stuff into helper 
functions, or whatever.



Comment at: lldb/source/Target/Target.cpp:202
  llvm::StringRef plugin_name,
  const FileSpec *crash_file,
  bool can_connect) {

Add an extra argument here.



Comment at: lldb/source/Target/Target.cpp:3044-3045
+// they invoke Process::Launch.
+m_hijacker_on_process_creation_sp =
+Listener::MakeListener(hijacking_listener_name);
+launch_info.SetHijackListener(m_hijacker_on_process_creation_sp);

Remove this. Make sure the listener in the launch_info is plumbed to the launch 
function.



Comment at: lldb/source/Target/Target.cpp:3069
 m_process_sp =
 GetPlatform()->DebugProcess(launch_info, debugger, *this, error);
 

Remove hijack listener creation from DebugProcess implementations (you can 
replace with an assert if you want).



Comment at: lldb/source/Target/Target.cpp:3106-3107
+hijack_listener_sp = Listener::MakeListener(hijacking_listener_name);
 launch_info.SetHijackListener(hijack_listener_sp);
 m_process_sp->HijackProcessEvents(hijack_listener_sp);
   }

I guess we should just delete this now, as it is never correct to hijack events 
this late in the game.


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

https://reviews.llvm.org/D119548

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


[Lldb-commits] [lldb] 0c58e9f - [lldb] Fix memory leak in CommandObjectType

2022-02-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-02-16T09:05:08-08:00
New Revision: 0c58e9f4a474c60ed863e6a66c0e1202b4bd6c78

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

LOG: [lldb] Fix memory leak in CommandObjectType

Avoid leaking the ScriptAddOptions or SynthAddOptions when we return
early because of an empty type name.

Added: 


Modified: 
lldb/source/Commands/CommandObjectType.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectType.cpp 
b/lldb/source/Commands/CommandObjectType.cpp
index f9e1d0f91fb76..f4ecd80fb0210 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -1337,9 +1337,9 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
 m_options.m_flags, funct_name_str.c_str(), code.c_str());
   } else {
 // Use an IOHandler to grab Python code from the user
-ScriptAddOptions *options =
-new ScriptAddOptions(m_options.m_flags, m_options.m_regex,
- m_options.m_name, m_options.m_category);
+auto options = std::make_unique(
+m_options.m_flags, m_options.m_regex, m_options.m_name,
+m_options.m_category);
 
 for (auto &entry : command.entries()) {
   if (entry.ref().empty()) {
@@ -1351,10 +1351,10 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
 }
 
 m_interpreter.GetPythonCommandsFromIOHandler(
-"",   // Prompt
-*this,// IOHandlerDelegate
-options); // Baton for the "io_handler" that will be passed back into
-  // our IOHandlerDelegate functions
+"", // Prompt
+*this,  // IOHandlerDelegate
+options.release()); // Baton for the "io_handler" that will be passed
+// back into our IOHandlerDelegate functions
 result.SetStatus(eReturnStatusSuccessFinishNoResult);
 
 return result.Succeeded();
@@ -2252,7 +2252,7 @@ class CommandObjectTypeSynthClear : public 
CommandObjectTypeFormatterClear {
 
 bool CommandObjectTypeSynthAdd::Execute_HandwritePython(
 Args &command, CommandReturnObject &result) {
-  SynthAddOptions *options = new SynthAddOptions(
+  auto options = std::make_unique(
   m_options.m_skip_pointers, m_options.m_skip_references,
   m_options.m_cascade, m_options.m_regex, m_options.m_category);
 
@@ -2266,10 +2266,10 @@ bool CommandObjectTypeSynthAdd::Execute_HandwritePython(
   }
 
   m_interpreter.GetPythonCommandsFromIOHandler(
-  "",   // Prompt
-  *this,// IOHandlerDelegate
-  options); // Baton for the "io_handler" that will be passed back into our
-// IOHandlerDelegate functions
+  "", // Prompt
+  *this,  // IOHandlerDelegate
+  options.release()); // Baton for the "io_handler" that will be passed 
back
+  // into our IOHandlerDelegate functions
   result.SetStatus(eReturnStatusSuccessFinishNoResult);
   return result.Succeeded();
 }



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


[Lldb-commits] [lldb] 6f1ce04 - [lldb] BreakpointResolver::CreateFromStructuredData Gardening (NFC)

2022-02-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-02-16T10:38:05-08:00
New Revision: 6f1ce046fdd02458fe2e3824b865ba4bdf129d67

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

LOG: [lldb] BreakpointResolver::CreateFromStructuredData Gardening (NFC)

 - Use an early return.
 - Check for error.Fail() instead of !error.Success().
 - Check the resolver pointer before using instead of relying on the
   error being set.

Added: 


Modified: 
lldb/source/Breakpoint/BreakpointResolver.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/BreakpointResolver.cpp 
b/lldb/source/Breakpoint/BreakpointResolver.cpp
index 2443befcbfb42..71cbb2b2c6668 100644
--- a/lldb/source/Breakpoint/BreakpointResolver.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolver.cpp
@@ -109,8 +109,7 @@ BreakpointResolverSP 
BreakpointResolver::CreateFromStructuredData(
 return result_sp;
   }
 
-  BreakpointResolver *resolver;
-
+  BreakpointResolver *resolver = nullptr;
   switch (resolver_type) {
   case FileLineResolver:
 resolver = BreakpointResolverFileLine::CreateFromStructuredData(
@@ -139,13 +138,12 @@ BreakpointResolverSP 
BreakpointResolver::CreateFromStructuredData(
 llvm_unreachable("Should never get an unresolvable resolver type.");
   }
 
-  if (!error.Success()) {
+  if (!resolver || error.Fail())
 return result_sp;
-  } else {
-// Add on the global offset option:
-resolver->SetOffset(offset);
-return BreakpointResolverSP(resolver);
-  }
+
+  // Add on the global offset option:
+  resolver->SetOffset(offset);
+  return BreakpointResolverSP(resolver);
 }
 
 StructuredData::DictionarySP BreakpointResolver::WrapOptionsDict(



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


[Lldb-commits] [lldb] 046b772 - [lldb] Default initialize DWARFDebugMacroHeader

2022-02-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-02-16T10:38:05-08:00
New Revision: 046b772c78a8f6a9728191eda7dae9eb0c766f1b

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

LOG: [lldb] Default initialize DWARFDebugMacroHeader

Default initialize the DWARFDebugMacroHeader to avoid returning a header
with uninitialized variables from DWARFDebugMacroHeader::ParseHeader.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
index 5c0338e950eb8..cbf762458331b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
@@ -43,9 +43,9 @@ class DWARFDebugMacroHeader {
   SkipOperandTable(const lldb_private::DWARFDataExtractor &debug_macro_data,
lldb::offset_t *offset);
 
-  uint16_t m_version;
-  bool m_offset_is_64_bit;
-  uint64_t m_debug_line_offset;
+  uint16_t m_version = 0;
+  bool m_offset_is_64_bit = false;
+  uint64_t m_debug_line_offset = 0;
 };
 
 class DWARFDebugMacroEntry {



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


[Lldb-commits] [PATCH] D119501: [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

2022-02-16 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 409325.
mib marked an inline comment as done.
mib added a comment.

Add test


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

https://reviews.llvm.org/D119501

Files:
  lldb/bindings/python/CMakeLists.txt
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test

Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
@@ -0,0 +1,10 @@
+# RUN: %clang_host -g %S/Inputs/test.c -o %t.out
+
+# RUN: cp %S/Inputs/scripted_crashlog.ips %t.crash
+# RUN: %python %S/patch-crashlog.py --binary %t.out --crashlog %t.crash --offsets '{"main":20, "bar":9, "foo":16}' --json
+# RUN: %lldb %t.out -o 'command script import lldb.macosx.crashlog' -o 'crashlog -i %t.crash' -o 'process status' 2>&1 | FileCheck %s
+
+# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands
+# CHECK: Process 92190 stopped
+# CHECK: * thread #1, name = 'CrashLogScriptedThread.thread-0', stop reason = EXC_BAD_ACCESS
+# CHECK: frame #0: 0x000104a23f68 scripted_crashlog_json.test.tmp.out`foo at test.c:3:6 [artificial]
Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
@@ -0,0 +1,172 @@
+{"app_name":"scripted_crashlog_json.test.tmp.out","timestamp":"2022-02-14 16:30:31.00 -0800","app_version":"","slice_uuid":"b928ee77-9429-334f-ac88-41440bb3d4c7","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.3 (21E209)","incident_id":"E57CADE7-DC44-45CE-8D16-18EBC4406B97","name":"scripted_crashlog_json.test.tmp.out"}
+{
+  "uptime" : 26,
+  "procLaunch" : "2022-02-14 16:30:31.8048 -0800",
+  "procRole" : "Unspecified",
+  "version" : 2,
+  "userID" : 501,
+  "deployVersion" : 210,
+  "modelCode" : "MacBookPro18,2",
+  "procStartAbsTime" : 6478056069413,
+  "coalitionID" : 22196,
+  "osVersion" : {
+"train" : "macOS 12.3",
+"build" : "21E209",
+"releaseType" : "Internal"
+  },
+  "captureTime" : "2022-02-14 16:30:31.8096 -0800",
+  "incident" : "E57CADE7-DC44-45CE-8D16-18EBC4406B97",
+  "bug_type" : "309",
+  "pid" : 92190,
+  "procExitAbsTime" : 6478056175721,
+  "translated" : false,
+  "cpuType" : "ARM-64",
+  "procName" : "scripted_crashlog_json.test.tmp.out",
+  "procPath" : "\/Users\/USER\/*\/scripted_crashlog_json.test.tmp.out",
+  "parentProc" : "zsh",
+  "parentPid" : 82132,
+  "coalitionName" : "com.apple.Terminal",
+  "crashReporterKey" : "CDC11418-EDBF-2A49-0D83-8B441A5004B0",
+  "responsiblePid" : 76395,
+  "responsibleProc" : "Terminal",
+  "wakeTime" : 14889,
+  "sleepWakeUUID" : "BCA947AE-2F0A-44C7-8445-FEDFFA236CD0",
+  "sip" : "enabled",
+  "vmRegionInfo" : "0 is not in any region.  Bytes before following region: 4372692992\n  REGION TYPESTART - END [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n  UNUSED SPACE AT START\n--->  \n  __TEXT  104a2-104a24000[   16K] r-x\/r-x SM=COW  test.tmp.out",
+  "isCorpse" : 1,
+  "exception" : {"codes":"0x0001, 0x","rawCodes":[1,0],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x"},
+  "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":92190},
+  "vmregioninfo" : "0 is not in any region.  Bytes before following region: 4372692992\n  REGION TYPESTART - END [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n  UNUSED SPACE AT START\n--->  \n  __TEXT  104a2-104a24000[   16K] r-x\/r-x SM=COW  test.tmp.out",
+  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":156,"task_for_pid":28},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
+  "faultingThread" : 0,
+  "threads" : [{"triggered":true,"id":4567339,"threadState":{"x":[{"value":1},{"value":6094187136},{"value":6094187152},{"value":6094187720},{"value":0},{"value":0},{"value":0},{"value":0},{"value":1},{"value":0},{"value":0},{"value":2},{"value":2},{"value":0},{"value":80},{"value":0},{"value":13118353544},{"value":7701436843874442528},{"value":0},{"value":4373676128},{"sourceLine":8,"value":4372709256,"sourceFile":"test.c","symbol":"main","symbolLocation":0},{

[Lldb-commits] [PATCH] D119501: [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

2022-02-16 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 409335.

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

https://reviews.llvm.org/D119501

Files:
  lldb/bindings/python/CMakeLists.txt
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test

Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
@@ -0,0 +1,10 @@
+# RUN: %clang_host -g %S/Inputs/test.c -o %t.out
+
+# RUN: cp %S/Inputs/scripted_crashlog.ips %t.crash
+# RUN: %python %S/patch-crashlog.py --binary %t.out --crashlog %t.crash --offsets '{"main":20, "bar":9, "foo":16}' --json
+# RUN: %lldb %t.out -o 'command script import lldb.macosx.crashlog' -o 'crashlog -i %t.crash' -o 'process status' 2>&1 | FileCheck %s
+
+# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands
+# CHECK: Process 92190 stopped
+# CHECK: * thread #1, name = 'CrashLogScriptedThread.thread-0', stop reason = EXC_BAD_ACCESS
+# CHECK: frame #0: 0x000104a23f68 scripted_crashlog_json.test.tmp.out`foo at test.c:3:6 [artificial]
Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
@@ -0,0 +1,95 @@
+{"app_name":"scripted_crashlog_json.test.tmp.out","timestamp":"2022-02-14 16:30:31.00 -0800","app_version":"","slice_uuid":"b928ee77-9429-334f-ac88-41440bb3d4c7","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.3 (21E209)","incident_id":"E57CADE7-DC44-45CE-8D16-18EBC4406B97","name":"scripted_crashlog_json.test.tmp.out"}
+{
+  "uptime" : 26,
+  "procLaunch" : "2022-02-14 16:30:31.8048 -0800",
+  "procRole" : "Unspecified",
+  "version" : 2,
+  "userID" : 501,
+  "deployVersion" : 210,
+  "modelCode" : "MacBookPro18,2",
+  "procStartAbsTime" : 6478056069413,
+  "coalitionID" : 22196,
+  "osVersion" : {
+"train" : "macOS 12.3",
+"build" : "",
+"releaseType" : ""
+  },
+  "captureTime" : "2022-02-14 16:30:31.8096 -0800",
+  "incident" : "E57CADE7-DC44-45CE-8D16-18EBC4406B97",
+  "bug_type" : "309",
+  "pid" : 92190,
+  "procExitAbsTime" : 6478056175721,
+  "translated" : false,
+  "cpuType" : "ARM-64",
+  "procName" : "scripted_crashlog_json.test.tmp.out",
+  "procPath" : "\/Users\/USER\/*\/scripted_crashlog_json.test.tmp.out",
+  "parentProc" : "zsh",
+  "parentPid" : 82132,
+  "coalitionName" : "com.apple.Terminal",
+  "crashReporterKey" : "CDC11418-EDBF-2A49-0D83-8B441A5004B0",
+  "responsiblePid" : 76395,
+  "responsibleProc" : "Terminal",
+  "wakeTime" : 14889,
+  "sleepWakeUUID" : "BCA947AE-2F0A-44C7-8445-FEDFFA236CD0",
+  "sip" : "enabled",
+  "vmRegionInfo" : "0 is not in any region.  Bytes before following region: 4372692992\n  REGION TYPESTART - END [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n  UNUSED SPACE AT START\n--->  \n  __TEXT  104a2-104a24000[   16K] r-x\/r-x SM=COW  test.tmp.out",
+  "isCorpse" : 1,
+  "exception" : {"codes":"0x0001, 0x","rawCodes":[1,0],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x"},
+  "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":92190},
+  "vmregioninfo" : "0 is not in any region.  Bytes before following region: 4372692992\n  REGION TYPESTART - END [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n  UNUSED SPACE AT START\n--->  \n  __TEXT  104a2-104a24000[   16K] r-x\/r-x SM=COW  test.tmp.out",
+  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":156,"task_for_pid":28},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
+  "faultingThread" : 0,
+  "threads" : [{"triggered":true,"id":4567339,"threadState":{"x":[{"value":1},{"value":6094187136},{"value":6094187152},{"value":6094187720},{"value":0},{"value":0},{"value":0},{"value":0},{"value":1},{"value":0},{"value":0},{"value":2},{"value":2},{"value":0},{"value":80},{"value":0},{"value":13118353544},{"value":7701436843874442528},{"value":0},{"value":4373676128},{"sourceLine":8,"value":4372709256,"sourceFile":"test.c","symbol":"main","symbolLocation":0},{"value":4373332080,"symbolLocation":0,"symbol":"dyld4::sConfigBuffer"},{"value":0},{"

[Lldb-commits] [PATCH] D119501: [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

2022-02-16 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.

LGTM


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

https://reviews.llvm.org/D119501

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


[Lldb-commits] [PATCH] D119963: [LLDB] Dump valid ranges of variables

2022-02-16 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu created this revision.
zequanwu added a reviewer: labath.
zequanwu requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This allows `image lookup -a ... -v` to print variables only if the given
address is covered by the valid ranges of the variables. Since variables created
in dwarf plugin always has empty scope range, print the variable if it has
empty scope.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119963

Files:
  lldb/source/Core/Address.cpp


Index: lldb/source/Core/Address.cpp
===
--- lldb/source/Core/Address.cpp
+++ lldb/source/Core/Address.cpp
@@ -720,10 +720,18 @@
   bool get_parent_variables = true;
   bool stop_if_block_is_inlined_function = false;
   VariableList variable_list;
-  sc.block->AppendVariables(can_create, get_parent_variables,
-stop_if_block_is_inlined_function,
-[](Variable *) { return true; },
-&variable_list);
+  addr_t file_addr = GetFileAddress();
+  sc.block->AppendVariables(
+  can_create, get_parent_variables,
+  stop_if_block_is_inlined_function,
+  [&file_addr](Variable *var) {
+// Variables created from Dwarf always have empty scope range.
+if (var->GetScopeRange().IsEmpty())
+  return true;
+return var->GetScopeRange().FindEntryThatContains(file_addr) !=
+   nullptr;
+  },
+  &variable_list);
 
   for (const VariableSP &var_sp : variable_list) {
 if (var_sp && var_sp->LocationIsValidForAddress(*this)) {
@@ -739,6 +747,16 @@
   var_sp->DumpLocationForAddress(s, *this);
   s->PutCString(", decl = ");
   var_sp->GetDeclaration().DumpStopContext(s, false);
+  s->PutCString(", valid ranges =");
+  for (auto range : var_sp->GetScopeRange()) {
+s->PutCString(" [");
+s->AsRawOstream() << llvm::format_hex(range.GetRangeBase(),
+  2 + 2 * addr_size);
+s->PutCString("-");
+s->AsRawOstream()
+<< llvm::format_hex(range.GetRangeEnd(), 2 + 2 * 
addr_size);
+s->PutCString(")");
+  }
   s->EOL();
 }
   }


Index: lldb/source/Core/Address.cpp
===
--- lldb/source/Core/Address.cpp
+++ lldb/source/Core/Address.cpp
@@ -720,10 +720,18 @@
   bool get_parent_variables = true;
   bool stop_if_block_is_inlined_function = false;
   VariableList variable_list;
-  sc.block->AppendVariables(can_create, get_parent_variables,
-stop_if_block_is_inlined_function,
-[](Variable *) { return true; },
-&variable_list);
+  addr_t file_addr = GetFileAddress();
+  sc.block->AppendVariables(
+  can_create, get_parent_variables,
+  stop_if_block_is_inlined_function,
+  [&file_addr](Variable *var) {
+// Variables created from Dwarf always have empty scope range.
+if (var->GetScopeRange().IsEmpty())
+  return true;
+return var->GetScopeRange().FindEntryThatContains(file_addr) !=
+   nullptr;
+  },
+  &variable_list);
 
   for (const VariableSP &var_sp : variable_list) {
 if (var_sp && var_sp->LocationIsValidForAddress(*this)) {
@@ -739,6 +747,16 @@
   var_sp->DumpLocationForAddress(s, *this);
   s->PutCString(", decl = ");
   var_sp->GetDeclaration().DumpStopContext(s, false);
+  s->PutCString(", valid ranges =");
+  for (auto range : var_sp->GetScopeRange()) {
+s->PutCString(" [");
+s->AsRawOstream() << llvm::format_hex(range.GetRangeBase(),
+  2 + 2 * addr_size);
+s->PutCString("-");
+s->AsRawOstream()
+<< llvm::format_hex(range.GetRangeEnd(), 2 + 2 * addr_size);
+s->PutCString(")");
+  }
   s->EOL();
 }
   }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D119915: Replace use of double underscore in identifiers

2022-02-16 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 409344.
shafik added a comment.

Used shorter options for renaming based on feedback.


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

https://reviews.llvm.org/D119915

Files:
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  lldb/source/Plugins/Language/ObjC/CF.cpp
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/Language/ObjC/NSError.cpp
  lldb/source/Plugins/Language/ObjC/NSException.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -3011,8 +3011,8 @@
   if (m_CFBoolean_values)
 return true;
 
-  static ConstString g___kCFBooleanFalse("__kCFBooleanFalse");
-  static ConstString g___kCFBooleanTrue("__kCFBooleanTrue");
+  static ConstString g_dunder_kCFBooleanFalse("__kCFBooleanFalse");
+  static ConstString g_dunder_kCFBooleanTrue("__kCFBooleanTrue");
   static ConstString g_kCFBooleanFalse("kCFBooleanFalse");
   static ConstString g_kCFBooleanTrue("kCFBooleanTrue");
 
@@ -3045,8 +3045,8 @@
 return addr;
   };
 
-  lldb::addr_t false_addr = get_symbol(g___kCFBooleanFalse, g_kCFBooleanFalse);
-  lldb::addr_t true_addr = get_symbol(g___kCFBooleanTrue, g_kCFBooleanTrue);
+  lldb::addr_t false_addr = get_symbol(g_dunder_kCFBooleanFalse, g_kCFBooleanFalse);
+  lldb::addr_t true_addr = get_symbol(g_dunder_kCFBooleanTrue, g_kCFBooleanTrue);
 
   return (m_CFBoolean_values = {false_addr, true_addr}).operator bool();
 }
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
@@ -32,7 +32,7 @@
 Symbol callable_symbol;
 Address callable_address;
 LineEntry callable_line_entry;
-lldb::addr_t member__f_pointer_value = 0u;
+lldb::addr_t member_f_pointer_value = 0u;
 LibCppStdFunctionCallableCase callable_case =
 LibCppStdFunctionCallableCase::Invalid;
   };
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -63,7 +63,7 @@
 CPPLanguageRuntime::LibCppStdFunctionCallableInfo
 line_entry_helper(Target &target, const SymbolContext &sc, Symbol *symbol,
   llvm::StringRef first_template_param_sref,
-  bool has___invoke) {
+  bool has_invoke) {
 
   CPPLanguageRuntime::LibCppStdFunctionCallableInfo optional_info;
 
@@ -78,7 +78,7 @@
 LineEntry line_entry;
 addr.CalculateSymbolContextLineEntry(line_entry);
 
-if (contains_lambda_identifier(first_template_param_sref) || has___invoke) {
+if (contains_lambda_identifier(first_template_param_sref) || has_invoke) {
   // Case 1 and 2
   optional_info.callable_case = lldb_private::CPPLanguageRuntime::
   LibCppStdFunctionCallableCase::Lambda;
@@ -138,25 +138,25 @@
   //we will obtain the name from this pointer.
   // 5) a free function. A pointer to the function will stored after the vtable
   //we will obtain the name from this pointer.
-  ValueObjectSP member__f_(
+  ValueObjectSP member_f_(
   valobj_sp->GetChildMemberWithName(ConstString("__f_"), true));
 
-  if (member__f_) {
-ValueObjectSP sub_member__f_(
-   member__f_->GetChildMemberWithName(ConstString("__f_"), true));
+  if (member_f_) {
+ValueObjectSP sub_member_f_(
+   member_f_->GetChildMemberWithName(ConstString("__f_"), true));
 
-if (sub_member__f_)
-member__f_ = sub_member__f_;
+if (sub_member_f_)
+member_f_ = sub_member_f_;
   }
 
-  if (!member__f_)
+  if (!member_f_)
 return optional_info;
 
-  lldb::addr_t member__f_pointer_value = member__f_->GetValueAsUnsigned(0);
+  lldb::addr_t member_f_pointer_value = member_f_->GetValueAsUnsigned(0);
 
-  optional_info.member__f_pointer_value = member__f_pointer_value;
+  optional_info.member_f_pointer_value = member_f_pointer_value;
 
-  if (!member__f_pointer_value)
+  if (!member_f_pointer_value)
 return optional_info;
 
   ExecutionContext exe_ctx(valobj_sp->GetExecutionContextRef());

[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

2022-02-16 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D119548#3325999 , @labath wrote:

> Doing it in the common code is a great idea, and it will make the code more 
> robust. However, instead of "sneaking" the listener through a member 
> variable, it would be better to pass it through function arguments instead 
> (normally in the LaunchInfo struct, and as a probably as separate argument 
> for the last mile). I believe this is what Jim had in mind as well.

Yup!

> See inline comments for details.




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

https://reviews.llvm.org/D119548

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


[Lldb-commits] [PATCH] D119386: [lldb/Plugins] Clean-up ScriptedProcess python script (NFC)

2022-02-16 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc30742ba7381: [lldb/Plugins] Clean-up ScriptedProcess python 
script (NFC) (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119386

Files:
  lldb/examples/python/scripted_process/my_scripted_process.py
  lldb/examples/python/scripted_process/scripted_process.py

Index: lldb/examples/python/scripted_process/scripted_process.py
===
--- lldb/examples/python/scripted_process/scripted_process.py
+++ lldb/examples/python/scripted_process/scripted_process.py
@@ -38,6 +38,7 @@
 triple = self.target.triple
 if triple:
 self.arch = triple.split('-')[0]
+self.dbg = target.GetDebugger()
 if isinstance(args, lldb.SBStructuredData) and args.IsValid():
 self.args = args
 
@@ -217,10 +218,6 @@
 self.scripted_process = None
 self.process = None
 self.args = None
-if isinstance(scripted_process, ScriptedProcess):
-self.target = scripted_process.target
-self.scripted_process = scripted_process
-self.process = self.target.GetProcess()
 
 self.id = None
 self.idx = None
@@ -232,6 +229,13 @@
 self.register_ctx = {}
 self.frames = []
 
+if isinstance(scripted_process, ScriptedProcess):
+self.target = scripted_process.target
+self.scripted_process = scripted_process
+self.process = self.target.GetProcess()
+self.get_register_info()
+
+
 @abstractmethod
 def get_thread_id(self):
 """ Get the scripted thread identifier.
@@ -257,6 +261,7 @@
 eStateRunning,   ///< Process or thread is running and can't be examined.
 eStateStepping,  ///< Process or thread is in the process of stepping and can
  /// not be examined.
+eStateCrashed,   ///< Process or thread has crashed and can be examined.
 
 Returns:
 int: The state type of the scripted thread.
Index: lldb/examples/python/scripted_process/my_scripted_process.py
===
--- lldb/examples/python/scripted_process/my_scripted_process.py
+++ /dev/null
@@ -1,136 +0,0 @@
-import os,struct,signal
-
-from typing import Any, Dict
-
-import lldb
-from lldb.plugins.scripted_process import ScriptedProcess
-from lldb.plugins.scripted_process import ScriptedThread
-
-class MyScriptedProcess(ScriptedProcess):
-memory_regions = [
-lldb.SBMemoryRegionInfo("stack", 0x1040b2000, 0x1040b4000, 0b110, True,
-True)
-]
-
-stack_memory_dump = os.path.join(os.path.dirname(os.path.abspath(__file__)),
- 'main.stack-dump')
-
-def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData):
-super().__init__(target, args)
-
-def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo:
-for region in self.memory_regions:
-if region.GetRegionBase() <= addr < region.GetRegionEnd():
-return region
-return None
-
-def get_thread_with_id(self, tid: int):
-return {}
-
-def get_registers_for_thread(self, tid: int):
-return {}
-
-def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData:
-data = lldb.SBData()
-
-with open(self.stack_memory_dump, 'rb') as f:
-stack_mem = f.read(-1)
-if not stack_mem:
-return data
-
-mem_region = self.get_memory_region_containing_address(addr)
-
-if not mem_region or addr + size > mem_region.GetRegionEnd():
-return data
-
-offset = addr - mem_region.GetRegionBase()
-shrunk_stack_mem = stack_mem[offset:offset + size]
-
-error = lldb.SBError()
-data.SetData(error, shrunk_stack_mem,
-self.target.GetByteOrder(),
-self.target.GetAddressByteSize())
-return data
-
-def get_loaded_images(self):
-return self.loaded_images
-
-def get_process_id(self) -> int:
-return 42
-
-def should_stop(self) -> bool:
-return True
-
-def is_alive(self) -> bool:
-return True
-
-def get_scripted_thread_plugin(self):
-return MyScriptedThread.__module__ + "." + MyScriptedThread.__name__
-
-
-class MyScriptedThread(ScriptedThread):
-register_ctx = {
-"rax":0x06e4,
-"rbx":0x0001040b6060,
-"rcx":0x0001040b2e00,
-"rdx":0x0001040b2ba8,
-"rdi":0x002a,
-"rsi":0x0001040b2b98,
-"rbp":0x0001040b2a20

[Lldb-commits] [lldb] c30742b - [lldb/Plugins] Clean-up ScriptedProcess python script (NFC)

2022-02-16 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-02-16T11:44:07-08:00
New Revision: c30742ba73816ca61926121c82b81a766ebe1a6e

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

LOG: [lldb/Plugins] Clean-up ScriptedProcess python script (NFC)

This patch removes the `my_scripted_process.py` blueprint since it's not
used anymore.

The patch also updates the base ScriptedProcess and ScriptedThread
initializers to automatically initialize convinience variables, to
access debugger from the ScriptedProcess, access the SBProcess and
ScriptedProcess object from a ScriptedThread instance.

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/scripted_process/scripted_process.py

Removed: 
lldb/examples/python/scripted_process/my_scripted_process.py



diff  --git a/lldb/examples/python/scripted_process/my_scripted_process.py 
b/lldb/examples/python/scripted_process/my_scripted_process.py
deleted file mode 100644
index 202ad097d4987..0
--- a/lldb/examples/python/scripted_process/my_scripted_process.py
+++ /dev/null
@@ -1,136 +0,0 @@
-import os,struct,signal
-
-from typing import Any, Dict
-
-import lldb
-from lldb.plugins.scripted_process import ScriptedProcess
-from lldb.plugins.scripted_process import ScriptedThread
-
-class MyScriptedProcess(ScriptedProcess):
-memory_regions = [
-lldb.SBMemoryRegionInfo("stack", 0x1040b2000, 0x1040b4000, 0b110, True,
-True)
-]
-
-stack_memory_dump = 
os.path.join(os.path.dirname(os.path.abspath(__file__)),
- 'main.stack-dump')
-
-def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData):
-super().__init__(target, args)
-
-def get_memory_region_containing_address(self, addr: int) -> 
lldb.SBMemoryRegionInfo:
-for region in self.memory_regions:
-if region.GetRegionBase() <= addr < region.GetRegionEnd():
-return region
-return None
-
-def get_thread_with_id(self, tid: int):
-return {}
-
-def get_registers_for_thread(self, tid: int):
-return {}
-
-def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData:
-data = lldb.SBData()
-
-with open(self.stack_memory_dump, 'rb') as f:
-stack_mem = f.read(-1)
-if not stack_mem:
-return data
-
-mem_region = self.get_memory_region_containing_address(addr)
-
-if not mem_region or addr + size > mem_region.GetRegionEnd():
-return data
-
-offset = addr - mem_region.GetRegionBase()
-shrunk_stack_mem = stack_mem[offset:offset + size]
-
-error = lldb.SBError()
-data.SetData(error, shrunk_stack_mem,
-self.target.GetByteOrder(),
-self.target.GetAddressByteSize())
-return data
-
-def get_loaded_images(self):
-return self.loaded_images
-
-def get_process_id(self) -> int:
-return 42
-
-def should_stop(self) -> bool:
-return True
-
-def is_alive(self) -> bool:
-return True
-
-def get_scripted_thread_plugin(self):
-return MyScriptedThread.__module__ + "." + MyScriptedThread.__name__
-
-
-class MyScriptedThread(ScriptedThread):
-register_ctx = {
-"rax":0x06e4,
-"rbx":0x0001040b6060,
-"rcx":0x0001040b2e00,
-"rdx":0x0001040b2ba8,
-"rdi":0x002a,
-"rsi":0x0001040b2b98,
-"rbp":0x0001040b2a20,
-"rsp":0x0001040b2a20,
-"r8":0x003e131e,
-"r9":0x,
-"r10":0x,
-"r11":0x0246,
-"r12":0x00010007c3a0,
-"r13":0x0001040b2b18,
-"r14":0x00013f90,
-"r15":0x0001040b2b88,
-"rip":0x00013f61,
-"rflags":0x0206,
-"cs":0x002b,
-"fs":0x,
-"gs":0x,
-}
-
-def __init__(self, process, args):
-super().__init__(process, args)
-
-def get_thread_id(self) -> int:
-return 0x19
-
-def get_name(self) -> str:
-return MyScriptedThread.__name__ + ".thread-1"
-
-def get_stop_reason(self) -> Dict[str, Any]:
-return { "type": lldb.eStopReasonSignal, "data": {
-"signal": signal.SIGINT
-} }
-
-def get_stackframes(self):
-class ScriptedStackFrame:
-def __init__(idx, cfa, pc, symbol_ctx):
-self.idx = idx
-self.cfa = cfa
-self.pc = pc
- 

[Lldb-commits] [lldb] 7066584 - [lldb/Plugin] Add artificial stackframe loading in ScriptedThread

2022-02-16 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-02-16T11:44:07-08:00
New Revision: 70665844915eeb66273a84f131ffc33a202539d5

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

LOG: [lldb/Plugin] Add artificial stackframe loading in ScriptedThread

This patch adds the ability for ScriptedThread to load artificial stack
frames. To do so, the interpreter instance can create a list that will
contain the frame index and its pc address.

Then, when the Scripted Process plugin stops, it will refresh its
Scripted Threads state by invalidating their register context and load
to list from the interpreter object and reconstruct each frame.

This patch also removes all of the default implementation for
`get_stackframes` from the derived ScriptedThread classes, and add the
interface code for the Scripted Thread Interface.

rdar://88721095

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/scripted_process/scripted_process.py
lldb/include/lldb/Target/StackFrameList.h
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
lldb/source/Plugins/Process/scripted/ScriptedThread.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h

lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py

lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py

Removed: 




diff  --git a/lldb/examples/python/scripted_process/scripted_process.py 
b/lldb/examples/python/scripted_process/scripted_process.py
index 88df73147d5a6..2d3092d70e8e0 100644
--- a/lldb/examples/python/scripted_process/scripted_process.py
+++ b/lldb/examples/python/scripted_process/scripted_process.py
@@ -306,9 +306,9 @@ def __init__(idx, cfa, pc, symbol_ctx):
 containing for each entry, the frame index, the canonical
 frame address, the program counter value for that frame
 and a symbol context.
-None if the list is empty.
+The list can be empty.
 """
-return 0
+return self.frames
 
 def get_register_info(self):
 if self.register_info is None:

diff  --git a/lldb/include/lldb/Target/StackFrameList.h 
b/lldb/include/lldb/Target/StackFrameList.h
index c98995cad36fd..e05a398e3c0bc 100644
--- a/lldb/include/lldb/Target/StackFrameList.h
+++ b/lldb/include/lldb/Target/StackFrameList.h
@@ -17,6 +17,8 @@
 
 namespace lldb_private {
 
+class ScriptedThread;
+
 class StackFrameList {
 public:
   // Constructors and Destructors
@@ -86,6 +88,7 @@ class StackFrameList {
 
 protected:
   friend class Thread;
+  friend class ScriptedThread;
 
   bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp);
 

diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp 
b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index f98c415c2bdb9..1abf0f1409c57 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -359,6 +359,7 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList 
&old_thread_list,
 void ScriptedProcess::RefreshStateAfterStop() {
   // Let all threads recover from stopping and do any clean up based on the
   // previous thread state (if any).
+  m_thread_list.RefreshStateAfterStop();
 }
 
 bool ScriptedProcess::GetProcessInfo(ProcessInstanceInfo &info) {

diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp 
b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
index 173f503f279d0..8174a8bde3315 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -147,6 +147,73 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame 
*frame) {
   return m_reg_context_sp;
 }
 
+bool ScriptedThread::LoadArtificialStackFrames() {
+  StructuredData::ArraySP arr_sp = GetInterface()->GetStackFrames();
+
+  Status error;
+  if (!arr_sp)
+return GetInterface()->ErrorWithMessage(
+LLVM_PRETTY_FUNCTION, "Failed to get scripted thread stackframes.",
+error, LLDBLog::Thread);
+
+  size_t arr_size = arr_sp->GetSize();
+  if (arr_size > std::numeric_limits::max())
+return GetInterface()->ErrorWithMessage(
+LLVM_PRETTY_FUNCTION,
+llvm::Twine(
+"StackFrame array size (" + llvm::Twine(arr

[Lldb-commits] [lldb] 7f3fc2e - [lldb/API] Add a way to check if the CommandInterpreter is interactive

2022-02-16 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-02-16T11:44:07-08:00
New Revision: 7f3fc2eee8ff13f6922a16331870fc57cd022773

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

LOG: [lldb/API] Add a way to check if the CommandInterpreter is interactive

This patch adds the ability for the user to check if the command
interpreter's IOHandler is interactive.

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/bindings/interface/SBCommandInterpreter.i
lldb/include/lldb/API/SBCommandInterpreter.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/Interpreter/CommandInterpreter.cpp

Removed: 




diff  --git a/lldb/bindings/interface/SBCommandInterpreter.i 
b/lldb/bindings/interface/SBCommandInterpreter.i
index b9a32716cfd61..cad79248d0a2c 100644
--- a/lldb/bindings/interface/SBCommandInterpreter.i
+++ b/lldb/bindings/interface/SBCommandInterpreter.i
@@ -125,6 +125,9 @@ public:
 bool
 HasAliasOptions ();
 
+bool
+IsInteractive ();
+
 lldb::SBProcess
 GetProcess ();
 

diff  --git a/lldb/include/lldb/API/SBCommandInterpreter.h 
b/lldb/include/lldb/API/SBCommandInterpreter.h
index 2364a8dae88c7..4ebcc797d5bb6 100644
--- a/lldb/include/lldb/API/SBCommandInterpreter.h
+++ b/lldb/include/lldb/API/SBCommandInterpreter.h
@@ -59,6 +59,8 @@ class SBCommandInterpreter {
 
   bool HasAliasOptions();
 
+  bool IsInteractive();
+
   lldb::SBProcess GetProcess();
 
   lldb::SBDebugger GetDebugger();

diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 85eefcc899724..af4117fcc4867 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -605,6 +605,8 @@ class CommandInterpreter : public Broadcaster,
 
   FileSpec GetCurrentSourceDir();
 
+  bool IsInteractive();
+
 protected:
   friend class Debugger;
 

diff  --git a/lldb/source/API/SBCommandInterpreter.cpp 
b/lldb/source/API/SBCommandInterpreter.cpp
index c9a63bae0cb11..0a8c83f51f207 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -329,6 +329,12 @@ bool SBCommandInterpreter::HasAliasOptions() {
   return (IsValid() ? m_opaque_ptr->HasAliasOptions() : false);
 }
 
+bool SBCommandInterpreter::IsInteractive() {
+  LLDB_INSTRUMENT_VA(this);
+
+  return (IsValid() ? m_opaque_ptr->IsInteractive() : false);
+}
+
 SBProcess SBCommandInterpreter::GetProcess() {
   LLDB_INSTRUMENT_VA(this);
 

diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index 087e8b4a3ccac..622f36e2a67ff 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -3162,6 +3162,10 @@ bool CommandInterpreter::SaveTranscript(
   return true;
 }
 
+bool CommandInterpreter::IsInteractive() {
+  return (GetIOHandler() ? GetIOHandler()->GetIsInteractive() : false);
+}
+
 FileSpec CommandInterpreter::GetCurrentSourceDir() {
   if (m_command_source_dirs.empty())
 return {};



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


[Lldb-commits] [PATCH] D119388: [lldb/Plugin] Add artificial stackframe loading in ScriptedThread

2022-02-16 Thread Med Ismail Bennani 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 rG70665844915e: [lldb/Plugin] Add artificial stackframe 
loading in ScriptedThread (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119388

Files:
  lldb/examples/python/scripted_process/scripted_process.py
  lldb/include/lldb/Target/StackFrameList.h
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
  lldb/source/Plugins/Process/scripted/ScriptedThread.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
  lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
  lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
  lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
  lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py

Index: lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
@@ -139,21 +139,6 @@
 
 return stop_reason
 
-def get_stackframes(self):
-class ScriptedStackFrame:
-def __init__(idx, cfa, pc, symbol_ctx):
-self.idx = idx
-self.cfa = cfa
-self.pc = pc
-self.symbol_ctx = symbol_ctx
-
-
-symbol_ctx = lldb.SBSymbolContext()
-frame_zero = ScriptedStackFrame(0, 0x42424242, 0x500, symbol_ctx)
-self.frames.append(frame_zero)
-
-return self.frame_zero[0:0]
-
 def get_register_context(self) -> str:
 if not self.corefile_thread or self.corefile_thread.GetNumFrames() == 0:
 return None
Index: lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
@@ -57,21 +57,6 @@
 "signal": signal.SIGTRAP
 } }
 
-def get_stackframes(self):
-class ScriptedStackFrame:
-def __init__(idx, cfa, pc, symbol_ctx):
-self.idx = idx
-self.cfa = cfa
-self.pc = pc
-self.symbol_ctx = symbol_ctx
-
-
-symbol_ctx = lldb.SBSymbolContext()
-frame_zero = ScriptedStackFrame(0, 0x42424242, 0x500, symbol_ctx)
-self.frames.append(frame_zero)
-
-return self.frame_zero[0:0]
-
 def get_register_context(self) -> str:
 return None
 
Index: lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
@@ -46,6 +46,7 @@
 class DummyScriptedThread(ScriptedThread):
 def __init__(self, process, args):
 super().__init__(process, args)
+self.frames.append({"pc": 0x011b00 })
 
 def get_thread_id(self) -> int:
 return 0x19
@@ -61,21 +62,6 @@
 "signal": signal.SIGINT
 } }
 
-def get_stackframes(self):
-class ScriptedStackFrame:
-def __init__(idx, cfa, pc, symbol_ctx):
-self.idx = idx
-self.cfa = cfa
-self.pc = pc
-self.symbol_ctx = symbol_ctx
-
-
-symbol_ctx = lldb.SBSymbolContext()
-frame_zero = ScriptedStackFrame(0, 0x42424242, 0x500, symbol_ctx)
-self.frames.append(frame_zero)
-
-return self.frame_zero[0:0]
-
 def get_register_context(self) -> str:
 return struct.pack(
 '21Q', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)
@@ -88,4 +74,4 @@
  DummyScriptedProcess.__name__))
 else:
 print("Name of the class that will manage the scripted process: '%s.%s'"
-% (__name__, DummyScriptedProcess.__name__))
\ No newline at end of file
+% (__name__, DummyScriptedProcess.__name__))
Index: lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
===
--- lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ lldb/test/API/functionalities/scripted_process/TestScriptedPr

[Lldb-commits] [lldb] 7c54ffd - [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

2022-02-16 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-02-16T11:44:07-08:00
New Revision: 7c54ffdc6c2e55565344a8d6200f63ee016891a9

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

LOG: [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

This patch introduces a new type of ScriptedProcess: CrashLogScriptedProcess.
It takes advantage of lldb's crashlog parsers and Scripted Processes to
reconstruct a static debugging session with symbolicated stackframes, instead
of just dumping out everything in the user's terminal.

The crashlog command also has an interactive mode that only provide a
very limited experience. This is why this patch removes all the logic
for this interactive mode and creates CrashLogScriptedProcess instead.

This will fetch and load all the libraries that were used by the crashed
thread and re-create all the frames artificially.

rdar://88721117

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

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/examples/python/scripted_process/crashlog_scripted_process.py

lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips

lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test

Modified: 
lldb/bindings/python/CMakeLists.txt
lldb/examples/python/crashlog.py
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp

Removed: 




diff  --git a/lldb/bindings/python/CMakeLists.txt 
b/lldb/bindings/python/CMakeLists.txt
index 82a52da89a7e3..afad367baa9fa 100644
--- a/lldb/bindings/python/CMakeLists.txt
+++ b/lldb/bindings/python/CMakeLists.txt
@@ -114,6 +114,7 @@ function(finish_swig_python swig_target 
lldb_python_bindings_dir lldb_python_tar
   ${swig_target}
   ${lldb_python_target_dir} "macosx"
   FILES "${LLDB_SOURCE_DIR}/examples/python/crashlog.py"
+
"${LLDB_SOURCE_DIR}/examples/python/scripted_process/crashlog_scripted_process.py"
 "${LLDB_SOURCE_DIR}/examples/darwin/heap_find/heap.py")
 
 create_python_package(

diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index bc57a275ce744..2f5cafc49503c 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -63,7 +63,6 @@
 
 from lldb.utils import symbolication
 
-
 def read_plist(s):
 if sys.version_info.major == 3:
 return plistlib.loads(s)
@@ -780,138 +779,6 @@ def usage():
 sys.exit(0)
 
 
-class Interactive(cmd.Cmd):
-'''Interactive prompt for analyzing one or more Darwin crash logs, type 
"help" to see a list of supported commands.'''
-image_option_parser = None
-
-def __init__(self, crash_logs):
-cmd.Cmd.__init__(self)
-self.use_rawinput = False
-self.intro = 'Interactive crashlogs prompt, type "help" to see a list 
of supported commands.'
-self.crash_logs = crash_logs
-self.prompt = '% '
-
-def default(self, line):
-'''Catch all for unknown command, which will exit the interpreter.'''
-print("uknown command: %s" % line)
-return True
-
-def do_q(self, line):
-'''Quit command'''
-return True
-
-def do_quit(self, line):
-'''Quit command'''
-return True
-
-def do_symbolicate(self, line):
-description = '''Symbolicate one or more darwin crash log files by 
index to provide source file and line information,
-inlined stack frames back to the concrete functions, and disassemble 
the location of the crash
-for the first frame of the crashed thread.'''
-option_parser = CreateSymbolicateCrashLogOptions(
-'symbolicate', description, False)
-command_args = shlex.split(line)
-try:
-(options, args) = option_parser.parse_args(command_args)
-except:
-return
-
-if args:
-# We have arguments, they must valid be crash log file indexes
-for idx_str in args:
-idx = int(idx_str)
-if idx < len(self.crash_logs):
-SymbolicateCrashLog(self.crash_logs[idx], options)
-else:
-print('error: crash log index %u is out of range' % (idx))
-else:
-# No arguments, symbolicate all crash logs using the options
-# provided
-for idx in range(len(self.crash_logs)):
-SymbolicateCrashLog(self.crash_logs[idx], options)
-
-def do_list(self, line=None):
-'''Dump a list of all crash logs that are currently loaded.
-
-USAGE: list'''
-print('%u crash logs are loaded:' % len(self.crash_logs))
-for (crash_log_idx, crash_log) in enumerate(self.crash_logs):
-print('[%u] = %s' % (crash_log_idx, crash

[Lldb-commits] [lldb] 21658b7 - [lldb/crashlog] Fix exception signal parsing

2022-02-16 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-02-16T11:44:07-08:00
New Revision: 21658b77a5965217eb67f8e1ccd4307111c775f7

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

LOG: [lldb/crashlog] Fix exception signal parsing

In some cases, it can happen that crashlogs don't have any signal in
the exception, which causes the parser to crash.

This fixes the parsing by checking if the `signal` field is in the
`exception` dictionary before trying to access it.

rdar://84552251

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/crashlog.py

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index 2f5cafc49503..8c20fa71d3e2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -466,14 +466,17 @@ def parse_process_info(self, json_data):
 
 def parse_crash_reason(self, json_exception):
 exception_type = json_exception['type']
-exception_signal = json_exception['signal']
+exception_signal = " "
+if 'signal' in json_exception:
+exception_signal += "({})".format(json_exception['signal'])
+
 if 'codes' in json_exception:
 exception_extra = " ({})".format(json_exception['codes'])
 elif 'subtype' in json_exception:
 exception_extra = " ({})".format(json_exception['subtype'])
 else:
 exception_extra = ""
-return "{} ({}){}".format(exception_type, exception_signal,
+return "{}{}{}".format(exception_type, exception_signal,
   exception_extra)
 
 def parse_images(self, json_images):



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


[Lldb-commits] [PATCH] D119499: [lldb/API] Add a way to check if the CommandInterpreter is interactive

2022-02-16 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7f3fc2eee8ff: [lldb/API] Add a way to check if the 
CommandInterpreter is interactive (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119499

Files:
  lldb/bindings/interface/SBCommandInterpreter.i
  lldb/include/lldb/API/SBCommandInterpreter.h
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -3162,6 +3162,10 @@
   return true;
 }
 
+bool CommandInterpreter::IsInteractive() {
+  return (GetIOHandler() ? GetIOHandler()->GetIsInteractive() : false);
+}
+
 FileSpec CommandInterpreter::GetCurrentSourceDir() {
   if (m_command_source_dirs.empty())
 return {};
Index: lldb/source/API/SBCommandInterpreter.cpp
===
--- lldb/source/API/SBCommandInterpreter.cpp
+++ lldb/source/API/SBCommandInterpreter.cpp
@@ -329,6 +329,12 @@
   return (IsValid() ? m_opaque_ptr->HasAliasOptions() : false);
 }
 
+bool SBCommandInterpreter::IsInteractive() {
+  LLDB_INSTRUMENT_VA(this);
+
+  return (IsValid() ? m_opaque_ptr->IsInteractive() : false);
+}
+
 SBProcess SBCommandInterpreter::GetProcess() {
   LLDB_INSTRUMENT_VA(this);
 
Index: lldb/include/lldb/Interpreter/CommandInterpreter.h
===
--- lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -605,6 +605,8 @@
 
   FileSpec GetCurrentSourceDir();
 
+  bool IsInteractive();
+
 protected:
   friend class Debugger;
 
Index: lldb/include/lldb/API/SBCommandInterpreter.h
===
--- lldb/include/lldb/API/SBCommandInterpreter.h
+++ lldb/include/lldb/API/SBCommandInterpreter.h
@@ -59,6 +59,8 @@
 
   bool HasAliasOptions();
 
+  bool IsInteractive();
+
   lldb::SBProcess GetProcess();
 
   lldb::SBDebugger GetDebugger();
Index: lldb/bindings/interface/SBCommandInterpreter.i
===
--- lldb/bindings/interface/SBCommandInterpreter.i
+++ lldb/bindings/interface/SBCommandInterpreter.i
@@ -125,6 +125,9 @@
 bool
 HasAliasOptions ();
 
+bool
+IsInteractive ();
+
 lldb::SBProcess
 GetProcess ();
 


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -3162,6 +3162,10 @@
   return true;
 }
 
+bool CommandInterpreter::IsInteractive() {
+  return (GetIOHandler() ? GetIOHandler()->GetIsInteractive() : false);
+}
+
 FileSpec CommandInterpreter::GetCurrentSourceDir() {
   if (m_command_source_dirs.empty())
 return {};
Index: lldb/source/API/SBCommandInterpreter.cpp
===
--- lldb/source/API/SBCommandInterpreter.cpp
+++ lldb/source/API/SBCommandInterpreter.cpp
@@ -329,6 +329,12 @@
   return (IsValid() ? m_opaque_ptr->HasAliasOptions() : false);
 }
 
+bool SBCommandInterpreter::IsInteractive() {
+  LLDB_INSTRUMENT_VA(this);
+
+  return (IsValid() ? m_opaque_ptr->IsInteractive() : false);
+}
+
 SBProcess SBCommandInterpreter::GetProcess() {
   LLDB_INSTRUMENT_VA(this);
 
Index: lldb/include/lldb/Interpreter/CommandInterpreter.h
===
--- lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -605,6 +605,8 @@
 
   FileSpec GetCurrentSourceDir();
 
+  bool IsInteractive();
+
 protected:
   friend class Debugger;
 
Index: lldb/include/lldb/API/SBCommandInterpreter.h
===
--- lldb/include/lldb/API/SBCommandInterpreter.h
+++ lldb/include/lldb/API/SBCommandInterpreter.h
@@ -59,6 +59,8 @@
 
   bool HasAliasOptions();
 
+  bool IsInteractive();
+
   lldb::SBProcess GetProcess();
 
   lldb::SBDebugger GetDebugger();
Index: lldb/bindings/interface/SBCommandInterpreter.i
===
--- lldb/bindings/interface/SBCommandInterpreter.i
+++ lldb/bindings/interface/SBCommandInterpreter.i
@@ -125,6 +125,9 @@
 bool
 HasAliasOptions ();
 
+bool
+IsInteractive ();
+
 lldb::SBProcess
 GetProcess ();
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D119501: [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

2022-02-16 Thread Med Ismail Bennani 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 rG7c54ffdc6c2e: [lldb/crashlog] Add CrashLogScriptedProcess 
& remove interactive mode (authored by mib).

Changed prior to commit:
  https://reviews.llvm.org/D119501?vs=409335&id=409354#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119501

Files:
  lldb/bindings/python/CMakeLists.txt
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test

Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
@@ -0,0 +1,10 @@
+# RUN: %clang_host -g %S/Inputs/test.c -o %t.out
+
+# RUN: cp %S/Inputs/scripted_crashlog.ips %t.crash
+# RUN: %python %S/patch-crashlog.py --binary %t.out --crashlog %t.crash --offsets '{"main":20, "bar":9, "foo":16}' --json
+# RUN: %lldb %t.out -o 'command script import lldb.macosx.crashlog' -o 'crashlog -i %t.crash' -o 'process status' 2>&1 | FileCheck %s
+
+# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands
+# CHECK: Process 92190 stopped
+# CHECK: * thread #1, name = 'CrashLogScriptedThread.thread-0', stop reason = EXC_BAD_ACCESS
+# CHECK: frame #0: 0x000104a23f68 scripted_crashlog_json.test.tmp.out`foo at test.c:3:6 [artificial]
Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
@@ -0,0 +1,75 @@
+{"app_name":"scripted_crashlog_json.test.tmp.out","timestamp":"2022-02-14 16:30:31.00 -0800","app_version":"","slice_uuid":"b928ee77-9429-334f-ac88-41440bb3d4c7","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.3","incident_id":"E57CADE7-DC44-45CE-8D16-18EBC4406B97","name":"scripted_crashlog_json.test.tmp.out"}
+{
+  "uptime" : 26,
+  "procLaunch" : "2022-02-14 16:30:31.8048 -0800",
+  "procRole" : "Unspecified",
+  "version" : 2,
+  "userID" : 501,
+  "deployVersion" : 210,
+  "modelCode" : "MacBookPro18,2",
+  "procStartAbsTime" : 6478056069413,
+  "coalitionID" : 22196,
+  "osVersion" : {
+"train" : "macOS 12.3",
+"build" : "",
+"releaseType" : ""
+  },
+  "captureTime" : "2022-02-14 16:30:31.8096 -0800",
+  "incident" : "E57CADE7-DC44-45CE-8D16-18EBC4406B97",
+  "bug_type" : "309",
+  "pid" : 92190,
+  "procExitAbsTime" : 6478056175721,
+  "translated" : false,
+  "cpuType" : "ARM-64",
+  "procName" : "scripted_crashlog_json.test.tmp.out",
+  "procPath" : "\/Users\/USER\/*\/scripted_crashlog_json.test.tmp.out",
+  "parentProc" : "zsh",
+  "parentPid" : 82132,
+  "coalitionName" : "com.apple.Terminal",
+  "crashReporterKey" : "CDC11418-EDBF-2A49-0D83-8B441A5004B0",
+  "responsiblePid" : 76395,
+  "responsibleProc" : "Terminal",
+  "wakeTime" : 14889,
+  "sleepWakeUUID" : "BCA947AE-2F0A-44C7-8445-FEDFFA236CD0",
+  "sip" : "enabled",
+  "vmRegionInfo" : "0 is not in any region.  Bytes before following region: 4372692992\n  REGION TYPESTART - END [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n  UNUSED SPACE AT START\n--->  \n  __TEXT  104a2-104a24000[   16K] r-x\/r-x SM=COW  test.tmp.out",
+  "isCorpse" : 1,
+  "exception" : {"codes":"0x0001, 0x","rawCodes":[1,0],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x"},
+  "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":92190},
+  "vmregioninfo" : "0 is not in any region.  Bytes before following region: 4372692992\n  REGION TYPESTART - END [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n  UNUSED SPACE AT START\n--->  \n  __TEXT  104a2-104a24000[   16K] r-x\/r-x SM=COW  test.tmp.out",
+  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":156,"task_for_pid":28},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
+  "faultingThread" : 0,
+  "threads" : [{"triggered":true,"id":4567339,"threadState":{"x":[{"value":1},{"value":6094187136},{"value":6094187152},{"value":6094187720},{"value":0},{"value":0},{"value":0},{"value":0},{"value":1},{"value":0},{"value":0}

[Lldb-commits] [PATCH] D119504: [lldb/crashlog] Fix exception signal parsing

2022-02-16 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21658b77a596: [lldb/crashlog] Fix exception signal parsing 
(authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119504

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -466,14 +466,17 @@
 
 def parse_crash_reason(self, json_exception):
 exception_type = json_exception['type']
-exception_signal = json_exception['signal']
+exception_signal = " "
+if 'signal' in json_exception:
+exception_signal += "({})".format(json_exception['signal'])
+
 if 'codes' in json_exception:
 exception_extra = " ({})".format(json_exception['codes'])
 elif 'subtype' in json_exception:
 exception_extra = " ({})".format(json_exception['subtype'])
 else:
 exception_extra = ""
-return "{} ({}){}".format(exception_type, exception_signal,
+return "{}{}{}".format(exception_type, exception_signal,
   exception_extra)
 
 def parse_images(self, json_images):


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -466,14 +466,17 @@
 
 def parse_crash_reason(self, json_exception):
 exception_type = json_exception['type']
-exception_signal = json_exception['signal']
+exception_signal = " "
+if 'signal' in json_exception:
+exception_signal += "({})".format(json_exception['signal'])
+
 if 'codes' in json_exception:
 exception_extra = " ({})".format(json_exception['codes'])
 elif 'subtype' in json_exception:
 exception_extra = " ({})".format(json_exception['subtype'])
 else:
 exception_extra = ""
-return "{} ({}){}".format(exception_type, exception_signal,
+return "{}{}{}".format(exception_type, exception_signal,
   exception_extra)
 
 def parse_images(self, json_images):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D119963: [LLDB] Dump valid ranges of variables

2022-02-16 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

I think the valid range output should be governed by another flag, like 
--show-variable-ranges.  In optimized code, there can be a whole lot of ranges 
for each variable, so this could get really noisy and make the whole output 
hard to look at.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119963

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


[Lldb-commits] [lldb] 80a11e0 - [LLDB] Replace use of double underscore in identifiers

2022-02-16 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-02-16T11:54:45-08:00
New Revision: 80a11e0803585556804274fc374b208901aa7a94

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

LOG: [LLDB] Replace use of double underscore in identifiers

Identifiers with __ anywhere are reserved. I picked this up via the
bugprone-reserved-identifier clang-tidy check but -Wreserved-identifier will
also flag these uses as well.

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

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Language/ObjC/CF.cpp
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSError.cpp
lldb/source/Plugins/Language/ObjC/NSException.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 21196393371ea..129e10f3a8dc7 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -79,7 +79,7 @@ bool lldb_private::formatters::LibcxxFunctionSummaryProvider(
 
   switch (callable_info.callable_case) {
   case CPPLanguageRuntime::LibCppStdFunctionCallableCase::Invalid:
-stream.Printf(" __f_ = %" PRIu64, callable_info.member__f_pointer_value);
+stream.Printf(" __f_ = %" PRIu64, callable_info.member_f_pointer_value);
 return false;
 break;
   case CPPLanguageRuntime::LibCppStdFunctionCallableCase::Lambda:
@@ -228,7 +228,7 @@ bool 
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
   if (!valobj_sp)
 return false;
 
-  static ConstString g___i_("__i_");
+  static ConstString g_i_("__i_");
 
   // this must be a ValueObject* because it is a child of the ValueObject we
   // are producing children for it if were a ValueObjectSP, we would end up
@@ -258,7 +258,7 @@ bool 
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
  nullptr)
  .get();
 if (m_pair_ptr) {
-  auto __i_(valobj_sp->GetChildMemberWithName(g___i_, true));
+  auto __i_(valobj_sp->GetChildMemberWithName(g_i_, true));
   if (!__i_) {
 m_pair_ptr = nullptr;
 return false;

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
index 65e88d114fcc2..94ab014a5eb01 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
@@ -61,9 +61,9 @@ 
lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
 
 size_t lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
 CalculateNumChildren() {
-  static ConstString g___size_("__size_");
+  static ConstString g_size_("__size_");
   m_num_elements = 0;
-  ValueObjectSP size_sp(m_backend.GetChildMemberWithName(g___size_, true));
+  ValueObjectSP size_sp(m_backend.GetChildMemberWithName(g_size_, true));
   if (size_sp)
 m_num_elements = size_sp->GetValueAsUnsigned(0);
   return m_num_elements;
@@ -85,7 +85,7 @@ lldb::ValueObjectSP lldb_private::formatters::
 
 bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
 Update() {
-  static ConstString g___begin_("__begin_");
+  static ConstString g_begin_("__begin_");
 
   m_start = nullptr;
   m_num_elements = 0;
@@ -96,7 +96,7 @@ bool 
lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
   if (llvm::Optional size = m_element_type.GetByteSize(nullptr)) {
 m_element_size = *size;
 // Store raw pointers or end up with a circular dependency.
-m_start = m_backend.GetChildMemberWithName(g___begin_, true).get();
+m_start = m_backend.GetChildMemberWithName(g_begin_, true).get();
   }
 
   return false;

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index 25c2bfd9387bb..d3c0bd2e9ec3a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -213,27 +213,27 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
 
 size_t lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
 CalculateNumChildren() {
-  static ConstString g___pair3_("__pair3_");
-  static ConstString g___first_

[Lldb-commits] [PATCH] D119915: Replace use of double underscore in identifiers

2022-02-16 Thread Shafik Yaghmour via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG80a11e080358: [LLDB] Replace use of double underscore in 
identifiers (authored by shafik).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119915

Files:
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  lldb/source/Plugins/Language/ObjC/CF.cpp
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/Language/ObjC/NSError.cpp
  lldb/source/Plugins/Language/ObjC/NSException.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -3011,8 +3011,8 @@
   if (m_CFBoolean_values)
 return true;
 
-  static ConstString g___kCFBooleanFalse("__kCFBooleanFalse");
-  static ConstString g___kCFBooleanTrue("__kCFBooleanTrue");
+  static ConstString g_dunder_kCFBooleanFalse("__kCFBooleanFalse");
+  static ConstString g_dunder_kCFBooleanTrue("__kCFBooleanTrue");
   static ConstString g_kCFBooleanFalse("kCFBooleanFalse");
   static ConstString g_kCFBooleanTrue("kCFBooleanTrue");
 
@@ -3045,8 +3045,8 @@
 return addr;
   };
 
-  lldb::addr_t false_addr = get_symbol(g___kCFBooleanFalse, g_kCFBooleanFalse);
-  lldb::addr_t true_addr = get_symbol(g___kCFBooleanTrue, g_kCFBooleanTrue);
+  lldb::addr_t false_addr = get_symbol(g_dunder_kCFBooleanFalse, g_kCFBooleanFalse);
+  lldb::addr_t true_addr = get_symbol(g_dunder_kCFBooleanTrue, g_kCFBooleanTrue);
 
   return (m_CFBoolean_values = {false_addr, true_addr}).operator bool();
 }
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
@@ -32,7 +32,7 @@
 Symbol callable_symbol;
 Address callable_address;
 LineEntry callable_line_entry;
-lldb::addr_t member__f_pointer_value = 0u;
+lldb::addr_t member_f_pointer_value = 0u;
 LibCppStdFunctionCallableCase callable_case =
 LibCppStdFunctionCallableCase::Invalid;
   };
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -63,7 +63,7 @@
 CPPLanguageRuntime::LibCppStdFunctionCallableInfo
 line_entry_helper(Target &target, const SymbolContext &sc, Symbol *symbol,
   llvm::StringRef first_template_param_sref,
-  bool has___invoke) {
+  bool has_invoke) {
 
   CPPLanguageRuntime::LibCppStdFunctionCallableInfo optional_info;
 
@@ -78,7 +78,7 @@
 LineEntry line_entry;
 addr.CalculateSymbolContextLineEntry(line_entry);
 
-if (contains_lambda_identifier(first_template_param_sref) || has___invoke) {
+if (contains_lambda_identifier(first_template_param_sref) || has_invoke) {
   // Case 1 and 2
   optional_info.callable_case = lldb_private::CPPLanguageRuntime::
   LibCppStdFunctionCallableCase::Lambda;
@@ -138,25 +138,25 @@
   //we will obtain the name from this pointer.
   // 5) a free function. A pointer to the function will stored after the vtable
   //we will obtain the name from this pointer.
-  ValueObjectSP member__f_(
+  ValueObjectSP member_f_(
   valobj_sp->GetChildMemberWithName(ConstString("__f_"), true));
 
-  if (member__f_) {
-ValueObjectSP sub_member__f_(
-   member__f_->GetChildMemberWithName(ConstString("__f_"), true));
+  if (member_f_) {
+ValueObjectSP sub_member_f_(
+   member_f_->GetChildMemberWithName(ConstString("__f_"), true));
 
-if (sub_member__f_)
-member__f_ = sub_member__f_;
+if (sub_member_f_)
+member_f_ = sub_member_f_;
   }
 
-  if (!member__f_)
+  if (!member_f_)
 return optional_info;
 
-  lldb::addr_t member__f_pointer_value = member__f_->GetValueAsUnsigned(0);
+  lldb::addr_t member_f_pointer_value = member_f_->GetValueAsUnsigned(0);
 
-  optional_info.member__f_pointer_value = member__f_pointer_value;
+  optional_info.member_f_pointer_value = member_f_pointer_value;
 
-  if (!member__f_pointer_val

[Lldb-commits] [PATCH] D119501: [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

2022-02-16 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

Looks like the `scripted_crashlog_json.test` is broken on green dragon: 
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/41454/testReport/junit/lldb-shell/ScriptInterpreter_Python_Crashlog/scripted_crashlog_json_test/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119501

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


[Lldb-commits] [PATCH] D119963: [LLDB] Dump valid ranges of variables

2022-02-16 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

In D119963#3327139 , @jingham wrote:

> It's really useful to be able to see these variable ranges, so the feature 
> seems good to me, but I think the valid range output should be governed by 
> another flag, like --show-variable-ranges.  In optimized code, there can be a 
> whole lot of ranges for each variable, so this could get really noisy and 
> make the whole output hard to look at, so it would be good to have a way to 
> turn it off.

Using a flag to control it seems good to me.

> Unfortunately `-v` doesn't work for that since the non `-v` version isn't so 
> useful.

I don't quite understand what you mean here. I suppose we want a flag 
`--show-variable-ranges` to have effect only when `-v` is given in `image 
lookup -v -a ...`. Is this what you mean?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119963

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


[Lldb-commits] [lldb] d95961f - [lldb/test] Disable scripted_crashlog_json.test on non darwin aarch64 systems

2022-02-16 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-02-16T13:51:53-08:00
New Revision: d95961f214a9f2e7abc2844cee309e42eba5600c

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

LOG: [lldb/test] Disable scripted_crashlog_json.test on non darwin aarch64 
systems

This patch adds requirement for the `scripted_crashlog_json` test to
make sure it only runs on apple silicon systems.

This should fix the following green dragon failure:
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/41454

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 

lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test

Removed: 




diff  --git 
a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test 
b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
index a94a667eae545..c82c183378d3c 100644
--- 
a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
+++ 
b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
@@ -1,3 +1,5 @@
+# REQUIRES: python, native && target-aarch64 && system-darwin
+
 # RUN: %clang_host -g %S/Inputs/test.c -o %t.out
 
 # RUN: cp %S/Inputs/scripted_crashlog.ips %t.crash



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


[Lldb-commits] [PATCH] D119501: [lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode

2022-02-16 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D119501#3327339 , @shafik wrote:

> Looks like the `scripted_crashlog_json.test` is broken on green dragon: 
> https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/41454/testReport/junit/lldb-shell/ScriptInterpreter_Python_Crashlog/scripted_crashlog_json_test/

@shafik d95961f214a9f2e7abc2844cee309e42eba5600c 
 should 
fix the test failure on GreenDragon.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119501

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


[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

2022-02-16 Thread Ilya Nozhkin via Phabricator via lldb-commits
ilya-nozhkin updated this revision to Diff 409404.
ilya-nozhkin added a comment.
Herald added a subscriber: emaste.

Applied requested changes.


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

https://reviews.llvm.org/D119548

Files:
  lldb/include/lldb/Target/Process.h
  lldb/include/lldb/Target/Target.h
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
  lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/test/API/tools/lldb-vscode/stop-hooks/Makefile
  lldb/test/API/tools/lldb-vscode/stop-hooks/TestVSCode_stop_hooks.py
  lldb/test/API/tools/lldb-vscode/stop-hooks/main.c

Index: lldb/test/API/tools/lldb-vscode/stop-hooks/main.c
===
--- /dev/null
+++ lldb/test/API/tools/lldb-vscode/stop-hooks/main.c
@@ -0,0 +1 @@
+int main() { return 0; }
Index: lldb/test/API/tools/lldb-vscode/stop-hooks/TestVSCode_stop_hooks.py
===
--- /dev/null
+++ lldb/test/API/tools/lldb-vscode/stop-hooks/TestVSCode_stop_hooks.py
@@ -0,0 +1,35 @@
+"""
+Test stop hooks
+"""
+
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+import lldbvscode_testcase
+
+
+class TestVSCode_stop_hooks(lldbvscode_testcase.VSCodeTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfRemote
+def test_stop_hooks_before_run(self):
+'''
+Test that there is no race condition between lldb-vscode and
+stop hooks executor
+'''
+program = self.getBuildArtifact("a.out")
+preRunCommands = ['target stop-hook add -o help']
+self.build_and_launch(program, stopOnEntry=True, preRunCommands=preRunCommands)
+
+# The first stop is on entry.
+self.continue_to_next_stop()
+
+breakpoint_ids = self.set_function_breakpoints(['main'])
+# This request hangs if the race happens, because, in that case, the
+# command interpreter is in synchronous mode while lldb-vscode expects
+# it to be in asynchronous mode, so, the process doesn't send the stop
+# event to "lldb.Debugger" listener (which is monitored by lldb-vscode).
+self.continue_to_breakpoints(breakpoint_ids)
+
+self.continue_to_exit()
Index: lldb/test/API/tools/lldb-vscode/stop-hooks/Makefile
===
--- /dev/null
+++ lldb/test/API/tools/lldb-vscode/stop-hooks/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -200,12 +200,17 @@
 const lldb::ProcessSP &Target::CreateProcess(ListenerSP listener_sp,
  llvm::StringRef plugin_name,
  const FileSpec *crash_file,
- bool can_connect) {
+ bool can_connect,
+ ListenerSP hijack_listener_sp) {
   if (!listener_sp)
 listener_sp = GetDebugger().GetListener();
   DeleteCurrentProcess();
   m_process_sp = Process::FindPlugin(shared_from_this(), plugin_name,
  listener_sp, crash_file, can_connect);
+
+  if (m_process_sp && hijack_listener_sp)
+m_process_sp->HijackProcessEvents(hijack_listener_sp);
+
   return m_process_sp;
 }
 
@@ -3026,6 +3031,14 @@
   if (!launch_info.GetArchitecture().IsValid())
 launch_info.GetArchitecture() = GetArchitecture();
 
+  // Hijacking events of the process to be created to be sure that all events
+  // until the first stop are intercepted (in case if platform doesn't define
+  // its own hijacking listener or if the process is created by the target
+  // manually, without the platform).
+  if (synchronous_execution && !launch_info.GetHijackListener())
+launch_info.SetHijackListener(
+Listener::MakeListener("lldb.Target.Launch.hijack"));
+
   // If we're not already connected to the process, and if we have a platform
   // that can launch a process for debugging, go ahead and do that here.
   if (state != eStateConnected && platform_sp &&
@@ -3053,7 +3066,8 @@
 } else {
   // Use a Process plugin to construct the process.
   const char *plugin_name = launch_info.GetProcessPluginName();
-  CreateProcess(launch_info.GetListener(), plugin_name, nullptr, false);
+  CreateProcess(launch_info.GetListener(), plugin_name, nullptr, false,
+   

[Lldb-commits] [PATCH] D119963: [LLDB] Dump valid ranges of variables

2022-02-16 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D119963#3327472 , @zequanwu wrote:

> In D119963#3327139 , @jingham wrote:
>
>> It's really useful to be able to see these variable ranges, so the feature 
>> seems good to me, but I think the valid range output should be governed by 
>> another flag, like --show-variable-ranges.  In optimized code, there can be 
>> a whole lot of ranges for each variable, so this could get really noisy and 
>> make the whole output hard to look at, so it would be good to have a way to 
>> turn it off.
>
> Using a flag to control it seems good to me.
>
>> Unfortunately `-v` doesn't work for that since the non `-v` version isn't so 
>> useful.
>
> I don't quite understand what you mean here. I suppose we want a flag 
> `--show-variable-ranges` to have effect only when `-v` is given in `image 
> lookup -v -a ...`. Is this what you mean?

I was addressing another unasked question: It seemed odd to say "add another 
flag to reduce the amount of output for something that is only printed when the 
user asks for verbose output".  So I was trying to explain why that made sense. 
 The reason being that when we made the "image lookup" command, the non-verbose 
version wasn't actually terribly useful, but the verbose version was.  So 
pretty much everybody uses the `-v` flag when the command is used.  The other 
option would be to do the horrible thing some tools do and have multiple -v's 
meaning more and more verbose.  You could do it that way too (the option parser 
can count the number of -v's it has seen).  But I think it's a lot better to 
have an option to dial up the specific extra info you want in this case.

But you are right, we don't print the variable information at all without -v, 
so while it's odd to have --show-variable-ranges only take effect when -v is 
supplied, I think that's the reasonable way to do it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119963

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


[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

2022-02-16 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

I don't think CreateProcess needs a HijackListener, does it?  It doesn't 
generate events, it just make the connection to the server.  It is always 
followed by Launch or DebugProcess, which are the ones that do the real work.




Comment at: lldb/include/lldb/Target/Target.h:587
 
   // If listener_sp is null, the listener of the owning Debugger object will be
   // used.

Probably worth saying what the hijack_listener is for as well.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py:14
 '''Create the Visual Studio Code debug adaptor'''
-self.assertTrue(os.path.exists(self.lldbVSCodeExec),
-'lldb-vscode must exist')
+self.assertTrue(is_exe(self.lldbVSCodeExec), 'lldb-vscode must exist')
 log_file_path = self.getBuildArtifact('vscode.txt')

I don't know if it's worth working harder for this, but it would be confusing 
if lldb-vscode existed but wasn't executable, and we gave an error of 
"lldb-vscode must exist". Maybe just say "must exist and be executable"...



Comment at: lldb/source/Target/Target.cpp:3038
+  // manually, without the platform).
+  if (synchronous_execution && !launch_info.GetHijackListener())
+launch_info.SetHijackListener(

In this context sync vrs. async is really about whether the caller expects to 
get a stop event for the first "real user stop", or just have Launch return 
when we are at the first user event w/o the caller having to spin the event 
loop.  A real user stop is generally "process hit a breakpoint" or "process 
crashed", etc.

That means we should hijack the events up to the stop at the entry point in 
both sync and async modes.  The odd case is when "stop at entry" is set.  In 
that case the "launch success" stop is also the first "real user stop". So in 
the "stop at entry && async" mode we need to arrange for there to be a stop 
event that the caller can wait on.  

The cleanest way to do this would be to always hijack the events, and then in 
the case where stop at entry is set in async mode, rebroadcast the stop event 
to the regular listener.  You could have the DebugProcess & Launch return the 
last event SP for this purpose.

The way the old code did it was to just undo the hijack, and return w/o calling 
WaitForProcessToStop (line 3084 & following) under the assumption that this 
would leave the last stop event unfetched and available for the caller.  But 
I'm not sure that's guaranteed to work.


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

https://reviews.llvm.org/D119548

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


[Lldb-commits] [PATCH] D119963: [LLDB] Dump valid ranges of variables

2022-02-16 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu updated this revision to Diff 409440.
zequanwu added a comment.
Herald added a subscriber: dang.

Add `-show-variables-ranges`/`-R` flag to enable it with `-v`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119963

Files:
  lldb/include/lldb/Core/Address.h
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/Options.td
  lldb/source/Core/Address.cpp
  lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc.s

Index: lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc.s
===
--- lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc.s
+++ lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc.s
@@ -5,21 +5,21 @@
 # UNSUPPORTED: lldb-repro
 
 # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym LOC=0 > %t
-# RUN: %lldb %t -o "image lookup -v -a 0" -o "image lookup -v -a 2" \
+# RUN: %lldb %t -o "image lookup -v -a 0 -R" -o "image lookup -v -a 2 -R" \
 # RUN:   -o "image dump symfile" -o exit | FileCheck %s
 
 # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym LOCLISTS=0 > %t
-# RUN: %lldb %t -o "image lookup -v -a 0" -o "image lookup -v -a 2" \
+# RUN: %lldb %t -o "image lookup -v -a 0 -R" -o "image lookup -v -a 2 -R" \
 # RUN:   -o "image dump symfile" -o exit | FileCheck %s --check-prefix=CHECK --check-prefix=LOCLISTS
 
-# CHECK-LABEL: image lookup -v -a 0
-# CHECK: Variable: {{.*}}, name = "x0", type = "int", location = DW_OP_reg5 RDI,
-# CHECK: Variable: {{.*}}, name = "x1", type = "int", location = ,
+# CHECK-LABEL: image lookup -v -a 0 -R
+# CHECK: Variable: {{.*}}, name = "x0", type = "int", location = DW_OP_reg5 RDI, decl = , valid ranges =
+# CHECK: Variable: {{.*}}, name = "x1", type = "int", location = , decl = , valid ranges =
 
-# CHECK-LABEL: image lookup -v -a 2
-# CHECK: Variable: {{.*}}, name = "x0", type = "int", location = DW_OP_reg0 RAX,
-# CHECK: Variable: {{.*}}, name = "x1", type = "int", location = ,
-# CHECK: Variable: {{.*}}, name = "x3", type = "int", location = DW_OP_reg1 RDX,
+# CHECK-LABEL: image lookup -v -a 2 -R
+# CHECK: Variable: {{.*}}, name = "x0", type = "int", location = DW_OP_reg0 RAX, decl = , valid ranges =
+# CHECK: Variable: {{.*}}, name = "x1", type = "int", location = , decl = , valid ranges =
+# CHECK: Variable: {{.*}}, name = "x3", type = "int", location = DW_OP_reg1 RDX, decl = , valid ranges =
 
 # CHECK-LABEL: image dump symfile
 # CHECK: CompileUnit{0x}
Index: lldb/source/Core/Address.cpp
===
--- lldb/source/Core/Address.cpp
+++ lldb/source/Core/Address.cpp
@@ -403,7 +403,8 @@
 }
 
 bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
-   DumpStyle fallback_style, uint32_t addr_size) const {
+   DumpStyle fallback_style, uint32_t addr_size,
+   bool print_var_ranges) const {
   // If the section was nullptr, only load address is going to work unless we
   // are trying to deref a pointer
   SectionSP section_sp(GetSection());
@@ -720,10 +721,18 @@
   bool get_parent_variables = true;
   bool stop_if_block_is_inlined_function = false;
   VariableList variable_list;
-  sc.block->AppendVariables(can_create, get_parent_variables,
-stop_if_block_is_inlined_function,
-[](Variable *) { return true; },
-&variable_list);
+  addr_t file_addr = GetFileAddress();
+  sc.block->AppendVariables(
+  can_create, get_parent_variables,
+  stop_if_block_is_inlined_function,
+  [&file_addr](Variable *var) {
+// Variables created from Dwarf always have empty scope range.
+if (var->GetScopeRange().IsEmpty())
+  return true;
+return var->GetScopeRange().FindEntryThatContains(file_addr) !=
+   nullptr;
+  },
+  &variable_list);
 
   for (const VariableSP &var_sp : variable_list) {
 if (var_sp && var_sp->LocationIsValidForAddress(*this)) {
@@ -739,6 +748,18 @@
   var_sp->DumpLocationForAddress(s, *this);
   s->PutCString(", decl = ");
   var_sp->GetDeclaration().DumpStopContext(s, false);
+  if (print_var_ranges) {
+s->PutCString(", valid ranges =");
+for (auto range : var_sp->GetScopeRange()) {
+  s->PutCString(" [");
+  s->AsRawOstream() << llvm::format_hex(range.GetRangeBase(),
+2 + 2 * addr_size);
+  s->PutCString("-");
+  s->AsRawOstream() << llvm::format_hex(range.GetRangeEnd(),
+2 + 2 * addr_size)

[Lldb-commits] [PATCH] D119918: [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE

2022-02-16 Thread Petr Hosek via Phabricator via lldb-commits
phosek created this revision.
phosek added reviewers: beanz, smeenai, ldionne, compnerd.
Herald added subscribers: ayermolo, sdasgup3, wenzhicui, wrengr, Chia-hungDuan, 
dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, 
grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, 
shauheen, rriddle, mehdi_amini, usaxena95, kadircet, arphaman, mgorny.
Herald added a reviewer: bollu.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: Flang.
phosek requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, Sanitizers, 
yota9, stephenneuendorffer, nicolasvasilache, jdoerfert.
Herald added projects: clang, Sanitizers, LLDB, MLIR, LLVM, clang-tools-extra.

This clarifies that this is an LLVM specific variable and avoids
potential conflicts with other projects.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119918

Files:
  bolt/test/Unit/lit.site.cfg.py.in
  bolt/test/lit.site.cfg.py.in
  clang-tools-extra/clangd/test/lit.site.cfg.py.in
  clang-tools-extra/test/Unit/lit.site.cfg.py.in
  clang-tools-extra/test/lit.site.cfg.py.in
  clang/cmake/caches/CrossWinToARMLinux.cmake
  clang/test/Unit/lit.site.cfg.py.in
  clang/test/lit.site.cfg.py.in
  clang/utils/perf-training/lit.site.cfg.in
  clang/utils/perf-training/order-files.lit.site.cfg.in
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
  compiler-rt/test/fuzzer/lit.site.cfg.py.in
  compiler-rt/unittests/lit.common.unit.configured.in
  cross-project-tests/lit.site.cfg.py.in
  flang/test/NonGtestUnit/lit.site.cfg.py.in
  flang/test/Unit/lit.site.cfg.py.in
  lld/test/Unit/lit.site.cfg.py.in
  lld/test/lit.site.cfg.py.in
  lldb/test/API/lit.site.cfg.py.in
  lldb/test/CMakeLists.txt
  lldb/test/Shell/lit.site.cfg.py.in
  lldb/test/Unit/lit.site.cfg.py.in
  lldb/test/lit.site.cfg.py.in
  llvm/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/CrossCompile.cmake
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/runtimes/CMakeLists.txt
  llvm/test/lit.site.cfg.py.in
  llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
  llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
  llvm/utils/gn/secondary/clang/test/BUILD.gn
  llvm/utils/gn/secondary/lld/test/BUILD.gn
  llvm/utils/gn/secondary/lldb/test/BUILD.gn
  llvm/utils/gn/secondary/llvm/test/BUILD.gn
  mlir/examples/standalone/test/lit.site.cfg.py.in
  mlir/test/lit.site.cfg.py.in
  polly/test/Unit/lit.site.cfg.in
  polly/test/lit.site.cfg.in

Index: polly/test/lit.site.cfg.in
===
--- polly/test/lit.site.cfg.in
+++ polly/test/lit.site.cfg.in
@@ -6,7 +6,7 @@
 config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
 config.polly_obj_root = "@POLLY_BINARY_DIR@"
 config.polly_lib_dir = "@POLLY_LIB_DIR@"
-config.target_triple = "@TARGET_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.enable_gpgpu_codegen = "@GPU_CODEGEN@"
 config.llvm_polly_link_into_tools = "@LLVM_POLLY_LINK_INTO_TOOLS@"
 config.targets_to_build = "@TARGETS_TO_BUILD@"
@@ -15,7 +15,7 @@
 ## Check the current platform with regex
 import re
 EAT_ERR_ON_X86 = ' '
-if (re.match(r'^x86_64*', '@TARGET_TRIPLE@') == None) :
+if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') == None) :
   EAT_ERR_ON_X86 = '|| echo \"error is eaten\"'
 
 for arch in config.targets_to_build.split():
Index: polly/test/Unit/lit.site.cfg.in
===
--- polly/test/Unit/lit.site.cfg.in
+++ polly/test/Unit/lit.site.cfg.in
@@ -11,7 +11,7 @@
 config.polly_lib_dir = "@POLLY_LIB_DIR@"
 config.enable_shared = @ENABLE_SHARED@
 config.shlibdir = "@SHLIBDIR@"
-config.target_triple = "@TARGET_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.enable_gpgpu_codegen = "@GPU_CODEGEN@"
 config.llvm_polly_link_into_tools = "@LLVM_POLLY_LINK_INTO_TOOLS@"
 config.has_unittests = @POLLY_GTEST_AVAIL@
Index: mlir/test/lit.site.cfg.py.in
===
--- mlir/test/lit.site.cfg.py.in
+++ mlir/test/lit.site.cfg.py.in
@@ -3,7 +3,7 @@
 import sys
 
 config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.target_triple = "@TARGET_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: mlir/examples/standalone/test/lit.site.cfg.py.in
===
--- mlir/examples/standalone/test/lit.site.cfg.py.in
+++ mlir/examples/standalone/test/lit.site.cfg.py.in
@@ -3,7 +3,7 @@
 import sys
 
 config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.target_triple = "@TARGET_

[Lldb-commits] [PATCH] D119918: [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE

2022-02-16 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: JDevlieghere.

Looks great!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119918

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


[Lldb-commits] [PATCH] D119918: [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE

2022-02-16 Thread Diana Picus via Phabricator via lldb-commits
rovka added a comment.

Is this going to break for everyone that still passes TARGET_TRIPLE to cmake? 
If so, we should probably have a period where we support both.

In particular, this might break some of our buildbots 

 who explicitly set TARGET_TRIPLE. Could you send a patch to zorg cleaning that 
up (and maybe wait for that to go through before removing TARGET_TRIPLE 
completely)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119918

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


[Lldb-commits] [PATCH] D119918: [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE

2022-02-16 Thread Louis Dionne via Phabricator via lldb-commits
ldionne accepted this revision.
ldionne added a comment.

LGTM from libc++/libc++abi's perspective.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119918

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


[Lldb-commits] [PATCH] D119178: Add support for generating debug-info for structured bindings of structs and arrays

2022-02-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4647
+const bool UsePointerValue) {
+  assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
+  assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");

shafik wrote:
> aprantl wrote:
> > do you need a 
> > ```
> >  if (DebugKind > codegenoptions::LimitedDebugInfo)
> >   return
> > ```
> > 
> > here?
> That kind of check is only used in limited places, why would it apply here as 
> let's say opposed to the `EmitDeclare` for `VarDecl` case?
I think the answer is that Ty would be null then.


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

https://reviews.llvm.org/D119178

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


[Lldb-commits] [PATCH] D119918: [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE

2022-02-16 Thread Petr Hosek via Phabricator via lldb-commits
phosek updated this revision to Diff 409394.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119918

Files:
  bolt/test/Unit/lit.site.cfg.py.in
  bolt/test/lit.site.cfg.py.in
  clang-tools-extra/clangd/test/lit.site.cfg.py.in
  clang-tools-extra/test/Unit/lit.site.cfg.py.in
  clang-tools-extra/test/lit.site.cfg.py.in
  clang/cmake/caches/CrossWinToARMLinux.cmake
  clang/test/Unit/lit.site.cfg.py.in
  clang/test/lit.site.cfg.py.in
  clang/utils/perf-training/lit.site.cfg.in
  clang/utils/perf-training/order-files.lit.site.cfg.in
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
  compiler-rt/test/fuzzer/lit.site.cfg.py.in
  compiler-rt/unittests/lit.common.unit.configured.in
  cross-project-tests/lit.site.cfg.py.in
  flang/test/NonGtestUnit/lit.site.cfg.py.in
  flang/test/Unit/lit.site.cfg.py.in
  lld/test/Unit/lit.site.cfg.py.in
  lld/test/lit.site.cfg.py.in
  lldb/test/API/lit.site.cfg.py.in
  lldb/test/CMakeLists.txt
  lldb/test/Shell/lit.site.cfg.py.in
  lldb/test/Unit/lit.site.cfg.py.in
  lldb/test/lit.site.cfg.py.in
  llvm/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/CrossCompile.cmake
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/runtimes/CMakeLists.txt
  llvm/test/lit.site.cfg.py.in
  llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
  llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
  llvm/utils/gn/secondary/clang/test/BUILD.gn
  llvm/utils/gn/secondary/lld/test/BUILD.gn
  llvm/utils/gn/secondary/lldb/test/BUILD.gn
  llvm/utils/gn/secondary/llvm/test/BUILD.gn
  mlir/examples/standalone/test/lit.site.cfg.py.in
  mlir/test/lit.site.cfg.py.in
  polly/test/Unit/lit.site.cfg.in
  polly/test/lit.site.cfg.in

Index: polly/test/lit.site.cfg.in
===
--- polly/test/lit.site.cfg.in
+++ polly/test/lit.site.cfg.in
@@ -6,7 +6,7 @@
 config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
 config.polly_obj_root = "@POLLY_BINARY_DIR@"
 config.polly_lib_dir = "@POLLY_LIB_DIR@"
-config.target_triple = "@TARGET_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.enable_gpgpu_codegen = "@GPU_CODEGEN@"
 config.llvm_polly_link_into_tools = "@LLVM_POLLY_LINK_INTO_TOOLS@"
 config.targets_to_build = "@TARGETS_TO_BUILD@"
@@ -15,7 +15,7 @@
 ## Check the current platform with regex
 import re
 EAT_ERR_ON_X86 = ' '
-if (re.match(r'^x86_64*', '@TARGET_TRIPLE@') == None) :
+if (re.match(r'^x86_64*', '@LLVM_TARGET_TRIPLE@') == None) :
   EAT_ERR_ON_X86 = '|| echo \"error is eaten\"'
 
 for arch in config.targets_to_build.split():
Index: polly/test/Unit/lit.site.cfg.in
===
--- polly/test/Unit/lit.site.cfg.in
+++ polly/test/Unit/lit.site.cfg.in
@@ -11,7 +11,7 @@
 config.polly_lib_dir = "@POLLY_LIB_DIR@"
 config.enable_shared = @ENABLE_SHARED@
 config.shlibdir = "@SHLIBDIR@"
-config.target_triple = "@TARGET_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.enable_gpgpu_codegen = "@GPU_CODEGEN@"
 config.llvm_polly_link_into_tools = "@LLVM_POLLY_LINK_INTO_TOOLS@"
 config.has_unittests = @POLLY_GTEST_AVAIL@
Index: mlir/test/lit.site.cfg.py.in
===
--- mlir/test/lit.site.cfg.py.in
+++ mlir/test/lit.site.cfg.py.in
@@ -3,7 +3,7 @@
 import sys
 
 config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.target_triple = "@TARGET_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: mlir/examples/standalone/test/lit.site.cfg.py.in
===
--- mlir/examples/standalone/test/lit.site.cfg.py.in
+++ mlir/examples/standalone/test/lit.site.cfg.py.in
@@ -3,7 +3,7 @@
 import sys
 
 config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.target_triple = "@TARGET_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: llvm/utils/gn/secondary/llvm/test/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/test/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/test/BUILD.gn
@@ -72,7 +72,7 @@
 "LLVM_VERSION_SUFFIX=git",
 "Python3_EXECUTABLE=$python_path",
 "TARGETS_TO_BUILD=$llvm_targets_to_build_string",
-"TARGET_TRIPLE=$llvm_target_triple",
+"LLVM_TARGET_TRIPLE=$llvm_target_triple",
 
 "LLVM_LIBCXX_USED=0",
 
Index: llvm/utils/gn/secondary/lldb/test/BUILD.gn
===
--- llvm/utils/gn/secondary/l

[Lldb-commits] [PATCH] D119918: [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE

2022-02-16 Thread Petr Hosek via Phabricator via lldb-commits
phosek added a comment.

Provide fallback for `TARGET_TRIPLE` and print a warning about deprecation and 
future removal.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119918

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


[Lldb-commits] [PATCH] D119997: Add a little test for simple breaking on overloaded functions by name

2022-02-16 Thread Jim Ingham via Phabricator via lldb-commits
jingham created this revision.
jingham added a reviewer: JDevlieghere.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

When Jonas made the change to not add demangled names to the name indexes, we 
were worried it might cause breaking on overloaded functions to stop working.  
But that's actually not true, anything that uses the Symbol::LookupInfo to 
search names will do the right thing here, which includes 
SBModule::FindFunctions and the breakpoint by name resolver.  That does the job 
of extracting the base name, finding potential matches, and then comparing the 
demangled name of the match to the input string.  It's still the case that the 
names must match exactly.

Anyway, in the course of proving this to myself I wrote a little test for 
simple overloaded name breakpoints.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119997

Files:
  lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/Makefile
  
lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
  lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp


Index: lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp
@@ -0,0 +1,29 @@
+int a_function(int x) {
+  return x * x;
+}
+
+int a_function(double x) {
+  return static_cast(x * x);
+}
+
+int a_function(double x, int y) {
+  return y * y;
+}
+
+int a_function(int x, double y) {
+  return static_cast(y * y);
+}
+
+int main(int argc, char const *argv[]) {
+  // This is a random comment.
+
+  int int_val = 20;
+  double double_val = 20.0;
+
+  int result = a_function(int_val);
+  result += a_function(double_val);
+  result += a_function(double_val, int_val);
+  result += a_function(int_val, double_val);
+
+  return result;
+}
Index: 
lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
===
--- /dev/null
+++ 
lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
@@ -0,0 +1,32 @@
+"""
+Test setting a breakpoint on an overloaded function by name.
+"""
+
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestBreakpointOnOverload(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def check_breakpoint(self, name):
+bkpt = self.target.BreakpointCreateByName(name)
+self.assertEqual(bkpt.num_locations, 1, "Got one location")
+addr = bkpt.locations[0].GetAddress()
+self.assertTrue(addr.function.IsValid(), "Got a real function")
+self.assertEqual(addr.function.name, name, "Got the right name")
+
+def test_break_on_overload(self):
+self.build()
+self.target = lldbutil.run_to_breakpoint_make_target(self)
+self.check_breakpoint("a_function(int)")
+self.check_breakpoint("a_function(double)")
+self.check_breakpoint("a_function(int, double)")
+self.check_breakpoint("a_function(double, int)")
+
+
+
Index: lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/Makefile
===
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/Makefile
@@ -0,0 +1,4 @@
+CXX_SOURCES := main.cpp
+CXXFLAGS_EXTRAS := -std=c++14
+
+include Makefile.rules


Index: lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp
@@ -0,0 +1,29 @@
+int a_function(int x) {
+  return x * x;
+}
+
+int a_function(double x) {
+  return static_cast(x * x);
+}
+
+int a_function(double x, int y) {
+  return y * y;
+}
+
+int a_function(int x, double y) {
+  return static_cast(y * y);
+}
+
+int main(int argc, char const *argv[]) {
+  // This is a random comment.
+
+  int int_val = 20;
+  double double_val = 20.0;
+
+  int result = a_function(int_val);
+  result += a_function(double_val);
+  result += a_function(double_val, int_val);
+  result += a_function(int_val, double_val);
+
+  return result;
+}
Index: lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
===
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
@@ -0,0 +1,32 @@
+"""
+Test setting a breakpoint on an overloaded function by name.
+"""
+
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class Te

[Lldb-commits] [PATCH] D119997: Add a little test for simple breaking on overloaded functions by name

2022-02-16 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 Jim! LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119997

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


[Lldb-commits] [lldb] dd8490d - Add a test for breaking on overloaded functions by name.

2022-02-16 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2022-02-16T18:12:00-08:00
New Revision: dd8490d207d3a1612091abbea04bf660f133a89f

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

LOG: Add a test for breaking on overloaded functions by name.

Added: 
lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/Makefile

lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp

Modified: 


Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/Makefile 
b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/Makefile
new file mode 100644
index ..a27336ffd9ac
--- /dev/null
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/Makefile
@@ -0,0 +1,4 @@
+CXX_SOURCES := main.cpp
+CXXFLAGS_EXTRAS := -std=c++14
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
new file mode 100644
index ..49d7442f6763
--- /dev/null
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
@@ -0,0 +1,32 @@
+"""
+Test setting a breakpoint on an overloaded function by name.
+"""
+
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestBreakpointOnOverload(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def check_breakpoint(self, name):
+bkpt = self.target.BreakpointCreateByName(name)
+self.assertEqual(bkpt.num_locations, 1, "Got one location")
+addr = bkpt.locations[0].GetAddress()
+self.assertTrue(addr.function.IsValid(), "Got a real function")
+self.assertEqual(addr.function.name, name, "Got the right name")
+
+def test_break_on_overload(self):
+self.build()
+self.target = lldbutil.run_to_breakpoint_make_target(self)
+self.check_breakpoint("a_function(int)")
+self.check_breakpoint("a_function(double)")
+self.check_breakpoint("a_function(int, double)")
+self.check_breakpoint("a_function(double, int)")
+
+
+

diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp 
b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp
new file mode 100644
index ..55afab8ad0c3
--- /dev/null
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/main.cpp
@@ -0,0 +1,29 @@
+int a_function(int x) {
+  return x * x;
+}
+
+int a_function(double x) {
+  return static_cast(x * x);
+}
+
+int a_function(double x, int y) {
+  return y * y;
+}
+
+int a_function(int x, double y) {
+  return static_cast(y * y);
+}
+
+int main(int argc, char const *argv[]) {
+  // This is a random comment.
+
+  int int_val = 20;
+  double double_val = 20.0;
+
+  int result = a_function(int_val);
+  result += a_function(double_val);
+  result += a_function(double_val, int_val);
+  result += a_function(int_val, double_val);
+
+  return result;
+}



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


[Lldb-commits] [PATCH] D119997: Add a little test for simple breaking on overloaded functions by name

2022-02-16 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Should have been Module::LookupInfo in the Description...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119997

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


[Lldb-commits] [lldb] 05f10ae - On Windows, the function name contains the return parameter, so

2022-02-16 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2022-02-16T19:10:03-08:00
New Revision: 05f10ae0d8548e65130475730a1565203da8726d

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

LOG: On Windows, the function name contains the return parameter, so
the test has to be "function name contains the name we used to specify
the breakpoint" not IS the name...

Added: 


Modified: 

lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
index 49d7442f6763..30124f8335d7 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_on_overload/TestBreakOnOverload.py
@@ -18,7 +18,12 @@ def check_breakpoint(self, name):
 self.assertEqual(bkpt.num_locations, 1, "Got one location")
 addr = bkpt.locations[0].GetAddress()
 self.assertTrue(addr.function.IsValid(), "Got a real function")
-self.assertEqual(addr.function.name, name, "Got the right name")
+# On Window, the name of the function includes the return value.
+# We still succeed in setting the breakpoint, but the resultant
+# name is not the same.
+# So just look for the name we used for the breakpoint in the
+# function name, rather than doing an equality check.
+self.assertIn(name, addr.function.name, "Got the right name")
 
 def test_break_on_overload(self):
 self.build()



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