[Lldb-commits] [PATCH] D151344: Reland "[CMake] Bumps minimum version to 3.20.0.

2023-05-25 Thread H. Vetinari via Phabricator via lldb-commits
h-vetinari added inline comments.



Comment at: libunwind/src/CMakeLists.txt:28-35
 
 # See add_asm_sources() in compiler-rt for explanation of this workaround.
 # CMake doesn't work correctly with assembly on AIX. Workaround by compiling
 # as C files as well.
 if((APPLE AND CMAKE_VERSION VERSION_LESS 3.19) OR
-   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17) OR
-   (${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
+   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17))
   set_source_files_properties(${LIBUNWIND_ASM_SOURCES} PROPERTIES LANGUAGE C)

mstorsjo wrote:
> h-vetinari wrote:
> > Shouldn't it be possible to remove that entire block (as it only fires for 
> > CMake <3.20)?
> The intention was to do such cleanups in a later patch, as mentioned in the 
> original commit message in https://reviews.llvm.org/D144509. (I guess it 
> would be good to bring the original commit message along with the reland 
> attempts too.)
Well sure, but "workarounds" is a broad term. It makes sense to not try to 
clean up everything that newer CMake enables, but this PR does remove a lot of 
(all?) other lines with `CMAKE_VERSION VERSION_LESS ` where x<3.20. On top 
of that, since this line is already being changed (which is why I noticed in 
the first place), I'd suggest to just remove it. But I don't feel strongly 
about this, just thought I'd point it out.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151344

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


[Lldb-commits] [PATCH] D151344: Reland "[CMake] Bumps minimum version to 3.20.0.

2023-05-25 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added inline comments.



Comment at: libunwind/src/CMakeLists.txt:28-35
 
 # See add_asm_sources() in compiler-rt for explanation of this workaround.
 # CMake doesn't work correctly with assembly on AIX. Workaround by compiling
 # as C files as well.
 if((APPLE AND CMAKE_VERSION VERSION_LESS 3.19) OR
-   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17) OR
-   (${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
+   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17))
   set_source_files_properties(${LIBUNWIND_ASM_SOURCES} PROPERTIES LANGUAGE C)

h-vetinari wrote:
> Shouldn't it be possible to remove that entire block (as it only fires for 
> CMake <3.20)?
The intention was to do such cleanups in a later patch, as mentioned in the 
original commit message in https://reviews.llvm.org/D144509. (I guess it would 
be good to bring the original commit message along with the reland attempts 
too.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151344

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


[Lldb-commits] [lldb] c9ee631 - TestStackCoreScriptedProcess.py is timing out, skip it

2023-05-25 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2023-05-25T19:13:16-07:00
New Revision: c9ee63138189368674cd201891577e65bd289ed4

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

LOG: TestStackCoreScriptedProcess.py is timing out, skip it

The x86_64 macOS CI bot is failing because this test
times out.  It was marked as expectedFail earlier today,
but that's not considered a fail so the CI runs are
red.  Skipping it on Darwin for now until Ismail can
look into it.

Added: 


Modified: 

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

Removed: 




diff  --git 
a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
 
b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
index 6c695c659d506..bf9681ad678b6 100644
--- 
a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
+++ 
b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
@@ -35,7 +35,7 @@ def get_module_with_name(self, target, name):
 @skipIfOutOfTreeDebugserver
 @skipIfRemote
 @skipIfAsan  # On ASAN builds, this test times-out (rdar://98678134)
-@expectedFailureDarwin
+@skipIfDarwin
 def test_launch_scripted_process_stack_frames(self):
 """Test that we can launch an lldb scripted process from the command
 line, check its process ID and read string from memory."""



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


[Lldb-commits] [PATCH] D150928: Two bug fixes for loading process save-core created core files, plus perf improvements

2023-05-25 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda updated this revision to Diff 525910.
jasonmolenda added a comment.

Updating the patch to incorporate Alex's feedback, and a little further 
refinement with testing.  I am still doing final testing now, and mostly 
interested in how to create a mach-o corefile that would trigger the failure 
that started this fix - where lldb found enough of a dyld in a 
modified-memory-only corefile that it cleared the binary list, but not enough 
to actually load the full list of binaries out of corefile memory.  I think it 
may be tricky to get a corefile that meets that criteria, but I want to look 
into it a bit.

I suspect the actual code changes are done at this point though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150928

Files:
  lldb/include/lldb/Target/DynamicLoader.h
  lldb/source/Core/DynamicLoader.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/source/Symbol/LocateSymbolFileMacOSX.cpp

Index: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
===
--- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
+++ lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
@@ -559,14 +559,17 @@
   const UUID *uuid_ptr = module_spec.GetUUIDPtr();
   const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr();
 
+  // If \a dbgshell_command is set, the user has specified
+  // forced symbol lookup via that command.  We'll get the
+  // path back from GetDsymForUUIDExecutable() later.
   llvm::StringRef dbgshell_command = GetDbgShellCommand();
 
-  // When dbgshell_command is empty, the user has not enabled the use of an
-  // external program to find the symbols, don't run it for them.
+  // If forced lookup isn't set, by the user's \a dbgshell_command or
+  // by the \a force_lookup argument, exit this method.
   if (!force_lookup && dbgshell_command.empty())
 return false;
 
-  // We need a UUID or valid (existing FileSpec.
+  // We need a UUID or valid existing FileSpec.
   if (!uuid_ptr &&
   (!file_spec_ptr || !FileSystem::Instance().Exists(*file_spec_ptr)))
 return false;
Index: lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
===
--- lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -252,20 +252,20 @@
   m_mach_kernel_addr = objfile_binary_value;
   m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
   found_main_binary_definitively = true;
+} else if (type == ObjectFile::eBinaryTypeUser) {
+  m_dyld_addr = objfile_binary_value;
+  m_dyld_plugin_name = DynamicLoaderMacOSXDYLD::GetPluginNameStatic();
 } else {
   const bool force_symbol_search = true;
   const bool notify = true;
+  const bool set_address_in_target = true;
   if (DynamicLoader::LoadBinaryWithUUIDAndAddress(
   this, llvm::StringRef(), objfile_binary_uuid,
   objfile_binary_value, objfile_binary_value_is_offset,
-  force_symbol_search, notify)) {
+  force_symbol_search, notify, set_address_in_target)) {
 found_main_binary_definitively = true;
 m_dyld_plugin_name = DynamicLoaderStatic::GetPluginNameStatic();
   }
-  if (type == ObjectFile::eBinaryTypeUser) {
-m_dyld_addr = objfile_binary_value;
-m_dyld_plugin_name = DynamicLoaderMacOSXDYLD::GetPluginNameStatic();
-  }
 }
   }
 
@@ -314,9 +314,11 @@
   const bool value_is_offset = false;
   const bool force_symbol_search = true;
   const bool notify = true;
+  const bool set_address_in_target = true;
   if (DynamicLoader::LoadBinaryWithUUIDAndAddress(
   this, llvm::StringRef(), ident_uuid, ident_binary_addr,
-  value_is_offset, force_symbol_search, notify)) {
+  value_is_offset, force_symbol_search, notify,
+  set_address_in_target)) {
 found_main_binary_definitively = true;
 m_dyld_plugin_name = DynamicLoaderStatic::GetPluginNameStatic();
   }
@@ -325,7 +327,10 @@
 
   // Finally, load any binaries noted by "load binary" LC_NOTEs in the
   // corefile
-  core_objfile->LoadCoreFileImages(*this);
+  if (core_objfile->LoadCoreFileImages(*this)) {
+found_main_binary_definitively = true;
+m_dyld_plugin_name = DynamicLoaderStatic::GetPluginNameStatic();
+  }
 
   // LoadCoreFileImges may have set the dynamic loader, e.g. in
   // PlatformDarwinKernel::LoadPlatformBinaryAndSetup().
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

[Lldb-commits] [PATCH] D151524: [lldb][NFCI] Change type of SBDebugger::m_instance_name

2023-05-25 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, jingham, mib.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This doesn't need to be in the ConstString StringPool. There's little
benefit to having these be unique, and we don't need fast comparisons on
them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151524

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -408,7 +408,7 @@
   m_session_dict(PyInitialValue::Invalid),
   m_sys_module_dict(PyInitialValue::Invalid), m_run_one_line_function(),
   m_run_one_line_str_global(),
-  m_dictionary_name(m_debugger.GetInstanceName().AsCString()),
+  m_dictionary_name(m_debugger.GetInstanceName()),
   m_active_io_handler(eIOHandlerNone), m_session_is_active(false),
   m_pty_secondary_is_open(false), m_valid_session(true), m_lock_count(0),
   m_command_thread_state(nullptr) {
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -740,19 +740,20 @@
   }
 }
 
