[Lldb-commits] [lldb] 11dc235 - [lldb] Fix matchers for char array formatters

2021-12-17 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-12-17T10:06:38+01:00
New Revision: 11dc235c7dda298befa84833a51ac9cdc92e7c2e

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

LOG: [lldb] Fix matchers for char array formatters

They were being applied too narrowly (they didn't cover signed char *,
for instance), and too broadly (they covered SomeTemplate) at
the same time.

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

Added: 


Modified: 
lldb/source/DataFormatters/FormatManager.cpp
lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp

Removed: 




diff  --git a/lldb/source/DataFormatters/FormatManager.cpp 
b/lldb/source/DataFormatters/FormatManager.cpp
index cda1ae60d8572..924b7b6948f3c 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -724,7 +724,7 @@ void FormatManager::LoadSystemFormatters() {
   lldb::TypeSummaryImplSP string_array_format(
   new StringSummaryFormat(string_array_flags, "${var%char[]}"));
 
-  RegularExpression any_size_char_arr(llvm::StringRef("char ?\\[[0-9]+\\]"));
+  RegularExpression any_size_char_arr(R"(^((un)?signed )?char ?\[[0-9]+\]$)");
 
   TypeCategoryImpl::SharedPointer sys_category_sp =
   GetCategory(m_system_category_name);
@@ -733,6 +733,9 @@ void FormatManager::LoadSystemFormatters() {
 string_format);
   sys_category_sp->GetTypeSummariesContainer()->Add(
   ConstString("unsigned char *"), string_format);
+  sys_category_sp->GetTypeSummariesContainer()->Add(
+  ConstString("signed char *"), string_format);
+
   sys_category_sp->GetRegexTypeSummariesContainer()->Add(
   std::move(any_size_char_arr), string_array_format);
 

diff  --git 
a/lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp 
b/lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
index cdd1b0ada5e08..b6886ea7f2052 100644
--- a/lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
@@ -6,6 +6,27 @@ struct A {
   char overflow[4];
 };
 
+#define MAKE_VARS3(c, v, s)
\
+  c v s char c##v##s##chararray[] = #c #v #s "char";   
\
+  c v s char *c##v##s##charstar = c##v##s##chararray
+#define MAKE_VARS2(c, v)   
\
+  MAKE_VARS3(c, v, );  
\
+  MAKE_VARS3(c, v, signed);
\
+  MAKE_VARS3(c, v, unsigned)
+#define MAKE_VARS(c)   
\
+  MAKE_VARS2(c, ); 
\
+  MAKE_VARS2(c, volatile)
+
+MAKE_VARS();
+MAKE_VARS(const);
+
+template
+struct S {
+  int x = 0;
+};
+S Schar5;
+S Scharstar;
+
 int main (int argc, char const *argv[])
 {
 A a, b, c;
@@ -15,7 +36,7 @@ int main (int argc, char const *argv[])
 memcpy(b.data, "FO\0BAR", 7);
 memcpy(c.data, "F\0O\0AR", 7);
 std::string stdstring("Hello\t\tWorld\nI am here\t\tto say hello\n"); 
//%self.addTearDownHook(lambda x: x.runCmd("setting set escape-non-printables 
true"))
-const char* constcharstar = stdstring.c_str();
+const char *charwithtabs = stdstring.c_str();
 std::string longstring(
 "I am a very long string; in fact I am longer than any reasonable length that 
a string should be; quite long indeed; oh my, so many words; so many letters; 
this is kind of like writing a poem; except in real life all that is happening"
 " is just me producing a very very long set of words; there is text here, text 
there, text everywhere; it fills me with glee to see so much text; all around 
me it's just letters, and symbols, and other pleasant drawings that cause me"
@@ -32,15 +53,30 @@ int main (int argc, char const *argv[])
   );
 const char* longconstcharstar = longstring.c_str();
 return 0; //% if self.TraceOn(): self.runCmd('frame variable')
+//%
 //% self.expect_var_path('stdstring', summary='"Hello\\t\\tWorld\\nI am 
here\\t\\tto say hello\\n"')
-//% self.expect_var_path('constcharstar', summary='"Hello\\t\\tWorld\\nI 
am here\\t\\tto say hello\\n"')
+//% self.expect_var_path('charwithtabs', summary='"Hello\\t\\tWorld\\nI am 
here\\t\\tto say hello\\n"')
 //% self.expect_var_path("a.data", summary='"FOOB"')
 //% self.expect_var_path("b.data", summary=r'"FO\0B"')
 //% self.expect_var_path("c.data", summary=r'"F\0O"')
 //%
+//% for c in ["", "const"]:
+//%   for v in ["", "volatile"]:
+//% for s in ["", "signed", "unsigned"]:
+//%   summary = '"'+c+

[Lldb-commits] [PATCH] D112709: [lldb] Fix matchers for char array formatters

2021-12-17 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG11dc235c7dda: [lldb] Fix matchers for char array formatters 
(authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112709

Files:
  lldb/source/DataFormatters/FormatManager.cpp
  lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp


Index: lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
===
--- lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
+++ lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
@@ -6,6 +6,27 @@
   char overflow[4];
 };
 
+#define MAKE_VARS3(c, v, s)
\
+  c v s char c##v##s##chararray[] = #c #v #s "char";   
\
+  c v s char *c##v##s##charstar = c##v##s##chararray
+#define MAKE_VARS2(c, v)   
\
+  MAKE_VARS3(c, v, );  
\
+  MAKE_VARS3(c, v, signed);
\
+  MAKE_VARS3(c, v, unsigned)
+#define MAKE_VARS(c)   
\
+  MAKE_VARS2(c, ); 
\
+  MAKE_VARS2(c, volatile)
+
+MAKE_VARS();
+MAKE_VARS(const);
+
+template
+struct S {
+  int x = 0;
+};
+S Schar5;
+S Scharstar;
+
 int main (int argc, char const *argv[])
 {
 A a, b, c;
@@ -15,7 +36,7 @@
 memcpy(b.data, "FO\0BAR", 7);
 memcpy(c.data, "F\0O\0AR", 7);
 std::string stdstring("Hello\t\tWorld\nI am here\t\tto say hello\n"); 
//%self.addTearDownHook(lambda x: x.runCmd("setting set escape-non-printables 
true"))
-const char* constcharstar = stdstring.c_str();
+const char *charwithtabs = stdstring.c_str();
 std::string longstring(
 "I am a very long string; in fact I am longer than any reasonable length that 
a string should be; quite long indeed; oh my, so many words; so many letters; 
this is kind of like writing a poem; except in real life all that is happening"
 " is just me producing a very very long set of words; there is text here, text 
there, text everywhere; it fills me with glee to see so much text; all around 
me it's just letters, and symbols, and other pleasant drawings that cause me"
@@ -32,15 +53,30 @@
   );
 const char* longconstcharstar = longstring.c_str();
 return 0; //% if self.TraceOn(): self.runCmd('frame variable')
+//%
 //% self.expect_var_path('stdstring', summary='"Hello\\t\\tWorld\\nI am 
here\\t\\tto say hello\\n"')
-//% self.expect_var_path('constcharstar', summary='"Hello\\t\\tWorld\\nI 
am here\\t\\tto say hello\\n"')
+//% self.expect_var_path('charwithtabs', summary='"Hello\\t\\tWorld\\nI am 
here\\t\\tto say hello\\n"')
 //% self.expect_var_path("a.data", summary='"FOOB"')
 //% self.expect_var_path("b.data", summary=r'"FO\0B"')
 //% self.expect_var_path("c.data", summary=r'"F\0O"')
 //%
+//% for c in ["", "const"]:
+//%   for v in ["", "volatile"]:
+//% for s in ["", "signed", "unsigned"]:
+//%   summary = '"'+c+v+s+'char"'
+//%   self.expect_var_path(c+v+s+"chararray", summary=summary)
+//% # These should be printed normally
+//%   self.expect_var_path(c+v+s+"charstar", summary=summary)
+//% Schar5 = self.expect_var_path("Schar5",
+//% children=[ValueCheck(name="x", value="0")])
+//% self.assertIsNone(Schar5.GetSummary())
+//% Scharstar = self.expect_var_path("Scharstar",
+//% children=[ValueCheck(name="x", value="0")])
+//% self.assertIsNone(Scharstar.GetSummary())
+//%
 //% self.runCmd("setting set escape-non-printables false")
 //% self.expect_var_path('stdstring', summary='"Hello\t\tWorld\nI am 
here\t\tto say hello\n"')
-//% self.expect_var_path('constcharstar', summary='"Hello\t\tWorld\nI am 
here\t\tto say hello\n"')
+//% self.expect_var_path('charwithtabs', summary='"Hello\t\tWorld\nI am 
here\t\tto say hello\n"')
 //% 
self.assertTrue(self.frame().FindVariable('longstring').GetSummary().endswith('"...'))
 //% 
self.assertTrue(self.frame().FindVariable('longconstcharstar').GetSummary().endswith('"...'))
 // FIXME: make "b.data" and "c.data" work sanely
Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -724,7 +724,7 @@
   lldb::TypeSummaryImplSP string_array_format(
   new StringSummaryFormat(string_array_flags, "${var%char[]}"));
 
-  RegularExpression any_size_char_arr(llvm::StringRef("char ?\\[[0-9]+\\]"));
+  RegularExpression any_size_char_arr(R"(^((un)?signed )?char ?\[[0-9]+\]$)");
 
 

[Lldb-commits] [PATCH] D115925: [lldb/python] Fix (some) dangling pointers in our glue code

2021-12-17 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, mib.
labath requested review of this revision.
Herald added a project: LLDB.

This starts to fix the other half of the lifetime problems in this code

- dangling references. SB objects created on the stack will go away

when the function returns, which is a problem if the python code they
were meant for stashes a reference to them somewhere.  Most of the time
this goes by unnoticed, as the code rarely has a reason to store these,
but in case it does, we shouldn't respond by crashing.

This patch fixes the management for a couple of SB objects (Debugger,
Frame, Thread). The SB objects are now created on the heap, and
their ownership is immediately passed on to SWIG, which will ensure they
are destroyed when the last python reference goes away. I will handle
the other objects in separate patches.

I include one test which demonstrates the lifetime issue for SBDebugger.
Strictly speaking, one should create a test case for each of these
objects and each of the contexts they are being used. That would require
figuring out how to persist (and later access) each of these objects.
Some of those may involve a lot of hoop-jumping (we can run python code
from within a frame-format string). I don't think that is
necessary/worth it since the new wrapper functions make it very hard to
get this wrong.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115925

Files:
  lldb/bindings/python/python-swigsafecast.swig
  lldb/bindings/python/python-wrapper.swig
  lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/test/API/commands/command/script/TestCommandScript.py
  lldb/test/API/commands/command/script/persistence.py
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -88,7 +88,7 @@
 
 void *lldb_private::LLDBSwigPythonCreateCommandObject(
 const char *python_class_name, const char *session_dictionary_name,
-const lldb::DebuggerSP debugger_sp) {
+lldb::DebuggerSP debugger_sp) {
   return nullptr;
 }
 
@@ -172,14 +172,14 @@
 
 bool lldb_private::LLDBSwigPythonCallCommand(
 const char *python_function_name, const char *session_dictionary_name,
-lldb::DebuggerSP &debugger, const char *args,
+lldb::DebuggerSP debugger, const char *args,
 lldb_private::CommandReturnObject &cmd_retobj,
 lldb::ExecutionContextRefSP exe_ctx_ref_sp) {
   return false;
 }
 
 bool lldb_private::LLDBSwigPythonCallCommandObject(
-PyObject *implementor, lldb::DebuggerSP &debugger, const char *args,
+PyObject *implementor, lldb::DebuggerSP debugger, const char *args,
 lldb_private::CommandReturnObject &cmd_retobj,
 lldb::ExecutionContextRefSP exe_ctx_ref_sp) {
   return false;
@@ -187,7 +187,7 @@
 
 bool lldb_private::LLDBSwigPythonCallModuleInit(
 const char *python_module_name, const char *session_dictionary_name,
-lldb::DebuggerSP &debugger) {
+lldb::DebuggerSP debugger) {
   return false;
 }
 
@@ -228,10 +228,10 @@
   return false;
 }
 
-bool lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
+llvm::Optional lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
 const char *python_function_name, const char *session_dictionary_name,
-lldb::ThreadSP &thread, std::string &output) {
-  return false;
+lldb::ThreadSP thread) {
+  return llvm::None;
 }
 
 bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget(
@@ -240,10 +240,10 @@
   return false;
 }
 
-bool lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
+llvm::Optional lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
 const char *python_function_name, const char *session_dictionary_name,
-lldb::StackFrameSP &frame, std::string &output) {
-  return false;
+lldb::StackFrameSP frame) {
+  return llvm::None;
 }
 
 bool lldb_private::LLDBSWIGPythonRunScriptKeywordValue(
Index: lldb/test/API/commands/command/script/persistence.py
===
--- /dev/null
+++ lldb/test/API/commands/command/script/persistence.py
@@ -0,0 +1,9 @@
+import lldb
+
+debugger_copy = None
+
+def save_debugger(debugger, command, context, result, internal_dict):
+global debugger_copy
+debugger_copy = debugger
+result.AppendMessage(str(debugger))
+result.SetStatus(lldb.eReturnStatusSuccessFinishResult)
Index: lldb/test/API/commands/command/script/TestCommandScript.py
===
--- lldb/test/API/commands/command/script/TestCommandScript.py
+++ lldb/test/API/commands/command/script/TestCommandScript.py
@@ -165,3 +165,10 @@
 self.runCmd('command script add -f bug11569 bug1

[Lldb-commits] [PATCH] D115926: [lldb/lua] Support external breakpoint callback

2021-12-17 Thread Siger Young via Phabricator via lldb-commits
siger-young created this revision.
siger-young added reviewers: JDevlieghere, tammela.
siger-young requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This commit supports registerubg breakpoint callback when using
liblldb in Lua. (able to `SetScriptCallback(function(a, b, ...) end)`)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115926

Files:
  lldb/bindings/interface/SBBreakpoint.i
  lldb/bindings/lua/lua-typemaps.swig
  lldb/bindings/lua/lua-wrapper.swig
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/include/lldb/API/SBBreakpointOptionCommon.h
  lldb/include/lldb/API/SBDefines.h
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointName.cpp
  lldb/source/API/SBBreakpointOptionCommon.cpp
  lldb/source/API/SBBreakpointOptionCommon.h
  lldb/test/API/lua_api/TestBreakpointAPI.lua

Index: lldb/test/API/lua_api/TestBreakpointAPI.lua
===
--- lldb/test/API/lua_api/TestBreakpointAPI.lua
+++ lldb/test/API/lua_api/TestBreakpointAPI.lua
@@ -49,4 +49,20 @@
 assertEquals(var_argc_value, 3)
 end
 
+function _T:TestBreakpointRealCallback()
+local target = self:create_target()
+local breakpoint = target:BreakpointCreateByLocation('main.c', 31)
+assertTrue(breakpoint:IsValid() and breakpoint:GetNumLocations() == 1)
+local flag = false
+local i = 1
+breakpoint:SetScriptCallback(function(frame)
+flag = true
+assertEquals(frame:FindVariable('i'):GetValueAsSigned(), i)
+i = i + 1
+return false
+end)
+target:LaunchSimple(nil, nil, nil)
+assertTrue(flag)
+end
+
 os.exit(_T:run())
Index: lldb/source/API/SBBreakpointOptionCommon.h
===
--- lldb/source/API/SBBreakpointOptionCommon.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//===-- SBBreakpointOptionCommon.h --*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_SOURCE_API_SBBREAKPOINTOPTIONCOMMON_H
-#define LLDB_SOURCE_API_SBBREAKPOINTOPTIONCOMMON_H
-
-#include "lldb/API/SBDefines.h"
-#include "lldb/Utility/Baton.h"
-
-namespace lldb
-{
-struct CallbackData {
-  SBBreakpointHitCallback callback;
-  void *callback_baton;
-};
-
-class SBBreakpointCallbackBaton : public lldb_private::TypedBaton {
-public:
-  SBBreakpointCallbackBaton(SBBreakpointHitCallback callback,
-void *baton);
-
-  ~SBBreakpointCallbackBaton() override;
-
-  static bool PrivateBreakpointHitCallback(void *baton,
-   lldb_private::StoppointCallbackContext *ctx,
-   lldb::user_id_t break_id,
-   lldb::user_id_t break_loc_id);
-};
-
-} // namespace lldb
-#endif // LLDB_SOURCE_API_SBBREAKPOINTOPTIONCOMMON_H
Index: lldb/source/API/SBBreakpointOptionCommon.cpp
===
--- lldb/source/API/SBBreakpointOptionCommon.cpp
+++ lldb/source/API/SBBreakpointOptionCommon.cpp
@@ -6,8 +6,9 @@
 //
 //===--===//
 
-#include "lldb/API/SBBreakpointName.h"
+#include "lldb/API/SBBreakpointOptionCommon.h"
 #include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBBreakpointName.h"
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBEvent.h"
 #include "lldb/API/SBProcess.h"
@@ -31,13 +32,15 @@
 
 #include "lldb/lldb-enumerations.h"
 
-#include "SBBreakpointOptionCommon.h"
-
 #include "llvm/ADT/STLExtras.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
+SBBreakpointCallbackBaton::SBBreakpointCallbackBaton(
+std::unique_ptr Data)
+: TypedBaton(std::move(Data)) {}
+
 SBBreakpointCallbackBaton::SBBreakpointCallbackBaton(SBBreakpointHitCallback 
  callback,
  void *baton)
@@ -52,26 +55,18 @@
   lldb::user_id_t break_loc_id)
 {
   ExecutionContext exe_ctx(ctx->exe_ctx_ref);
+  SBFrame sb_frame(exe_ctx.GetFrameSP());
   BreakpointSP bp_sp(
   exe_ctx.GetTargetRef().GetBreakpointList().FindBreakpointByID(break_id));
   if (baton && bp_sp) {
 CallbackData *data = (CallbackData *)baton;
 lldb_private::Breakpoint *bp = bp_sp.get();
-if (bp && data->callback) {
-  Process *process = exe_ctx.GetProcessPtr();
-  if (process) {
-SBProcess sb_process(process->shared_from_this());
-SBThread sb_thread;
-SBBreakpointLocation sb_location;
-assert(bp_sp);
-sb_loca

[Lldb-commits] [PATCH] D115926: [lldb/lua] Support external breakpoint callback

2021-12-17 Thread Siger Young via Phabricator via lldb-commits
siger-young updated this revision to Diff 395076.
siger-young added a comment.

Remove "return" to prevent memory leakage.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115926

Files:
  lldb/bindings/interface/SBBreakpoint.i
  lldb/bindings/lua/lua-typemaps.swig
  lldb/bindings/lua/lua-wrapper.swig
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/include/lldb/API/SBBreakpointOptionCommon.h
  lldb/include/lldb/API/SBDefines.h
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointName.cpp
  lldb/source/API/SBBreakpointOptionCommon.cpp
  lldb/source/API/SBBreakpointOptionCommon.h
  lldb/test/API/lua_api/TestBreakpointAPI.lua

Index: lldb/test/API/lua_api/TestBreakpointAPI.lua
===
--- lldb/test/API/lua_api/TestBreakpointAPI.lua
+++ lldb/test/API/lua_api/TestBreakpointAPI.lua
@@ -49,4 +49,20 @@
 assertEquals(var_argc_value, 3)
 end
 
+function _T:TestBreakpointRealCallback()
+local target = self:create_target()
+local breakpoint = target:BreakpointCreateByLocation('main.c', 31)
+assertTrue(breakpoint:IsValid() and breakpoint:GetNumLocations() == 1)
+local flag = false
+local i = 1
+breakpoint:SetScriptCallback(function(frame)
+flag = true
+assertEquals(frame:FindVariable('i'):GetValueAsSigned(), i)
+i = i + 1
+return false
+end)
+target:LaunchSimple(nil, nil, nil)
+assertTrue(flag)
+end
+
 os.exit(_T:run())
Index: lldb/source/API/SBBreakpointOptionCommon.h
===
--- lldb/source/API/SBBreakpointOptionCommon.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//===-- SBBreakpointOptionCommon.h --*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_SOURCE_API_SBBREAKPOINTOPTIONCOMMON_H
-#define LLDB_SOURCE_API_SBBREAKPOINTOPTIONCOMMON_H
-
-#include "lldb/API/SBDefines.h"
-#include "lldb/Utility/Baton.h"
-
-namespace lldb
-{
-struct CallbackData {
-  SBBreakpointHitCallback callback;
-  void *callback_baton;
-};
-
-class SBBreakpointCallbackBaton : public lldb_private::TypedBaton {
-public:
-  SBBreakpointCallbackBaton(SBBreakpointHitCallback callback,
-void *baton);
-
-  ~SBBreakpointCallbackBaton() override;
-
-  static bool PrivateBreakpointHitCallback(void *baton,
-   lldb_private::StoppointCallbackContext *ctx,
-   lldb::user_id_t break_id,
-   lldb::user_id_t break_loc_id);
-};
-
-} // namespace lldb
-#endif // LLDB_SOURCE_API_SBBREAKPOINTOPTIONCOMMON_H
Index: lldb/source/API/SBBreakpointOptionCommon.cpp
===
--- lldb/source/API/SBBreakpointOptionCommon.cpp
+++ lldb/source/API/SBBreakpointOptionCommon.cpp
@@ -6,8 +6,9 @@
 //
 //===--===//
 
-#include "lldb/API/SBBreakpointName.h"
+#include "lldb/API/SBBreakpointOptionCommon.h"
 #include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBBreakpointName.h"
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBEvent.h"
 #include "lldb/API/SBProcess.h"
@@ -31,13 +32,15 @@
 
 #include "lldb/lldb-enumerations.h"
 
-#include "SBBreakpointOptionCommon.h"
-
 #include "llvm/ADT/STLExtras.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
+SBBreakpointCallbackBaton::SBBreakpointCallbackBaton(
+std::unique_ptr Data)
+: TypedBaton(std::move(Data)) {}
+
 SBBreakpointCallbackBaton::SBBreakpointCallbackBaton(SBBreakpointHitCallback 
  callback,
  void *baton)
@@ -52,26 +55,18 @@
   lldb::user_id_t break_loc_id)
 {
   ExecutionContext exe_ctx(ctx->exe_ctx_ref);
+  SBFrame sb_frame(exe_ctx.GetFrameSP());
   BreakpointSP bp_sp(
   exe_ctx.GetTargetRef().GetBreakpointList().FindBreakpointByID(break_id));
   if (baton && bp_sp) {
 CallbackData *data = (CallbackData *)baton;
 lldb_private::Breakpoint *bp = bp_sp.get();
-if (bp && data->callback) {
-  Process *process = exe_ctx.GetProcessPtr();
-  if (process) {
-SBProcess sb_process(process->shared_from_this());
-SBThread sb_thread;
-SBBreakpointLocation sb_location;
-assert(bp_sp);
-sb_location.SetLocation(bp_sp->FindLocationByID(break_loc_id));
-Thread *thread = exe_ctx.GetThreadPtr();
-if (thread)
-  sb_thread.Se

[Lldb-commits] [PATCH] D115926: [lldb/lua] Support external breakpoint callback

2021-12-17 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

I actually quite like this, but we should figure out a way to do it while 
respecting our SB contracts. See inline comments for details.




Comment at: lldb/bindings/lua/lua-wrapper.swig:119-124
+bool SBBreakpointHitCallbackLua(
+   void *baton,
+   SBFrame &sb_frame,
+   SBBreakpointLocation &sb_bp_loc
+)
+{

I have (just yesterday) reformatted these files to follow the normal llvm/lldb 
style. Could you please rebase and reformat the patch so we don't profilerate 
this weirdness.



Comment at: lldb/include/lldb/API/SBBreakpointOptionCommon.h:14
+#include "lldb/API/SBDefines.h"
+#include "lldb/Utility/Baton.h"
+

The reason this file was in the `source` folder is because lldb public header 
cannot depend the internal ones. We'll need to figure out a different way to do 
that.

I guess that means placing these definitions somewhere where they would be 
accessible by the swig code, but still inaccessible to the outside world. Would 
any of the FileSP tricks we do in the python code help?



Comment at: lldb/include/lldb/API/SBDefines.h:97-98
 
-typedef bool (*SBBreakpointHitCallback)(void *baton, SBProcess &process,
-SBThread &thread,
-lldb::SBBreakpointLocation &location);
+typedef bool (*SBBreakpointHitCallback)(void *baton, SBFrame &sb_frame,
+SBBreakpointLocation &sb_bp_loc);
 }

What's the reason for changing this?

If this were a new API, then I think I might agree with having an SBFrame here, 
but we'd need a very good reason to change this after the fact. I would assume 
the sb_frame object can be accessed as thread.GetFrameAtIndex(0), can it not?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115926

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


[Lldb-commits] [PATCH] D115926: [lldb/lua] Support external breakpoint callback

2021-12-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I don't know if you've seen this but we have some description of it here 
https://lldb.llvm.org/design/sbapi.html. The gist of it is:

- be backward compatible
- don't depend on other stuff


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115926

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


[Lldb-commits] [PATCH] D115926: [lldb/lua] Support external breakpoint callback

2021-12-17 Thread Siger Young via Phabricator via lldb-commits
siger-young added a comment.

In D115926#3199496 , @labath wrote:

> I don't know if you've seen this but we have some description of it here 
> https://lldb.llvm.org/design/sbapi.html. The gist of it is:
>
> - be backward compatible
> - don't depend on other stuff

Thanks, I got it. I will stick to these rules.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115926

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


[Lldb-commits] [lldb] 586765c - [lldb/qemu] Add emulator-env-vars setting

2021-12-17 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-12-17T13:59:21+01:00
New Revision: 586765c0ee518310612d286f3a731786b4ea4148

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

LOG: [lldb/qemu] Add emulator-env-vars setting

This setting is for variables we want to pass to the emulator only --
then will be automatically removed from the target environment by our
environment diffing code. This variable can be used to pass various
QEMU_*** variables (although most of these can be passed through
emulator-args as well), as well as any other variables that can affect
the operation of the emulator (e.g. LD_LIBRARY_PATH).

Added: 


Modified: 
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
lldb/test/API/qemu/TestQemuLaunch.py

Removed: 




diff  --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp 
b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 2542464301dee..67c9484680a42 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -55,6 +55,13 @@ class PluginProperties : public Properties {
 return result;
   }
 
+  Environment GetEmulatorEnvVars() {
+Args args;
+m_collection_sp->GetPropertyAtIndexAsArgs(nullptr, 
ePropertyEmulatorEnvVars,
+  args);
+return Environment(args);
+  }
+
   Environment GetTargetEnvVars() {
 Args args;
 m_collection_sp->GetPropertyAtIndexAsArgs(nullptr, ePropertyTargetEnvVars,
@@ -175,8 +182,13 @@ lldb::ProcessSP 
PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
get_arg_range(args));
 
   launch_info.SetArguments(args, true);
+
+  Environment emulator_env = Host::GetEnvironment();
+  for (const auto &KV : GetGlobalProperties().GetEmulatorEnvVars())
+emulator_env[KV.first()] = KV.second;
   launch_info.GetEnvironment() = ComputeLaunchEnvironment(
-  std::move(launch_info.GetEnvironment()), Host::GetEnvironment());
+  std::move(launch_info.GetEnvironment()), std::move(emulator_env));
+
   launch_info.SetLaunchInSeparateProcessGroup(true);
   launch_info.GetFlags().Clear(eLaunchFlagDebug);
   launch_info.SetMonitorProcessCallback(ProcessLaunchInfo::NoOpMonitorCallback,

diff  --git 
a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td 
b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
index 2792e2cef0349..4e8fbcfd67609 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
@@ -13,7 +13,12 @@ let Definition = "platformqemuuser" in {
 Global,
 DefaultStringValue<"">,
 Desc<"Extra arguments to pass to the emulator.">;
+  def EmulatorEnvVars: Property<"emulator-env-vars", "Dictionary">,
+Global,
+ElementType<"String">,
+Desc<"Extra variables to add to the emulator environment.">;
   def TargetEnvVars: Property<"target-env-vars", "Dictionary">,
+Global,
 ElementType<"String">,
 Desc<"Extra variables to add to emulated target environment.">;
 }

diff  --git a/lldb/test/API/qemu/TestQemuLaunch.py 
b/lldb/test/API/qemu/TestQemuLaunch.py
index 07d7cb6a82f9d..2e817ede4154d 100644
--- a/lldb/test/API/qemu/TestQemuLaunch.py
+++ b/lldb/test/API/qemu/TestQemuLaunch.py
@@ -171,7 +171,7 @@ def test_extra_args(self):
 
 self.assertEqual(state["fake-arg"], "fake-value")
 
-def test_target_env_vars(self):
+def test_env_vars(self):
 # First clear any global environment to have a clean slate for this 
test
 self.runCmd("settings clear target.env-vars")
 self.runCmd("settings clear target.unset-env-vars")
@@ -187,6 +187,10 @@ def cleanup():
 del os.environ[var(i)]
 self.addTearDownHook(cleanup)
 
+# Set some emulator-only variables.
+self.set_emulator_setting("emulator-env-vars",
+"%s='emulator only'"%var(4))
+
 # And through the platform setting.
 self.set_emulator_setting("target-env-vars",
 "%s='from platform' %s='from platform'" % (var(1), var(2)))
@@ -195,11 +199,13 @@ def cleanup():
 info = target.GetLaunchInfo()
 env = info.GetEnvironment()
 
-# Platform settings should trump host values.
+# Platform settings should trump host values. Emulator-only variables
+# should not be visible.
 self.assertEqual(env.Get(var(0)), "from host")
 self.assertEqual(env.Get(var(1)), "from platform")
 self.assertEqual(env.Get(var(2)), "from platform")
 self.assertEqual(env.Get(var(3)), "from host")
+self.assertIsNone(env.Get(var(4)))

[Lldb-commits] [lldb] 12873d1 - Silence unused variable warning in release builds

2021-12-17 Thread Benjamin Kramer via lldb-commits

Author: Benjamin Kramer
Date: 2021-12-17T16:07:02+01:00
New Revision: 12873d1a670b4a82b5853dabc8b6ea4d300759af

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

LOG: Silence unused variable warning in release builds

lldb/source/Core/DataFileCache.cpp:278:10: warning: unused variable 'pos' 
[-Wunused-variable]
auto pos = m_string_to_offset.find(s);
 ^
lldb/source/Core/DataFileCache.cpp:277:18: warning: unused variable 'stroff' 
[-Wunused-variable]
const size_t stroff = encoder.GetByteSize() - strtab_offset;
 ^

Added: 


Modified: 
lldb/source/Core/DataFileCache.cpp

Removed: 




diff  --git a/lldb/source/Core/DataFileCache.cpp 
b/lldb/source/Core/DataFileCache.cpp
index 8d4dba307a124..3f52b925ef467 100644
--- a/lldb/source/Core/DataFileCache.cpp
+++ b/lldb/source/Core/DataFileCache.cpp
@@ -274,9 +274,8 @@ bool ConstStringTable::Encode(DataEncoder &encoder) {
   encoder.AppendU8(0); // Start the string table with with an empty string.
   for (auto s: m_strings) {
 // Make sure all of the offsets match up with what we handed out!
-const size_t stroff = encoder.GetByteSize() - strtab_offset;
-auto pos = m_string_to_offset.find(s);
-assert(pos->second == stroff);
+assert(m_string_to_offset.find(s)->second ==
+   encoder.GetByteSize() - strtab_offset);
 // Append the C string into the encoder
 encoder.AppendCString(s.GetStringRef());
   }



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


[Lldb-commits] [PATCH] D115951: Cache the manual DWARF index out to the LLDB cache directory when the LLDB index cache is enabled.

2021-12-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg created this revision.
clayborg added reviewers: labath, wallace, aadsm, jingham, JDevlieghere.
Herald added subscribers: arphaman, mgorny.
clayborg requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: lldb-commits, sstefan1.
Herald added a project: LLDB.

This patch add the ability to cache the manual DWARF indexing results to disk 
for faster subsequent debug sessions. Manual DWARF indexing is time consuming 
and causes all DWARF to be fully parsed and indexed each time you debug a 
binary that doesn't have an acceptable accelerator table. Acceptable 
accelerator tables include .debug_names in DWARF5 or Apple accelerator tables.

This patch breaks up testing by testing all of the encoding and decoding of 
required C++ objects in a gtest unit test, and then has a test to verify the 
debug info cache is generated correctly.

This patch also adds the ability to track when a symbol table or DWARF index is 
loaded or saved to the cache in the "statistics dump" command. This is 
essential to know in statistics as it can help explain why a debug session was 
slower or faster than expected.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115951

Files:
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/Symtab.h
  lldb/include/lldb/Target/Statistics.h
  lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.h
  lldb/source/Symbol/Symtab.cpp
  lldb/source/Target/Statistics.cpp
  lldb/test/API/commands/statistics/basic/TestStats.py
  lldb/test/API/functionalities/module_cache/debug_index/TestDebugIndexCache.py
  lldb/test/API/functionalities/module_cache/debug_index/exe.yaml
  lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp

Index: lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp
@@ -0,0 +1,200 @@
+//===-- DWARFIndexCachingTest.cpp -=---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/SymbolFile/DWARF/DIERef.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+#include "Plugins/SymbolFile/DWARF/ManualDWARFIndex.h"
+#include "Plugins/SymbolFile/DWARF/NameToDIE.h"
+#include "TestingSupport/Symbol/YAMLModuleTester.h"
+#include "lldb/Core/DataFileCache.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Utility/DataEncoder.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "llvm/ADT/STLExtras.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static void EncodeDecode(const DIERef &object, ByteOrder byte_order) {
+  const uint8_t addr_size = 8;
+  DataEncoder encoder(byte_order, addr_size);
+  object.Encode(encoder);
+  llvm::ArrayRef bytes = encoder.GetData();
+  DataExtractor data(bytes.data(), bytes.size(), byte_order, addr_size);
+  offset_t data_offset = 0;
+  llvm::Optional decoded_object = DIERef::Decode(data, &data_offset);
+  ASSERT_EQ((bool)decoded_object, true);
+  EXPECT_EQ(object, decoded_object.getValue());
+}
+
+static void EncodeDecode(const DIERef &object) {
+  EncodeDecode(object, eByteOrderLittle);
+  EncodeDecode(object, eByteOrderBig);
+}
+
+TEST(DWARFIndexCachingTest, DIERefEncodeDecode) {
+  // Tests DIERef::Encode(...) and DIERef::Decode(...)
+  EncodeDecode(DIERef(llvm::None, DIERef::Section::DebugInfo, 0x11223344));
+  EncodeDecode(DIERef(llvm::None, DIERef::Section::DebugTypes, 0x11223344));
+  EncodeDecode(DIERef(100, DIERef::Section::DebugInfo, 0x11223344));
+  EncodeDecode(DIERef(200, DIERef::Section::DebugTypes, 0x11223344));
+}
+
+static void EncodeDecode(const NameToDIE &object, ByteOrder byte_order) {
+  const uint8_t addr_size = 8;
+  DataEncoder encoder(byte_order, addr_size);
+  DataEncoder strtab_encoder(byte_order, addr_size);
+  ConstStringTable const_strtab;
+
+  object.Encode(encoder, const_strtab);
+
+  llvm::ArrayRef bytes = encoder.GetData();
+  DataExtractor data(bytes.data(), bytes.size(), byte_order, addr_size);
+
+  const_strtab.Encode(strtab_encoder);
+  llvm::ArrayRef strtab_bytes = strtab_encoder.GetData();
+  DataExtractor strtab_data(strtab_bytes.data(), strtab_bytes.size(),
+byte_order, addr_size);
+  StringTableReader strtab_reader;
+  offs

[Lldb-commits] [PATCH] D115925: [lldb/python] Fix (some) dangling pointers in our glue code

2021-12-17 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.

Thanks for fixing this! LGTM beside a small nit.




Comment at: lldb/test/API/commands/command/script/TestCommandScript.py:172
+self.runCmd("command script add -f persistence.save_debugger 
save_debugger")
+self.runCmd("command script add -f persistence.use_debugger 
use_debugger")
+self.expect("save_debugger", substrs=[str(self.dbg)])

persistence.py doesn't seem to have a `use_debugger` function 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115925

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


[Lldb-commits] [PATCH] D115926: [lldb/lua] Support external breakpoint callback

2021-12-17 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D115926#3199520 , @siger-young 
wrote:

> In D115926#3199496 , @labath wrote:
>
>> I don't know if you've seen this but we have some description of it here 
>> https://lldb.llvm.org/design/sbapi.html. The gist of it is:
>>
>> - be backward compatible
>> - don't depend on other stuff
>
> Thanks, I got it. I will stick to these rules.

It's fine to add an API if we decide the one we had originally was unwieldily.  
I have no idea why one of us (probably me) thought breakpoint callbacks needed 
a process & thread.




Comment at: lldb/include/lldb/API/SBBreakpointOptionCommon.h:17
+namespace lldb {
+struct CallbackData {
+  SBBreakpointHitCallback callback;

It's odd to have something called lldb::CallbackData, but have it be specific 
to breakpoints.  We probably need to do the same thing for Watchpoints, for 
instance, but either there should be a common class for both watchpoints, or 
they should be distinguishable by name.  And other things might have callbacks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115926

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


[Lldb-commits] [lldb] 2a844c8 - Fix macOS buildbots after https://reviews.llvm.org/D115324.

2021-12-17 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2021-12-17T12:14:44-08:00
New Revision: 2a844c8869909960fb006a668d30c7349f55ee7e

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

LOG: Fix macOS buildbots after https://reviews.llvm.org/D115324.

The test was attempting to make a universal x86_64/arm64 binary, but some older 
bots don't have a macOS SDK that can handle this. Switching over to using a 
yaml file instead should solve the problem.

Added: 
lldb/test/API/functionalities/module_cache/universal/universal.yaml

Modified: 

lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py

Removed: 
lldb/test/API/functionalities/module_cache/universal/Makefile
lldb/test/API/functionalities/module_cache/universal/main.c



diff  --git a/lldb/test/API/functionalities/module_cache/universal/Makefile 
b/lldb/test/API/functionalities/module_cache/universal/Makefile
deleted file mode 100644
index 71e8469bf1a88..0
--- a/lldb/test/API/functionalities/module_cache/universal/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-EXE := testit
-
-include Makefile.rules
-
-all: testit
-
-testit: testit.x86_64 testit.arm64
-   lipo -create -o testit $^
-
-testit.arm64: testit.arm64.o
-   $(CC) -isysroot $(SDKROOT) -target arm64-apple-macosx10.9 -o 
testit.arm64 $<
-
-testit.x86_64: testit.x86_64.o
-   $(CC) -isysroot $(SDKROOT) -target x86_64-apple-macosx10.9 -o 
testit.x86_64 $<
-
-testit.arm64.o: main.c
-   $(CC) -isysroot $(SDKROOT) -g -O0 -target arm64-apple-macosx10.9 -c -o 
testit.arm64.o $<
-
-testit.x86_64.o: main.c
-   $(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64-apple-macosx10.9 -c -o 
testit.x86_64.o $<

diff  --git 
a/lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py
 
b/lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py
index 3898a5f292ac8..a39db4d1164b5 100644
--- 
a/lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py
+++ 
b/lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py
@@ -22,8 +22,6 @@ def setUp(self):
 # artifacts directory so no other tests are interfered with.
 self.runCmd('settings set symbols.lldb-index-cache-path "%s"' % 
(self.cache_dir))
 self.runCmd('settings set symbols.enable-lldb-index-cache true')
-self.build()
-
 
 def get_module_cache_files(self, basename):
 module_file_glob = os.path.join(self.cache_dir, "llvmcache-*%s*" % 
(basename))
@@ -43,8 +41,12 @@ def test(self):
 they will each have a unique directory.
 """
 exe_basename = "testit"
+src_dir = self.getSourceDir()
+yaml_path = os.path.join(src_dir, "universal.yaml")
+yaml_base, ext = os.path.splitext(yaml_path)
 exe = self.getBuildArtifact(exe_basename)
-
+self.yaml2obj(yaml_path, exe)
+self.assertTrue(os.path.exists(exe))
 # Create a module with no depedencies.
 self.runCmd('target create -d --arch x86_64 %s' % (exe))
 self.runCmd('image dump symtab %s' % (exe_basename))

diff  --git a/lldb/test/API/functionalities/module_cache/universal/main.c 
b/lldb/test/API/functionalities/module_cache/universal/main.c
deleted file mode 100644
index 8e93a53a118ba..0
--- a/lldb/test/API/functionalities/module_cache/universal/main.c
+++ /dev/null
@@ -1,3 +0,0 @@
-int main(int argc, const char **argv) {
-  return 0;
-}

diff  --git 
a/lldb/test/API/functionalities/module_cache/universal/universal.yaml 
b/lldb/test/API/functionalities/module_cache/universal/universal.yaml
new file mode 100644
index 0..c36194901d74b
--- /dev/null
+++ b/lldb/test/API/functionalities/module_cache/universal/universal.yaml
@@ -0,0 +1,523 @@
+--- !fat-mach-o
+FatHeader:
+  magic:   0xCAFEBABE
+  nfat_arch:   2
+FatArchs:
+  - cputype: 0x107
+cpusubtype:  0x3
+offset:  0x4000
+size:16944
+align:   14
+  - cputype: 0x10C
+cpusubtype:  0x0
+offset:  0xC000
+size:17225
+align:   14
+Slices:
+  - !mach-o
+FileHeader:
+  magic:   0xFEEDFACF
+  cputype: 0x107
+  cpusubtype:  0x3
+  filetype:0x2
+  ncmds:   14
+  sizeofcmds:  728
+  flags:   0x200085
+  reserved:0x0
+LoadCommands:
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __PAGEZERO
+vmaddr:  0
+vmsize:  4294967296
+fileoff: 0
+filesize:0
+maxprot: 0
+initprot:0
+nsects:  0
+flags:   

[Lldb-commits] [PATCH] D115324: Added the ability to cache the finalized symbol tables subsequent debug sessions to start faster.

2021-12-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Some mac buildbots were failing due to 
"lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py"
 failing to build the executable with the makefile due to lack of arm64 support 
in the SDK that was being used.

commit 2a844c8869909960fb006a668d30c7349f55ee7e 
 (HEAD -> 
main, origin/main, origin/HEAD)
Author: Greg Clayton 
Date:   Fri Dec 17 12:14:44 2021 -0800

  Fix macOS buildbots after https://reviews.llvm.org/D115324.
  
  The test was attempting to make a universal x86_64/arm64 binary, but some 
older bots don't have a macOS SDK that can handle this. Switching over to using 
a yaml file instead should solve the problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115324

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


[Lldb-commits] [lldb] 67bc243 - [lldb] Remove --reproducer-finalize and associated functionality

2021-12-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-12-17T12:19:55-08:00
New Revision: 67bc2435359a8f09f607d6c3fc0a196bd496d31f

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

LOG: [lldb] Remove --reproducer-finalize and associated functionality

This is part of a bigger rework of the reproducer feature. See [1] for
more details.

[1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html

Added: 


Modified: 
lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
lldb/tools/driver/Driver.cpp
lldb/tools/driver/Options.td

Removed: 
lldb/test/Shell/Reproducer/TestCrash.test
lldb/test/Shell/Reproducer/TestFinalize.test



diff  --git a/lldb/test/Shell/Reproducer/TestCrash.test 
b/lldb/test/Shell/Reproducer/TestCrash.test
deleted file mode 100644
index 530dd8ad398d8..0
--- a/lldb/test/Shell/Reproducer/TestCrash.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# This tests that a reproducer is generated when LLDB crashes.
-
-# Start clean.
-# RUN: rm -rf %t.repro
-
-# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s 
SIGSEGV' | FileCheck %s
-# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s 
SIGILL' | FileCheck %s
-
-# CHECK: 
-# CHECK: Crash reproducer for
-# CHECK: Reproducer written to
-# CHECK: 
-
-# RUN: %lldb -b --capture --capture-path %t.repro 
--reproducer-no-generate-on-signal -o 'reproducer xcrash -s SIGSEGV' | 
FileCheck %s --check-prefix NOHANDLER
-
-# NOHANDLER-NOT: Crash reproducer
-# NOHANDLER-NOT: Reproducer written

diff  --git a/lldb/test/Shell/Reproducer/TestFinalize.test 
b/lldb/test/Shell/Reproducer/TestFinalize.test
deleted file mode 100644
index 4bfe82b56f171..0
--- a/lldb/test/Shell/Reproducer/TestFinalize.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# RUN: mkdir -p %t.repro
-# RUN: touch %t.known.file
-# RUN: mkdir -p %t.known.dir
-# RUN: touch %t.repro/index.yaml
-# RUN: echo -n "%t.known.file" > %t.repro/files.txt
-# RUN: echo -n "%t.known.dir" > %t.repro/dirs.txt
-
-# RUN: %lldb --reproducer-finalize %t.repro 2>&1 | FileCheck %s
-# CHECK-NOT: error
-# CHECK: Reproducer written to
-
-# RUN: echo "CHECK-DAG: %t.known.file" > %t.filecheck
-# RUN: echo "CHECK-DAG %t.known.dir" >> %t.filecheck
-# RUN: cat %t.repro/files.yaml | FileCheck %t.filecheck

diff  --git a/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test 
b/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
index 683a7e2f55297..8a6b03c4e22d7 100644
--- a/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
+++ b/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
@@ -13,11 +13,6 @@
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path 
%t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
 # RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK 
--check-prefix REPLAY
 
-# Test crash reproducer.
-# RUN: rm -rf %t.repro
-# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCrashCapture.in --capture 
--capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK 
--check-prefix CAPTURE
-# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK 
--check-prefix REPLAY
-
 # CHECK: Breakpoint 1
 # CHECK: Process {{.*}} stopped
 # CHECK: Process {{.*}} launched

diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 977cc306bb4e6..86a74ae285e80 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -736,31 +736,6 @@ static void printHelp(LLDBOptTable &table, llvm::StringRef 
tool_name) {
 
 static llvm::Optional InitializeReproducer(llvm::StringRef argv0,
 opt::InputArgList &input_args) 
{
-  if (auto *finalize_path = input_args.getLastArg(OPT_reproducer_finalize)) {
-if (const char *error = SBReproducer::Finalize(finalize_path->getValue())) 
{
-  WithColor::error() << "reproducer finalization failed: " << error << 
'\n';
-  return 1;
-}
-
-llvm::outs() << "\n";
-llvm::outs() << "Crash reproducer for ";
-llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
-llvm::outs() << '\n';
-llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
- << "'\n";
-llvm::outs() << '\n';
-llvm::outs() << "Before attaching the reproducer to a bug report:\n";
-llvm::outs() << " - Look at the directory to ensure you're willing to "
-"share its content.\n";
-llvm::outs()
-<< " - Make sure the reproducer works by replaying the reproducer.\n";
-llvm::outs() << '\n';
-llvm::outs() << "Replay the reproducer with the following command:\n";
-llvm::outs() << argv0 << " -replay " << finalize_path->getValue() << "\n";
-llvm::

[Lldb-commits] [PATCH] D115951: Cache the manual DWARF index out to the LLDB cache directory when the LLDB index cache is enabled.

2021-12-17 Thread walter erquinigo via Phabricator via lldb-commits
wallace added inline comments.



Comment at: lldb/include/lldb/Symbol/Symtab.h:279
   m_mutex; // Provide thread safety for this symbol table
-  bool m_file_addr_to_index_computed : 1, m_name_indexes_computed : 1;
+  bool m_file_addr_to_index_computed : 1, m_name_indexes_computed : 1,
+m_loaded_from_cache : 1, m_saved_to_cache : 1;

teach me C++. What is this? Is everything stored as part of a single 8 byte 
section in memory?



Comment at: 
lldb/test/API/functionalities/module_cache/debug_index/TestDebugIndexCache.py:40-41
+command = "statistics dump "
+if f:
+f.write('(lldb) %s\n' % (command))
+self.ci.HandleCommand(command, return_obj, False)

i'm curious, why do you do that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115951

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


[Lldb-commits] [PATCH] D115974: [formatters] Improve documentation

2021-12-17 Thread walter erquinigo via Phabricator via lldb-commits
wallace created this revision.
wallace added a reviewer: clayborg.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This adds some important remarks to the data formatter documentation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115974

Files:
  lldb/docs/use/variable.rst

Index: lldb/docs/use/variable.rst
===
--- lldb/docs/use/variable.rst
+++ lldb/docs/use/variable.rst
@@ -29,6 +29,52 @@
(uint8_t) x = chr='a' dec=65 hex=0x41
(intptr_t) y = 0x76f919f
 
+In addition, some data structures can encode their data in a way that is not easily
+readable to the user, in which case a data formatter could be used to show
+the data in a human readable way. For example, without a formatter, printing a
+``std::deque`` with the elements ``{2, 3, 4, 5, 6}`` would result in something
+like:
+
+::
+
+   (lldb) p a_deque
+   (std::deque >) $0 = {
+  std::_Deque_base > = {
+ _M_impl = {
+_M_map = 0x0062ceb0
+_M_map_size = 8
+_M_start = {
+   _M_cur = 0x0062cf00
+   _M_first = 0x0062cf00
+   _M_last = 0x0062d2f4
+   _M_node = 0x0062cec8
+}
+_M_finish = {
+   _M_cur = 0x0062d300
+   _M_first = 0x0062d300
+   _M_last = 0x0062d6f4
+   _M_node = 0x0062ced0
+}
+ }
+  }
+   }
+
+which is very hard to make sense of. On the other hand, a proper formatter could
+produce the following output
+
+::
+
+   (lldb) p a_deque
+   (std::deque >) $0 = size=5 {
+  [0] = 2
+  [1] = 3
+  [2] = 4
+  [3] = 5
+  [4] = 6
+   }
+
+which is what the user would expect from a good debugger.
+
 There are several features related to data visualization: formats, summaries,
 filters, synthetic children.
 
@@ -871,18 +917,23 @@
  this call should return a new LLDB SBValue object representing the child at the index given as argument
   def update(self):
  this call should be used to update the internal state of this Python object whenever the state of the variables in LLDB changes.[1]
+ Also, this method is invoked before any other method in the interface.
   def has_children(self):
  this call should return True if this object might have children, and False if this object can be guaranteed not to have children.[2]
   def get_value(self):
  this call can return an SBValue to be presented as the value of the synthetic value under consideration.[3]
 
-[1] This method is optional. Also, it may optionally choose to return a value
-(starting with SVN rev153061/LLDB-134). If it returns a value, and that value
-is True, LLDB will be allowed to cache the children and the children count it
-previously obtained, and will not return to the provider class to ask. If
-nothing, None, or anything other than True is returned, LLDB will discard the
-cached information and ask. Regardless, whenever necessary LLDB will call
-update.
+As a warning, exceptions that are thrown by python formatters are caught silently by LLDB and should be handled appropriately
+by the formatter itself. Being more specific, in case of exceptions, LLDB might assume that the given object has no children
+or it might skip printing some children.
+
+[1] This method is optional. Also, a boolean value must be returned
+(starting with SVN rev153061/LLDB-134). If ``False`` is returned, then whenever
+the process reaches a new stop, this method will be invoked again to generate an
+updated list of the children for a given variable. Otherwise, if ``True`` is returned,
+then the value is cached and this method won't be called again, effectively freezing
+the state of the value in subsequent stops. Beware that returning ``True`` incorrectly
+could show misleading information to the user.
 
 [2] This method is optional (starting with SVN rev166495/LLDB-175). While
 implementing it in terms of num_children is acceptable, implementors are
@@ -972,6 +1023,22 @@
   (int) [3] = 1234
}
 
+It's worth mentioning that LLDB invokes the synthetic child provider before invoking the
+summary string provider, which allows the latter to have access to the actual displayable
+children. This applies to both inlined summary strings and python-based summary providers.
+
+
+As a warning, when programmatically accessing the children or children count of a
+variable that has a synthetic child provider, notice that LLDB hides the actual
+raw children. For example, suppose we have a ``std::vector``, which has an actual in-memory property
+``__begin`` marking the beginning of its data. After the synthetic child provider is
+executed, the ``std::vector`` variable won't show ``__begin`` as child anymore, even through
+the SB API. It will have

[Lldb-commits] [PATCH] D115974: [formatters] Improve documentation

2021-12-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Please reflow your text to fit in the existing 80 col limit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115974

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


[Lldb-commits] [lldb] fa12606 - [lldb] Remove reproducer replay functionality

2021-12-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-12-17T17:14:52-08:00
New Revision: fa1260697ec80ac0586d67c0de8758818ca865c0

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

LOG: [lldb] Remove reproducer replay functionality

This is part of a bigger rework of the reproducer feature. See [1] for
more details.

[1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html

Added: 


Modified: 
lldb/include/lldb/Utility/Reproducer.h
lldb/source/API/SBReproducer.cpp
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Utility/Reproducer.cpp
lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py
lldb/test/Shell/Driver/TestHelp.test
lldb/test/Shell/Reproducer/Modules/TestModuleCXX.test
lldb/test/Shell/Reproducer/TestDriverOptions.test
lldb/test/Shell/Reproducer/TestDump.test
lldb/test/Shell/Reproducer/TestFileRepro.test
lldb/test/Shell/Reproducer/TestHomeDir.test
lldb/test/Shell/Reproducer/TestVerify.test
lldb/test/Shell/Reproducer/TestVersionCheck.test
lldb/test/Shell/Reproducer/TestWorkingDir.test
lldb/tools/driver/Driver.cpp
lldb/tools/driver/Options.td
lldb/unittests/Utility/ReproducerTest.cpp

Removed: 
lldb/test/Shell/Reproducer/Functionalities/Inputs/DataFormatter.in
lldb/test/Shell/Reproducer/Functionalities/Inputs/ExpressionEvaluation.in
lldb/test/Shell/Reproducer/Functionalities/Inputs/foo.cpp
lldb/test/Shell/Reproducer/Functionalities/Inputs/stepping.c
lldb/test/Shell/Reproducer/Functionalities/TestDataFormatter.test
lldb/test/Shell/Reproducer/Functionalities/TestExpressionEvaluation.test
lldb/test/Shell/Reproducer/Functionalities/TestImageList.test
lldb/test/Shell/Reproducer/Functionalities/TestStepping.test
lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
lldb/test/Shell/Reproducer/TestMultipleTargets.test
lldb/test/Shell/Reproducer/TestProcessList.test
lldb/test/Shell/Reproducer/TestRelativePath.test
lldb/test/Shell/Reproducer/TestReuseDirectory.test
lldb/test/Shell/Reproducer/TestSynchronous.test



diff  --git a/lldb/include/lldb/Utility/Reproducer.h 
b/lldb/include/lldb/Utility/Reproducer.h
index 4659254e57d6f..35043d6885111 100644
--- a/lldb/include/lldb/Utility/Reproducer.h
+++ b/lldb/include/lldb/Utility/Reproducer.h
@@ -29,8 +29,6 @@ class Reproducer;
 
 enum class ReproducerMode {
   Capture,
-  Replay,
-  PassiveReplay,
   Off,
 };
 
@@ -179,15 +177,12 @@ class Loader final {
 
   const FileSpec &GetRoot() const { return m_root; }
 
-  bool IsPassiveReplay() const { return m_passive_replay; }
-
 private:
   bool HasFile(llvm::StringRef file);
 
   FileSpec m_root;
   std::vector m_files;
   bool m_loaded;
-  bool m_passive_replay;
 };
 
 /// The reproducer enables clients to obtain access to the Generator and
@@ -212,11 +207,9 @@ class Reproducer {
   FileSpec GetReproducerPath() const;
 
   bool IsCapturing() { return static_cast(m_generator); };
-  bool IsReplaying() { return static_cast(m_loader); };
 
 protected:
   llvm::Error SetCapture(llvm::Optional root);
-  llvm::Error SetReplay(llvm::Optional root, bool passive = false);
 
 private:
   static llvm::Optional &InstanceImpl();

diff  --git a/lldb/source/API/SBReproducer.cpp 
b/lldb/source/API/SBReproducer.cpp
index 3bd82df5c9065..c9c9a03c694a9 100644
--- a/lldb/source/API/SBReproducer.cpp
+++ b/lldb/source/API/SBReproducer.cpp
@@ -165,111 +165,24 @@ const char *SBReproducer::Capture(const char *path) {
 }
 
 const char *SBReproducer::PassiveReplay(const char *path) {
-  static std::string error;
-  if (auto e = Reproducer::Initialize(ReproducerMode::PassiveReplay,
-  FileSpec(path))) {
-error = llvm::toString(std::move(e));
-return error.c_str();
-  }
-
-  if (auto *l = lldb_private::repro::Reproducer::Instance().GetLoader()) {
-FileSpec file = l->GetFile();
-auto error_or_file = llvm::MemoryBuffer::getFile(file.GetPath());
-if (!error_or_file) {
-  error =
-  "unable to read SB API data: " + error_or_file.getError().message();
-  return error.c_str();
-}
-static ReplayData r(std::move(*error_or_file));
-InstrumentationData::Initialize(r.GetDeserializer(), r.GetRegistry());
-  }
-
-  return nullptr;
+  return "Reproducer replay has been removed";
 }
 
 const char *SBReproducer::Replay(const char *path) {
-  SBReplayOptions options;
-  return SBReproducer::Replay(path, options);
+  return "Reproducer replay has been removed";
 }
 
 const char *SBReproducer::Replay(const char *path, bool skip_version_c

[Lldb-commits] [PATCH] D115974: [formatters] Improve documentation

2021-12-17 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Those are useful tips, thanks!




Comment at: lldb/docs/use/variable.rst:77
+which is what the user would expect from a good debugger.
+
 There are several features related to data visualization: formats, summaries,

This is a nice example, but we should also/instead use an example with `v` for 
two reasons.

First, `p` is super overkill as a way to print a local variable called a_deque, 
`v` is the preferred tool.
Second, `v` actually understands synthetic children, so you can also do:

(lldb) v a_deque[0]

if you only want to see the first element, etc.

This can be convenient, and may not be as widely known.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115974

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


[Lldb-commits] [PATCH] D115974: [formatters] Improve documentation

2021-12-17 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: lldb/docs/use/variable.rst:77
+which is what the user would expect from a good debugger.
+
 There are several features related to data visualization: formats, summaries,

jingham wrote:
> This is a nice example, but we should also/instead use an example with `v` 
> for two reasons.
> 
> First, `p` is super overkill as a way to print a local variable called 
> a_deque, `v` is the preferred tool.
> Second, `v` actually understands synthetic children, so you can also do:
> 
> (lldb) v a_deque[0]
> 
> if you only want to see the first element, etc.
> 
> This can be convenient, and may not be as widely known.
It also might be worth pointing out - since you have the example on hand - that 
the "size=5" bit of that display is the work of the summary formatter?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115974

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