-DebuggerSP Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
-  DebuggerSP debugger_sp;
-  if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
-std::lock_guard guard(*g_debugger_list_mutex_ptr);
-DebuggerList::iterator pos, end = g_debugger_list_ptr->end();
-for (pos = g_debugger_list_ptr->begin(); pos != end; ++pos) {
-  if ((*pos)->m_instance_name == instance_name) {
-debugger_sp = *pos;
-break;
-  }
-}
+DebuggerSP
+Debugger::FindDebuggerWithInstanceName(llvm::StringRef instance_name) {
+  if (!g_debugger_list_ptr || !g_debugger_list_mutex_ptr)
+return DebuggerSP();
+
+  std::lock_guard guard(*g_debugger_list_mutex_ptr);
+  for (const DebuggerSP _sp : *g_debugger_list_ptr) {
+if (!debugger_sp)
+  continue;
+
+if (llvm::StringRef(debugger_sp->GetInstanceName()) == instance_name)
+  return debugger_sp;
   }
-  return debugger_sp;
+  return DebuggerSP();
 }
 
 TargetSP Debugger::FindTargetWithProcessID(lldb::pid_t pid) {
@@ -801,13 +802,13 @@
   m_source_manager_up(), m_source_file_cache(),
   m_command_interpreter_up(
   std::make_unique(*this, false)),
-  m_io_handler_stack(), m_instance_name(), m_loaded_plugins(),
-  m_event_handler_thread(), m_io_handler_thread(),
+  m_io_handler_stack(),
+  m_instance_name(llvm::formatv("debugger_{0}", GetID()).str()),
+  m_loaded_plugins(), m_event_handler_thread(), m_io_handler_thread(),
   m_sync_broadcaster(nullptr, "lldb.debugger.sync"),
   m_broadcaster(m_broadcaster_manager_sp,
 GetStaticBroadcasterClass().AsCString()),
   m_forward_listener_sp(), m_clear_once() {
-  m_instance_name.SetString(llvm::formatv("debugger_{0}", GetID()).str());
   // Initialize the debugger properties as early as possible as other parts of
   // LLDB will start querying them during construction.
   m_collection_sp->Initialize(g_debugger_properties);
Index: lldb/source/API/SBDebugger.cpp
===
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -1326,7 +1326,10 @@
 const char *SBDebugger::GetInstanceName() {
   LLDB_INSTRUMENT_VA(this);
 
-  return (m_opaque_sp ? m_opaque_sp->GetInstanceName().AsCString() : nullptr);
+  if (!m_opaque_sp)
+return nullptr;
+
+  return ConstString(m_opaque_sp->GetInstanceName()).AsCString();
 }
 
 SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
@@ -1334,8 +1337,8 @@
   LLDB_INSTRUMENT_VA(var_name, value, debugger_instance_name);
 
   SBError sb_error;
-  DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName(
-  ConstString(debugger_instance_name)));
+  DebuggerSP debugger_sp(
+  Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
   Status error;
   if (debugger_sp) {
 ExecutionContext exe_ctx(
@@ -1356,8 +1359,8 @@
  const char *debugger_instance_name) {
   LLDB_INSTRUMENT_VA(var_name, debugger_instance_name);
 
-  DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName(
-  ConstString(debugger_instance_name)));
+  DebuggerSP debugger_sp(
+  Debugger::FindDebuggerWithInstanceName(debugger_instance_name));
   Status error;
   if (debugger_sp) {
 ExecutionContext exe_ctx(
@@ -1487,7 

[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/Breakpoint/Watchpoint.cpp:127
+
+bool Watchpoint::VariableWatchpointDisabler(void *baton,
+StoppointCallbackContext *context,

mib wrote:
> JDevlieghere wrote:
> > I think this should return an `llvm::Error` and log it at the call site. 
> > For every early return we know what went wrong. Same for 
> > `SetupVariableWatchpointDisabler`.
> This is a WatchpointCallback so it have to match a specific function 
> signature (and return a `bool`). I could change 
> `SetupVariableWatchpointDisabler` to return an `llvm::Error` in a follow-up
That's unfortunate but makes sense. Thanks for clarifying. 



Comment at: lldb/source/Breakpoint/Watchpoint.cpp:140
+
+  LLDB_LOGF(log, "Watchpoint::%s called by breakpoint %" PRIu64 ".%" PRIu64,
+__FUNCTION__, break_id, break_loc_id);

mib wrote:
> JDevlieghere wrote:
> > Doesn't __FUNCTION__ already include `Watchpoint::`? Also I think there's a 
> > flag to include the function name in the log, so this is redundant. 
> No, it only prints the method name, `LLVM_PRETTY_FUNCTION` prints everything 
> but I think that macro is not defined with other compiler.
`LLVM_PRETTY_FUNCTION` is an llvm define, it expands to the appropriate macro 
based on the host compiler. You can totally use it but you must include 
`Compiler.h`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151366

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


[Lldb-commits] [PATCH] D151344: Reland "[CMake] Bumps minimum version to 3.20.0.

2023-05-25 Thread H. Vetinari via Phabricator via lldb-commits
h-vetinari added inline comments.



Comment at: libunwind/src/CMakeLists.txt:28-35
 
 # See add_asm_sources() in compiler-rt for explanation of this workaround.
 # CMake doesn't work correctly with assembly on AIX. Workaround by compiling
 # as C files as well.
 if((APPLE AND CMAKE_VERSION VERSION_LESS 3.19) OR
-   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17) OR
-   (${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
+   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17))
   set_source_files_properties(${LIBUNWIND_ASM_SOURCES} PROPERTIES LANGUAGE C)

Shouldn't it be possible to remove that entire block (as it only fires for 
CMake <3.20)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151344

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


[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked an inline comment as done.
mib added inline comments.



Comment at: lldb/source/Commands/CommandObjectWatchpoint.cpp:959
   ", variable expression='%s').\n",
   addr, (uint64_t)size, command.GetArgumentAtIndex(0));
   if (error.AsCString(nullptr))

JDevlieghere wrote:
> You wouldn't need the `(uint64_t)` cast if you used formatv. This also should 
> use a C++ style cast 
> (https://discourse.llvm.org/t/rfc-add-preferred-casting-style-to-coding-standards/70793/4).
Good point, but this code was already here before my patch, I just moved around 
to have early returns.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151366

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


[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

2023-05-25 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

In D151497#4374495 , @JDevlieghere 
wrote:

> In D151497#4374080 , @bulbazord 
> wrote:
>
>> I think it's good to improve the error messaging but I think we can probably 
>> do better. "Function caller" is specific to the internals of LLDB and isn't 
>> really meaningful for many users. It's also somewhat confusing from a user's 
>> perspective when the expression you're running isn't calling a function.
>>
>> If I were an end user who didn't know much about LLDB, I would think "I'm 
>> trying to print a variable, what's this about a function?" and "Why is 
>> memory allocation involved?". I would suggest changing the error message to 
>> something like: "Unable to evaluate expression while the process is $STATE: 
>> the process must be running and stopped to evaluate this expression".
>>
>> What do you think?
>
> I very much agree that error messages should first and foremost be helpful to 
> our users. In this particular patch, we have two places where we emit this 
> error. In `UtilityFunction::MakeFunctionCaller` I believe the current error 
> is totally appropriate. That doesn't mean that I think it should be shown to 
> the user as such. I didn't look at how this function is called, but if it 
> trips, I would like to see an error along the lines of:
>
>   error: Couldn't run utility function. Can't make a function caller while 
> the process is stopped: the process must be stopped to allocate memory.
>
> On the other hand, in `UserExpression::Evaluate` I think it's totally 
> appropriate to rephrase this, but at the same time I don't think we need to 
> dumb this down.
>
>   error: Unable to evaluate expression while the process is $STATE: the 
> process must be stopped because the expression might requires allocating 
> memory.
>
> I'll update the error messages accordingly.

This makes sense to me. I don't want to dumb things down per-se, but now that I 
look back at my suggestion it may have been too simplistic. I think the message 
you've written is an excellent. Thank you for working on this.




Comment at: lldb/source/Expression/UserExpression.cpp:207-208
+
+  // Since we might need to call allocate memory, we need to be stopped to run
+  // an expression.
   if (process != nullptr && process->GetState() != lldb::eStateStopped) {





Comment at: lldb/source/Expression/UtilityFunction.cpp:68-69
   }
   // Since we might need to call allocate memory and maybe call code to make
   // the caller, we need to be stopped.
   if (process_sp->GetState() != lldb::eStateStopped) {




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

https://reviews.llvm.org/D151497

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


[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked an inline comment as done.
mib added inline comments.



Comment at: lldb/source/Breakpoint/Watchpoint.cpp:127
+
+bool Watchpoint::VariableWatchpointDisabler(void *baton,
+StoppointCallbackContext *context,

JDevlieghere wrote:
> I think this should return an `llvm::Error` and log it at the call site. For 
> every early return we know what went wrong. Same for 
> `SetupVariableWatchpointDisabler`.
This is a WatchpointCallback so it have to match a specific function signature 
(and return a `bool`). I could change `SetupVariableWatchpointDisabler` to 
return an `llvm::Error` in a follow-up



Comment at: lldb/source/Breakpoint/Watchpoint.cpp:140
+
+  LLDB_LOGF(log, "Watchpoint::%s called by breakpoint %" PRIu64 ".%" PRIu64,
+__FUNCTION__, break_id, break_loc_id);

JDevlieghere wrote:
> Doesn't __FUNCTION__ already include `Watchpoint::`? Also I think there's a 
> flag to include the function name in the log, so this is redundant. 
No, it only prints the method name, `LLVM_PRETTY_FUNCTION` prints everything 
but I think that macro is not defined with other compiler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151366

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


[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/Breakpoint/Watchpoint.cpp:127
+
+bool Watchpoint::VariableWatchpointDisabler(void *baton,
+StoppointCallbackContext *context,

I think this should return an `llvm::Error` and log it at the call site. For 
every early return we know what went wrong. Same for 
`SetupVariableWatchpointDisabler`.



Comment at: lldb/source/Breakpoint/Watchpoint.cpp:140
+
+  LLDB_LOGF(log, "Watchpoint::%s called by breakpoint %" PRIu64 ".%" PRIu64,
+__FUNCTION__, break_id, break_loc_id);

Doesn't __FUNCTION__ already include `Watchpoint::`? Also I think there's a 
flag to include the function name in the log, so this is redundant. 



Comment at: lldb/source/Commands/CommandObjectWatchpoint.cpp:959
   ", variable expression='%s').\n",
   addr, (uint64_t)size, command.GetArgumentAtIndex(0));
   if (error.AsCString(nullptr))

You wouldn't need the `(uint64_t)` cast if you used formatv. This also should 
use a C++ style cast 
(https://discourse.llvm.org/t/rfc-add-preferred-casting-style-to-coding-standards/70793/4).



Comment at: lldb/source/Commands/CommandObjectWatchpoint.cpp:960-961
   addr, (uint64_t)size, command.GetArgumentAtIndex(0));
   if (error.AsCString(nullptr))
 result.AppendError(error.AsCString());
+  return result.Succeeded();

`Status::AsCString` isn't trivial so probably worth calling this one and 
storing it in a temporary variable. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151366

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


[Lldb-commits] [PATCH] D151516: [lldb][NFCI] Remove use of ConstString from UnixSignals::SignalCode

2023-05-25 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, labath, DavidSpickett.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

On llvm.org and all downstream forks that I'm aware of, SignalCodes are
always created from C string literals. They are never compared to
anything so they take up space in the ConstString StringPool for no
tangible benefit.

I've changed the type here to `const llvm::StringLiteral` instead of
using a `StringRef` or a `const char *` to express intent -- These
strings come from constant data whose lifetime is directly tied to that
of the running process (and are thus safe to store).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151516

Files:
  lldb/include/lldb/Target/UnixSignals.h
  lldb/source/Target/UnixSignals.cpp


Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -113,13 +113,14 @@
   ++m_version;
 }
 
-void UnixSignals::AddSignalCode(int signo, int code, const char *description,
+void UnixSignals::AddSignalCode(int signo, int code,
+const llvm::StringLiteral description,
 SignalCodePrintOption print_option) {
   collection::iterator signal = m_signals.find(signo);
   assert(signal != m_signals.end() &&
  "Tried to add code to signal that does not exist.");
   signal->second.m_codes.insert(
-  std::pair{code, SignalCode{ConstString(description), print_option}});
+  std::pair{code, SignalCode{description, print_option}});
   ++m_version;
 }
 
@@ -150,13 +151,13 @@
 str = pos->second.m_name.GetCString();
 
 if (code) {
-  std::map::const_iterator cpos =
+  std::map::const_iterator cpos =
   pos->second.m_codes.find(*code);
   if (cpos != pos->second.m_codes.end()) {
 const SignalCode  = cpos->second;
 str += ": ";
 if (sc.m_print_option != SignalCodePrintOption::Bounds)
-  str += sc.m_description.GetCString();
+  str += sc.m_description.str();
 
 std::stringstream strm;
 switch (sc.m_print_option) {
@@ -178,7 +179,7 @@
 strm << ", upper bound: 0x" << std::hex << *upper;
 strm << ")";
   } else
-strm << sc.m_description.GetCString();
+strm << sc.m_description.str();
 
   break;
 }
Index: lldb/include/lldb/Target/UnixSignals.h
===
--- lldb/include/lldb/Target/UnixSignals.h
+++ lldb/include/lldb/Target/UnixSignals.h
@@ -94,7 +94,7 @@
   // Instead of calling this directly, use a ADD_SIGCODE macro to get compile
   // time checks when on the native platform.
   void AddSignalCode(
-  int signo, int code, const char *description,
+  int signo, int code, const llvm::StringLiteral description,
   SignalCodePrintOption print_option = SignalCodePrintOption::None);
 
   void RemoveSignal(int signo);
@@ -127,8 +127,8 @@
   // Classes that inherit from UnixSignals can see and modify these
 
   struct SignalCode {
-ConstString m_description;
-SignalCodePrintOption m_print_option;
+const llvm::StringLiteral m_description;
+const SignalCodePrintOption m_print_option;
   };
 
   struct Signal {


Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -113,13 +113,14 @@
   ++m_version;
 }
 
-void UnixSignals::AddSignalCode(int signo, int code, const char *description,
+void UnixSignals::AddSignalCode(int signo, int code,
+const llvm::StringLiteral description,
 SignalCodePrintOption print_option) {
   collection::iterator signal = m_signals.find(signo);
   assert(signal != m_signals.end() &&
  "Tried to add code to signal that does not exist.");
   signal->second.m_codes.insert(
-  std::pair{code, SignalCode{ConstString(description), print_option}});
+  std::pair{code, SignalCode{description, print_option}});
   ++m_version;
 }
 
@@ -150,13 +151,13 @@
 str = pos->second.m_name.GetCString();
 
 if (code) {
-  std::map::const_iterator cpos =
+  std::map::const_iterator cpos =
   pos->second.m_codes.find(*code);
   if (cpos != pos->second.m_codes.end()) {
 const SignalCode  = cpos->second;
 str += ": ";
 if (sc.m_print_option != SignalCodePrintOption::Bounds)
-  str += sc.m_description.GetCString();
+  str += sc.m_description.str();
 
 std::stringstream strm;
 switch (sc.m_print_option) {
@@ -178,7 +179,7 @@
 strm << ", upper bound: 0x" << std::hex << *upper;
 strm << ")";
   } 

[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/Expression/UserExpression.cpp:211
+error.SetErrorStringWithFormatv(
+"unable to evaluate expression while the process is {0}: the process "
+"must be stopped because the expression might requires allocating "

This is intentionally lowercase to match the other error messages coming from 
`UserExpression::Evaluate`


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

https://reviews.llvm.org/D151497

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


[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 525861.
JDevlieghere added a comment.

Rephrase error message for `UserExpression::Evaluate`


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

https://reviews.llvm.org/D151497

Files:
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/test/Shell/Expr/TestExited.test


Index: lldb/test/Shell/Expr/TestExited.test
===
--- /dev/null
+++ lldb/test/Shell/Expr/TestExited.test
@@ -0,0 +1,3 @@
+# RUN: %clangxx_host %p/Inputs/call-function.cpp -g -o %t
+# RUN: %lldb %t -o 'r' -o 'expr strlen("")' | FileCheck %s
+# CHECK: error: unable to evaluate expression while the process is exited: the 
process must be stopped because the expression might requires allocating memory.
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb_private;
@@ -67,8 +68,10 @@
   // Since we might need to call allocate memory and maybe call code to make
   // the caller, we need to be stopped.
   if (process_sp->GetState() != lldb::eStateStopped) {
-error.SetErrorString("Can't make a function caller while the process is " 
- "running");
+error.SetErrorStringWithFormatv(
+"Can't make a function caller while the process is {0}: the process "
+"must be stopped to allocate memory.",
+StateAsCString(process_sp->GetState()));
 return nullptr;
   }
 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -39,6 +39,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
 #include "lldb/Utility/StreamString.h"
 
 using namespace lldb_private;
@@ -202,15 +203,18 @@
 
 return execution_results;
   }
-  // Since we might need to call allocate memory and maybe call code to make
-  // the caller, we need to be stopped.
+
+  // Since we might need to call allocate memory, we need to be stopped to run
+  // an expression.
   if (process != nullptr && process->GetState() != lldb::eStateStopped) {
-error.SetErrorString("Can't make a function caller while the process is " 
-  "running");
+error.SetErrorStringWithFormatv(
+"unable to evaluate expression while the process is {0}: the process "
+"must be stopped because the expression might requires allocating "
+"memory.",
+StateAsCString(process->GetState()));
 return execution_results;
   }
 
-
   // Explicitly force the IR interpreter to evaluate the expression when the
   // there is no process that supports running the expression for us. Don't
   // change the execution policy if we have the special top-level policy that


Index: lldb/test/Shell/Expr/TestExited.test
===
--- /dev/null
+++ lldb/test/Shell/Expr/TestExited.test
@@ -0,0 +1,3 @@
+# RUN: %clangxx_host %p/Inputs/call-function.cpp -g -o %t
+# RUN: %lldb %t -o 'r' -o 'expr strlen("")' | FileCheck %s
+# CHECK: error: unable to evaluate expression while the process is exited: the process must be stopped because the expression might requires allocating memory.
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb_private;
@@ -67,8 +68,10 @@
   // Since we might need to call allocate memory and maybe call code to make
   // the caller, we need to be stopped.
   if (process_sp->GetState() != lldb::eStateStopped) {
-error.SetErrorString("Can't make a function caller while the process is " 
- "running");
+error.SetErrorStringWithFormatv(
+"Can't make a function caller while the process is {0}: the process "
+"must be stopped to allocate memory.",
+StateAsCString(process_sp->GetState()));
 return nullptr;
   }
 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -39,6 +39,7 @@
 #include "lldb/Utility/ConstString.h"
 

[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D151497#4374080 , @bulbazord wrote:

> I think it's good to improve the error messaging but I think we can probably 
> do better. "Function caller" is specific to the internals of LLDB and isn't 
> really meaningful for many users. It's also somewhat confusing from a user's 
> perspective when the expression you're running isn't calling a function.
>
> If I were an end user who didn't know much about LLDB, I would think "I'm 
> trying to print a variable, what's this about a function?" and "Why is memory 
> allocation involved?". I would suggest changing the error message to 
> something like: "Unable to evaluate expression while the process is $STATE: 
> the process must be running and stopped to evaluate this expression".
>
> What do you think?

I very much agree that error messages should first and foremost be helpful to 
our users. In this particular patch, we have two places where we emit this 
error. In `UtilityFunction::MakeFunctionCaller` I believe the current error is 
totally appropriate. That doesn't mean that I think it should be shown to the 
user as such. I didn't look at how this function is called, but if it trips, I 
would like to see an error along the lines of:

  error: Couldn't run utility function. Can't make a function caller while the 
process is stopped: the process must be stopped to allocate memory.

On the other hand, in `UserExpression::Evaluate` I think it's totally 
appropriate to rephrase this, but at the same time I don't think we need to 
dumb this down.

  error: Unable to evaluate expression while the process is $STATE: the process 
must be stopped because the expression might requires allocating memory.

I'll update the error messages accordingly.


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

https://reviews.llvm.org/D151497

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


[Lldb-commits] [PATCH] D151392: Fix SBValue::FindValue for file static variables

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib accepted this revision.
mib added a comment.

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151392

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


[Lldb-commits] [PATCH] D151399: [lldb] Introduce FileSpec::GetComponents

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib accepted this revision.
mib added a comment.
This revision is now accepted and ready to land.

LGTM!




Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp:1241
+// We want the components in reverse order.
+std::reverse(path_parts.begin(), path_parts.end());
 const size_t path_parts_size = path_parts.size();

Cool!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151399

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


[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a subscriber: kastiglione.
mib added a comment.

In D151497#4374080 , @bulbazord wrote:

> I think it's good to improve the error messaging but I think we can probably 
> do better. "Function caller" is specific to the internals of LLDB and isn't 
> really meaningful for many users. It's also somewhat confusing from a user's 
> perspective when the expression you're running isn't calling a function. For 
> example:
>
>   alex@alangford build % ./bin/lldb ~/tmp/foo
>   (lldb) target create "/Users/alex/tmp/foo"
>   Current executable set to '/Users/alex/tmp/foo' (arm64).
>   (lldb) b main
>   Breakpoint 1: where = foo`main + 28 at foo.c:6:7, address = 
> 0x00013f68
>   (lldb) r
>   Process 44467 launched: '/Users/alex/tmp/foo' (arm64)
>   Process 44467 stopped
>   * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
>   frame #0: 0x00013f68 foo`main at foo.c:6:7
>  1#include 
>  2
>  3int g_foo = 5;
>  4
>  5int main() {
>   -> 6  int val = 7;
>  7  printf("Hello World!: %d\n", val);
>  8  return 0;
>  9}
>   (lldb) c
>   Process 44467 resuming
>   Hello World!: 7
>   Process 44467 exited with status = 0 (0x)
>   (lldb) p val
>   error: Can't make a function caller while the process is running
>
> If I were an end user who didn't know much about LLDB, I would think "I'm 
> trying to print a variable, what's this about a function?" and "Why is memory 
> allocation involved?". I would suggest changing the error message to 
> something like: "Unable to evaluate expression while the process is $STATE: 
> the process must be running and stopped to evaluate this expression".
>
> What do you think?

I do agree on rephrasing the error message to be more user-friendly. I'd also 
assume that if the process has exited, may be `dwim-print` would do `target 
variable` instead of evaluating an expression, am I right @kastiglione ?


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

https://reviews.llvm.org/D151497

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


[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c847ac4bd1b: [lldb] Disable variable watchpoints when going 
out of scope (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151366

Files:
  lldb/include/lldb/Breakpoint/Watchpoint.h
  lldb/source/Breakpoint/Watchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
  lldb/test/Shell/Watchpoint/Inputs/val.c
  lldb/test/Shell/Watchpoint/Inputs/watchpoint.in
  lldb/test/Shell/Watchpoint/LocalVariableWatchpointDisabler.test

Index: lldb/test/Shell/Watchpoint/LocalVariableWatchpointDisabler.test
===
--- /dev/null
+++ lldb/test/Shell/Watchpoint/LocalVariableWatchpointDisabler.test
@@ -0,0 +1,3 @@
+# XFAIL: system-netbsd
+# RUN: %clang_host -x c %S/Inputs/val.c -g -o %t
+# RUN: %lldb -b -s %S/Inputs/watchpoint.in %t 2>&1 | FileCheck %S/Inputs/watchpoint.in
Index: lldb/test/Shell/Watchpoint/Inputs/watchpoint.in
===
--- /dev/null
+++ lldb/test/Shell/Watchpoint/Inputs/watchpoint.in
@@ -0,0 +1,13 @@
+breakpoint set -p "Break here"
+r
+watchpoint set variable val
+watchpoint modify -c "val == 1"
+c
+# CHECK: Watchpoint 1 hit:
+# CHECK-NEXT: old value: 0
+# CHECK-NEXT: new value: 1
+# CHECK-NEXT: Process {{[0-9]+}} resuming
+# CHECK-NEXT: Process {{[0-9]+}} stopped
+# CHECK-NEXT: {{.*}} stop reason = watchpoint 1
+c
+# CHECK: Process {{[0-9]+}} exited with status = 0 (0x)
Index: lldb/test/Shell/Watchpoint/Inputs/val.c
===
--- /dev/null
+++ lldb/test/Shell/Watchpoint/Inputs/val.c
@@ -0,0 +1,7 @@
+int main() {
+  int val = 0;
+  // Break here
+  val++;
+  val++;
+  return 0;
+}
Index: lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
===
--- lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
+++ lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
@@ -1,4 +1,4 @@
-# XFAIL: system-netbsd, system-darwin
+# XFAIL: system-netbsd
 # RUN: %clang_host -x c %S/Inputs/val.c -g -o %t
 # RUN: %lldb -b -s %S/Inputs/watchpoint1.in --script-language lua %t 2>&1 | FileCheck %S/Inputs/watchpoint1.in
 # RUN: %lldb -b -s %S/Inputs/watchpoint2.in --script-language lua %t 2>&1 | FileCheck %S/Inputs/watchpoint2.in
Index: lldb/source/Commands/CommandObjectWatchpoint.cpp
===
--- lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -9,6 +9,7 @@
 #include "CommandObjectWatchpoint.h"
 #include "CommandObjectWatchpointCommand.h"
 
+#include 
 #include 
 
 #include "llvm/ADT/StringRef.h"
@@ -20,6 +21,7 @@
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandOptionArgumentTable.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/StackFrame.h"
@@ -950,27 +952,32 @@
 error.Clear();
 WatchpointSP watch_sp =
 target->CreateWatchpoint(addr, size, _type, watch_type, error);
-if (watch_sp) {
-  watch_sp->SetWatchSpec(command.GetArgumentAtIndex(0));
-  watch_sp->SetWatchVariable(true);
-  if (var_sp && var_sp->GetDeclaration().GetFile()) {
-StreamString ss;
-// True to show fullpath for declaration file.
-var_sp->GetDeclaration().DumpStopContext(, true);
-watch_sp->SetDeclInfo(std::string(ss.GetString()));
-  }
-  output_stream.Printf("Watchpoint created: ");
-  watch_sp->GetDescription(_stream, lldb::eDescriptionLevelFull);
-  output_stream.EOL();
-  result.SetStatus(eReturnStatusSuccessFinishResult);
-} else {
+if (!watch_sp) {
   result.AppendErrorWithFormat(
   "Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64
   ", variable expression='%s').\n",
   addr, (uint64_t)size, command.GetArgumentAtIndex(0));
   if (error.AsCString(nullptr))
 result.AppendError(error.AsCString());
+  return result.Succeeded();
+}
+
+watch_sp->SetWatchSpec(command.GetArgumentAtIndex(0));
+watch_sp->SetWatchVariable(true);
+if (var_sp) {
+  if (var_sp->GetDeclaration().GetFile()) {
+StreamString ss;
+// True to show fullpath for declaration file.
+var_sp->GetDeclaration().DumpStopContext(, true);
+watch_sp->SetDeclInfo(std::string(ss.GetString()));
+  }
+  if (var_sp->GetScope() == eValueTypeVariableLocal)
+watch_sp->SetupVariableWatchpointDisabler(m_exe_ctx.GetFrameSP());
 }
+output_stream.Printf("Watchpoint created: ");

[Lldb-commits] [lldb] 7c847ac - [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-25T15:07:09-07:00
New Revision: 7c847ac4bd1bd8a89c7fbb4581328fa8cb0498f1

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

LOG: [lldb] Disable variable watchpoints when going out of scope

If we use a variable watchpoint with a condition using a scope variable,
if we go out-of-scope, the watpoint remains active which can the
expression evaluator to fail to parse the watchpoint condition (because
of the missing varible bindings).

This was discovered after `watchpoint_callback.test` started failing on
the green dragon bot.

This patch should address that issue by setting an internal breakpoint
on the return addresss of the current frame when creating a variable
watchpoint. The breakpoint has a callback that will disable the watchpoint
if the the breakpoint execution context matches the watchpoint execution
context.

This is only enabled for local variables.

This patch also re-enables the failing test following e1086384e584.

rdar://109574319

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

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/test/Shell/Watchpoint/Inputs/val.c
lldb/test/Shell/Watchpoint/Inputs/watchpoint.in
lldb/test/Shell/Watchpoint/LocalVariableWatchpointDisabler.test

Modified: 
lldb/include/lldb/Breakpoint/Watchpoint.h
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 037be4539066c..3ee75516debe8 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -90,6 +90,40 @@ class Watchpoint : public 
std::enable_shared_from_this,
   void SetWatchVariable(bool val);
   bool CaptureWatchedValue(const ExecutionContext _ctx);
 
+  /// \struct WatchpointVariableContext
+  /// \brief Represents the context of a watchpoint variable.
+  ///
+  /// This struct encapsulates the information related to a watchpoint 
variable,
+  /// including the watch ID and the execution context in which it is being
+  /// used. This struct is passed as a Baton to the \b
+  /// VariableWatchpointDisabler breakpoint callback.
+  struct WatchpointVariableContext {
+/// \brief Constructor for WatchpointVariableContext.
+/// \param watch_id The ID of the watchpoint.
+/// \param exe_ctx The execution context associated with the watchpoint.
+WatchpointVariableContext(lldb::watch_id_t watch_id,
+  ExecutionContext exe_ctx)
+: watch_id(watch_id), exe_ctx(exe_ctx) {}
+
+lldb::watch_id_t watch_id; ///< The ID of the watchpoint.
+ExecutionContext
+exe_ctx; ///< The execution context associated with the watchpoint.
+  };
+
+  class WatchpointVariableBaton : public TypedBaton 
{
+  public:
+WatchpointVariableBaton(std::unique_ptr Data)
+: TypedBaton(std::move(Data)) {}
+  };
+
+  bool SetupVariableWatchpointDisabler(lldb::StackFrameSP frame_sp) const;
+
+  /// Callback routine to disable the watchpoint set on a local variable when
+  ///  it goes out of scope.
+  static bool VariableWatchpointDisabler(
+  void *baton, lldb_private::StoppointCallbackContext *context,
+  lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+
   void GetDescription(Stream *s, lldb::DescriptionLevel level);
   void Dump(Stream *s) const override;
   void DumpSnapshots(Stream *s, const char *prefix = nullptr) const;

diff  --git a/lldb/source/Breakpoint/Watchpoint.cpp 
b/lldb/source/Breakpoint/Watchpoint.cpp
index d8b8bd505db95..fa95d6db6cc5e 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -83,6 +83,94 @@ void Watchpoint::SetCallback(WatchpointHitCallback callback,
   SendWatchpointChangedEvent(eWatchpointEventTypeCommandChanged);
 }
 
+bool Watchpoint::SetupVariableWatchpointDisabler(StackFrameSP frame_sp) const {
+  if (!frame_sp)
+return false;
+
+  ThreadSP thread_sp = frame_sp->GetThread();
+  if (!thread_sp)
+return false;
+
+  uint32_t return_frame_index =
+  thread_sp->GetSelectedFrameIndex(DoNoSelectMostRelevantFrame) + 1;
+  if (return_frame_index >= LLDB_INVALID_FRAME_ID)
+return false;
+
+  StackFrameSP return_frame_sp(
+  thread_sp->GetStackFrameAtIndex(return_frame_index));
+  if (!return_frame_sp)
+return false;
+
+  ExecutionContext exe_ctx(return_frame_sp);
+  TargetSP target_sp = exe_ctx.GetTargetSP();
+  if (!target_sp)
+return false;
+
+  Address return_address(return_frame_sp->GetFrameCodeAddress());
+  lldb::addr_t return_addr = return_address.GetLoadAddress(target_sp.get());
+  if (return_addr == 

[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D151366#4372731 , @aprantl wrote:

>> @aprantl Do you know if we can detect the end of the scope ? I'm not sure 
>> it's possible currently ... But even if we could do it, that wouldn't cover 
>> the following case:
>
> When setting a variable watchpoint, you would have to store the scope the 
> variable is in, and then ignore all hits that are (1) on the same thread but 
> (2) where the scope is not any of the lexical scopes in any of the stack 
> frames. Because you still want to find modifications in child frames or on 
> other threads.

As discussed offline, watchpoints still have many shortcomings that can't be 
addressed all at once, so I'll land this patch and document the various issues 
discussed here so hopefully we can find a solution for those.


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

https://reviews.llvm.org/D151366

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


[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

2023-05-25 Thread Alex Langford via Phabricator via lldb-commits
bulbazord requested changes to this revision.
bulbazord added a comment.
This revision now requires changes to proceed.

I think it's good to improve the error messaging but I think we can probably do 
better. "Function caller" is specific to the internals of LLDB and isn't really 
meaningful for many users. It's also somewhat confusing from a user's 
perspective when the expression you're running isn't calling a function. For 
example:

  alex@alangford build % ./bin/lldb ~/tmp/foo
  (lldb) target create "/Users/alex/tmp/foo"
  Current executable set to '/Users/alex/tmp/foo' (arm64).
  (lldb) b main
  Breakpoint 1: where = foo`main + 28 at foo.c:6:7, address = 0x00013f68
  (lldb) r
  Process 44467 launched: '/Users/alex/tmp/foo' (arm64)
  Process 44467 stopped
  * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  frame #0: 0x00013f68 foo`main at foo.c:6:7
 1#include 
 2
 3int g_foo = 5;
 4
 5int main() {
  -> 6  int val = 7;
 7  printf("Hello World!: %d\n", val);
 8  return 0;
 9}
  (lldb) c
  Process 44467 resuming
  Hello World!: 7
  Process 44467 exited with status = 0 (0x)
  (lldb) p val
  error: Can't make a function caller while the process is running

If I were an end user who didn't know much about LLDB, I would think "I'm 
trying to print a variable, what's this about a function?" and "Why is memory 
allocation involved?". I would suggest changing the error message to something 
like: "Unable to evaluate expression while the process is $STATE: the process 
must be running and stopped to evaluate this expression".

What do you think?


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

https://reviews.llvm.org/D151497

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


[Lldb-commits] [PATCH] D151501: [LLDB] Explicitly declare constructor in `PersistentExpressionState`

2023-05-25 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.
Herald added subscribers: Michael137, JDevlieghere.

thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151501

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


[Lldb-commits] [PATCH] D151501: [LLDB] Explicitly declare constructor in `PersistentExpressionState`

2023-05-25 Thread Laszlo Kindrat via Phabricator via lldb-commits
laszlokindrat created this revision.
laszlokindrat added reviewers: rriddle, bzcheeseman, wallace.
Herald added a project: All.
laszlokindrat requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

It seems that when trying to link the lldb library explicitly, the inlined 
default constructor cannot find the vtable for the class. This patch fixes this 
by explicitly declaring a default constructor in `PersistentExpressionState`, 
and providing the definition in the source file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151501

Files:
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/source/Expression/ExpressionVariable.cpp


Index: lldb/source/Expression/ExpressionVariable.cpp
===
--- lldb/source/Expression/ExpressionVariable.cpp
+++ lldb/source/Expression/ExpressionVariable.cpp
@@ -34,6 +34,8 @@
 
 char PersistentExpressionState::ID;
 
+PersistentExpressionState::PersistentExpressionState() = default;
+
 PersistentExpressionState::~PersistentExpressionState() = default;
 
 lldb::addr_t PersistentExpressionState::LookupSymbol(ConstString name) {
Index: lldb/include/lldb/Expression/ExpressionVariable.h
===
--- lldb/include/lldb/Expression/ExpressionVariable.h
+++ lldb/include/lldb/Expression/ExpressionVariable.h
@@ -207,6 +207,8 @@
   /// LLVM RTTI support
   static char ID;
 
+  PersistentExpressionState();
+
   virtual ~PersistentExpressionState();
 
   virtual lldb::ExpressionVariableSP


Index: lldb/source/Expression/ExpressionVariable.cpp
===
--- lldb/source/Expression/ExpressionVariable.cpp
+++ lldb/source/Expression/ExpressionVariable.cpp
@@ -34,6 +34,8 @@
 
 char PersistentExpressionState::ID;
 
+PersistentExpressionState::PersistentExpressionState() = default;
+
 PersistentExpressionState::~PersistentExpressionState() = default;
 
 lldb::addr_t PersistentExpressionState::LookupSymbol(ConstString name) {
Index: lldb/include/lldb/Expression/ExpressionVariable.h
===
--- lldb/include/lldb/Expression/ExpressionVariable.h
+++ lldb/include/lldb/Expression/ExpressionVariable.h
@@ -207,6 +207,8 @@
   /// LLVM RTTI support
   static char ID;
 
+  PersistentExpressionState();
+
   virtual ~PersistentExpressionState();
 
   virtual lldb::ExpressionVariableSP
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, aprantl, bulbazord, mib.
Herald added a project: All.
JDevlieghere requested review of this revision.

When trying to run an expression after a process has existed, you currently are 
shown the following error message:

  (lldb) p strlen("")
  error: Can't make a function caller while the process is running

This error is wrong and pretty uninformative. After this patch, the following 
error message is shown:

  (lldb) p strlen("")
  error: Can't make a function caller while the process is exited: the process 
must be stopped to allocate memory.

rdar://109731325


https://reviews.llvm.org/D151497

Files:
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/test/Shell/Expr/TestFunctionCaller.test


Index: lldb/test/Shell/Expr/TestFunctionCaller.test
===
--- /dev/null
+++ lldb/test/Shell/Expr/TestFunctionCaller.test
@@ -0,0 +1,3 @@
+# RUN: %clangxx_host %p/Inputs/call-function.cpp -g -o %t
+# RUN: %lldb %t -o 'r' -o 'expr strlen("")' | FileCheck %s
+# CHECK: error: Can't make a function caller while the process is exited: the 
process must be stopped to allocate memory.
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb_private;
@@ -67,8 +68,10 @@
   // Since we might need to call allocate memory and maybe call code to make
   // the caller, we need to be stopped.
   if (process_sp->GetState() != lldb::eStateStopped) {
-error.SetErrorString("Can't make a function caller while the process is " 
- "running");
+error.SetErrorStringWithFormatv(
+"Can't make a function caller while the process is {0}: the process "
+"must be stopped to allocate memory.",
+StateAsCString(process_sp->GetState()));
 return nullptr;
   }
 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -39,6 +39,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
 #include "lldb/Utility/StreamString.h"
 
 using namespace lldb_private;
@@ -205,8 +206,10 @@
   // Since we might need to call allocate memory and maybe call code to make
   // the caller, we need to be stopped.
   if (process != nullptr && process->GetState() != lldb::eStateStopped) {
-error.SetErrorString("Can't make a function caller while the process is " 
-  "running");
+error.SetErrorStringWithFormatv(
+"Can't make a function caller while the process is {0}: the process "
+"must be stopped to allocate memory.",
+StateAsCString(process->GetState()));
 return execution_results;
   }
 


Index: lldb/test/Shell/Expr/TestFunctionCaller.test
===
--- /dev/null
+++ lldb/test/Shell/Expr/TestFunctionCaller.test
@@ -0,0 +1,3 @@
+# RUN: %clangxx_host %p/Inputs/call-function.cpp -g -o %t
+# RUN: %lldb %t -o 'r' -o 'expr strlen("")' | FileCheck %s
+# CHECK: error: Can't make a function caller while the process is exited: the process must be stopped to allocate memory.
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb_private;
@@ -67,8 +68,10 @@
   // Since we might need to call allocate memory and maybe call code to make
   // the caller, we need to be stopped.
   if (process_sp->GetState() != lldb::eStateStopped) {
-error.SetErrorString("Can't make a function caller while the process is " 
- "running");
+error.SetErrorStringWithFormatv(
+"Can't make a function caller while the process is {0}: the process "
+"must be stopped to allocate memory.",
+StateAsCString(process_sp->GetState()));
 return nullptr;
   }
 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -39,6 +39,7 @@
 #include "lldb/Utility/ConstString.h"
 #include 

[Lldb-commits] [lldb] 0e90ac9 - Re-revert "[lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module"

2023-05-25 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-25T14:00:11-07:00
New Revision: 0e90ac9c94d716fa78e0c86a6c7f6ff24decf7fe

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

LOG: Re-revert "[lldb] Move PassthroughScriptedProcess to 
`lldb.scripted_process` module"

This reverts commit 429e74839506ea8ba962d24647264ed81f680bbf since it
didn't address the test failures on GreenDragon.

This patch will mark the tests as expected to fail until I can reproduce
the issue and find a solution.

Signed-off-by: Med Ismail Bennani 

Added: 


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

lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py

lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py

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

Removed: 




diff  --git a/lldb/examples/python/scripted_process/scripted_process.py 
b/lldb/examples/python/scripted_process/scripted_process.py
index b756cd027866..d74ef02dec85 100644
--- a/lldb/examples/python/scripted_process/scripted_process.py
+++ b/lldb/examples/python/scripted_process/scripted_process.py
@@ -1,6 +1,7 @@
 from abc import ABCMeta, abstractmethod
 
 import lldb
+import json, struct, signal
 
 
 class ScriptedProcess(metaclass=ABCMeta):
@@ -382,6 +383,754 @@ def get_extended_info(self):
 return self.extended_info
 
 
+class PassthroughScriptedProcess(ScriptedProcess):
+driving_target = None
+driving_process = None
+
+def __init__(self, exe_ctx, args, launched_driving_process=True):
+super().__init__(exe_ctx, args)
+
+self.driving_target = None
+self.driving_process = None
+
+self.driving_target_idx = args.GetValueForKey("driving_target_idx")
+if self.driving_target_idx and self.driving_target_idx.IsValid():
+idx = self.driving_target_idx.GetUnsignedIntegerValue(42)
+self.driving_target = 
self.target.GetDebugger().GetTargetAtIndex(idx)
+
+if launched_driving_process:
+self.driving_process = self.driving_target.GetProcess()
+for driving_thread in self.driving_process:
+structured_data = lldb.SBStructuredData()
+structured_data.SetFromJSON(
+json.dumps(
+{
+"driving_target_idx": idx,
+"thread_idx": driving_thread.GetIndexID(),
+}
+)
+)
+
+self.threads[
+driving_thread.GetThreadID()
+] = PassthroughScriptedThread(self, structured_data)
+
+for module in self.driving_target.modules:
+path = module.file.fullpath
+load_addr = 
module.GetObjectFileHeaderAddress().GetLoadAddress(
+self.driving_target
+)
+self.loaded_images.append({"path": path, "load_addr": 
load_addr})
+
+def get_memory_region_containing_address(self, addr):
+mem_region = lldb.SBMemoryRegionInfo()
+error = self.driving_process.GetMemoryRegionInfo(addr, mem_region)
+if error.Fail():
+return None
+return mem_region
+
+def read_memory_at_address(self, addr, size, error):
+data = lldb.SBData()
+bytes_read = self.driving_process.ReadMemory(addr, size, error)
+
+if error.Fail():
+return data
+
+data.SetDataWithOwnership(
+error,
+bytes_read,
+self.driving_target.GetByteOrder(),
+self.driving_target.GetAddressByteSize(),
+)
+
+return data
+
+def write_memory_at_address(self, addr, data, error):
+return self.driving_process.WriteMemory(
+addr, bytearray(data.uint8.all()), error
+)
+
+def get_process_id(self):
+return self.driving_process.GetProcessID()
+
+def is_alive(self):
+return True
+
+def get_scripted_thread_plugin(self):
+return 
f"{PassthroughScriptedThread.__module__}.{PassthroughScriptedThread.__name__}"
+
+
+class PassthroughScriptedThread(ScriptedThread):
+def __init__(self, process, args):
+super().__init__(process, args)
+driving_target_idx = args.GetValueForKey("driving_target_idx")
+thread_idx = args.GetValueForKey("thread_idx")
+
+# TODO: Change to Walrus operator (:=) with oneline if assignment
+# Requires python 3.8
+val = thread_idx.GetUnsignedIntegerValue()
+if val is not None:
+self.idx = val
+
+  

[Lldb-commits] [PATCH] D151460: [NFC][Py Reformat] Reformat python files in lldb

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2238dcc39358: [NFC][Py Reformat] Reformat python files in 
lldb (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D151460?vs=525647=525759#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151460

Files:
  lldb/docs/_lldb/__init__.py
  lldb/docs/conf.py
  lldb/examples/customization/bin-utils/binutils.py
  lldb/examples/customization/import-python/importcmd.py
  lldb/examples/customization/pwd-cd-and-system/utils.py
  lldb/examples/darwin/heap_find/heap.py
  lldb/examples/python/armv7_cortex_m_target_defintion.py
  lldb/examples/python/bsd.py
  lldb/examples/python/cmdtemplate.py
  lldb/examples/python/crashlog.py
  lldb/examples/python/delta.py
  lldb/examples/python/diagnose_nsstring.py
  lldb/examples/python/diagnose_unwind.py
  lldb/examples/python/dict_utils.py
  lldb/examples/python/disasm-stress-test.py
  lldb/examples/python/disasm.py
  lldb/examples/python/disassembly_mode.py
  lldb/examples/python/file_extract.py
  lldb/examples/python/gdb_disassemble.py
  lldb/examples/python/gdbremote.py
  lldb/examples/python/globals.py
  lldb/examples/python/in_call_stack.py
  lldb/examples/python/jump.py
  lldb/examples/python/lldb_module_utils.py
  lldb/examples/python/lldbtk.py
  lldb/examples/python/mach_o.py
  lldb/examples/python/memory.py
  lldb/examples/python/operating_system.py
  lldb/examples/python/performance.py
  lldb/examples/python/process_events.py
  lldb/examples/python/pytracer.py
  lldb/examples/python/sbvalue.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/examples/python/scripted_process/scripted_platform.py
  lldb/examples/python/scripted_process/scripted_process.py
  lldb/examples/python/scripted_step.py
  lldb/examples/python/shadow.py
  lldb/examples/python/sources.py
  lldb/examples/python/stacks.py
  lldb/examples/python/step_and_print.py
  lldb/examples/python/symbolication.py
  lldb/examples/python/types.py
  lldb/examples/python/x86_64_linux_target_definition.py
  lldb/examples/python/x86_64_qemu_target_definition.py
  lldb/examples/python/x86_64_target_definition.py
  lldb/examples/scripting/tree_utils.py
  lldb/examples/summaries/cocoa/CFArray.py
  lldb/examples/summaries/cocoa/CFBag.py
  lldb/examples/summaries/cocoa/CFBinaryHeap.py
  lldb/examples/summaries/cocoa/CFBitVector.py
  lldb/examples/summaries/cocoa/CFDictionary.py
  lldb/examples/summaries/cocoa/CFString.py
  lldb/examples/summaries/cocoa/Class.py
  lldb/examples/summaries/cocoa/Logger.py
  lldb/examples/summaries/cocoa/NSBundle.py
  lldb/examples/summaries/cocoa/NSData.py
  lldb/examples/summaries/cocoa/NSDate.py
  lldb/examples/summaries/cocoa/NSException.py
  lldb/examples/summaries/cocoa/NSIndexSet.py
  lldb/examples/summaries/cocoa/NSMachPort.py
  lldb/examples/summaries/cocoa/NSNotification.py
  lldb/examples/summaries/cocoa/NSNumber.py
  lldb/examples/summaries/cocoa/NSSet.py
  lldb/examples/summaries/cocoa/NSURL.py
  lldb/examples/summaries/cocoa/Selector.py
  lldb/examples/summaries/cocoa/attrib_fromdict.py
  lldb/examples/summaries/cocoa/cache.py
  lldb/examples/summaries/cocoa/metrics.py
  lldb/examples/summaries/cocoa/objc_runtime.py
  lldb/examples/summaries/pysummary.py
  lldb/examples/summaries/sp_cp.py
  lldb/examples/summaries/synth.py
  lldb/examples/summaries/unicode_strings.py
  lldb/examples/synthetic/bitfield/example.py
  lldb/examples/synthetic/gnu_libstdcpp.py
  lldb/examples/synthetic/libcxx.py
  lldb/examples/synthetic/recognizer_function/example.py
  lldb/examples/synthetic/unordered_multi.py
  lldb/packages/Python/lldbsuite/__init__.py
  lldb/packages/Python/lldbsuite/support/encoded_file.py
  lldb/packages/Python/lldbsuite/support/funcutils.py
  lldb/packages/Python/lldbsuite/support/gmodules.py
  lldb/packages/Python/lldbsuite/support/seven.py
  lldb/packages/Python/lldbsuite/test/bench.py
  lldb/packages/Python/lldbsuite/test/builders/__init__.py
  lldb/packages/Python/lldbsuite/test/builders/builder.py
  lldb/packages/Python/lldbsuite/test/builders/darwin.py
  lldb/packages/Python/lldbsuite/test/concurrent_base.py
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/decorators.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/dotest_args.py
  lldb/packages/Python/lldbsuite/test/gdbclientutils.py
  lldb/packages/Python/lldbsuite/test/lldb_pylint_helper.py
  lldb/packages/Python/lldbsuite/test/lldbbench.py
  lldb/packages/Python/lldbsuite/test/lldbdwarf.py
  lldb/packages/Python/lldbsuite/test/lldbgdbclient.py
  lldb/packages/Python/lldbsuite/test/lldbinline.py
  lldb/packages/Python/lldbsuite/test/lldbpexpect.py
  lldb/packages/Python/lldbsuite/test/lldbplatform.py
  lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
  

[Lldb-commits] [PATCH] D151399: [lldb] Introduce FileSpec::GetComponents

2023-05-25 Thread Alex Langford via Phabricator via lldb-commits
bulbazord updated this revision to Diff 525757.
bulbazord added a comment.

Convert return type to `std::vector`
Actually fix code so this thing compiles correctly


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151399

Files:
  lldb/include/lldb/Utility/FileSpec.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Utility/FileSpec.cpp
  lldb/unittests/Utility/FileSpecTest.cpp

Index: lldb/unittests/Utility/FileSpecTest.cpp
===
--- lldb/unittests/Utility/FileSpecTest.cpp
+++ lldb/unittests/Utility/FileSpecTest.cpp
@@ -504,3 +504,33 @@
   EXPECT_FALSE(win_noext.IsSourceImplementationFile());
   EXPECT_FALSE(exe.IsSourceImplementationFile());
 }
+
+TEST(FileSpecTest, TestGetComponents) {
+  std::pair> PosixTests[] = {
+  {"/", {}},
+  {"/foo", {"foo"}},
+  {"/foo/", {"foo"}},
+  {"/foo/bar", {"foo", "bar"}},
+  {"/llvm-project/lldb/unittests/Utility/FileSpecTest.cpp",
+   {"llvm-project", "lldb", "unittests", "Utility", "FileSpecTest.cpp"}},
+  };
+
+  for (const auto  : PosixTests) {
+FileSpec file_spec = PosixSpec(pair.first);
+EXPECT_EQ(file_spec.GetComponents(), pair.second);
+  }
+
+  std::pair> WindowsTests[] = {
+  {"C:\\", {"C:"}},
+  {"C:\\Windows\\", {"C:", "Windows"}},
+  {"C:\\Windows\\System32", {"C:", "Windows", "System32"}},
+  {"C:\\llvm-project\\lldb\\unittests\\Utility\\FileSpecTest.cpp",
+   {"C:", "llvm-project", "lldb", "unittests", "Utility",
+"FileSpecTest.cpp"}},
+  };
+
+  for (const auto  : WindowsTests) {
+FileSpec file_spec = WindowsSpec(pair.first);
+EXPECT_EQ(file_spec.GetComponents(), pair.second);
+  }
+}
Index: lldb/source/Utility/FileSpec.cpp
===
--- lldb/source/Utility/FileSpec.cpp
+++ lldb/source/Utility/FileSpec.cpp
@@ -463,6 +463,26 @@
   }
   return false;
 }
+
+std::vector FileSpec::GetComponents() const {
+  std::vector components;
+
+  auto dir_begin = llvm::sys::path::begin(m_directory.GetStringRef(), m_style);
+  auto dir_end = llvm::sys::path::end(m_directory.GetStringRef());
+
+  for (auto iter = dir_begin; iter != dir_end; ++iter) {
+if (*iter == "/" || *iter == ".")
+  continue;
+
+components.push_back(*iter);
+  }
+
+  if (!m_filename.IsEmpty() && m_filename != "/" && m_filename != ".")
+components.push_back(m_filename.GetStringRef());
+
+  return components;
+}
+
 /// Returns true if the filespec represents an implementation source
 /// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
 /// extension).
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1236,13 +1236,9 @@
 // "UIFoundation" and "UIFoundation.framework" -- most likely the latter
 // will be the one we find there.
 
-FileSpec platform_pull_upart(platform_file);
-std::vector path_parts;
-path_parts.push_back(platform_pull_upart.GetFilename().AsCString());
-while (platform_pull_upart.RemoveLastPathComponent()) {
-  ConstString part = platform_pull_upart.GetFilename();
-  path_parts.push_back(part.AsCString());
-}
+std::vector path_parts = platform_file.GetComponents();
+// We want the components in reverse order.
+std::reverse(path_parts.begin(), path_parts.end());
 const size_t path_parts_size = path_parts.size();
 
 size_t num_module_search_paths = module_search_paths_ptr->GetSize();
Index: lldb/include/lldb/Utility/FileSpec.h
===
--- lldb/include/lldb/Utility/FileSpec.h
+++ lldb/include/lldb/Utility/FileSpec.h
@@ -408,6 +408,18 @@
   /// A boolean value indicating whether the path was updated.
   bool RemoveLastPathComponent();
 
+  /// Gets the components of the FileSpec's path.
+  /// For example, given the path:
+  ///   /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation
+  ///
+  /// This function returns:
+  ///   {"System", "Library", "PrivateFrameworks", "UIFoundation.framework",
+  ///   "UIFoundation"}
+  /// \return
+  ///   A std::vector of llvm::StringRefs for each path component.
+  ///   The lifetime of the StringRefs is tied to the lifetime of the FileSpec.
+  std::vector GetComponents() const;
+
 protected:
   // Convenience method for setting the file without changing the style.
   void SetFile(llvm::StringRef path);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151451: [lldb][nfc] Refactor methods with out parameter

2023-05-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG346afb857228: [lldb][nfc] Refactor methods with out 
parameter (authored by fdeazeve).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151451

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -840,9 +840,9 @@
   if (!dwarf_ast)
 return nullptr;
 
-  DWARFRangeList ranges;
-  if (die.GetDIE()->GetAttributeAddressRanges(die.GetCU(), ranges,
-  /*check_hi_lo_pc=*/true) == 0)
+  DWARFRangeList ranges = die.GetDIE()->GetAttributeAddressRanges(
+  die.GetCU(), /*check_hi_lo_pc=*/true);
+  if (ranges.IsEmpty())
 return nullptr;
 
   // Union of all ranges in the function DIE (if the function is
@@ -3208,10 +3208,9 @@
   DWARFDIE function_die = GetDIE(sc.function->GetID());
 
   dw_addr_t func_lo_pc = LLDB_INVALID_ADDRESS;
-  DWARFRangeList ranges;
-  if (function_die.GetDIE()->GetAttributeAddressRanges(
-  function_die.GetCU(), ranges,
-  /*check_hi_lo_pc=*/true))
+  DWARFRangeList ranges = function_die.GetDIE()->GetAttributeAddressRanges(
+  function_die.GetCU(), /*check_hi_lo_pc=*/true);
+  if (!ranges.IsEmpty())
 func_lo_pc = ranges.GetMinRangeBase(0);
   if (func_lo_pc != LLDB_INVALID_ADDRESS) {
 const size_t num_variables =
@@ -4282,4 +4281,3 @@
 args.insert({comp_unit, Args(flags)});
   }
 }
-
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -94,8 +94,8 @@
   uint64_t fail_value,
   bool check_specification_or_abstract_origin = false) const;
 
-  size_t GetAttributeAddressRanges(
-  DWARFUnit *cu, DWARFRangeList , bool check_hi_lo_pc,
+  DWARFRangeList GetAttributeAddressRanges(
+  DWARFUnit *cu, bool check_hi_lo_pc,
   bool check_specification_or_abstract_origin = false) const;
 
   const char *GetName(const DWARFUnit *cu) const;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -636,15 +636,16 @@
   return false;
 }
 
-size_t DWARFDebugInfoEntry::GetAttributeAddressRanges(
-DWARFUnit *cu, DWARFRangeList , bool check_hi_lo_pc,
+DWARFRangeList DWARFDebugInfoEntry::GetAttributeAddressRanges(
+DWARFUnit *cu, bool check_hi_lo_pc,
 bool check_specification_or_abstract_origin) const {
-  ranges.Clear();
 
   DWARFFormValue form_value;
-  if (GetAttributeValue(cu, DW_AT_ranges, form_value)) {
-ranges = GetRangesOrReportError(*cu, *this, form_value);
-  } else if (check_hi_lo_pc) {
+  if (GetAttributeValue(cu, DW_AT_ranges, form_value))
+return GetRangesOrReportError(*cu, *this, form_value);
+
+  DWARFRangeList ranges;
+  if (check_hi_lo_pc) {
 dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
 dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
 if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS,
@@ -653,7 +654,7 @@
 ranges.Append(DWARFRangeList::Entry(lo_pc, hi_pc - lo_pc));
 }
   }
-  return ranges.GetSize();
+  return ranges;
 }
 
 // GetName
@@ -716,9 +717,8 @@
 DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
   if (m_tag) {
 if (m_tag == DW_TAG_subprogram) {
-  DWARFRangeList ranges;
-  GetAttributeAddressRanges(cu, ranges,
-/*check_hi_lo_pc=*/true);
+  DWARFRangeList ranges =
+  GetAttributeAddressRanges(cu, /*check_hi_lo_pc=*/true);
   for (const auto  : ranges) {
 debug_aranges->AppendRange(GetOffset(), r.GetRangeBase(),
r.GetRangeEnd());
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -168,10 +168,9 @@
   }
 
   if (match_addr_range) {
-DWARFRangeList ranges;
-if (m_die->GetAttributeAddressRanges(m_cu, ranges,
- /*check_hi_lo_pc=*/true) &&
-

[Lldb-commits] [lldb] 346afb8 - [lldb][nfc] Refactor methods with out parameter

2023-05-25 Thread Felipe de Azevedo Piovezan via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2023-05-25T13:38:35-04:00
New Revision: 346afb8572280292139c22a00f80afbbfdb509f6

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

LOG: [lldb][nfc] Refactor methods with out parameter

Currently, the method `GetAttributeAddressRanges` takes a DWARFRangeList as a
parameter, just to immediately clear it. The method also returns the size of
this list. Such an API was obfuscating the intent of the call sites (it's not
clear from the method name what it returns) and it was obfuscating redundant
checks on the size of the list.

This commit refactors the method to return the list and to also make the call
sites use the more explicit `IsEmpty` method.

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index dbe86c6ccb9ce..f839a59bf6c39 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -40,18 +40,14 @@ void DWARFCompileUnit::BuildAddressRangeTable(
 
   const dw_offset_t cu_offset = GetOffset();
   if (die) {
-DWARFRangeList ranges;
-const size_t num_ranges =
-die->GetAttributeAddressRanges(this, ranges, /*check_hi_lo_pc=*/true);
-if (num_ranges > 0) {
-  for (size_t i = 0; i < num_ranges; ++i) {
-const DWARFRangeList::Entry  = ranges.GetEntryRef(i);
-debug_aranges->AppendRange(cu_offset, range.GetRangeBase(),
-   range.GetRangeEnd());
-  }
+DWARFRangeList ranges =
+die->GetAttributeAddressRanges(this, /*check_hi_lo_pc=*/true);
+for (const DWARFRangeList::Entry  : ranges)
+  debug_aranges->AppendRange(cu_offset, range.GetRangeBase(),
+ range.GetRangeEnd());
 
+if (!ranges.IsEmpty())
   return;
-}
   }
 
   if (debug_aranges->GetNumRanges() == num_debug_aranges) {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 65fab503deb28..b31c5dcac9185 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -168,10 +168,9 @@ DWARFDIE::LookupDeepestBlock(lldb::addr_t address) const {
   }
 
   if (match_addr_range) {
-DWARFRangeList ranges;
-if (m_die->GetAttributeAddressRanges(m_cu, ranges,
- /*check_hi_lo_pc=*/true) &&
-ranges.FindEntryThatContains(address)) {
+DWARFRangeList ranges =
+m_die->GetAttributeAddressRanges(m_cu, /*check_hi_lo_pc=*/true);
+if (ranges.FindEntryThatContains(address)) {
   check_children = true;
   switch (Tag()) {
   default:

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index a929046ca14aa..f26fb2f4c9a4d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -636,15 +636,16 @@ bool DWARFDebugInfoEntry::GetAttributeAddressRange(
   return false;
 }
 
-size_t DWARFDebugInfoEntry::GetAttributeAddressRanges(
-DWARFUnit *cu, DWARFRangeList , bool check_hi_lo_pc,
+DWARFRangeList DWARFDebugInfoEntry::GetAttributeAddressRanges(
+DWARFUnit *cu, bool check_hi_lo_pc,
 bool check_specification_or_abstract_origin) const {
-  ranges.Clear();
 
   DWARFFormValue form_value;
-  if (GetAttributeValue(cu, DW_AT_ranges, form_value)) {
-ranges = GetRangesOrReportError(*cu, *this, form_value);
-  } else if (check_hi_lo_pc) {
+  if (GetAttributeValue(cu, DW_AT_ranges, form_value))
+return GetRangesOrReportError(*cu, *this, form_value);
+
+  DWARFRangeList ranges;
+  if (check_hi_lo_pc) {
 dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
 dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
 if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS,
@@ -653,7 +654,7 @@ size_t DWARFDebugInfoEntry::GetAttributeAddressRanges(
 ranges.Append(DWARFRangeList::Entry(lo_pc, hi_pc - lo_pc));
 }
   }
-  return ranges.GetSize();
+  return ranges;
 }
 
 // GetName
@@ -716,9 +717,8 @@ void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
 DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
   if (m_tag) {
 if (m_tag == 

[Lldb-commits] [PATCH] D151451: [lldb][nfc] Refactor methods with out parameter

2023-05-25 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.

Thanks for doing this work!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151451

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


[Lldb-commits] [PATCH] D151399: [lldb] Introduce FileSpec::GetComponents

2023-05-25 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added inline comments.



Comment at: lldb/include/lldb/Utility/FileSpec.h:420
+  ///   A std::vector of std::strings for each path component.
+  std::vector GetComponents() const;
+

JDevlieghere wrote:
> bulbazord wrote:
> > JDevlieghere wrote:
> > > I'm surprised this returns a vector of `std::string`s and not 
> > > `llvm::StringRef`s. I would expect all the components to be part of the 
> > > FileSpec's stored path. Even with the file and directory stored as 
> > > separate `ConstString`s, that should be possible?
> > Yes, it is possible to do `std::vector` here, especially 
> > because they would be backed by `ConstString`s which live forever. I chose 
> > `std::string` here because of the possibility that we one day no longer use 
> > `ConstString` to store the path, in which case the vector's StringRefs 
> > would only be valid for the lifetime of the FileSpec (or until it gets 
> > mutated).
> > 
> > Maybe I'm thinking too far ahead or planning for a future that will never 
> > come though. What do you think?
> I think it's reasonable to expect the lifetime of things handed out by a 
> FileSpec match the lifetime of the FileSpec, but that depends on how we want 
> to deal with mutability. If we want to be able to mutate a FileSpec in place, 
> then you're right, these things need to have their own lifetime. 
I'd prefer to move towards FileSpec being immutable (or as close as possible), 
so I'll update this and change it to `StringRef. Thanks for the feedback!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151399

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


[Lldb-commits] [PATCH] D151451: [lldb][nfc] Refactor methods with out parameter

2023-05-25 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


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151451

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


[Lldb-commits] [PATCH] D151460: [NFC][Py Reformat] Reformat python files in lldb

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D151460#4372779 , @thieta wrote:

> In D151460#4372763 , @mib wrote:
>
>> Can you add this commit hash to the `.git-blame-ignore-revs` file so it 
>> doesn't show up in the git history
>
> Yeah that should be done. But has to be done after arc land anyway.

Yup, but as Tobias pointed it needs to be committed first in order to get the 
hash.


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

https://reviews.llvm.org/D151460

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


[Lldb-commits] [PATCH] D151425: [lldb][nfc] Place comment in the right place

2023-05-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52b03b63972a: [lldb][nfc] Place comment in the right place 
(authored by fdeazeve).

Changed prior to commit:
  https://reviews.llvm.org/D151425?vs=525544=525679#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151425

Files:
  lldb/include/lldb/Utility/RangeMap.h


Index: lldb/include/lldb/Utility/RangeMap.h
===
--- lldb/include/lldb/Utility/RangeMap.h
+++ lldb/include/lldb/Utility/RangeMap.h
@@ -42,9 +42,9 @@
 size = 0;
   }
 
-  // Set the start value for the range, and keep the same size
   BaseType GetRangeBase() const { return base; }
 
+  /// Set the start value for the range, and keep the same size
   void SetRangeBase(BaseType b) { base = b; }
 
   void Slide(BaseType slide) { base += slide; }


Index: lldb/include/lldb/Utility/RangeMap.h
===
--- lldb/include/lldb/Utility/RangeMap.h
+++ lldb/include/lldb/Utility/RangeMap.h
@@ -42,9 +42,9 @@
 size = 0;
   }
 
-  // Set the start value for the range, and keep the same size
   BaseType GetRangeBase() const { return base; }
 
+  /// Set the start value for the range, and keep the same size
   void SetRangeBase(BaseType b) { base = b; }
 
   void Slide(BaseType slide) { base += slide; }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 52b03b6 - [lldb][nfc] Place comment in the right place

2023-05-25 Thread Felipe de Azevedo Piovezan via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2023-05-25T12:53:35-04:00
New Revision: 52b03b63972a75cef8cfa5e1a2b1675a04f3dbe8

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

LOG: [lldb][nfc] Place comment in the right place

This line has been misplaced since it was introduced in 2011 by
c26e4454035a4160cffc3c865cf83be194ca38c4.

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

Added: 


Modified: 
lldb/include/lldb/Utility/RangeMap.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/RangeMap.h 
b/lldb/include/lldb/Utility/RangeMap.h
index 49b7eebfea6f7..7632126f97ec4 100644
--- a/lldb/include/lldb/Utility/RangeMap.h
+++ b/lldb/include/lldb/Utility/RangeMap.h
@@ -42,9 +42,9 @@ template  struct Range {
 size = 0;
   }
 
-  // Set the start value for the range, and keep the same size
   BaseType GetRangeBase() const { return base; }
 
+  /// Set the start value for the range, and keep the same size
   void SetRangeBase(BaseType b) { base = b; }
 
   void Slide(BaseType slide) { base += slide; }



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


[Lldb-commits] [PATCH] D151460: [NFC][Py Reformat] Reformat python files in lldb

2023-05-25 Thread Tobias Hieta via Phabricator via lldb-commits
thieta added a comment.

In D151460#4372763 , @mib wrote:

> Can you add this commit hash to the `.git-blame-ignore-revs` file so it 
> doesn't show up in the git history

Yeah that should be done. But has to be done after arc land anyway.


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

https://reviews.llvm.org/D151460

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


[Lldb-commits] [PATCH] D151460: [NFC][Py Reformat] Reformat python files in lldb

2023-05-25 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

Can you add this commit hash to the `.git-blame-ignore-revs` file so it doesn't 
show up in the git history


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

https://reviews.llvm.org/D151460

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


[Lldb-commits] [PATCH] D151460: [NFC][Py Reformat] Reformat python files in lldb

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D151460#4372711 , @thieta wrote:

> Thanks for doing this! Going to assume you ran the tests and it worked :)

Yup, no regressions. I'll keep an eye on the bots to make sure that holds true 
for other configurations too.


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

https://reviews.llvm.org/D151460

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


[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

2023-05-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

> @aprantl Do you know if we can detect the end of the scope ? I'm not sure 
> it's possible currently ... But even if we could do it, that wouldn't cover 
> the following case:

When setting a variable watchpoint, you would have to store the scope the 
variable is in, and then ignore all hits that are (1) on the same thread but 
(2) where the scope is not any of the lexical scopes in any of the stack 
frames. Because you still want to find modifications in child frames or on 
other threads.


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

https://reviews.llvm.org/D151366

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


[Lldb-commits] [PATCH] D151460: [NFC][Py Reformat] Reformat python files in lldb

2023-05-25 Thread Tobias Hieta via Phabricator via lldb-commits
thieta accepted this revision.
thieta added a comment.
This revision is now accepted and ready to land.

Thanks for doing this! Going to assume you ran the tests and it worked :)


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

https://reviews.llvm.org/D151460

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


[Lldb-commits] [PATCH] D151460: [NFC][Py Reformat] Reformat python files in lldb

2023-05-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, thieta.
Herald added subscribers: pmatos, asb, ormris, mstorsjo, wenlei, arphaman, 
steven_wu, kbarton, hiraditya, fedor.sergeev, sbc100, nemanjai, emaste.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a project: All.
JDevlieghere requested review of this revision.
Herald added subscribers: jplehr, sstefan1, aheejin.
Herald added a reviewer: jdoerfert.

This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black`.

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours ` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style


https://reviews.llvm.org/D151460

Files:
  lldb/docs/_lldb/__init__.py
  lldb/docs/conf.py
  lldb/examples/customization/bin-utils/binutils.py
  lldb/examples/customization/import-python/importcmd.py
  lldb/examples/customization/pwd-cd-and-system/utils.py
  lldb/examples/darwin/heap_find/heap.py
  lldb/examples/python/armv7_cortex_m_target_defintion.py
  lldb/examples/python/bsd.py
  lldb/examples/python/cmdtemplate.py
  lldb/examples/python/crashlog.py
  lldb/examples/python/delta.py
  lldb/examples/python/diagnose_nsstring.py
  lldb/examples/python/diagnose_unwind.py
  lldb/examples/python/dict_utils.py
  lldb/examples/python/disasm-stress-test.py
  lldb/examples/python/disasm.py
  lldb/examples/python/disassembly_mode.py
  lldb/examples/python/file_extract.py
  lldb/examples/python/gdb_disassemble.py
  lldb/examples/python/gdbremote.py
  lldb/examples/python/globals.py
  lldb/examples/python/in_call_stack.py
  lldb/examples/python/jump.py
  lldb/examples/python/lldb_module_utils.py
  lldb/examples/python/lldbtk.py
  lldb/examples/python/mach_o.py
  lldb/examples/python/memory.py
  lldb/examples/python/operating_system.py
  lldb/examples/python/performance.py
  lldb/examples/python/process_events.py
  lldb/examples/python/pytracer.py
  lldb/examples/python/sbvalue.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/examples/python/scripted_process/scripted_platform.py
  lldb/examples/python/scripted_process/scripted_process.py
  lldb/examples/python/scripted_step.py
  lldb/examples/python/shadow.py
  lldb/examples/python/sources.py
  lldb/examples/python/stacks.py
  lldb/examples/python/step_and_print.py
  lldb/examples/python/symbolication.py
  lldb/examples/python/types.py
  lldb/examples/python/x86_64_linux_target_definition.py
  lldb/examples/python/x86_64_qemu_target_definition.py
  lldb/examples/python/x86_64_target_definition.py
  lldb/examples/scripting/tree_utils.py
  lldb/examples/summaries/cocoa/CFArray.py
  lldb/examples/summaries/cocoa/CFBag.py
  lldb/examples/summaries/cocoa/CFBinaryHeap.py
  lldb/examples/summaries/cocoa/CFBitVector.py
  lldb/examples/summaries/cocoa/CFDictionary.py
  lldb/examples/summaries/cocoa/CFString.py
  lldb/examples/summaries/cocoa/Class.py
  lldb/examples/summaries/cocoa/Logger.py
  lldb/examples/summaries/cocoa/NSBundle.py
  lldb/examples/summaries/cocoa/NSData.py
  lldb/examples/summaries/cocoa/NSDate.py
  lldb/examples/summaries/cocoa/NSException.py
  lldb/examples/summaries/cocoa/NSIndexSet.py
  lldb/examples/summaries/cocoa/NSMachPort.py
  lldb/examples/summaries/cocoa/NSNotification.py
  lldb/examples/summaries/cocoa/NSNumber.py
  lldb/examples/summaries/cocoa/NSSet.py
  lldb/examples/summaries/cocoa/NSURL.py
  lldb/examples/summaries/cocoa/Selector.py
  lldb/examples/summaries/cocoa/attrib_fromdict.py
  lldb/examples/summaries/cocoa/cache.py
  lldb/examples/summaries/cocoa/metrics.py
  lldb/examples/summaries/cocoa/objc_runtime.py
  lldb/examples/summaries/pysummary.py
  lldb/examples/summaries/sp_cp.py
  lldb/examples/summaries/synth.py
  lldb/examples/summaries/unicode_strings.py
  lldb/examples/synthetic/bitfield/example.py
  lldb/examples/synthetic/gnu_libstdcpp.py
  lldb/examples/synthetic/libcxx.py
  lldb/examples/synthetic/recognizer_function/example.py
  lldb/examples/synthetic/unordered_multi.py
  lldb/packages/Python/lldbsuite/__init__.py
  lldb/packages/Python/lldbsuite/support/encoded_file.py
  lldb/packages/Python/lldbsuite/support/funcutils.py
  lldb/packages/Python/lldbsuite/support/gmodules.py
  lldb/packages/Python/lldbsuite/support/seven.py
  lldb/packages/Python/lldbsuite/test/bench.py
  lldb/packages/Python/lldbsuite/test/builders/__init__.py
  lldb/packages/Python/lldbsuite/test/builders/builder.py
  lldb/packages/Python/lldbsuite/test/builders/darwin.py
  lldb/packages/Python/lldbsuite/test/concurrent_base.py
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/decorators.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/dotest_args.py
  lldb/packages/Python/lldbsuite/test/gdbclientutils.py
  

[Lldb-commits] [PATCH] D151425: [lldb][nfc] Place comment in the right place

2023-05-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve added inline comments.



Comment at: lldb/include/lldb/Utility/RangeMap.h:47
 
+  // Set the start value for the range, and keep the same size
   void SetRangeBase(BaseType b) { base = b; }

JDevlieghere wrote:
> 
I can update it for sure, but note that no comments in this file are doxygen 
enabled


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151425

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


[Lldb-commits] [PATCH] D151425: [lldb][nfc] Place comment in the right place

2023-05-25 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 modulo Doxygen comment.




Comment at: lldb/include/lldb/Utility/RangeMap.h:47
 
+  // Set the start value for the range, and keep the same size
   void SetRangeBase(BaseType b) { base = b; }




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151425

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


[Lldb-commits] [PATCH] D151451: [lldb][nfc] Refactor methods with out parameter

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

Currently, the method `GetAttributeAddressRanges` takes a DWARFRangeList as a
parameter, just to immediately clear it. The method also returns the size of
this list. Such an API was obfuscating the intent of the call sites (it's not
clear from the method name what it returns) and it was obfuscating redundant
checks on the size of the list.

This commit refactors the method to return the list and to also make the call
sites use the more explicit `IsEmpty` method.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151451

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -840,9 +840,9 @@
   if (!dwarf_ast)
 return nullptr;
 
-  DWARFRangeList ranges;
-  if (die.GetDIE()->GetAttributeAddressRanges(die.GetCU(), ranges,
-  /*check_hi_lo_pc=*/true) == 0)
+  DWARFRangeList ranges = die.GetDIE()->GetAttributeAddressRanges(
+  die.GetCU(), /*check_hi_lo_pc=*/true);
+  if (ranges.IsEmpty())
 return nullptr;
 
   // Union of all ranges in the function DIE (if the function is
@@ -3208,10 +3208,9 @@
   DWARFDIE function_die = GetDIE(sc.function->GetID());
 
   dw_addr_t func_lo_pc = LLDB_INVALID_ADDRESS;
-  DWARFRangeList ranges;
-  if (function_die.GetDIE()->GetAttributeAddressRanges(
-  function_die.GetCU(), ranges,
-  /*check_hi_lo_pc=*/true))
+  DWARFRangeList ranges = function_die.GetDIE()->GetAttributeAddressRanges(
+  function_die.GetCU(), /*check_hi_lo_pc=*/true);
+  if (!ranges.IsEmpty())
 func_lo_pc = ranges.GetMinRangeBase(0);
   if (func_lo_pc != LLDB_INVALID_ADDRESS) {
 const size_t num_variables =
@@ -4282,4 +4281,3 @@
 args.insert({comp_unit, Args(flags)});
   }
 }
-
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -94,8 +94,8 @@
   uint64_t fail_value,
   bool check_specification_or_abstract_origin = false) const;
 
-  size_t GetAttributeAddressRanges(
-  DWARFUnit *cu, DWARFRangeList , bool check_hi_lo_pc,
+  DWARFRangeList GetAttributeAddressRanges(
+  DWARFUnit *cu, bool check_hi_lo_pc,
   bool check_specification_or_abstract_origin = false) const;
 
   const char *GetName(const DWARFUnit *cu) const;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -636,15 +636,16 @@
   return false;
 }
 
-size_t DWARFDebugInfoEntry::GetAttributeAddressRanges(
-DWARFUnit *cu, DWARFRangeList , bool check_hi_lo_pc,
+DWARFRangeList DWARFDebugInfoEntry::GetAttributeAddressRanges(
+DWARFUnit *cu, bool check_hi_lo_pc,
 bool check_specification_or_abstract_origin) const {
-  ranges.Clear();
 
   DWARFFormValue form_value;
-  if (GetAttributeValue(cu, DW_AT_ranges, form_value)) {
-ranges = GetRangesOrReportError(*cu, *this, form_value);
-  } else if (check_hi_lo_pc) {
+  if (GetAttributeValue(cu, DW_AT_ranges, form_value))
+return GetRangesOrReportError(*cu, *this, form_value);
+
+  DWARFRangeList ranges;
+  if (check_hi_lo_pc) {
 dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
 dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
 if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS,
@@ -653,7 +654,7 @@
 ranges.Append(DWARFRangeList::Entry(lo_pc, hi_pc - lo_pc));
 }
   }
-  return ranges.GetSize();
+  return ranges;
 }
 
 // GetName
@@ -716,9 +717,8 @@
 DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
   if (m_tag) {
 if (m_tag == DW_TAG_subprogram) {
-  DWARFRangeList ranges;
-  GetAttributeAddressRanges(cu, ranges,
-/*check_hi_lo_pc=*/true);
+  DWARFRangeList ranges =
+  GetAttributeAddressRanges(cu, /*check_hi_lo_pc=*/true);
   for (const auto  : ranges) {
 debug_aranges->AppendRange(GetOffset(), r.GetRangeBase(),
r.GetRangeEnd());
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp

[Lldb-commits] [PATCH] D151425: [lldb][nfc] Place comment in the right place

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

This line has been misplaced since it was introduced in 2011 by
c26e4454035a4160cffc3c865cf83be194ca38c4.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151425

Files:
  lldb/include/lldb/Utility/RangeMap.h


Index: lldb/include/lldb/Utility/RangeMap.h
===
--- lldb/include/lldb/Utility/RangeMap.h
+++ lldb/include/lldb/Utility/RangeMap.h
@@ -42,9 +42,9 @@
 size = 0;
   }
 
-  // Set the start value for the range, and keep the same size
   BaseType GetRangeBase() const { return base; }
 
+  // Set the start value for the range, and keep the same size
   void SetRangeBase(BaseType b) { base = b; }
 
   void Slide(BaseType slide) { base += slide; }


Index: lldb/include/lldb/Utility/RangeMap.h
===
--- lldb/include/lldb/Utility/RangeMap.h
+++ lldb/include/lldb/Utility/RangeMap.h
@@ -42,9 +42,9 @@
 size = 0;
   }
 
-  // Set the start value for the range, and keep the same size
   BaseType GetRangeBase() const { return base; }
 
+  // Set the start value for the range, and keep the same size
   void SetRangeBase(BaseType b) { base = b; }
 
   void Slide(BaseType slide) { base += slide; }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151344: Reland "[CMake] Bumps minimum version to 3.20.0.

2023-05-25 Thread Hans Wennborg via Phabricator via lldb-commits
hans added a comment.

This looks right to me. (I'm out of office at the moment, but this looks like 
what I tested in https://github.com/llvm/llvm-project/issues/62719 so it should 
work.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151344

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


[Lldb-commits] [PATCH] D151268: [lldb][DataFormatter] Add dereference support to libstdcpp std::shared_ptr formatter

2023-05-25 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a subscriber: compnerd.
Michael137 added a comment.

Any chance someone with a working aarch64 windows 10 setup could take a look? 
(@compnerd ?) Or let me know how I might be able to set this up.

The place where we seem to crash in `TestVarPath.py` is:

  # Make sure we don't crash when looking for non existant child 
  # in type with synthetic children. This used to cause a crash. 
  v = frame.GetValueForVariablePath('pt_sp->not_valid_child')
  self.assertTrue(v.GetError().Fail(),   
  "Make sure we don't find 'pt_sp->not_valid_child'")

A crash that was previously addressed in `0d6f681292d5a`. Interestingly, the 
code path that was added in that patch is the one that we used to take before 
adding support for `$$dereference$$` in this patch.


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

https://reviews.llvm.org/D151268

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


[Lldb-commits] [PATCH] D151268: [lldb][DataFormatter] Add dereference support to libstdcpp std::shared_ptr formatter

2023-05-25 Thread antoine moynault via Phabricator via lldb-commits
antmo added a comment.

Hi Michael,
lldb-aarch64-windows bot is broken since yesterday: 
https://lab.llvm.org/buildbot/#/builders/219/builds/3012
I suspect this is due to this commit. Could you please take a look at this ?


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

https://reviews.llvm.org/D151268

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