[Lldb-commits] [lldb] r342757 - build: add libedit to include paths

2018-09-21 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 21 11:34:41 2018
New Revision: 342757

URL: http://llvm.org/viewvc/llvm-project?rev=342757&view=rev
Log:
build: add libedit to include paths

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

Modified:
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Interpreter/CMakeLists.txt

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=342757&r1=342756&r2=342757&view=diff
==
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Fri Sep 21 11:34:41 2018
@@ -80,3 +80,7 @@ add_lldb_library(lldbCore
 # Needed to properly resolve references in a debug build.
 # TODO: Remove once we have better layering
 set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 4)
+
+if (NOT LLDB_DISABLE_LIBEDIT)
+  target_include_directories(lldbCore PRIVATE ${libedit_INCLUDE_DIRS})
+endif()

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=342757&r1=342756&r2=342757&view=diff
==
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Fri Sep 21 11:34:41 2018
@@ -174,3 +174,7 @@ add_lldb_library(lldbHost
 Object
 Support
   )
+
+if (NOT LLDB_DISABLE_LIBEDIT)
+  target_include_directories(lldbHost PUBLIC ${libedit_INCLUDE_DIRS})
+endif()

Modified: lldb/trunk/source/Interpreter/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CMakeLists.txt?rev=342757&r1=342756&r2=342757&view=diff
==
--- lldb/trunk/source/Interpreter/CMakeLists.txt (original)
+++ lldb/trunk/source/Interpreter/CMakeLists.txt Fri Sep 21 11:34:41 2018
@@ -55,3 +55,7 @@ add_lldb_library(lldbInterpreter
   LINK_COMPONENTS
 Support
   )
+
+if (NOT LLDB_DISABLE_LIBEDIT)
+  target_include_directories(lldbInterpreter PRIVATE ${libedit_INCLUDE_DIRS})
+endif()
\ No newline at end of file


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


[Lldb-commits] [lldb] r342762 - Move architecture-specific address adjustment to architecture plugins

2018-09-21 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 21 11:56:44 2018
New Revision: 342762

URL: http://llvm.org/viewvc/llvm-project?rev=342762&view=rev
Log:
Move architecture-specific address adjustment to architecture plugins

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

Added:
lldb/trunk/source/Plugins/Architecture/Mips/
lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.h
lldb/trunk/source/Plugins/Architecture/Mips/CMakeLists.txt
Modified:
lldb/trunk/include/lldb/Core/Architecture.h
lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.h
lldb/trunk/source/Plugins/Architecture/CMakeLists.txt
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Core/Architecture.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Architecture.h?rev=342762&r1=342761&r2=342762&view=diff
==
--- lldb/trunk/include/lldb/Core/Architecture.h (original)
+++ lldb/trunk/include/lldb/Core/Architecture.h Fri Sep 21 11:56:44 2018
@@ -67,6 +67,51 @@ public:
   virtual void AdjustBreakpointAddress(const Symbol &func,
Address &addr) const {}
 
+
+  //--
+  /// Get \a load_addr as a callable code load address for this target
+  ///
+  /// Take \a load_addr and potentially add any address bits that are
+  /// needed to make the address callable. For ARM this can set bit
+  /// zero (if it already isn't) if \a load_addr is a thumb function.
+  /// If \a addr_class is set to AddressClass::eInvalid, then the address
+  /// adjustment will always happen. If it is set to an address class
+  /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
+  /// returned.
+  //--
+  virtual lldb::addr_t GetCallableLoadAddress(
+  lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) 
const {
+return addr;
+  }
+
+  //--
+  /// Get \a load_addr as an opcode for this target.
+  ///
+  /// Take \a load_addr and potentially strip any address bits that are
+  /// needed to make the address point to an opcode. For ARM this can
+  /// clear bit zero (if it already isn't) if \a load_addr is a
+  /// thumb function and load_addr is in code.
+  /// If \a addr_class is set to AddressClass::eInvalid, then the address
+  /// adjustment will always happen. If it is set to an address class
+  /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
+  /// returned.
+  //--
+
+  virtual lldb::addr_t GetOpcodeLoadAddress(
+  lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) 
const {
+return addr;
+  }
+
+  // Get load_addr as breakable load address for this target. Take a addr and
+  // check if for any reason there is a better address than this to put a
+  // breakpoint on. If there is then return that address. For MIPS, if
+  // instruction at addr is a delay slot instruction then this method will find
+  // the address of its previous instruction and return that address.
+  virtual lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr,
+   Target &target) const {
+return addr;
+  }
+
 private:
   Architecture(const Architecture &) = delete;
   void operator=(const Architecture &) = delete;

Modified: lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp?rev=342762&r1=342761&r2=342762&view=diff
==
--- lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp (original)
+++ lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp Fri Sep 21 
11:56:44 2018
@@ -126,3 +126,33 @@ void ArchitectureArm::OverrideStopInfo(T
 }
   }
 }
+
+addr_t ArchitectureArm::GetCallableLoadAddress(addr_t code_addr,
+   AddressClass addr_class) const {
+  bool is_alternate_isa = false;
+
+  switch (addr_class) {
+  case AddressClass::eData:
+  case AddressClass::eDebug:
+return LLDB_INVALID_ADDRESS;
+  case AddressClass::eCodeAlternateISA:
+is_alternate_isa = true;
+break;
+  default: break;
+  }
+
+  if ((code_addr & 2u) || is_alternate_isa)
+return code_addr | 1u;
+  return code_addr;
+}
+
+addr_t ArchitectureArm::GetOpcodeLoadAddress(addr_t opcode_addr,
+ AddressClass addr_class) const {
+  switch (addr_class) {
+  case AddressClass::eData:
+  case AddressClass::eDebug:
+return LLDB_INVALID_ADDRESS;
+ 

[Lldb-commits] [lldb] r342959 - [Swig] Merge typemaps with same bodies

2018-09-25 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Sep 25 03:30:32 2018
New Revision: 342959

URL: http://llvm.org/viewvc/llvm-project?rev=342959&view=rev
Log:
[Swig] Merge typemaps with same bodies

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

Modified:
lldb/trunk/scripts/Python/python-typemaps.swig

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=342959&r1=342958&r2=342959&view=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Tue Sep 25 03:30:32 2018
@@ -139,30 +139,9 @@
 
 // typemap for an outgoing buffer
 // See also SBEvent::SBEvent(uint32_t event, const char *cstr, uint32_t 
cstr_len).
-%typemap(in) (const char *cstr, uint32_t cstr_len) {
-   using namespace lldb_private;
-   if (PythonString::Check($input)) {
-  PythonString str(PyRefType::Borrowed, $input);
-  $1 = (char*)str.GetString().data();
-  $2 = str.GetSize();
-   }
-   else if(PythonByteArray::Check($input)) {
-  PythonByteArray bytearray(PyRefType::Borrowed, $input);
-  $1 = (char*)bytearray.GetBytes().data();
-  $2 = bytearray.GetSize();
-   }
-   else if (PythonBytes::Check($input)) {
-  PythonBytes bytes(PyRefType::Borrowed, $input);
-  $1 = (char*)bytes.GetBytes().data();
-  $2 = bytes.GetSize();
-   }
-   else {
-  PyErr_SetString(PyExc_ValueError, "Expecting a string");
-  return NULL;
-   }
-}
 // Ditto for SBProcess::PutSTDIN(const char *src, size_t src_len).
-%typemap(in) (const char *src, size_t src_len) {
+%typemap(in) (const char *cstr, uint32_t cstr_len),
+ (const char *src, size_t src_len) {
using namespace lldb_private;
if (PythonString::Check($input)) {
   PythonString str(PyRefType::Borrowed, $input);
@@ -184,32 +163,9 @@
   return NULL;
}
 }
-// And SBProcess::WriteMemory.
-%typemap(in) (const void *buf, size_t size) {
-   using namespace lldb_private;
-   if (PythonString::Check($input)) {
-  PythonString str(PyRefType::Borrowed, $input);
-  $1 = (void*)str.GetString().data();
-  $2 = str.GetSize();
-   }
-   else if(PythonByteArray::Check($input)) {
-  PythonByteArray bytearray(PyRefType::Borrowed, $input);
-  $1 = (void*)bytearray.GetBytes().data();
-  $2 = bytearray.GetSize();
-   }
-   else if (PythonBytes::Check($input)) {
-  PythonBytes bytes(PyRefType::Borrowed, $input);
-  $1 = (void*)bytes.GetBytes().data();
-  $2 = bytes.GetSize();
-   }
-   else {
-  PyErr_SetString(PyExc_ValueError, "Expecting a buffer");
-  return NULL;
-   }
-}
-
-// For SBDebugger::DispatchInput
-%typemap(in) (const void *data, size_t data_len) {
+// For SBProcess::WriteMemory, SBTarget::GetInstructions and 
SBDebugger::DispatchInput.
+%typemap(in) (const void *buf, size_t size),
+ (const void *data, size_t data_len) {
using namespace lldb_private;
if (PythonString::Check($input)) {
   PythonString str(PyRefType::Borrowed, $input);
@@ -264,142 +220,70 @@
free($1);
 }
 
-// these typemaps allow Python users to pass list objects
-// and have them turn into C++ arrays (this is useful, for instance
-// when creating SBData objects from lists of numbers)
-%typemap(in) (uint64_t* array, size_t array_len) {
-  /* Check if is a list  */
-  if (PyList_Check($input)) {
-int size = PyList_Size($input);
-int i = 0;
-$2 = size;
-$1 = (uint64_t*) malloc(size * sizeof(uint64_t));
-for (i = 0; i < size; i++) {
-  PyObject *o = PyList_GetItem($input,i);
-  if (PyInt_Check(o)) {
-$1[i] = PyInt_AsLong(o);
-  }
-  else if (PyLong_Check(o)) {
-$1[i] = PyLong_AsUnsignedLongLong(o);
-  }
-  else {
-PyErr_SetString(PyExc_TypeError,"list must contain numbers");
-free($1);
-return NULL;
-  }
-
-  if (PyErr_Occurred()) {
-free($1);
-return NULL;
-  }
-}
-  } else if ($input == Py_None) {
-$1 =  NULL;
-$2 = 0;
-  } else {
-PyErr_SetString(PyExc_TypeError,"not a list");
-return NULL;
-  }
+%{
+namespace {
+template 
+T PyLongAsT(PyObject *obj) {
+  static_assert(true, "unsupported type"); 
 }
 
-%typemap(freearg) (uint64_t* array, size_t array_len) {
-  free($1);
+template <> uint64_t PyLongAsT(PyObject *obj) {
+  return static_cast(PyLong_AsUnsignedLongLong(obj));
 }
 
-%typemap(in) (uint32_t* array, size_t array_len) {
-  /* Check if is a list  */
-  if (PyList_Check($input)) {
-int size = PyList_Size($input);
-int i = 0;
-$2 = size;
-$1 = (uint32_t*) malloc(size * sizeof(uint32_t));
-for (i = 0; i < size; i++) {
-  PyObject *o = PyList_GetItem($input,i);
-  if (PyInt_Check(o)) {
-$1[i] = PyInt_AsLong(o);
-  }
-  else if (PyLong_Check(o)) {
-$1[i] = PyLong_AsUnsignedLong(o);
-  }
-  else {
- 

[Lldb-commits] [lldb] r342998 - Replace boolean parameter with enum value according r342633

2018-09-25 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Sep 25 10:59:44 2018
New Revision: 342998

URL: http://llvm.org/viewvc/llvm-project?rev=342998&view=rev
Log:
Replace boolean parameter with enum value according r342633

Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=342998&r1=342997&r2=342998&view=diff
==
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Tue Sep 25 
10:59:44 2018
@@ -335,7 +335,7 @@ ProcessFreeBSD::DoAttachToProcessWithID(
 GetTarget().SetArchitecture(module_arch);
 
   // Initialize the target module list
-  GetTarget().SetExecutableModule(exe_module_sp, true);
+  GetTarget().SetExecutableModule(exe_module_sp, eLoadDependentsYes);
 
   SetSTDIOFileDescriptor(m_monitor->GetTerminalFD());
 
@@ -519,7 +519,7 @@ void ProcessFreeBSD::DoDidExec() {
   executable_search_paths.GetSize() ? &executable_search_paths : NULL);
   if (!error.Success())
 return;
-  target->SetExecutableModule(exe_module_sp, true);
+  target->SetExecutableModule(exe_module_sp, eLoadDependentsYes);
 }
   }
 }


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


[Lldb-commits] [lldb] r343134 - Fix OSX build after r343130

2018-09-26 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Sep 26 12:41:57 2018
New Revision: 343134

URL: http://llvm.org/viewvc/llvm-project?rev=343134&view=rev
Log:
Fix OSX build after r343130

Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=343134&r1=343133&r2=343134&view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp 
(original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Wed Sep 
26 12:41:57 2018
@@ -188,12 +188,12 @@ const char *PlatformDarwinKernel::GetDes
 
 static PropertyDefinition g_properties[] = {
 {"search-locally-for-kexts", OptionValue::eTypeBoolean, true, true, NULL,
- NULL, "Automatically search for kexts on the local system when doing "
+ {}, "Automatically search for kexts on the local system when doing "
"kernel debugging."},
-{"kext-directories", OptionValue::eTypeFileSpecList, false, 0, NULL, NULL,
+{"kext-directories", OptionValue::eTypeFileSpecList, false, 0, NULL, {},
  "Directories/KDKs to search for kexts in when starting a kernel debug "
  "session."},
-{NULL, OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL}};
+{NULL, OptionValue::eTypeInvalid, false, 0, NULL, {}, NULL}};
 
 enum { ePropertySearchForKexts = 0, ePropertyKextDirectories };
 


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


[Lldb-commits] [lldb] r343141 - Fix ProcessKDP after r343130

2018-09-26 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Sep 26 13:31:39 2018
New Revision: 343141

URL: http://llvm.org/viewvc/llvm-project?rev=343141&view=rev
Log:
Fix ProcessKDP after r343130

Modified:
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=343141&r1=343140&r2=343141&view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Wed Sep 26 
13:31:39 2018
@@ -56,9 +56,9 @@ using namespace lldb_private;
 namespace {
 
 static PropertyDefinition g_properties[] = {
-{"packet-timeout", OptionValue::eTypeUInt64, true, 5, NULL, NULL,
+{"packet-timeout", OptionValue::eTypeUInt64, true, 5, NULL, {},
  "Specify the default packet timeout in seconds."},
-{NULL, OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL}};
+{NULL, OptionValue::eTypeInvalid, false, 0, NULL, {}, NULL}};
 
 enum { ePropertyPacketTimeout };
 


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


[Lldb-commits] [lldb] r343181 - Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef

2018-09-27 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Sep 27 00:11:58 2018
New Revision: 343181

URL: http://llvm.org/viewvc/llvm-project?rev=343181&view=rev
Log:
Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef

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


Modified:
lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
lldb/trunk/include/lldb/Interpreter/Property.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/OptionValueProperties.cpp

lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=343181&r1=343180&r2=343181&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Thu Sep 27 
00:11:58 2018
@@ -62,7 +62,7 @@ public:
   void Apropos(llvm::StringRef keyword,
std::vector &matching_properties) const;
 
-  void Initialize(const PropertyDefinition *setting_definitions);
+  void Initialize(const PropertyDefinitions &setting_definitions);
 
   //bool
   //GetQualifiedName (Stream &strm);

Modified: lldb/trunk/include/lldb/Interpreter/Property.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Property.h?rev=343181&r1=343180&r2=343181&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/Property.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Property.h Thu Sep 27 00:11:58 2018
@@ -32,6 +32,8 @@ struct PropertyDefinition {
   const char *description;
 };
 
+using PropertyDefinitions = llvm::ArrayRef;
+
 class Property {
 public:
   Property(const PropertyDefinition &definition);

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=343181&r1=343180&r2=343181&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Sep 27 00:11:58 2018
@@ -278,8 +278,7 @@ static constexpr PropertyDefinition g_pr
 {"frame-format-unique", OptionValue::eTypeFormatEntity, true, 0,
  DEFAULT_FRAME_FORMAT_NO_ARGS, {},
  "The default frame format string to use when displaying stack frame"
- "information for threads from thread backtrace unique."},
-{nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, {}, nullptr}};
+ "information for threads from thread backtrace unique."}};
 
 enum {
   ePropertyAutoConfirm = 0,

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=343181&r1=343180&r2=343181&view=diff
==
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Thu Sep 27 00:11:58 2018
@@ -74,8 +74,7 @@ static constexpr PropertyDefinition g_pr
  "the UUID of the executable."},
 {"clang-modules-cache-path", OptionValue::eTypeFileSpec, true, 0, nullptr,
  {},
- "The path to the clang modules cache directory (-fmodules-cache-path)."},
-{nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+ "The path to the clang modules cache directory (-fmodules-cache-path)."}};
 
 enum { ePropertyEnableExternalLookup, ePropertyClangModulesCachePath };
 

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=343181&r1=343180&r2=343181&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Sep 27 00:11:58 
2018
@@ -89,8 +89,7 @@ static constexpr PropertyDefinition g_pr
  nullptr, {}, "If true, LLDB will stop running a 'command source' 

[Lldb-commits] [lldb] r343348 - Clean-up usage of OptionDefinition arrays

2018-09-28 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 28 10:58:16 2018
New Revision: 343348

URL: http://llvm.org/viewvc/llvm-project?rev=343348&view=rev
Log:
Clean-up usage of OptionDefinition arrays

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

Modified:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/Commands/CommandObjectDisassemble.h
lldb/trunk/source/Commands/CommandObjectExpression.h
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Fri Sep 28 10:58:16 2018
@@ -1131,10 +1131,6 @@ public:
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   bool m_rsync;
@@ -1160,10 +1156,6 @@ public:
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   bool m_ssh;
@@ -1187,10 +1179,6 @@ public:
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   std::string m_cache_dir;

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.h?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectDisassemble.h (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.h Fri Sep 28 10:58:16 
2018
@@ -65,7 +65,6 @@ public:
   // "at_pc".  This should be set
 // in SetOptionValue if anything the selects a location is set.
 lldb::addr_t symbol_containing_addr;
-static OptionDefinition g_option_table[];
   };
 
   CommandObjectDisassemble(CommandInterpreter &interpreter);

Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Sep 28 10:58:16 
2018
@@ -39,9 +39,6 @@ public:
 
 void OptionParsingStarting(ExecutionContext *execution_context) override;
 
-// Options table: Required for subclasses of Options.
-
-static OptionDefinition g_option_table[];
 bool top_level;
 bool unwind_on_error;
 bool ignore_breakpoints;

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Fri Sep 28 10:58:16 2018
@@ -9,6 +9,7 @@
 
 #include "Driver.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include 
+#include 
 
 #if !defined(__APPLE__)
 #include "llvm/Support/DataTypes.h"
@@ -87,7 +89,7 @@ typedef struct {
 #define LLDB_3_TO_5 LLDB_OPT_SET_3 | LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 #define LLDB_4_TO_5 LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 
-static OptionDefinition g_options[] = {
+static constexpr OptionDefinition g_options[] = {
 {LLDB_OPT_SET_1, true, "help", 'h', no_argument, 0, eArgTypeNone,
  "Prints out the usage information for the LLDB debugger."},
 {LLDB_OPT_SET_2, true, "version", 'v', no_argument, 0, eArgTypeNone,
@@ -159,8 +161,9 @@ static OptionDefinition g_options[] = {
 {LLDB_OPT_SET_7, true, "repl", 'r', optional_argument, 0, eArgTypeNone,
  "Runs lldb in REPL mode with a stub process."},
 {LLDB_OPT_SET_7, true, "repl-language", 'R', required_argument, 0,
- eArgTypeNone, "Chooses the language for the REPL."},
-{0, false, NULL, 0, 0, 0, eArgTypeNone, NULL}};
+ eArgTypeNone, "Chooses the language for the REPL."}};
+
+static constexpr auto g_num_options = 
sizeof(g_options)/sizeof(OptionDefinition);
 
 static const uint32_t last_option_set_with_args = 2;
 
@@ -229,8 +232,7 @@ void OutputFormattedUsageText(FILE *out,
   }
 }
 
-void ShowUsage(FILE *out, OptionDefinition *option

[Lldb-commits] [lldb] r343357 - [Driver] Remove unused declarations and "include" directives

2018-09-28 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 28 12:58:03 2018
New Revision: 343357

URL: http://llvm.org/viewvc/llvm-project?rev=343357&view=rev
Log:
[Driver] Remove unused declarations and "include" directives

Modified:
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=343357&r1=343356&r2=343357&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Fri Sep 28 12:58:03 2018
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: lldb/trunk/tools/driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.h?rev=343357&r1=343356&r2=343357&view=diff
==
--- lldb/trunk/tools/driver/Driver.h (original)
+++ lldb/trunk/tools/driver/Driver.h Fri Sep 28 12:58:03 2018
@@ -11,9 +11,7 @@
 #define lldb_Driver_h_
 
 #include "Platform.h"
-#include "lldb/Host/PseudoTerminal.h"
 
-#include 
 #include 
 #include 
 #include 
@@ -23,8 +21,6 @@
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBError.h"
 
-class IOChannel;
-
 class Driver : public lldb::SBBroadcaster {
 public:
   typedef enum CommandPlacement {
@@ -107,9 +103,6 @@ public:
 OptionSet m_seen_options;
   };
 
-  static lldb::SBError SetOptionValue(int option_idx, const char *option_arg,
-  Driver::OptionData &data);
-
   lldb::SBDebugger &GetDebugger() { return m_debugger; }
 
   void ResizeWindow(unsigned short col);
@@ -119,8 +112,6 @@ private:
   OptionData m_option_data;
 
   void ResetOptionValues();
-
-  void ReadyForCommand();
 };
 
 #endif // lldb_Driver_h_


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


[Lldb-commits] [lldb] r343500 - Fix build with GCC < 5.0 (PR39131)

2018-10-01 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Mon Oct  1 10:14:12 2018
New Revision: 343500

URL: http://llvm.org/viewvc/llvm-project?rev=343500&view=rev
Log:
Fix build with GCC < 5.0 (PR39131)






Modified:
lldb/trunk/source/Commands/CommandObjectType.cpp

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=343500&r1=343499&r2=343500&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Oct  1 10:14:12 2018
@@ -1055,7 +1055,7 @@ class CommandObjectTypeFormatterList : p
 }
 
 llvm::ArrayRef GetDefinitions() override {
-  static constexpr OptionDefinition g_option_table[] = {
+  static constexpr OptionDefinition g_option_table[] {
   // clang-format off
 {LLDB_OPT_SET_1, false, "category-regex", 'w', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "Only show 
categories matching this filter."},
 {LLDB_OPT_SET_2, false, "language",   'l', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "Only show 
the category for a specific language."}


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


[Lldb-commits] [lldb] r343609 - Remove GetPythonDir declaration from HostInfoBase class

2018-10-02 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Oct  2 10:24:58 2018
New Revision: 343609

URL: http://llvm.org/viewvc/llvm-project?rev=343609&view=rev
Log:
Remove GetPythonDir declaration from HostInfoBase class

Modified:
lldb/trunk/include/lldb/Host/HostInfoBase.h

Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=343609&r1=343608&r2=343609&view=diff
==
--- lldb/trunk/include/lldb/Host/HostInfoBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostInfoBase.h Tue Oct  2 10:24:58 2018
@@ -75,10 +75,6 @@ public:
   /// member of the FileSpec is filled in.
   static FileSpec GetHeaderDir();
 
-  /// Returns the directory containing the python modules. Only the directory
-  /// member of the FileSpec is filled in.
-  static FileSpec GetPythonDir();
-
   /// Returns the directory containing the system plugins. Only the directory
   /// member of the FileSpec is filled in.
   static FileSpec GetSystemPluginDir();


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


[Lldb-commits] [lldb] r343769 - Re-commit r343500 "Fix build with GCC < 5.0 (PR39131)"

2018-10-04 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Oct  4 04:39:55 2018
New Revision: 343769

URL: http://llvm.org/viewvc/llvm-project?rev=343769&view=rev
Log:
Re-commit r343500 "Fix build with GCC < 5.0 (PR39131)"

Occasionally didn't commit actual fix the first time.

Modified:
lldb/trunk/source/Commands/CommandObjectType.cpp

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=343769&r1=343768&r2=343769&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Thu Oct  4 04:39:55 2018
@@ -1013,6 +1013,14 @@ public:
 "type format clear", "Delete all existing format styles.") {}
 };
 
+
+static constexpr OptionDefinition g_type_formatter_list_options[] = {
+  // clang-format off
+  {LLDB_OPT_SET_1, false, "category-regex", 'w', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "Only show 
categories matching this filter."},
+  {LLDB_OPT_SET_2, false, "language",   'l', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "Only show 
the category for a specific language."}
+  // clang-format on
+};
+
 template 
 class CommandObjectTypeFormatterList : public CommandObjectParsed {
   typedef typename FormatterType::SharedPointer FormatterSharedPointer;
@@ -1055,13 +1063,7 @@ class CommandObjectTypeFormatterList : p
 }
 
 llvm::ArrayRef GetDefinitions() override {
-  static constexpr OptionDefinition g_option_table[] {
-  // clang-format off
-{LLDB_OPT_SET_1, false, "category-regex", 'w', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName, "Only show 
categories matching this filter."},
-{LLDB_OPT_SET_2, false, "language",   'l', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeLanguage, "Only show 
the category for a specific language."}
-  // clang-format on
-  };
-  return llvm::ArrayRef(g_option_table);
+  return llvm::makeArrayRef(g_type_formatter_list_options);
 }
 
 // Instance variables to hold the values for command options.


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


[Lldb-commits] [lldb] r347693 - [CMake] Pass full libedit path to linker

2018-11-27 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Nov 27 11:41:30 2018
New Revision: 347693

URL: http://llvm.org/viewvc/llvm-project?rev=347693&view=rev
Log:
[CMake] Pass full libedit path to linker

Otherwise, linker fails with "cannot find -ledit" in case of custom libedit 
installation.

Modified:
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Utility/CMakeLists.txt

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=347693&r1=347692&r2=347693&view=diff
==
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Tue Nov 27 11:41:30 2018
@@ -155,7 +155,7 @@ if (HAVE_LIBDL)
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (NOT LLDB_DISABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS edit)
+  list(APPEND EXTRA_LIBS ${libedit_LIBRARIES})
 endif()
 
 add_lldb_library(lldbHost

Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=347693&r1=347692&r2=347693&view=diff
==
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Tue Nov 27 11:41:30 2018
@@ -9,7 +9,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows"
 endif ()
 
 if (NOT LLDB_DISABLE_LIBEDIT)
-  list(APPEND LLDB_SYSTEM_LIBS edit)
+  list(APPEND LLDB_SYSTEM_LIBS ${libedit_LIBRARIES})
 endif()
 if (NOT LLDB_DISABLE_CURSES)
   list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})


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


[Lldb-commits] [lldb] r349036 - Add missing Initialize/Terminate for Architecture plugins

2018-12-13 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Dec 13 06:28:25 2018
New Revision: 349036

URL: http://llvm.org/viewvc/llvm-project?rev=349036&view=rev
Log:
Add missing Initialize/Terminate for Architecture plugins

Modified:
lldb/trunk/source/API/SystemInitializerFull.cpp

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=349036&r1=349035&r2=349036&view=diff
==
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Thu Dec 13 06:28:25 2018
@@ -40,6 +40,7 @@
 #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
 #include "Plugins/Architecture/Arm/ArchitectureArm.h"
+#include "Plugins/Architecture/Mips/ArchitectureMips.h"
 #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
 #include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
 #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h"
@@ -326,6 +327,7 @@ SystemInitializerFull::Initialize(const
   ABISysV_s390x::Initialize();
 
   ArchitectureArm::Initialize();
+  ArchitectureMips::Initialize();
   ArchitecturePPC64::Initialize();
 
   DisassemblerLLVMC::Initialize();
@@ -440,6 +442,10 @@ void SystemInitializerFull::Terminate()
 
   ClangASTContext::Terminate();
 
+  ArchitectureArm::Terminate();
+  ArchitectureMips::Terminate();
+  ArchitecturePPC64::Terminate();
+
   ABIMacOSX_i386::Terminate();
   ABIMacOSX_arm::Terminate();
   ABIMacOSX_arm64::Terminate();


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


[Lldb-commits] [lldb] r349208 - Update a comment according to r255360 "Remove -r and -R options from dotest.py"

2018-12-14 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Dec 14 15:02:41 2018
New Revision: 349208

URL: http://llvm.org/viewvc/llvm-project?rev=349208&view=rev
Log:
Update a comment according to r255360 "Remove -r and -R options from dotest.py"

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=349208&r1=349207&r2=349208&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Dec 14 15:02:41 
2018
@@ -72,8 +72,7 @@ from lldbsuite.support import encoded_fi
 from lldbsuite.support import funcutils
 
 # See also dotest.parseOptionsAndInitTestdirs(), where the environment 
variables
-# LLDB_COMMAND_TRACE and LLDB_DO_CLEANUP are set from '-t' and '-r dir'
-# options.
+# LLDB_COMMAND_TRACE is set from '-t' option.
 
 # By default, traceAlways is False.
 if "LLDB_COMMAND_TRACE" in os.environ and os.environ[


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


[Lldb-commits] [lldb] r349766 - Replace MemoryRegionInfoSP with values and cleanup related code

2018-12-20 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Dec 20 07:02:58 2018
New Revision: 349766

URL: http://llvm.org/viewvc/llvm-project?rev=349766&view=rev
Log:
Replace MemoryRegionInfoSP with values and cleanup related code

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

Modified:
lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h
lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h
lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/API/SBMemoryRegionInfoList.cpp
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h?rev=349766&r1=349765&r2=349766&view=diff
==
--- lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h (original)
+++ lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h Thu Dec 20 07:02:58 2018
@@ -102,6 +102,7 @@ private:
 
   const lldb_private::MemoryRegionInfo &ref() const;
 
+  // Unused.
   SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
 
   lldb::MemoryRegionInfoUP m_opaque_ap;

Modified: lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h?rev=349766&r1=349765&r2=349766&view=diff
==
--- lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h (original)
+++ lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h Thu Dec 20 07:02:58 
2018
@@ -42,6 +42,12 @@ protected:
   const MemoryRegionInfoListImpl &operator*() const;
 
 private:
+  friend class SBProcess;
+
+  lldb_private::MemoryRegionInfos &ref();
+
+  const lldb_private::MemoryRegionInfos &ref() const;
+
   std::unique_ptr m_opaque_ap;
 };
 

Modified: lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/MemoryRegionInfo.h?rev=349766&r1=349765&r2=349766&view=diff
==
--- lldb/trunk/include/lldb/Target/MemoryRegionInfo.h (original)
+++ lldb/trunk/include/lldb/Target/MemoryRegionInfo.h Thu Dec 20 07:02:58 2018
@@ -123,6 +123,12 @@ inline bool operator<(lldb::addr_t lhs,
   return lhs < rhs.GetRange().GetRangeBase();
 }
 
+// Forward-declarable wrapper.
+class MemoryRegionInfos : public std::vector {
+public:
+  using std::vector::vector;
+};
+
 }
 
 namespace llvm {

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=349766&r1=349765&r2=349766&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu Dec 20 07:02:58 2018
@@ -2081,7 +2081,7 @@ public:
   /// An error value.
   //--
   virtual Status
-  GetMemoryRegions(std::vector ®ion_list);
+  GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list);
 
   virtual Status GetWatchpointSupportInfo(uint32_t &num) {
 Status error;

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=349766&r1=349765&r2=349766&view=diff
==
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Thu Dec 20 07:02:58 2018
@@ -125,13 +125,14 @@ class JITLoaderList;
 class Language;
 class LanguageCategory;
 class LanguageRuntime;
-class MemoryRegionInfo;
 class LineTable;
 class Listener;
 class Log;
 class Mangled;
 class Materializer;
 class MemoryHistory;
+class MemoryRegionInfo;
+class MemoryRegionInfos;
 class Module;
 class ModuleList;
 class ModuleSpec;
@@ -369,7 +370,6 @@ typedef std::shared_ptr ListenerSP;
 typedef std::weak_ptr ListenerWP;
 typedef std::shared_ptr MemoryHistorySP;
-typedef std::shared_ptr MemoryRegionInfoSP;
 typedef std::unique_ptr MemoryRegionInfoUP;
 typedef std::shared_ptr ModuleSP;
 typedef std::weak_ptr ModuleWP;

Modified: lldb/trunk/source/API/SBMemoryRegionInfoList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBMemoryRegionInfoList.cpp?rev=349766&r1=349765&r2=349766&view=diff
==
--- lldb/trunk/source/API/SBMemoryRegionInfoList.cpp (original)
+++ lldb/trunk/source/API/SBMemoryRegionInfoList.cpp Thu Dec 20 07:02:58 2018
@@ -32,31 +32,47 @@ public:
 return *this;
   }
 
-  uint32_t GetSize() { return m_regions.size(); }
+  size_t GetSize() const { return m_regions.size(); }
 
-  void Append(const lldb::SBMemoryR

[Lldb-commits] [lldb] r349767 - Overload GetMemoryRegions for the ProcessMinidump

2018-12-20 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Dec 20 07:05:43 2018
New Revision: 349767

URL: http://llvm.org/viewvc/llvm-project?rev=349767&view=rev
Log:
Overload GetMemoryRegions for the ProcessMinidump

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
lldb/trunk/scripts/interface/SBMemoryRegionInfo.i
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h
lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=349767&r1=349766&r2=349767&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 Thu Dec 20 07:05:43 2018
@@ -448,3 +448,65 @@ class MiniDumpNewTestCase(TestBase):
 frame = thread.GetFrameAtIndex(1)
 value = frame.EvaluateExpression('x')
 self.assertEqual(value.GetValueAsSigned(), 3)
+
+def test_memory_regions_in_minidump(self):
+"""Test memory regions from a Minidump"""
+# target create -c regions-linux-map.dmp
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("regions-linux-map.dmp")
+self.check_state()
+
+regions_count = 19
+region_info_list = self.process.GetMemoryRegions()
+self.assertEqual(region_info_list.GetSize(), regions_count)
+
+def check_region(index, start, end, read, write, execute, mapped, 
name):
+region_info = lldb.SBMemoryRegionInfo()
+self.assertTrue(
+self.process.GetMemoryRegionInfo(start, region_info).Success())
+self.assertEqual(start, region_info.GetRegionBase())
+self.assertEqual(end, region_info.GetRegionEnd())
+self.assertEqual(read, region_info.IsReadable())
+self.assertEqual(write, region_info.IsWritable())
+self.assertEqual(execute, region_info.IsExecutable())
+self.assertEqual(mapped, region_info.IsMapped())
+self.assertEqual(name, region_info.GetName())
+
+# Ensure we have the same regions as SBMemoryRegionInfoList 
contains.
+if index >= 0 and index < regions_count:
+region_info_from_list = lldb.SBMemoryRegionInfo()
+self.assertTrue(region_info_list.GetMemoryRegionAtIndex(
+index, region_info_from_list))
+self.assertEqual(region_info_from_list, region_info)
+
+a = "/system/bin/app_process"
+b = "/system/bin/linker"
+c = "/system/lib/liblog.so"
+d = "/system/lib/libc.so"
+n = None
+max_int = 0x
+
+# Test address before the first entry comes back with nothing mapped up
+# to first valid region info
+check_region(-1, 0x, 0x400d9000, False, False, False, False, n)
+check_region( 0, 0x400d9000, 0x400db000, True,  False, True,  True,  a)
+check_region( 1, 0x400db000, 0x400dc000, True,  False, False, True,  a)
+check_region( 2, 0x400dc000, 0x400dd000, True,  True,  False, True,  n)
+check_region( 3, 0x400dd000, 0x400ec000, True,  False, True,  True,  b)
+check_region( 4, 0x400ec000, 0x400ed000, True,  False, False, True,  n)
+check_region( 5, 0x400ed000, 0x400ee000, True,  False, False, True,  b)
+check_region( 6, 0x400ee000, 0x400ef000, True,  True,  False, True,  b)
+check_region( 7, 0x400ef000, 0x400fb000, True,  True,  False, True,  n)
+check_region( 8, 0x400fb000, 0x400fc000, True,  False, True,  True,  c)
+check_region( 9, 0x400fc000, 0x400fd000, True,  True,  True,  True,  c)
+check_region(10, 0x400fd000, 0x400ff000, True,  False, True,  True,  c)
+check_region(11, 0x400ff000, 0x4010, True,  False, False, True,  c)
+check_region(12, 0x4010, 0x40101000, True,  True,  False, True,  c)
+check_region(13, 0x40101000, 0x40122000, True,  False, True,  True,  d)
+check_region(14, 0x40122000, 0x40123000, True,  True,  True,  True,  d)
+check_region(15, 0x40123000, 0x40167000, True,  False, True,  True,  d)
+check_region(16, 0x40167000, 0x40169000, True,  False, False, True,  d)
+check_region(17, 0x40169000, 0x4016b000, True,

[Lldb-commits] [lldb] r322270 - Check existence of each required component during construction of LLVMCDisassembler.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Jan 11 04:06:22 2018
New Revision: 322270

URL: http://llvm.org/viewvc/llvm-project?rev=322270&view=rev
Log:
Check existence of each required component during construction of 
LLVMCDisassembler.

Summary:
Actually, fix two issues:

  # remove repeat creation of reg_info, use m_reg_info_ap  for createMCAsmInfo 
instead;

  # remove possibility to dereference nullptr during createMCAsmInfo 
invocation, that could lead to undefined behavior.

Placed checking of a component right after its creation to simplify the code 
and avoid same issues later.

Reviewers: zturner, clayborg, jingham, jasonmolenda, labath

Reviewed By: clayborg, labath

Subscribers: labath, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=322270&r1=322269&r2=322270&view=diff
==
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Thu Jan 
11 04:06:22 2018
@@ -10,6 +10,9 @@
 // C Includes
 // C++ Includes
 // Project includes
+#include "DisassemblerLLVMC.h"
+
+// Other libraries and framework includes
 #include "llvm-c/Disassembler.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/MC/MCAsmInfo.h"
@@ -27,9 +30,6 @@
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 
-// Other libraries and framework includes
-#include "DisassemblerLLVMC.h"
-
 #include "lldb/Core/Address.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Symbol/SymbolContext.h"
@@ -41,13 +41,47 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Log.h"
-#include "lldb/Utility/Stream.h"
-
 #include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Stream.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
+class DisassemblerLLVMC::MCDisasmInstance {
+public:
+  static std::unique_ptr
+  Create(const char *triple, const char *cpu, const char *features_str,
+ unsigned flavor, DisassemblerLLVMC &owner);
+
+  ~MCDisasmInstance() = default;
+
+  uint64_t GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len,
+ lldb::addr_t pc, llvm::MCInst &mc_inst) const;
+  void PrintMCInst(llvm::MCInst &mc_inst, std::string &inst_string,
+   std::string &comments_string);
+  void SetStyle(bool use_hex_immed, HexImmediateStyle hex_style);
+  bool CanBranch(llvm::MCInst &mc_inst) const;
+  bool HasDelaySlot(llvm::MCInst &mc_inst) const;
+  bool IsCall(llvm::MCInst &mc_inst) const;
+
+private:
+  MCDisasmInstance(std::unique_ptr &&instr_info_up,
+   std::unique_ptr &®_info_up,
+   std::unique_ptr &&subtarget_info_up,
+   std::unique_ptr &&asm_info_up,
+   std::unique_ptr &&context_up,
+   std::unique_ptr &&disasm_up,
+   std::unique_ptr &&instr_printer_up);
+
+  std::unique_ptr m_instr_info_up;
+  std::unique_ptr m_reg_info_up;
+  std::unique_ptr m_subtarget_info_up;
+  std::unique_ptr m_asm_info_up;
+  std::unique_ptr m_context_up;
+  std::unique_ptr m_disasm_up;
+  std::unique_ptr m_instr_printer_up;
+};
+
 class InstructionLLVMC : public lldb_private::Instruction {
 public:
   InstructionLLVMC(DisassemblerLLVMC &disasm,
@@ -72,7 +106,7 @@ public:
   bool is_alternate_isa;
   lldb::addr_t pc = m_address.GetFileAddress();
 
-  DisassemblerLLVMC::LLVMCDisassembler *mc_disasm_ptr =
+  DisassemblerLLVMC::MCDisasmInstance *mc_disasm_ptr =
   GetDisasmToUse(is_alternate_isa);
   const uint8_t *opcode_data = data.GetDataStart();
   const size_t opcode_data_len = data.GetByteSize();
@@ -107,7 +141,7 @@ public:
   bool is_alternate_isa;
   lldb::addr_t pc = m_address.GetFileAddress();
 
-  DisassemblerLLVMC::LLVMCDisassembler *mc_disasm_ptr =
+  DisassemblerLLVMC::MCDisasmInstance *mc_disasm_ptr =
   GetDisasmToUse(is_alternate_isa);
   const uint8_t *opcode_data = data.GetDataStart();
   const size_t opcode_data_len = data.GetByteSize();
@@ -132,19 +166,19 @@ public:
 return m_has_delay_slot == eLazyBoolYes;
   }
 
-  DisassemblerLLVMC::LLVMCDisassembler *GetDisasmToUse(bool &is_alternate_isa) 
{
+  DisassemblerLLVMC::MCDisasmInstance *GetDisasmToUse(bool &is_alternate_isa) {
 is_alternate_isa = false;
 std::shared_ptr disasm_sp(GetDisassembler());
 if (disasm_sp) {
-  if (disasm_sp->m_alternate_disasm_ap.get() != NULL) {
+  if (disasm_sp->m_alternate_disasm_up) {
 

[Lldb-commits] [lldb] r318833 - Remove unused variable.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Nov 22 05:35:04 2017
New Revision: 318833

URL: http://llvm.org/viewvc/llvm-project?rev=318833&view=rev
Log:
Remove unused variable.

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=318833&r1=318832&r2=318833&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp 
Wed Nov 22 05:35:04 2017
@@ -178,7 +178,7 @@ bool GDBRemoteRegisterContext::GetPrimor
 const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm) {
   const uint32_t lldb_reg = reg_info->kinds[eRegisterKindLLDB];
   const uint32_t remote_reg = reg_info->kinds[eRegisterKindProcessPlugin];
-  StringExtractorGDBRemote response;
+
   if (DataBufferSP buffer_sp =
   gdb_comm.ReadRegister(m_thread.GetProtocolID(), remote_reg))
 return PrivateSetRegisterValue(


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


[Lldb-commits] [lldb] r318832 - Test commit. Fix typo in comment.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Nov 22 05:03:02 2017
New Revision: 318832

URL: http://llvm.org/viewvc/llvm-project?rev=318832&view=rev
Log:
Test commit. Fix typo in comment.

Modified:
lldb/trunk/include/lldb/Core/Architecture.h

Modified: lldb/trunk/include/lldb/Core/Architecture.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Architecture.h?rev=318832&r1=318831&r2=318832&view=diff
==
--- lldb/trunk/include/lldb/Core/Architecture.h (original)
+++ lldb/trunk/include/lldb/Core/Architecture.h Wed Nov 22 05:03:02 2017
@@ -22,7 +22,7 @@ public:
   //--
   /// This is currently intended to handle cases where a
   /// program stops at an instruction that won't get executed and it
-  /// allows the stop reasonm, like "breakpoint hit", to be replaced
+  /// allows the stop reason, like "breakpoint hit", to be replaced
   /// with a different stop reason like "no stop reason".
   ///
   /// This is specifically used for ARM in Thumb code when we stop in


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


[Lldb-commits] [lldb] r318846 - Remove extra minuses from command option

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Nov 22 09:07:43 2017
New Revision: 318846

URL: http://llvm.org/viewvc/llvm-project?rev=318846&view=rev
Log:
Remove extra minuses from command option

Reviewers: labath, abidh, clayborg, ki.stfu

Reviewed By: labath, abidh, clayborg, ki.stfu

Subscribers: clayborg, ki.stfu, lldb-commits

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

Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=318846&r1=318845&r2=318846&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Nov 22 09:07:43 2017
@@ -2586,7 +2586,7 @@ public:
   "Fullpath or basename for module to load.", ""),
 m_load_option(LLDB_OPT_SET_1, false, "load", 'l',
   "Write file contents to the memory.", false, true),
-m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p',
+m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p',
 "Set PC to the entry point."
 " Only applicable with '--load' option.",
 false, true),


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


[Lldb-commits] [lldb] r326437 - Make Finalize tolerant of empty register sets.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Mar  1 06:36:42 2018
New Revision: 326437

URL: http://llvm.org/viewvc/llvm-project?rev=326437&view=rev
Log:
Make Finalize tolerant of empty register sets.

Modified:
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=326437&r1=326436&r2=326437&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Thu Mar  
1 06:36:42 2018
@@ -437,7 +437,7 @@ void DynamicRegisterInfo::Finalize(const
   for (size_t set = 0; set < num_sets; ++set) {
 assert(m_sets.size() == m_set_reg_nums.size());
 m_sets[set].num_registers = m_set_reg_nums[set].size();
-m_sets[set].registers = &m_set_reg_nums[set][0];
+m_sets[set].registers = m_set_reg_nums[set].data();
   }
 
   // sort and unique all value registers and make sure each is terminated with


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


[Lldb-commits] [lldb] r327549 - Use GetItemAtIndexAsString overload for ConstString and move set rather than copy.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Mar 14 11:29:41 2018
New Revision: 327549

URL: http://llvm.org/viewvc/llvm-project?rev=327549&view=rev
Log:
Use GetItemAtIndexAsString overload for ConstString and move set rather than 
copy.

Modified:
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=327549&r1=327548&r2=327549&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Wed Mar 
14 11:29:41 2018
@@ -44,13 +44,9 @@ DynamicRegisterInfo::SetRegisterInfo(con
   if (dict.GetValueForKeyAsArray("sets", sets)) {
 const uint32_t num_sets = sets->GetSize();
 for (uint32_t i = 0; i < num_sets; ++i) {
-  llvm::StringRef set_name_str;
   ConstString set_name;
-  if (sets->GetItemAtIndexAsString(i, set_name_str))
-set_name.SetString(set_name_str);
-  if (set_name) {
-RegisterSet new_set = {set_name.AsCString(), NULL, 0, NULL};
-m_sets.push_back(new_set);
+  if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) {
+m_sets.push_back({ set_name.AsCString(), NULL, 0, NULL });
   } else {
 Clear();
 printf("error: register sets must have valid names\n");
@@ -59,6 +55,7 @@ DynamicRegisterInfo::SetRegisterInfo(con
 }
 m_set_reg_nums.resize(m_sets.size());
   }
+
   StructuredData::Array *regs = nullptr;
   if (!dict.GetValueForKeyAsArray("registers", regs))
 return 0;


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


[Lldb-commits] [lldb] r327548 - Reuse IsEmpty for ConstString::operator bool().

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Mar 14 11:29:33 2018
New Revision: 327548

URL: http://llvm.org/viewvc/llvm-project?rev=327548&view=rev
Log:
Reuse IsEmpty for ConstString::operator bool().

Modified:
lldb/trunk/include/lldb/Utility/ConstString.h

Modified: lldb/trunk/include/lldb/Utility/ConstString.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ConstString.h?rev=327548&r1=327547&r2=327548&view=diff
==
--- lldb/trunk/include/lldb/Utility/ConstString.h (original)
+++ lldb/trunk/include/lldb/Utility/ConstString.h Wed Mar 14 11:29:33 2018
@@ -140,7 +140,7 @@ public:
   /// /b True this object contains a valid non-empty C string, \b
   /// false otherwise.
   //--
-  explicit operator bool() const { return m_string && m_string[0]; }
+  explicit operator bool() const { return !IsEmpty(); }
 
   //--
   /// Assignment operator


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


[Lldb-commits] [lldb] r335711 - Add missing constness.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Jun 27 00:01:07 2018
New Revision: 335711

URL: http://llvm.org/viewvc/llvm-project?rev=335711&view=rev
Log:
Add missing constness.

Modified:
lldb/trunk/include/lldb/Core/Architecture.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.h
lldb/trunk/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Target/ThreadPlanStepInRange.cpp

Modified: lldb/trunk/include/lldb/Core/Architecture.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Architecture.h?rev=335711&r1=335710&r2=335711&view=diff
==
--- lldb/trunk/include/lldb/Core/Architecture.h (original)
+++ lldb/trunk/include/lldb/Core/Architecture.h Wed Jun 27 00:01:07 2018
@@ -31,7 +31,7 @@ public:
   /// stopped at the current PC. The code is generic and applies to all
   /// ARM CPUs.
   //--
-  virtual void OverrideStopInfo(Thread &thread) = 0;
+  virtual void OverrideStopInfo(Thread &thread) const = 0;
 
   //--
   /// This method is used to get the number of bytes that should be

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=335711&r1=335710&r2=335711&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Wed Jun 27 00:01:07 2018
@@ -938,7 +938,7 @@ public:
 
   bool MergeArchitecture(const ArchSpec &arch_spec);
 
-  Architecture *GetArchitecturePlugin() { return m_arch.GetPlugin(); }
+  Architecture *GetArchitecturePlugin() const { return m_arch.GetPlugin(); }
 
   Debugger &GetDebugger() { return m_debugger; }
 

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=335711&r1=335710&r2=335711&view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Wed Jun 27 00:01:07 
2018
@@ -367,7 +367,7 @@ BreakpointResolverName::SearchCallback(S
 if (prologue_byte_size)
   break_addr.SetOffset(break_addr.GetOffset() + 
prologue_byte_size);
 else {
-  Architecture *arch =
+  const Architecture *arch =
   m_breakpoint->GetTarget().GetArchitecturePlugin();
   if (arch)
 arch->AdjustBreakpointAddress(*sc.symbol, break_addr);

Modified: lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp?rev=335711&r1=335710&r2=335711&view=diff
==
--- lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp (original)
+++ lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp Wed Jun 27 
00:01:07 2018
@@ -41,7 +41,7 @@ std::unique_ptr Architectu
 ConstString ArchitectureArm::GetPluginName() { return GetPluginNameStatic(); }
 uint32_t ArchitectureArm::GetPluginVersion() { return 1; }
 
-void ArchitectureArm::OverrideStopInfo(Thread &thread) {
+void ArchitectureArm::OverrideStopInfo(Thread &thread) const {
   // We need to check if we are stopped in Thumb mode in a IT instruction and
   // detect if the condition doesn't pass. If this is the case it means we
   // won't actually execute this instruction. If this happens we need to clear

Modified: lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.h?rev=335711&r1=335710&r2=335711&view=diff
==
--- lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.h (original)
+++ lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.h Wed Jun 27 
00:01:07 2018
@@ -23,7 +23,7 @@ public:
   ConstString GetPluginName() override;
   uint32_t GetPluginVersion() override;
 
-  void OverrideStopInfo(Thread &thread) override;
+  void OverrideStopInfo(Thread &thread) const override;
 
 private:
   static std::unique_ptr Create(const ArchSpec &arch);

Modified: lldb/trunk/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h?rev=335711&r1=335710&r2=335711&view=diff

[Lldb-commits] [lldb] r335656 - Amend "Change AddressClass type from 'enum' to 'enum class'".

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Jun 26 13:08:05 2018
New Revision: 335656

URL: http://llvm.org/viewvc/llvm-project?rev=335656&view=rev
Log:
Amend "Change AddressClass type from 'enum' to 'enum class'".

r335599 changes usages of AddressClass, but doesn't change the type itself.


Modified:
lldb/trunk/include/lldb/lldb-enumerations.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=335656&r1=335655&r2=335656&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Jun 26 13:08:05 2018
@@ -823,7 +823,7 @@ enum FrameComparison {
 // relative data and the object file might be able to tell us that an address
 // in code is data.
 //--
-enum AddressClass {
+enum class AddressClass {
   eInvalid,
   eUnknown,
   eCode,


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


[Lldb-commits] [lldb] r335273 - Remove duplicated check and shared_ptr copying.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Jun 21 12:19:57 2018
New Revision: 335273

URL: http://llvm.org/viewvc/llvm-project?rev=335273&view=rev
Log:
Remove duplicated check and shared_ptr copying.

Modified:
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=335273&r1=335272&r2=335273&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Thu Jun 21 12:19:57 
2018
@@ -161,10 +161,9 @@ Status CommandObjectDisassemble::Command
 
   case 'A':
 if (execution_context) {
-  auto target_sp =
-  execution_context ? execution_context->GetTargetSP() : TargetSP();
-  auto platform_sp = target_sp ? target_sp->GetPlatform() : PlatformSP();
-  arch = Platform::GetAugmentedArchSpec(platform_sp.get(), option_arg);
+  const auto &target_sp = execution_context->GetTargetSP();
+  auto platform_ptr = target_sp ? target_sp->GetPlatform().get() : nullptr;
+  arch = Platform::GetAugmentedArchSpec(platform_ptr, option_arg);
 }
 break;
 


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


[Lldb-commits] [lldb] r329597 - Fix compilation error caused by tgmath.h.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Mon Apr  9 10:32:56 2018
New Revision: 329597

URL: http://llvm.org/viewvc/llvm-project?rev=329597&view=rev
Log:
Fix compilation error caused by tgmath.h.

On CentOS calling functions from  produces multiple errors "'void*' 
is not a pointer-to-object type".

Modified:
lldb/trunk/lit/Expr/Inputs/anonymous-struct.cpp

Modified: lldb/trunk/lit/Expr/Inputs/anonymous-struct.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/Inputs/anonymous-struct.cpp?rev=329597&r1=329596&r2=329597&view=diff
==
--- lldb/trunk/lit/Expr/Inputs/anonymous-struct.cpp (original)
+++ lldb/trunk/lit/Expr/Inputs/anonymous-struct.cpp Mon Apr  9 10:32:56 2018
@@ -1,4 +1,4 @@
-#include 
+#include 
 
 typedef struct {
 float f;


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


[Lldb-commits] [lldb] r334282 - Fix DynamicRegisterInfo copying/moving issue.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Jun  8 04:28:15 2018
New Revision: 334282

URL: http://llvm.org/viewvc/llvm-project?rev=334282&view=rev
Log:
Fix DynamicRegisterInfo copying/moving issue.

Summary:
Default copy/move constructors and assignment operators leave wrong 
m_sets[i].registers pointers.

Made the class movable and non-copyable (it's difficult to imagine when it 
needs to be copied).

Reviewers: clayborg

Reviewed By: clayborg

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

Modified:
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.h

Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=334282&r1=334281&r2=334282&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Fri Jun  
8 04:28:15 2018
@@ -21,21 +21,42 @@
 using namespace lldb;
 using namespace lldb_private;
 
-DynamicRegisterInfo::DynamicRegisterInfo()
-: m_regs(), m_sets(), m_set_reg_nums(), m_set_names(), m_value_regs_map(),
-  m_invalidate_regs_map(), m_dynamic_reg_size_map(),
-  m_reg_data_byte_size(0), m_finalized(false) {}
-
 DynamicRegisterInfo::DynamicRegisterInfo(
 const lldb_private::StructuredData::Dictionary &dict,
-const lldb_private::ArchSpec &arch)
-: m_regs(), m_sets(), m_set_reg_nums(), m_set_names(), m_value_regs_map(),
-  m_invalidate_regs_map(), m_dynamic_reg_size_map(),
-  m_reg_data_byte_size(0), m_finalized(false) {
+const lldb_private::ArchSpec &arch) {
   SetRegisterInfo(dict, arch);
 }
 
-DynamicRegisterInfo::~DynamicRegisterInfo() {}
+DynamicRegisterInfo::DynamicRegisterInfo(DynamicRegisterInfo &&info) {
+  MoveFrom(std::move(info));
+}
+
+DynamicRegisterInfo &
+DynamicRegisterInfo::operator=(DynamicRegisterInfo &&info) {
+  MoveFrom(std::move(info));
+  return *this;
+}
+
+void DynamicRegisterInfo::MoveFrom(DynamicRegisterInfo &&info) {
+  m_regs = std::move(info.m_regs);
+  m_sets = std::move(info.m_sets);
+  m_set_reg_nums = std::move(info.m_set_reg_nums);
+  m_set_names = std::move(info.m_set_names);
+  m_value_regs_map = std::move(info.m_value_regs_map);
+  m_invalidate_regs_map = std::move(info.m_invalidate_regs_map);
+  m_dynamic_reg_size_map = std::move(info.m_dynamic_reg_size_map);
+
+  m_reg_data_byte_size = info.m_reg_data_byte_size;
+  m_finalized = info.m_finalized;
+
+  if (m_finalized) {
+const size_t num_sets = m_sets.size();
+for (size_t set = 0; set < num_sets; ++set)
+  m_sets[set].registers = m_set_reg_nums[set].data();
+  }
+
+  info.Clear();
+}
 
 size_t
 DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
@@ -136,7 +157,7 @@ DynamicRegisterInfo::SetRegisterInfo(con
 
 ConstString containing_reg_name(reg_name_str);
 
-RegisterInfo *containing_reg_info =
+const RegisterInfo *containing_reg_info =
 GetRegisterInfo(containing_reg_name);
 if (containing_reg_info) {
   const uint32_t max_bit = containing_reg_info->byte_size * 8;
@@ -205,7 +226,7 @@ DynamicRegisterInfo::SetRegisterInfo(con
   ConstString composite_reg_name;
   if (composite_reg_list->GetItemAtIndexAsString(
   composite_idx, composite_reg_name, nullptr)) {
-RegisterInfo *composite_reg_info =
+const RegisterInfo *composite_reg_info =
 GetRegisterInfo(composite_reg_name);
 if (composite_reg_info) {
   composite_offset = std::min(composite_offset,
@@ -345,7 +366,7 @@ DynamicRegisterInfo::SetRegisterInfo(con
   uint64_t invalidate_reg_num;
   if (invalidate_reg_list->GetItemAtIndexAsString(
   idx, invalidate_reg_name)) {
-RegisterInfo *invalidate_reg_info =
+const RegisterInfo *invalidate_reg_info =
 GetRegisterInfo(invalidate_reg_name);
 if (invalidate_reg_info) {
   m_invalidate_regs_map[i].push_back(
@@ -725,8 +746,8 @@ void DynamicRegisterInfo::Dump() const {
   }
 }
 
-lldb_private::RegisterInfo *DynamicRegisterInfo::GetRegisterInfo(
-const lldb_private::ConstString ®_name) {
+const lldb_private::RegisterInfo *DynamicRegisterInfo::GetRegisterInfo(
+const lldb_private::ConstString ®_name) const {
   for (auto ®_info : m_regs) {
 // We can use pointer comparison since we used a ConstString to set the
 // "name" member in AddRegister()

Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.h?rev=334282

[Lldb-commits] [lldb] r335710 - Move AddressClass to private enums since API doesn't provide any functions to manage it.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Jun 26 23:50:10 2018
New Revision: 335710

URL: http://llvm.org/viewvc/llvm-project?rev=335710&view=rev
Log:
Move AddressClass to private enums since API doesn't provide any functions to 
manage it.

This change allows to make AddressClass strongly typed enum and not to have 
issues with old versions of SWIG that don't support enum classes.

Modified:
lldb/trunk/include/lldb/API/SBAddress.h
lldb/trunk/include/lldb/API/SBInstruction.h
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/include/lldb/Core/Disassembler.h
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/include/lldb/lldb-private-enumerations.h
lldb/trunk/scripts/interface/SBAddress.i
lldb/trunk/scripts/interface/SBInstruction.i
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBInstruction.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h

Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=335710&r1=335709&r2=335710&view=diff
==
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Tue Jun 26 23:50:10 2018
@@ -80,8 +80,6 @@ public:
 
   lldb::SBLineEntry GetLineEntry();
 
-  lldb::AddressClass GetAddressClass();
-
 protected:
   friend class SBBlock;
   friend class SBBreakpointLocation;

Modified: lldb/trunk/include/lldb/API/SBInstruction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstruction.h?rev=335710&r1=335709&r2=335710&view=diff
==
--- lldb/trunk/include/lldb/API/SBInstruction.h (original)
+++ lldb/trunk/include/lldb/API/SBInstruction.h Tue Jun 26 23:50:10 2018
@@ -36,8 +36,6 @@ public:
 
   SBAddress GetAddress();
 
-  lldb::AddressClass GetAddressClass();
-
   const char *GetMnemonic(lldb::SBTarget target);
 
   const char *GetOperands(lldb::SBTarget target);

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=335710&r1=335709&r2=335710&view=diff
==
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Tue Jun 26 23:50:10 2018
@@ -11,8 +11,8 @@
 #define liblldb_Address_h_
 
 #include "lldb/lldb-defines.h"  // for LLDB_INVALID_ADDRESS
-#include "lldb/lldb-enumerations.h" // for AddressClass::eInvalid
 #include "lldb/lldb-forward.h"  // for SectionWP, SectionSP, ModuleSP
+#include "lldb/lldb-private-enumerations.h" // for AddressClass
 #include "lldb/lldb-types.h"// for addr_t
 
 #include  // for size_t
@@ -270,7 +270,7 @@ public:
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX) const;
 
-  lldb::AddressClass GetAddressClass() const;
+  AddressClass GetAddressClass() const;
 
   //--
   /// Get the file address.
@@ -338,7 +338,7 @@ public:
   //--
   lldb::addr_t GetOpcodeLoadAddress(
   Target *target,
-  lldb::AddressClass addr_class = lldb::AddressClass::eInvalid) const;
+  AddressClass addr_class = AddressClass::eInvalid) const;
 
   //--
   /// Get the section relative offset value.
@@ -432,7 +432,7 @@ public:
 
   bool SetOpcodeLoadAddress(
   lldb::addr_t load_addr, Target *target,
-  lldb::AddressClass addr_class = lldb::AddressClass::eInvalid,
+  AddressClass addr_class = AddressClass::eInvalid,
   bool allow_section_end = false);
 
   bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target);

Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=335710&r1=335709&r2=335710&view=diff
==
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Tue Jun 26 23:50:10 2018
@@ -22,8 +22,8 @@
 #include "lldb/Utility/ConstString.h" // for ConstString
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-defines.h"  // for DISALLOW_COPY_AND_ASSIGN
-#include "lldb/lldb-enumerations.h" // for AddressClass, AddressClass...
 #include "lldb/lldb-forward.h"  // for InstructionSP, DisassemblerSP
+#include "lldb/lldb-private-enumerations.h" // for AddressClass
 #include "lldb/lldb-types.h"// for addr_t, offset_t
 
 #include "llvm/ADT/StringRef.h" // for StringR

[Lldb-commits] [lldb] r335341 - ResolveAddress: check returned value of resolving functions.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Jun 22 05:24:57 2018
New Revision: 335341

URL: http://llvm.org/viewvc/llvm-project?rev=335341&view=rev
Log:
ResolveAddress: check returned value of resolving functions.

Modified:
lldb/trunk/source/Core/Disassembler.cpp

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=335341&r1=335340&r2=335341&view=diff
==
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Fri Jun 22 05:24:57 2018
@@ -112,14 +112,15 @@ static void ResolveAddress(const Executi
 // it to something
 Target *target = exe_ctx.GetTargetPtr();
 if (target) {
-  if (target->GetSectionLoadList().IsEmpty()) {
-target->GetImages().ResolveFileAddress(addr.GetOffset(), 
resolved_addr);
-  } else {
-target->GetSectionLoadList().ResolveLoadAddress(addr.GetOffset(),
-resolved_addr);
-  }
+  bool is_resolved =
+  target->GetSectionLoadList().IsEmpty() ?
+  target->GetImages().ResolveFileAddress(addr.GetOffset(),
+ resolved_addr) :
+  target->GetSectionLoadList().ResolveLoadAddress(addr.GetOffset(),
+  resolved_addr);
+
   // We weren't able to resolve the address, just treat it as a raw address
-  if (resolved_addr.IsValid())
+  if (is_resolved && resolved_addr.IsValid())
 return;
 }
   }


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


[Lldb-commits] [lldb] r335599 - Change AddressClass type from 'enum' to 'enum class'.

2018-07-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Jun 26 06:06:54 2018
New Revision: 335599

URL: http://llvm.org/viewvc/llvm-project?rev=335599&view=rev
Log:
Change AddressClass type from 'enum' to 'enum class'.

If we have a function with signature f(addr_t, AddressClass), it is easy to 
muddle up the order of arguments without any warnings from compiler. 'enum 
class' prevents passing integer in place of AddressClass and vice versa.

Modified:
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/include/lldb/Core/Disassembler.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBInstruction.cpp
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/RegisterContext.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/StackFrameList.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=335599&r1=335598&r2=335599&view=diff
==
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Tue Jun 26 06:06:54 2018
@@ -11,7 +11,7 @@
 #define liblldb_Address_h_
 
 #include "lldb/lldb-defines.h"  // for LLDB_INVALID_ADDRESS
-#include "lldb/lldb-enumerations.h" // for AddressClass::eAddressClassInvalid
+#include "lldb/lldb-enumerations.h" // for AddressClass::eInvalid
 #include "lldb/lldb-forward.h"  // for SectionWP, SectionSP, ModuleSP
 #include "lldb/lldb-types.h"// for addr_t
 
@@ -338,7 +338,7 @@ public:
   //--
   lldb::addr_t GetOpcodeLoadAddress(
   Target *target,
-  lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
+  lldb::AddressClass addr_class = lldb::AddressClass::eInvalid) const;
 
   //--
   /// Get the section relative offset value.
@@ -432,7 +432,7 @@ public:
 
   bool SetOpcodeLoadAddress(
   lldb::addr_t load_addr, Target *target,
-  lldb::AddressClass addr_class = lldb::eAddressClassInvalid,
+  lldb::AddressClass addr_class = lldb::AddressClass::eInvalid,
   bool allow_section_end = false);
 
   bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target);

Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=335599&r1=335598&r2=335599&view=diff
==
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Tue Jun 26 06:06:54 2018
@@ -78,7 +78,7 @@ namespace lldb_private {
 class Instruction {
 public:
   Instruction(const Address &address,
-  lldb::AddressClass addr_class = lldb::eAddressClassInvalid);
+  lldb::AddressClass addr_class = lldb::AddressClass::eInvalid);
 
   virtual ~Instruction();
 
@@ -106,7 +106,7 @@ public:
 
   void SetAddress(const Address &addr) {
 // Invalidate the address class to lazily discover it if we need to.
-m_address_class = lldb::eAddressClassInvalid;
+m_address_class = lldb::AddressClass::eInvalid;
 m_address = addr;
   }
 
@@ -235,9 +235,9 @@ protected:
   Address m_address; // The section offset address of this instruction
  // We include an address class in the Instruction class to
  // allow the instruction specify the
- // eAddressClassCodeAlternateISA (currently used for
- // thumb), and also to specify data (eAddressClassData).
- // The usual value will be eAddressClassCode, but often
+ // AddressClass::eCodeAlternateISA (currently used for
+ // thumb), and also to specify data (AddressClass::eData).
+ // The usual value will be AddressClass::eCode, but often
  // when disassembling memory, you might run into data.
  // This can help us to disassemble appro

[Lldb-commits] [lldb] r336483 - Fix build on Windows with SDK build version >= 17134.

2018-07-07 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Sat Jul  7 07:58:13 2018
New Revision: 336483

URL: http://llvm.org/viewvc/llvm-project?rev=336483&view=rev
Log:
Fix build on Windows with SDK build version >= 17134.

Platform.h doesn't define signal() and SIGINT since commit r263858. Code was 
compiled successfully because signal.h didn't have "ifndef" include guard in 
previous versions of Windows SDK. Now it does.

Modified:
lldb/trunk/tools/lldb-mi/MIDriverMain.cpp

Modified: lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMain.cpp?rev=336483&r1=336482&r2=336483&view=diff
==
--- lldb/trunk/tools/lldb-mi/MIDriverMain.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMain.cpp Sat Jul  7 07:58:13 2018
@@ -26,11 +26,6 @@
 //  MICmdBase.h / .cpp
 //  MICmdCmd.h / .cpp
 
-#if defined(_MSC_VER)
-#define _INC_SIGNAL // Stop window's signal.h being included -
-// CODETAG_IOR_SIGNALS
-#endif  // _MSC_VER
-
 // Third party headers:
 #include "lldb/API/SBHostOS.h"
 #include 


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


[Lldb-commits] [lldb] r336991 - Add abbreviated name for Debugger::EventHandlerThread.

2018-07-13 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Jul 13 04:21:06 2018
New Revision: 336991

URL: http://llvm.org/viewvc/llvm-project?rev=336991&view=rev
Log:
Add abbreviated name for Debugger::EventHandlerThread.

On OS's where thread names are limited to 16 bytes, the full name was truncated 
to not very meaningful "r.event-handler".

Modified:
lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=336991&r1=336990&r2=336991&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Fri Jul 13 04:21:06 2018
@@ -1586,15 +1586,18 @@ bool Debugger::StartEventHandlerThread()
 // is up and running and listening to events before we return from this
 // function. We do this by listening to events for the
 // eBroadcastBitEventThreadIsListening from the m_sync_broadcaster
-ListenerSP listener_sp(
-Listener::MakeListener("lldb.debugger.event-handler"));
+ConstString full_name("lldb.debugger.event-handler");
+ListenerSP listener_sp(Listener::MakeListener(full_name.AsCString()));
 listener_sp->StartListeningForEvents(&m_sync_broadcaster,
  eBroadcastBitEventThreadIsListening);
 
+auto thread_name =
+full_name.GetLength() < llvm::get_max_thread_name_length() ?
+full_name.AsCString() : "dbg.evt-handler";
+
 // Use larger 8MB stack for this thread
-m_event_handler_thread = ThreadLauncher::LaunchThread(
-"lldb.debugger.event-handler", EventHandlerThread, this, nullptr,
-g_debugger_event_thread_stack_bytes);
+m_event_handler_thread = ThreadLauncher::LaunchThread(thread_name,
+EventHandlerThread, this, nullptr, 
g_debugger_event_thread_stack_bytes);
 
 // Make sure DefaultEventHandler() is running and listening to events
 // before we return from this function. We are only listening for events of


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


[Lldb-commits] [lldb] r336993 - Adjust thread name column width depending on real name length.

2018-07-13 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Jul 13 04:49:28 2018
New Revision: 336993

URL: http://llvm.org/viewvc/llvm-project?rev=336993&view=rev
Log:
Adjust thread name column width depending on real name length.

Make 16-byte aligned field instead of truncating a name to 16 byte.

Modified:
lldb/trunk/source/Utility/Log.cpp

Modified: lldb/trunk/source/Utility/Log.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Log.cpp?rev=336993&r1=336992&r2=336993&view=diff
==
--- lldb/trunk/source/Utility/Log.cpp (original)
+++ lldb/trunk/source/Utility/Log.cpp Fri Jul 13 04:49:28 2018
@@ -286,7 +286,11 @@ void Log::WriteHeader(llvm::raw_ostream
   if (options.Test(LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) {
 llvm::SmallString<32> thread_name;
 llvm::get_thread_name(thread_name);
-OS << llvm::formatv("{0,-16} ", thread_name);
+
+llvm::SmallString<12> format_str;
+llvm::raw_svector_ostream format_os(format_str);
+format_os << "{0,-" << llvm::alignTo<16>(thread_name.size()) << "} ";
+OS << llvm::formatv(format_str.c_str(), thread_name);
   }
 
   if (options.Test(LLDB_LOG_OPTION_BACKTRACE))


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


[Lldb-commits] [lldb] r339153 - Check result after setting PC value.

2018-08-07 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Aug  7 09:46:11 2018
New Revision: 339153

URL: http://llvm.org/viewvc/llvm-project?rev=339153&view=rev
Log:
Check result after setting PC value.

Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=339153&r1=339152&r2=339153&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Aug  7 09:46:11 2018
@@ -2740,10 +2740,15 @@ protected:
   }
   if (set_pc) {
 ThreadList &thread_list = process->GetThreadList();
-ThreadSP curr_thread(thread_list.GetSelectedThread());
 RegisterContextSP reg_context(
-curr_thread->GetRegisterContext());
-reg_context->SetPC(file_entry.GetLoadAddress(target));
+thread_list.GetSelectedThread()->GetRegisterContext());
+addr_t file_entry_addr = file_entry.GetLoadAddress(target);
+if (!reg_context->SetPC(file_entry_addr)) {
+  result.AppendErrorWithFormat("failed to set PC value to "
+   "0x%" PRIx64 "\n",
+   file_entry_addr);
+  result.SetStatus(eReturnStatusFailed);
+}
   }
 }
   } else {


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


[Lldb-commits] [lldb] r339328 - Remove unused type Either from Utility library.

2018-08-09 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Aug  9 04:42:28 2018
New Revision: 339328

URL: http://llvm.org/viewvc/llvm-project?rev=339328&view=rev
Log:
Remove unused type Either from Utility library.

Modified:
lldb/trunk/include/lldb/Utility/Either.h
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/include/lldb/Utility/Either.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Either.h?rev=339328&r1=339327&r2=339328&view=diff
==
--- lldb/trunk/include/lldb/Utility/Either.h (original)
+++ lldb/trunk/include/lldb/Utility/Either.h Thu Aug  9 04:42:28 2018
@@ -12,115 +12,61 @@
 
 #include "llvm/ADT/Optional.h"
 
-#include 
-
 namespace lldb_utility {
-template  class Either {
-private:
-  enum class Selected { One, Two };
-
-  Selected m_selected;
-  union {
-T1 m_t1;
-T2 m_t2;
-  };
-
-public:
-  Either(const T1 &t1) {
-m_t1 = t1;
-m_selected = Selected::One;
-  }
-
-  Either(const T2 &t2) {
-m_t2 = t2;
-m_selected = Selected::Two;
-  }
-
-  Either(const Either &rhs) {
-switch (rhs.m_selected) {
-case Selected::One:
-  m_t1 = rhs.GetAs().getValue();
-  m_selected = Selected::One;
-  break;
-case Selected::Two:
-  m_t2 = rhs.GetAs().getValue();
-  m_selected = Selected::Two;
-  break;
-}
-  }
-
-  template ::value>::type
- * = nullptr>
-  llvm::Optional GetAs() const {
-switch (m_selected) {
-case Selected::One:
-  return m_t1;
-default:
-  return llvm::Optional();
-}
-  }
-
-  template ::value>::type
- * = nullptr>
-  llvm::Optional GetAs() const {
-switch (m_selected) {
-case Selected::Two:
-  return m_t2;
-default:
-  return llvm::Optional();
-}
-  }
-
-  template 
-  ResultType Apply(std::function if_T1,
-   std::function if_T2) const {
-switch (m_selected) {
-case Selected::One:
-  return if_T1(m_t1);
-case Selected::Two:
-  return if_T2(m_t2);
-}
-  }
-
-  bool operator==(const Either &rhs) {
-return (GetAs() == rhs.GetAs()) && (GetAs() == 
rhs.GetAs());
-  }
-
-  explicit operator bool() {
-switch (m_selected) {
-case Selected::One:
-  return (bool)m_t1;
-case Selected::Two:
-  return (bool)m_t2;
-}
-  }
-
-  Either &operator=(const Either &rhs) {
-switch (rhs.m_selected) {
-case Selected::One:
-  m_t1 = rhs.GetAs().getValue();
-  m_selected = Selected::One;
-  break;
-case Selected::Two:
-  m_t2 = rhs.GetAs().getValue();
-  m_selected = Selected::Two;
-  break;
-}
-return *this;
-  }
-
-  ~Either() {
-switch (m_selected) {
-case Selected::One:
-  m_t1.T1::~T1();
-  break;
-case Selected::Two:
-  m_t2.T2::~T2();
-  break;
-}
-  }
-};
-
+template 
+class Either {
+private:
+enum class Selected {
+One, Two
+};
+
+Selected m_selected;
+union {
+T1 m_t1;
+T2 m_t2;
+};
+
+public:
+Either(const T1& t1)
+{
+m_t1 = t1;
+m_selected = Selected::One;
+}
+
+Either(const T2& t2)
+{
+m_t2 = t2;
+m_selected = Selected::Two;
+}
+
+template ::value>::type * = nullptr >
+llvm::Optional
+GetAs()
+{
+switch (m_selected)
+{
+case Selected::One:
+return m_t1;
+default:
+return llvm::Optional();
+}
+}
+
+template ::value>::type * = nullptr >
+llvm::Optional
+GetAs()
+{
+switch (m_selected)
+{
+case Selected::Two:
+return m_t2;
+default:
+return llvm::Optional();
+}
+}
+};
+
 } // namespace lldb_utility
 
 #endif // #ifndef liblldb_Either_h_
+

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=339328&r1=339327&r2=339328&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Aug  9 04:42:28 2018
@@ -1777,7 +1777,6 @@
26CFDCA2186163A4000E63E5 /* Editline.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = Editline.cpp; sourceTree = ""; };
26CFDCA01861638D000E63E5 /* Editline.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
Editline.h; path = include/lldb/Host/Editline.h; sourceTree = ""; };
2326CF511BDD693B00A5CEAC /* EditlineTest.cpp

[Lldb-commits] [lldb] r339430 - Amend "Remove unused type Either from Utility library".

2018-08-10 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Aug 10 06:01:26 2018
New Revision: 339430

URL: http://llvm.org/viewvc/llvm-project?rev=339430&view=rev
Log:
Amend "Remove unused type Either from Utility library".

Removed:
lldb/trunk/include/lldb/Utility/Either.h

Removed: lldb/trunk/include/lldb/Utility/Either.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Either.h?rev=339429&view=auto
==
--- lldb/trunk/include/lldb/Utility/Either.h (original)
+++ lldb/trunk/include/lldb/Utility/Either.h (removed)
@@ -1,72 +0,0 @@
-//===-- Either.h ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#ifndef liblldb_Either_h_
-#define liblldb_Either_h_
-
-#include "llvm/ADT/Optional.h"
-
-namespace lldb_utility {
-template 
-class Either {
-private:
-enum class Selected {
-One, Two
-};
-
-Selected m_selected;
-union {
-T1 m_t1;
-T2 m_t2;
-};
-
-public:
-Either(const T1& t1)
-{
-m_t1 = t1;
-m_selected = Selected::One;
-}
-
-Either(const T2& t2)
-{
-m_t2 = t2;
-m_selected = Selected::Two;
-}
-
-template ::value>::type * = nullptr >
-llvm::Optional
-GetAs()
-{
-switch (m_selected)
-{
-case Selected::One:
-return m_t1;
-default:
-return llvm::Optional();
-}
-}
-
-template ::value>::type * = nullptr >
-llvm::Optional
-GetAs()
-{
-switch (m_selected)
-{
-case Selected::Two:
-return m_t2;
-default:
-return llvm::Optional();
-}
-}
-};
-
-} // namespace lldb_utility
-
-#endif // #ifndef liblldb_Either_h_
-


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


Re: [Lldb-commits] [lldb] r339328 - Remove unused type Either from Utility library.

2018-08-10 Thread Tatyana Krasnukha via lldb-commits
You are right, it seems I removed it only in my mind, sorry. Thank you for 
noting that.

> -Original Message-
> From: Davide Italiano 
> Sent: Thursday, 9 August, 2018 6:32 PM
> To: tatyana.krasnu...@synopsys.com
> Cc: lldb-commits 
> Subject: Re: [Lldb-commits] [lldb] r339328 - Remove unused type Either from
> Utility library.
> 
> On Thu, Aug 9, 2018 at 4:42 AM Tatyana Krasnukha via lldb-commits  comm...@lists.llvm.org> wrote:
> >
> > Author: tkrasnukha
> > Date: Thu Aug  9 04:42:28 2018
> > New Revision: 339328
> >
> > URL:
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_ll
> > vm-2Dproject-3Frev-3D339328-26view-
> 3Drev&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWq
> >
> B0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=6p498LDu1k
> uOMTB3Z
> > jxwhIt-
> nLt_qWPfVK472IWRb6U&s=nHSmFMtZaQ9JnQz5TSaOb_coK0Dy6GUCPe68N
> yxTc
> > KA&e=
> > Log:
> > Remove unused type Either from Utility library.
> >
> 
> I might be missing the obvious here, but it looks like `Either.h` is still 
> around in
> my checkout after you removed it? (also, from the xcodeproj files)
> 
> dcci@Davides-MacBook-Pro ~/w/l/l/t/lldb> ls ./include/lldb/Utility/Either.h
> ./include/lldb/Utility/Either.h
> 
> Do you plan to nuke the header from orbit completely?
> 
> --
> Davide
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r341482 - Hold GIL while allocating memory for PythonString.

2018-09-05 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Sep  5 10:07:29 2018
New Revision: 341482

URL: http://llvm.org/viewvc/llvm-project?rev=341482&view=rev
Log:
Hold GIL while allocating memory for PythonString.

Summary:
Swig wraps C++ code into SWIG_PYTHON_THREAD_BEGIN_ALLOW; ...  
SWIG_PYTHON_THREAD_END_ALLOW;
Thus, LLDB crashes with "Fatal Python error: Python memory allocator called 
without holding the GIL" when calls an lldb_SB***___str__ function.

Reviewers: clayborg

Reviewed By: clayborg

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

Modified:
lldb/trunk/scripts/Python/python-extensions.swig

Modified: lldb/trunk/scripts/Python/python-extensions.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=341482&r1=341481&r2=341482&view=diff
==
--- lldb/trunk/scripts/Python/python-extensions.swig (original)
+++ lldb/trunk/scripts/Python/python-extensions.swig Wed Sep  5 10:07:29 2018
@@ -1,5 +1,6 @@
 
 %extend lldb::SBAddress {
+%nothreadallow;
 PyObject *lldb::SBAddress::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -12,8 +13,10 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 }
 %extend lldb::SBBlock {
+%nothreadallow;
 PyObject *lldb::SBBlock::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -26,8 +29,10 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 }
 %extend lldb::SBBreakpoint {
+%nothreadallow;
 PyObject *lldb::SBBreakpoint::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -40,6 +45,7 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 
 %pythoncode %{ 
 def __eq__(self, rhs):
@@ -57,6 +63,7 @@
 
 }
 %extend lldb::SBBreakpointLocation {
+%nothreadallow;
 PyObject *lldb::SBBreakpointLocation::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description, 
lldb::eDescriptionLevelFull);
@@ -69,9 +76,11 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 }
 
 %extend lldb::SBBreakpointName {
+%nothreadallow;
 PyObject *lldb::SBBreakpointName::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -84,6 +93,7 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 }
 
 %extend lldb::SBBroadcaster {
@@ -103,6 +113,7 @@
 }
 
 %extend lldb::SBCommandReturnObject {
+%nothreadallow;
 PyObject *lldb::SBCommandReturnObject::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -115,6 +126,7 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 
 /* the write() and flush() calls are not part of the SB API proper, 
and are solely for Python usage
 they are meant to make an SBCommandReturnObject into a file-like 
object so that instructions of the sort
@@ -130,6 +142,7 @@
 {}
 }
 %extend lldb::SBCompileUnit {
+%nothreadallow;
 PyObject *lldb::SBCompileUnit::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -142,6 +155,7 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 %pythoncode %{ 
 def __eq__(self, rhs):
 if not isinstance(rhs, type(self)): 
@@ -157,6 +171,7 @@
 %}
 }
 %extend lldb::SBData {
+%nothreadallow;
 PyObject *lldb::SBData::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -169,8 +184,10 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 }
 %extend lldb::SBDebugger {
+%nothreadallow;
 PyObject *lldb::SBDebugger::__str__ (){
 lldb::SBStream description;
 $self->GetDescription (description);
@@ -183,8 +200,10 @@
 else
 return lldb_private::PythonString("").release();
 }
+%clearnothreadallow;
 }
 %extend lldb::SBDeclaration {
+%nothreadallow;
 PyObject *lldb::SBDeclaration::__str__ (){
 lldb::SBStream 

[Lldb-commits] [lldb] r342671 - Replace boolean parameter with enum value according r342633

2018-09-20 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Thu Sep 20 10:57:24 2018
New Revision: 342671

URL: http://llvm.org/viewvc/llvm-project?rev=342671&view=rev
Log:
Replace boolean parameter with enum value according r342633

Modified:
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=342671&r1=342670&r2=342671&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Thu Sep 
20 10:57:24 2018
@@ -837,7 +837,7 @@ void ProcessWindows::OnDebuggerConnected
   return;
 }
 
-GetTarget().SetExecutableModule(module, false);
+GetTarget().SetExecutableModule(module, eLoadDependentsNo);
   }
 
   bool load_addr_changed;


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


[Lldb-commits] [lldb] r342732 - Skip test if gcc version is less than 7.1 since it doesn't support -gcolumn-info option

2018-09-21 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 21 06:20:26 2018
New Revision: 342732

URL: http://llvm.org/viewvc/llvm-project?rev=342732&view=rev
Log:
Skip test if gcc version is less than 7.1 since it doesn't support 
-gcolumn-info option

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py?rev=342732&r1=342731&r2=342732&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py
 Fri Sep 21 06:20:26 2018
@@ -18,6 +18,8 @@ class BreakpointByLineAndColumnTestCase(
 
 mydir = TestBase.compute_mydir(__file__)
 
+## Skip gcc version less 7.1 since it doesn't support -gcolumn-info
+@skipIf(compiler="gcc", compiler_version=['<', '7.1'])
 def testBreakpointByLineAndColumn(self):
 self.build()
 main_c = lldb.SBFileSpec("main.c")
@@ -31,6 +33,8 @@ class BreakpointByLineAndColumnTestCase(
 in_then |= b_loc.GetColumn() == 50
 self.assertTrue(in_then)
 
+## Skip gcc version less 7.1 since it doesn't support -gcolumn-info
+@skipIf(compiler="gcc", compiler_version=['<', '7.1'])
 def testBreakpointByLine(self):
 self.build()
 main_c = lldb.SBFileSpec("main.c")


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


[Lldb-commits] [lldb] r342733 - Add dependency on llc required by find-variable-dwo test

2018-09-21 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 21 06:40:22 2018
New Revision: 342733

URL: http://llvm.org/viewvc/llvm-project?rev=342733&view=rev
Log:
Add dependency on llc required by find-variable-dwo test

Modified:
lldb/trunk/lit/CMakeLists.txt

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=342733&r1=342732&r2=342733&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Fri Sep 21 06:40:22 2018
@@ -24,6 +24,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLV
 list(APPEND LLDB_TEST_DEPS
   LLDBUnitTests
   dsymutil
+  llc
   lldb
   lldb-test
   llvm-config


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


[Lldb-commits] libxml2 for Windows

2017-11-14 Thread Tatyana Krasnukha via lldb-commits
Propose to enable libxml2 support for Windows. I've built sources from 
https://git.gnome.org/browse/libxml2 and successfully used lldb with it (in 
part of parsing target.xml in ProcessGDBRemote).


LLDBConfig.cmake.LibXml.patch
Description: LLDBConfig.cmake.LibXml.patch
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D39967: Refactoring of MemoryWrite function

2018-01-23 Thread Tatyana Krasnukha via lldb-commits
Like this idea of using breakpoint resolver very much. It's exactly how I see 
debugger's proper work in such cases.

> -Original Message-
> From: jing...@apple.com [mailto:jing...@apple.com]
> Sent: Tuesday, 23 January, 2018 8:43 PM
> To: reviews+d39967+public+2d921c2f326fd...@reviews.llvm.org; Tatyana
> Krasnukha via Phabricator 
> Cc: tatyana.krasnu...@synopsys.com; clayb...@gmail.com; lldb-
> comm...@lists.llvm.org
> Subject: Re: [Lldb-commits] [PATCH] D39967: Refactoring of MemoryWrite
> function
> 
> It seems to me better to remove breakpoint sites under any memory that
> you are going to overwrite.  The old breakpoints aren't guaranteed to make
> any sense and, for instance, on x86 could do harm (they could end up in the
> middle of an instruction in the new TEXT.)
> 
> If you want to do this regularly, you should remove the breakpoints and then
> ask the breakpoint resolver to re-check the new code once it has been
> written.  If for instance you are writing down memory that you have debug
> info for, then it will reset the breakpoints based on the new symbols for this
> location.
> 
> Jim
> 
> 
> > On Jan 23, 2018, at 8:42 AM, Tatyana Krasnukha via Phabricator via lldb-
> commits  wrote:
> >
> > tatyana-krasnukha added a comment.
> >
> > Cannot promise that I'll do it (with all tests) quickly, but I'll do.
> >
> > One more question: what are the cases when intersection can happen,
> beside user forgot to disable it manually? (Will not it be annoying for user 
> to
> get breakpoints in unpredictable locations after such situation?)
> >
> >
> > https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__reviews.llvm.org_D39967&d=DwICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r
> =8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=p7fMc9pHWz1TqLP
> GI2BcPpRTt7ir_dS_RN3DYanOVVw&s=ddJGG8U73bqnME4GDlY-N71n-
> aBo1zmXPw8KElfI19A&e=
> >
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-
> 2Dbin_mailman_listinfo_lldb-
> 2Dcommits&d=DwICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=8NZfjV_ZLY_S7gZy
> QMq8mj7tiN4vlymPiSt0Wl0jegw&m=p7fMc9pHWz1TqLPGI2BcPpRTt7ir_dS_
> RN3DYanOVVw&s=nKin51JixOP9e1x0sEjcQyEKPKwP0j_iTt2LzdkMX-I&e=

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


[Lldb-commits] Patch for fixing FDE indexing when scan debug_info section

2017-05-18 Thread Tatyana Krasnukha via lldb-commits
Fix FDE indexing while scan debug_info section.

There are some differences between eh_frame and debug_frame formats that are 
not considered by DWARFCallFrameInfo::GetFDEIndex.
An FDE entry contains CIE_pointer in debug_frame in same place as cie_id in 
eh_frame. As described in dwarf 
standard (section 6.4.1),
CIE_pointer is an "offset into the .debug_frame section". So, variable 
cie_offset should be equal cie_id for debug_frame.
FDE entries with zeroth CIE pointer (which is actually placed in cie_id 
variable) shouldn't be ignored also.

I had same issue as described here 
http://lists.llvm.org/pipermail/lldb-dev/2014-October/005520.html , and these 
changes have fixed it for me (with "m_is_eh_frame" set to false, of course).

Tatyana Krasnukha
Software Engineer, Sr. I, Solutions Group, Synopsys Inc.
w +7.812.408.7463 | m +7 981 757-4491 | 
taty...@synopsys.com



DWARFCallFrameInfo.cpp.patch
Description: DWARFCallFrameInfo.cpp.patch
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info section

2017-05-23 Thread Tatyana Krasnukha via lldb-commits
Done. I have also added a little change which allow to use debug_info section 
when eh_frame is absent. This case really can take place on some platforms.

Thanks,
Tatyana

From: Abid, Hafiz [mailto:hafiz_a...@mentor.com]
Sent: Tuesday, 23 May, 2017 3:31 PM
To: Tatyana Krasnukha ; 
lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info 
section

It looks ok to me. Please put the differences of .eh_frame and
.debug_frame that you described below in code comments too.​

Thanks,
Abid




From: lldb-commits 
mailto:lldb-commits-boun...@lists.llvm.org>>
 on behalf of Tatyana Krasnukha via lldb-commits 
mailto:lldb-commits@lists.llvm.org>>
Sent: Thursday, May 18, 2017 9:37 PM
To: lldb-commits@lists.llvm.org<mailto:lldb-commits@lists.llvm.org>
Subject: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info 
section

Fix FDE indexing while scan debug_info section.

There are some differences between eh_frame and debug_frame formats that are 
not considered by DWARFCallFrameInfo::GetFDEIndex.
An FDE entry contains CIE_pointer in debug_frame in same place as cie_id in 
eh_frame. As described in dwarf 
standard<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dwarfstd.org_doc_dwarf-2D2.0.0.pdf&d=DwMFAw&c=DPL6_X_6JkXFx7AXWqB0tg&r=yfnu24japkhNGh-WqJObHXmH3mINtC_2FO828lrNpM0&m=6bXYUUYhGtSz4V-aPy_DuviU1kYtmn9rHUU-2aIGDzE&s=kMPV12z6OBKSq3lC8HgNgMkv23SamtORaFALS-I-Vts&e=>
 (section 6.4.1),
CIE_pointer is an “offset into the .debug_frame section”. So, variable 
cie_offset should be equal cie_id for debug_frame.
FDE entries with zeroth CIE pointer (which is actually placed in cie_id 
variable) shouldn’t be ignored also.

I had same issue as described here 
http://lists.llvm.org/pipermail/lldb-dev/2014-October/005520.html<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_pipermail_lldb-2Ddev_2014-2DOctober_005520.html&d=DwMFAw&c=DPL6_X_6JkXFx7AXWqB0tg&r=yfnu24japkhNGh-WqJObHXmH3mINtC_2FO828lrNpM0&m=6bXYUUYhGtSz4V-aPy_DuviU1kYtmn9rHUU-2aIGDzE&s=7NGym3Cx6gVwlzBRE44Zm6Teee6tMi9Iq-BTRMjM6Pc&e=>
 , and these changes have fixed it for me (with "m_is_eh_frame" set to false, 
of course).

Tatyana Krasnukha
Software Engineer, Sr. I, Solutions Group, Synopsys Inc.
w +7.812.408.7463 | m +7 981 757-4491 | 
taty...@synopsys.com<mailto:taty...@synopsys.com>



Symbol.patch
Description: Symbol.patch
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] Fixing of Bug 32920 - Potentially premature destroying of the locker in Python interpreter

2017-05-23 Thread Tatyana Krasnukha via lldb-commits
CreateStructuredDictionary() needs the GIL to be held because it calls 
PyList_GET_SIZE from a nested function.



ScriptInterpreterPython.cpp.patch
Description: ScriptInterpreterPython.cpp.patch
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info section

2017-05-24 Thread Tatyana Krasnukha via lldb-commits
Formatting is done.
Created D33504, and it is accepted now, but what should I do next (I haven’t 
commit access)?

Thanks,
Tatyana

From: Abid, Hafiz [mailto:hafiz_a...@mentor.com]
Sent: Wednesday, 24 May, 2017 12:37 PM
To: Tatyana Krasnukha ; 
lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info 
section


Please put it as review in Phabricator so others can comment too. I am 
wondering how we can test this behaviour.

One can use -fno-asynchronous-unwind-tables with clang to disable generation of 
.eh_frame but the startup code

still brings in that section.



You also need to run clang-format to make sure formatting is right and I see 
some strange characters in the patch file.



> +  // Try to find .debug_frame section even if .eh_frame doesn't exist.

s/even if/if/



Thanks,

Abid


From: Tatyana Krasnukha 
mailto:tatyana.krasnu...@synopsys.com>>
Sent: Tuesday, May 23, 2017 6:20 PM
To: Abid, Hafiz; lldb-commits@lists.llvm.org<mailto:lldb-commits@lists.llvm.org>
Subject: RE: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info 
section

Done. I have also added a little change which allow to use debug_info section 
when eh_frame is absent. This case really can take place on some platforms.

Thanks,
Tatyana

From: Abid, Hafiz [mailto:hafiz_a...@mentor.com]
Sent: Tuesday, 23 May, 2017 3:31 PM
To: Tatyana Krasnukha 
mailto:tatyana.krasnu...@synopsys.com>>; 
lldb-commits@lists.llvm.org<mailto:lldb-commits@lists.llvm.org>
Subject: Re: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info 
section

It looks ok to me. Please put the differences of .eh_frame and
.debug_frame that you described below in code comments too.​

Thanks,
Abid




From: lldb-commits 
mailto:lldb-commits-boun...@lists.llvm.org>>
 on behalf of Tatyana Krasnukha via lldb-commits 
mailto:lldb-commits@lists.llvm.org>>
Sent: Thursday, May 18, 2017 9:37 PM
To: lldb-commits@lists.llvm.org<mailto:lldb-commits@lists.llvm.org>
Subject: [Lldb-commits] Patch for fixing FDE indexing when scan debug_info 
section

Fix FDE indexing while scan debug_info section.

There are some differences between eh_frame and debug_frame formats that are 
not considered by DWARFCallFrameInfo::GetFDEIndex.
An FDE entry contains CIE_pointer in debug_frame in same place as cie_id in 
eh_frame. As described in dwarf 
standard<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dwarfstd.org_doc_dwarf-2D2.0.0.pdf&d=DwMFAw&c=DPL6_X_6JkXFx7AXWqB0tg&r=yfnu24japkhNGh-WqJObHXmH3mINtC_2FO828lrNpM0&m=6bXYUUYhGtSz4V-aPy_DuviU1kYtmn9rHUU-2aIGDzE&s=kMPV12z6OBKSq3lC8HgNgMkv23SamtORaFALS-I-Vts&e=>
 (section 6.4.1),
CIE_pointer is an “offset into the .debug_frame section”. So, variable 
cie_offset should be equal cie_id for debug_frame.
FDE entries with zeroth CIE pointer (which is actually placed in cie_id 
variable) shouldn’t be ignored also.

I had same issue as described here 
http://lists.llvm.org/pipermail/lldb-dev/2014-October/005520.html<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_pipermail_lldb-2Ddev_2014-2DOctober_005520.html&d=DwMFAw&c=DPL6_X_6JkXFx7AXWqB0tg&r=yfnu24japkhNGh-WqJObHXmH3mINtC_2FO828lrNpM0&m=6bXYUUYhGtSz4V-aPy_DuviU1kYtmn9rHUU-2aIGDzE&s=7NGym3Cx6gVwlzBRE44Zm6Teee6tMi9Iq-BTRMjM6Pc&e=>
 , and these changes have fixed it for me (with "m_is_eh_frame" set to false, 
of course).

Tatyana Krasnukha
Software Engineer, Sr. I, Solutions Group, Synopsys Inc.
w +7.812.408.7463 | m +7 981 757-4491 | 
taty...@synopsys.com<mailto:taty...@synopsys.com>

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


Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while scan debug_info section

2017-05-26 Thread Tatyana Krasnukha via lldb-commits
.debug_frame may exist, even if there is no other debugging information. In 
this case we cannot obtain DWARF version from debug_info and ParseCIE is the 
only place where we can get CIE version and check whether it is supported or 
not.

Thanks,
Tatyana

-Original Message-
From: Pavel Labath [mailto:lab...@google.com] 
Sent: Friday, 26 May, 2017 2:17 PM
To: Robinson, Paul 
Cc: Tatyana Krasnukha ; 
lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while scan 
debug_info section

Yes, that would definitely be a good idea. I was just saying that we shouldn't 
gate *any* .debug_frame support on being able to read a
dwarf4 .debug_frame section.

BTW, we've had a short chat about this with Abidh on IRC, I am going to paste 
the relevant part here, to make sure everyone is on the same
page:

 after looking at the code, i think the eh_frame/debug_frame choice 
should be per function, not per-module  that's way more useful, and it 
should allow more reasonable testing  I am a little confused. You are 
saying that compiler should provide this per function choice  no 
 right  so what the current patch does is:
 if (we_have_eh_frame()) frame = eh_frame() else frame = debug_frame() 
 (this is in the initialization code)  and then later, when we 
actually try to get an unwind plan for some function, we do:
 if (frame->can_you_unwind(function)) return
frame->get_unwind_plan(function)
 what I am proposing instead is for the init code to do:
 frame1 = eh_frame(); frame2 = debug_frame();  and then later 
on (this would be the UnwindTable::GetFuncUnwindersContainingAddress function) 
 if (frame1->can_you_unwind(function)) return
frame1->get_unwind_plan(function)
 else if (frame2->can_you_unwind(function)) return
frame2->get_unwind_plan(function)
 so the choice which unwind section you use happens on a per-function 
basis


On 25 May 2017 at 22:42, Robinson, Paul  wrote:
> IANA lldb developer, but I should think lldb would want to understand 
> a DWARF 4 .debug_frame section.  (And it didn't change in DWARF 5, 
> either!) --paulr
>
>> -Original Message-
>> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On 
>> Behalf Of Pavel Labath via lldb-commits
>> Sent: Thursday, May 25, 2017 9:17 AM
>> To: Tatyana Krasnukha
>> Cc: lldb-commits@lists.llvm.org
>> Subject: Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while 
>> scan debug_info section
>>
>> +lldb-commits
>>
>> Yes, that is certainly a viable approach. If there is a subset of 
>> dwarf that we are capable of parsing correctly then it would be great 
>> to enable that.
>>
>> On 25 May 2017 at 16:46, Tatyana Krasnukha 
>>  wrote:
>> > This binary uses DWARF 4, that introduces two additional fields in 
>> > CIE -
>> address_size and segment_size just after augmentation field. That’s 
>> why values are parsed  incorrectly.
>> > May be we should discard unwind plan if there is unsupported dwarf
>> version for now?
>> >
>> > Thanks,
>> > Tatyana
>> >
>> > -Original Message-
>> > From: Pavel Labath [mailto:lab...@google.com]
>> > Sent: Thursday, 25 May, 2017 5:45 PM
>> > To: tatyana.krasnu...@synopsys.com
>> > Subject: Re: [PATCH] D33504: Fix FDE indexing while scan debug_info
>> section
>> >
>> > Hey, try the attached binary for size.
>> >
>> > It was generated from the source file in
>> lldb/test/testcases/functionalities/breakpoint/breakpoint_conditions/main.
>> c,
>> > while targetting android arm64.
>> >
>> > You should be able to create a test binary for yourself locally
>> (assuming you're on linux) like this:
>> > $ cat a.c
>> > int a(char *x) { return *x; }
>> >
>> > int f() {
>> >   return a(0);
>> > }
>> >
>> > int g() {
>> >   return 1+f();
>> > }
>> >
>> > int _start() { return 2+g(); }
>> >
>> > $ clang -fno-exceptions -fno-unwind-tables -g a.c -nostdlib
>> >
>> > If you debug the binary with and stop in the ParseCIE function, you 
>> > will
>> see that it parses the entry incorrectly:
>> > Process 39688 stopped
>> > * thread #1, name = 'lldb', stop reason = step over
>> > frame #0: 0x7074bb53
>> >
>> liblldb.so.5`lldb_private::DWARFCallFrameInfo::ParseCIE(this=0x00
>> 6
>> 13280,
>> > cie_offset=0) at DWARFCallFrameInfo.cpp:303
>> >300cie_sp->data_align = (int32_t)m_cfi_data.GetSLEB128(&offset);
>> >301cie_sp->return_addr_reg_num = m_cfi_data.GetU8(&offset);
>> >302
>> > -> 303if (cie_sp->augmentation[0]) {
>> >304  // Get the length of the eh_frame augmentation data
>> >305  // which starts with a ULEB128 length in bytes
>> >306  const size_t aug_data_len =
>> (size_t)m_cfi_data.GetULEB128(&offset);
>> >
>> > (lldb) fr var cie_sp._M_ptr[0]
>> > (lldb_private::DWARFCallFrameInfo::CIE) cie_sp._M_ptr[0] = {
>> >   cie_offset = 0
>> >   version = '\x04'
>> >   augmentation = ""
>> >   code_align = 8 <== wrong
>> >   data_align = 0 <== wrong
>> >   return_addr_reg_num = 1 <= wrong
>> >   inst_offset = 0
>> 

Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while scan debug_info section

2017-05-26 Thread Tatyana Krasnukha via lldb-commits
Yes, and it is what we need - this version increases when section undergo 
incompatible changes.  

Thanks,
Tatyana

-Original Message-
From: Abid, Hafiz [mailto:hafiz_a...@mentor.com] 
Sent: Friday, 26 May, 2017 7:51 PM
To: Pavel Labath ; Tatyana Krasnukha 

Cc: lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while scan 
debug_info section

Please note that version in the debug_frame is is specific to the call frame 
information.
It is not the same as DWARF version number.

Regards,
Abid

From: lldb-commits  on behalf of Tatyana 
Krasnukha via lldb-commits 
Sent: Friday, May 26, 2017 12:47 PM
To: Pavel Labath; lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while scan 
debug_info section

.debug_frame may exist, even if there is no other debugging information. In 
this case we cannot obtain DWARF version from debug_info and ParseCIE is the 
only place where we can get CIE version and check whether it is supported or 
not.

Thanks,
Tatyana

-Original Message-
From: Pavel Labath [mailto:lab...@google.com]
Sent: Friday, 26 May, 2017 2:17 PM
To: Robinson, Paul 
Cc: Tatyana Krasnukha ; 
lldb-commits@lists.llvm.org
Subject: Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while scan 
debug_info section

Yes, that would definitely be a good idea. I was just saying that we shouldn't 
gate *any* .debug_frame support on being able to read a
dwarf4 .debug_frame section.

BTW, we've had a short chat about this with Abidh on IRC, I am going to paste 
the relevant part here, to make sure everyone is on the same
page:

 after looking at the code, i think the eh_frame/debug_frame choice 
should be per function, not per-module  that's way more useful, and it 
should allow more reasonable testing  I am a little confused. You are 
saying that compiler should provide this per function choice  no 
 right  so what the current patch does is:
 if (we_have_eh_frame()) frame = eh_frame() else frame = debug_frame() 
 (this is in the initialization code)  and then later, when we 
actually try to get an unwind plan for some function, we do:
 if (frame->can_you_unwind(function)) return
frame->get_unwind_plan(function)
 what I am proposing instead is for the init code to do:
 frame1 = eh_frame(); frame2 = debug_frame();  and then later 
on (this would be the UnwindTable::GetFuncUnwindersContainingAddress function) 
 if (frame1->can_you_unwind(function)) return
frame1->get_unwind_plan(function)
 else if (frame2->can_you_unwind(function)) return
frame2->get_unwind_plan(function)
 so the choice which unwind section you use happens on a per-function 
basis


On 25 May 2017 at 22:42, Robinson, Paul  wrote:
> IANA lldb developer, but I should think lldb would want to understand 
> a DWARF 4 .debug_frame section.  (And it didn't change in DWARF 5,
> either!) --paulr
>
>> -Original Message-
>> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On 
>> Behalf Of Pavel Labath via lldb-commits
>> Sent: Thursday, May 25, 2017 9:17 AM
>> To: Tatyana Krasnukha
>> Cc: lldb-commits@lists.llvm.org
>> Subject: Re: [Lldb-commits] [PATCH] D33504: Fix FDE indexing while 
>> scan debug_info section
>>
>> +lldb-commits
>>
>> Yes, that is certainly a viable approach. If there is a subset of 
>> dwarf that we are capable of parsing correctly then it would be great 
>> to enable that.
>>
>> On 25 May 2017 at 16:46, Tatyana Krasnukha 
>>  wrote:
>> > This binary uses DWARF 4, that introduces two additional fields in 
>> > CIE -
>> address_size and segment_size just after augmentation field. That's 
>> why values are parsed  incorrectly.
>> > May be we should discard unwind plan if there is unsupported dwarf
>> version for now?
>> >
>> > Thanks,
>> > Tatyana
>> >
>> > -Original Message-
>> > From: Pavel Labath [mailto:lab...@google.com]
>> > Sent: Thursday, 25 May, 2017 5:45 PM
>> > To: tatyana.krasnu...@synopsys.com
>> > Subject: Re: [PATCH] D33504: Fix FDE indexing while scan debug_info
>> section
>> >
>> > Hey, try the attached binary for size.
>> >
>> > It was generated from the source file in
>> lldb/test/testcases/functionalities/breakpoint/breakpoint_conditions/main.
>> c,
>> > while targetting android arm64.
>> >
>> > You should be able to create a test binary for yourself locally
>> (assuming you're on linux) like this:
>> > $ cat a.c
>> > int a(char *x) { return *x; }
>> >
>> > int f() {
>> >   return a(0);
>> > }
>> >
>> > int g() {
>> &g

[Lldb-commits] [lldb] r352226 - ResolveBreakpointSite: fix outdated warning message

2019-01-25 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Jan 25 10:27:09 2019
New Revision: 352226

URL: http://llvm.org/viewvc/llvm-project?rev=352226&view=rev
Log:
ResolveBreakpointSite: fix outdated warning message

Currently if a breakpoint site is already present, its ID will be returned, not 
the LLDB_INVALID_BREAK_ID.
On the other hand, Process::CreateBreakpointSite may have another reasons to 
return LLDB_INVALID_BREAK_ID.

Modified:
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=352226&r1=352225&r2=352226&view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Jan 25 10:27:09 2019
@@ -454,13 +454,11 @@ bool BreakpointLocation::ResolveBreakpoi
   if (new_id == LLDB_INVALID_BREAK_ID) {
 Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
 if (log)
-  log->Warning("Tried to add breakpoint site at 0x%" PRIx64
-   " but it was already present.\n",
+  log->Warning("Failed to add breakpoint site at 0x%" PRIx64,
m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()));
-return false;
   }
 
-  return true;
+  return IsResolved();
 }
 
 bool BreakpointLocation::SetBreakpointSite(BreakpointSiteSP &bp_site_sp) {


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


[Lldb-commits] [lldb] r354206 - Add PythonBoolean type to the PythonDataObjects

2019-02-16 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Sat Feb 16 10:39:14 2019
New Revision: 354206

URL: http://llvm.org/viewvc/llvm-project?rev=354206&view=rev
Log:
Add PythonBoolean type to the PythonDataObjects

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

Modified:
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=354206&r1=354205&r2=354206&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
Sat Feb 16 10:39:14 2019
@@ -77,6 +77,8 @@ PyObjectType PythonObject::GetObjectType
 #endif
   if (PythonByteArray::Check(m_py_obj))
 return PyObjectType::ByteArray;
+  if (PythonBoolean::Check(m_py_obj))
+return PyObjectType::Boolean;
   if (PythonInteger::Check(m_py_obj))
 return PyObjectType::Integer;
   if (PythonFile::Check(m_py_obj))
@@ -178,6 +180,9 @@ StructuredData::ObjectSP PythonObject::C
   case PyObjectType::Dictionary:
 return PythonDictionary(PyRefType::Borrowed, m_py_obj)
 .CreateStructuredDictionary();
+  case PyObjectType::Boolean:
+return PythonBoolean(PyRefType::Borrowed, m_py_obj)
+.CreateStructuredBoolean();
   case PyObjectType::Integer:
 return PythonInteger(PyRefType::Borrowed, m_py_obj)
 .CreateStructuredInteger();
@@ -525,6 +530,55 @@ StructuredData::IntegerSP PythonInteger:
   return result;
 }
 
+//--
+// PythonBoolean
+//--
+
+PythonBoolean::PythonBoolean(PyRefType type, PyObject *py_obj)
+: PythonObject() {
+  Reset(type, py_obj); // Use "Reset()" to ensure that py_obj is a boolean type
+}
+
+PythonBoolean::PythonBoolean(const PythonBoolean &object)
+: PythonObject(object) {}
+
+PythonBoolean::PythonBoolean(bool value) {
+  SetValue(value);
+}
+
+bool PythonBoolean::Check(PyObject *py_obj) {
+  return py_obj ? PyBool_Check(py_obj) : false;
+}
+
+void PythonBoolean::Reset(PyRefType type, PyObject *py_obj) {
+  // Grab the desired reference type so that if we end up rejecting `py_obj` it
+  // still gets decremented if necessary.
+  PythonObject result(type, py_obj);
+
+  if (!PythonBoolean::Check(py_obj)) {
+PythonObject::Reset();
+return;
+  }
+
+  // Calling PythonObject::Reset(const PythonObject&) will lead to stack
+  // overflow since it calls back into the virtual implementation.
+  PythonObject::Reset(PyRefType::Borrowed, result.get());
+}
+
+bool PythonBoolean::GetValue() const {
+  return m_py_obj ? PyObject_IsTrue(m_py_obj) : false;
+}
+
+void PythonBoolean::SetValue(bool value) {
+  PythonObject::Reset(PyRefType::Owned, PyBool_FromLong(value));
+}
+
+StructuredData::BooleanSP PythonBoolean::CreateStructuredBoolean() const {
+  StructuredData::BooleanSP result(new StructuredData::Boolean);
+  result->SetValue(GetValue());
+  return result;
+}
+
 //--
 // PythonList
 //--

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h?rev=354206&r1=354205&r2=354206&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h Sat 
Feb 16 10:39:14 2019
@@ -57,6 +57,7 @@ private:
 enum class PyObjectType {
   Unknown,
   None,
+  Boolean,
   Integer,
   Dictionary,
   List,
@@ -297,6 +298,29 @@ public:
   StructuredData::IntegerSP CreateStructuredInteger() const;
 };
 
+class PythonBoolean : public PythonObject {
+public:
+  PythonBoolean() = default;
+  explicit PythonBoolean(bool value);
+  PythonBoolean(PyRefType type, PyObject *o);
+  PythonBoolean(const PythonBoolean &object);
+
+  ~PythonBoolean() override = default;
+
+  static bool Check(PyObject *py_obj);
+
+  // Bring in the no-argument base class version
+  using PythonObject::Reset;
+
+  void Reset(PyRefType type, PyObject *py_obj) override;
+
+  bool GetValue() const;
+
+  void SetValue(bool value);
+
+  StructuredData::BooleanSP CreateStructuredBoolean() const;
+};
+
 class PythonList : public PythonObject {
 public:
   PythonList() {}

Modified: 
lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTes

[Lldb-commits] [lldb] r354798 - [lldb-mi] Check raw pointers before passing them to std::string ctor/assignment

2019-02-25 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Mon Feb 25 08:40:11 2019
New Revision: 354798

URL: http://llvm.org/viewvc/llvm-project?rev=354798&view=rev
Log:
[lldb-mi] Check raw pointers before passing them to std::string ctor/assignment

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

Added:
lldb/trunk/unittests/tools/lldb-mi/
lldb/trunk/unittests/tools/lldb-mi/CMakeLists.txt
lldb/trunk/unittests/tools/lldb-mi/utils/
lldb/trunk/unittests/tools/lldb-mi/utils/CMakeLists.txt
lldb/trunk/unittests/tools/lldb-mi/utils/StringTest.cpp
Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp
lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
lldb/trunk/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
lldb/trunk/tools/lldb-mi/MICmnMIResultRecord.cpp
lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp
lldb/trunk/tools/lldb-mi/MIUtilString.cpp
lldb/trunk/tools/lldb-mi/MIUtilString.h
lldb/trunk/unittests/tools/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp?rev=354798&r1=354797&r2=354798&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp Mon Feb 25 08:40:11 2019
@@ -339,7 +339,9 @@ bool CMICmdCmdListThreadGroups::Acknowle
   const char *pDir = sbTrgt.GetExecutable().GetDirectory();
   const char *pFileName = sbTrgt.GetExecutable().GetFilename();
   const CMIUtilString strFile(
-  CMIUtilString::Format("%s/%s", pDir, pFileName));
+  CMIUtilString::Format("%s/%s",
+CMIUtilString::WithNullAsEmpty(pDir),
+CMIUtilString::WithNullAsEmpty(pFileName)));
   const CMICmnMIValueConst miValueConst4(strFile);
   const CMICmnMIValueResult miValueResult4("executable", miValueConst4);
   miTuple.Add(miValueResult4);

Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp?rev=354798&r1=354797&r2=354798&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp Mon Feb 25 08:40:11 
2019
@@ -375,11 +375,9 @@ bool CMICmnLLDBDebugSessionInfo::MIRespo
 
   // Add "target-id"
   const char *pThreadName = rThread.GetName();
-  const MIuint len =
-  (pThreadName != nullptr) ? CMIUtilString(pThreadName).length() : 0;
-  const bool bHaveName = ((pThreadName != nullptr) && (len > 0) && (len < 32) 
&&
-  CMIUtilString::IsAllValidAlphaAndNumeric(
-  pThreadName)); // 32 is arbitrary number
+  const MIuint len = CMIUtilString(pThreadName).length();
+  const bool bHaveName = (len > 0) && (len < 32) && // 32 is arbitrary number
+ CMIUtilString::IsAllValidAlphaAndNumeric(pThreadName);
   const char *pThrdFmt = bHaveName ? "%s" : "Thread %d";
   CMIUtilString strThread;
   if (bHaveName)

Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp?rev=354798&r1=354797&r2=354798&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp Mon Feb 25 08:40:11 2019
@@ -43,10 +43,11 @@ static inline bool MI_char_summary_provi
 
   lldb::BasicType type_code = value_type.GetBasicType();
   if (type_code == lldb::eBasicTypeSignedChar)
-stream.Printf("%d %s", (int)value.GetValueAsSigned(), value.GetValue());
+stream.Printf("%d %s", (int)value.GetValueAsSigned(),
+  CMIUtilString::WithNullAsEmpty(value.GetValue()));
   else if (type_code == lldb::eBasicTypeUnsignedChar)
 stream.Printf("%u %s", (unsigned)value.GetValueAsUnsigned(),
-  value.GetValue());
+  CMIUtilString::WithNullAsEmpty(value.GetValue()));
   else
 return false;
 

Modified: lldb/trunk/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp?rev=354798&r1=354797&r2=354798&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp Mon Feb 25 08:40:11 2019
@@ -109,8 +109,10 @@ MapOutOfBandToToken(CMICmnMIOutOfBandRec
 //--
 static CMIUtilString
 BuildAsyncRecord(CMICmnMIOutOfBandRecord::OutOfBand_e veType) {
-  return CMIUtilString::Format("%s%s", MapOutOfBandToToken(veType),
-  

[Lldb-commits] [lldb] r354803 - [lldb-mi] Fix conversion warning for 64-bit build

2019-02-25 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Mon Feb 25 10:23:44 2019
New Revision: 354803

URL: http://llvm.org/viewvc/llvm-project?rev=354803&view=rev
Log:
[lldb-mi] Fix conversion warning for 64-bit build

Modified:
lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp?rev=354803&r1=354802&r2=354803&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp Mon Feb 25 10:23:44 2019
@@ -558,7 +558,7 @@ bool CMICmnLLDBDebugger::UnregisterForEv
   ClientGetMaskForAllClients(vBroadcasterClass);
   MIuint newEventMask = 0;
   for (MIuint i = 0; i < 32; i++) {
-const MIuint bit = 1 << i;
+const MIuint bit = MIuint(1) << i;
 const MIuint clientBit = bit & clientsEventMask;
 const MIuint othersBit = bit & otherClientsEventMask;
 if ((clientBit != 0) && (othersBit == 0)) {


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


[Lldb-commits] [lldb] r354804 - [lldb-mi] Return source line number in proper format

2019-02-25 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Mon Feb 25 10:32:46 2019
New Revision: 354804

URL: http://llvm.org/viewvc/llvm-project?rev=354804&view=rev
Log:
[lldb-mi] Return source line number in proper format

Line number is a decimal number and is printed as such, however for some
reason it was prefixed with '0x', thus turning printed value invalid.

Patch by Anton Kolesov 

Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp?rev=354804&r1=354803&r2=354804&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Mon Feb 25 10:32:46 2019
@@ -418,7 +418,7 @@ bool CMICmdCmdDataDisassemble::Execute()
 
   // MI "src_and_asm_line={line=\"%u\",file=\"%s\",line_asm_insn=[ ]}"
   const CMICmnMIValueConst miValueConst(
-  CMIUtilString::Format("0x%u", nLine));
+  CMIUtilString::Format("%u", nLine));
   const CMICmnMIValueResult miValueResult("line", miValueConst);
   CMICmnMIValueTuple miValueTuple2(miValueResult);
   const CMICmnMIValueConst miValueConst2(pFileName);


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


[Lldb-commits] [lldb] r354883 - Fix error handling in Options::Parse

2019-02-26 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Feb 26 06:50:40 2019
New Revision: 354883

URL: http://llvm.org/viewvc/llvm-project?rev=354883&view=rev
Log:
Fix error handling in Options::Parse

Moved `if (error.Fail())` to correct place to catch all faulty cases such as
"unknown or ambiguous option" which was ignored before.

Modified:
lldb/trunk/source/Interpreter/Options.cpp

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=354883&r1=354882&r2=354883&view=diff
==
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Tue Feb 26 06:50:40 2019
@@ -1436,10 +1436,11 @@ llvm::Expected Options::Parse(cons
 } else {
   error.SetErrorStringWithFormat("invalid option with value '%i'", val);
 }
-if (error.Fail())
-  return error.ToError();
   }
 
+  if (error.Fail())
+return error.ToError();
+
   argv.erase(argv.begin(), argv.begin() + OptionParser::GetOptionIndex());
   return ReconstituteArgsAfterParsing(argv, args);
 }


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


[Lldb-commits] [lldb] r354890 - Fix short options syntax in Minidump test

2019-02-26 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Feb 26 07:38:30 2019
New Revision: 354890

URL: http://llvm.org/viewvc/llvm-project?rev=354890&view=rev
Log:
Fix short options syntax in Minidump test

Modified:
lldb/trunk/lit/Minidump/dump-all.test

Modified: lldb/trunk/lit/Minidump/dump-all.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/dump-all.test?rev=354890&r1=354889&r2=354890&view=diff
==
--- lldb/trunk/lit/Minidump/dump-all.test (original)
+++ lldb/trunk/lit/Minidump/dump-all.test Tue Feb 26 07:38:30 2019
@@ -11,32 +11,32 @@
 # RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP \
 # RUN: --check-prefix=CHECKSTAT --check-prefix=CHECKUP --check-prefix=CHECKFD 
%s
 # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
--directory' | FileCheck --check-prefix=CHECKDIR %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --d' | 
FileCheck --check-prefix=CHECKDIR %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -d' | 
FileCheck --check-prefix=CHECKDIR %s
 # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --linux' | \
 # RUN: FileCheck --check-prefix=CHECKCPU --check-prefix=CHECKSTATUS \
 # RUN: --check-prefix=CHECKLSB --check-prefix=CHECKCMD --check-prefix=CHECKENV 
\
 # RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP 
--check-prefix=CHECKSTAT \
 # RUN: --check-prefix=CHECKUP --check-prefix=CHECKFD %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cpuinfo' 
| FileCheck --check-prefix=CHECKCPU %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --C' | 
FileCheck --check-prefix=CHECKCPU %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --status' | 
FileCheck --check-prefix=CHECKSTATUS %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --s' | 
FileCheck --check-prefix=CHECKSTATUS %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cpuinfo'  
   | FileCheck --check-prefix=CHECKCPU %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -C' 
   | FileCheck --check-prefix=CHECKCPU %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --status'   
   | FileCheck --check-prefix=CHECKSTATUS %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -s' 
   | FileCheck --check-prefix=CHECKSTATUS %s
 # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
--lsb-release' | FileCheck --check-prefix=CHECKLSB %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --r' | 
FileCheck --check-prefix=CHECKLSB %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cmdline' 
| FileCheck --check-prefix=CHECKCMD %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --c' | 
FileCheck --check-prefix=CHECKCMD %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --environ' 
| FileCheck --check-prefix=CHECKENV %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --e' | 
FileCheck --check-prefix=CHECKENV %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --auxv' | 
FileCheck --check-prefix=CHECKAUX %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --x' | 
FileCheck --check-prefix=CHECKAUX %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --maps' | 
FileCheck --check-prefix=CHECKMAP %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --m' | 
FileCheck --check-prefix=CHECKMAP %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --stat' | 
FileCheck --check-prefix=CHECKSTAT %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --S' | 
FileCheck --check-prefix=CHECKSTAT %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --uptime' | 
FileCheck --check-prefix=CHECKUP %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --u' | 
FileCheck --check-prefix=CHECKUP %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --fd' | 
FileCheck --check-prefix=CHECKFD %s
-# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --f' | 
FileCheck --check-prefix=CHECKFD %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -r' 
   | FileCheck --check-prefix=CHECKLSB %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cmdline'  
   | FileCheck --check-prefix=CHECKCMD %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -c' 
   | FileCheck --check-prefix=CHECKCMD %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --environ'  
   | FileCheck --check-prefix=CHECKENV %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -e' 
   | FileCheck --check-prefix=CHECKENV %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --auxv' 
   | Fil

Re: [Lldb-commits] [lldb] r354890 - Fix short options syntax in Minidump test

2019-02-26 Thread Tatyana Krasnukha via lldb-commits
Those build didn't contain r354890 yet.

-Original Message-
From: Davide Italiano  
Sent: Tuesday, February 26, 2019 7:05 PM
To: Tatyana Krasnukha 
Cc: lldb-commits 
Subject: Re: [Lldb-commits] [lldb] r354890 - Fix short options syntax in 
Minidump test

Link to the failure:
https://urldefense.proofpoint.com/v2/url?u=http-3A__green.lab.llvm.org_green_job_lldb-2Dcmake__20543_console&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=g6rcurKPvoK7uD68Vi8adZfyKmJS9bRAr63MKkywSXk&s=jdhvETIBQFdrr0fN0efcvAVZ3EOQdqaYgbWsDZDdEEA&e=

On Tue, Feb 26, 2019 at 8:04 AM Davide Italiano  wrote:
>
> Tatyana, this commit broke one of the bots:
>
> Testing Time: 315.65s
> 
> Failing Tests (1):
> LLDB :: Minidump/dump-all.test
>
>   Expected Passes: 1466
>   Unsupported Tests  : 64
>   Unexpected Failures: 1
>
>
> I'm a little confused if I look at it because it modifies heavily a 
> test but there's no code change associated? Did you by any chance 
> forget to add a file?
> Anyway, please take a look and let me know if there's anything I can 
> help you with.
>
> Best,
>
> --
> Davide
>
> On Tue, Feb 26, 2019 at 7:37 AM Tatyana Krasnukha via lldb-commits 
>  wrote:
> >
> > Author: tkrasnukha
> > Date: Tue Feb 26 07:38:30 2019
> > New Revision: 354890
> >
> > URL: 
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_
> > llvm-2Dproject-3Frev-3D354890-26view-3Drev&d=DwIBaQ&c=DPL6_X_6JkXFx7
> > AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=g6rcurKPvoK
> > 7uD68Vi8adZfyKmJS9bRAr63MKkywSXk&s=-rE0GqyxP9jq55OdKHCMEDhWIfqRpjWXj
> > acBkREdhm8&e=
> > Log:
> > Fix short options syntax in Minidump test
> >
> > Modified:
> > lldb/trunk/lit/Minidump/dump-all.test
> >
> > Modified: lldb/trunk/lit/Minidump/dump-all.test
> > URL: 
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_
> > llvm-2Dproject_lldb_trunk_lit_Minidump_dump-2Dall.test-3Frev-3D35489
> > 0-26r1-3D354889-26r2-3D354890-26view-3Ddiff&d=DwIBaQ&c=DPL6_X_6JkXFx
> > 7AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=g6rcurKPvo
> > K7uD68Vi8adZfyKmJS9bRAr63MKkywSXk&s=fhMMfmhf9JBV-5F86-iQ8U2aGD73sYkJ
> > yY5lZd79lrQ&e= 
> > 
> > ==
> > --- lldb/trunk/lit/Minidump/dump-all.test (original)
> > +++ lldb/trunk/lit/Minidump/dump-all.test Tue Feb 26 07:38:30 2019
> > @@ -11,32 +11,32 @@
> >  # RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP \  # RUN: 
> > --check-prefix=CHECKSTAT --check-prefix=CHECKUP 
> > --check-prefix=CHECKFD %s  # RUN: %lldb -c 
> > %p/Inputs/dump-content.dmp -o 'process plugin dump --directory' | 
> > FileCheck --check-prefix=CHECKDIR %s -# RUN: %lldb -c 
> > %p/Inputs/dump-content.dmp -o 'process plugin dump --d' | FileCheck 
> > --check-prefix=CHECKDIR %s
> > +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
> > +-d' | FileCheck --check-prefix=CHECKDIR %s
> >  # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
> > --linux' | \  # RUN: FileCheck --check-prefix=CHECKCPU 
> > --check-prefix=CHECKSTATUS \  # RUN: --check-prefix=CHECKLSB 
> > --check-prefix=CHECKCMD --check-prefix=CHECKENV \  # RUN: 
> > --check-prefix=CHECKAUX --check-prefix=CHECKMAP 
> > --check-prefix=CHECKSTAT \  # RUN: --check-prefix=CHECKUP 
> > --check-prefix=CHECKFD %s -# RUN: %lldb -c 
> > %p/Inputs/dump-content.dmp -o 'process plugin dump --cpuinfo' | 
> > FileCheck --check-prefix=CHECKCPU %s -# RUN: %lldb -c 
> > %p/Inputs/dump-content.dmp -o 'process plugin dump --C' | FileCheck 
> > --check-prefix=CHECKCPU %s -# RUN: %lldb -c 
> > %p/Inputs/dump-content.dmp -o 'process plugin dump --status' | 
> > FileCheck --check-prefix=CHECKSTATUS %s -# RUN: %lldb -c 
> > %p/Inputs/dump-content.dmp -o 'process plugin dump --s' | FileCheck 
> > --check-prefix=CHECKSTATUS %s
> > +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
> > --cpuinfo' | FileCheck --check-prefix=CHECKCPU %s
> > +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -C' 
> >| FileCheck --check-prefix=CHECKCPU %s
> > +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
> > --status'  | FileCheck --check-prefix=CHECKSTATUS %s
> > +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'proces

Re: [Lldb-commits] [lldb] r354890 - Fix short options syntax in Minidump test

2019-02-26 Thread Tatyana Krasnukha via lldb-commits
This was fixed with r354890 ->  
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/20544/
Do you still have the issue?

-Original Message-
From: Davide Italiano  
Sent: Tuesday, February 26, 2019 7:28 PM
To: Tatyana Krasnukha 
Cc: lldb-commits 
Subject: Re: [Lldb-commits] [lldb] r354890 - Fix short options syntax in 
Minidump test

lldb: unrecognized option `--C'
error: unknown or ambiguous option
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/lit/Minidump/dump-all.test:55:13:
error: CHECKCPU: expected string not found in input

this seems to be the issue. Can you give another shot at fixing this or 
reverting? Thanks!

On Tue, Feb 26, 2019 at 8:16 AM Tatyana Krasnukha 
 wrote:
>
> Those build didn't contain r354890 yet.
>
> -Original Message-
> From: Davide Italiano 
> Sent: Tuesday, February 26, 2019 7:05 PM
> To: Tatyana Krasnukha 
> Cc: lldb-commits 
> Subject: Re: [Lldb-commits] [lldb] r354890 - Fix short options syntax 
> in Minidump test
>
> Link to the failure:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__green.lab.llvm.org
> _green_job_lldb-2Dcmake__20543_console&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0
> tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=g6rcurKPvoK7uD68Vi8
> adZfyKmJS9bRAr63MKkywSXk&s=jdhvETIBQFdrr0fN0efcvAVZ3EOQdqaYgbWsDZDdEEA
> &e=
>
> On Tue, Feb 26, 2019 at 8:04 AM Davide Italiano  wrote:
> >
> > Tatyana, this commit broke one of the bots:
> >
> > Testing Time: 315.65s
> > 
> > Failing Tests (1):
> > LLDB :: Minidump/dump-all.test
> >
> >   Expected Passes: 1466
> >   Unsupported Tests  : 64
> >   Unexpected Failures: 1
> >
> >
> > I'm a little confused if I look at it because it modifies heavily a 
> > test but there's no code change associated? Did you by any chance 
> > forget to add a file?
> > Anyway, please take a look and let me know if there's anything I can 
> > help you with.
> >
> > Best,
> >
> > --
> > Davide
> >
> > On Tue, Feb 26, 2019 at 7:37 AM Tatyana Krasnukha via lldb-commits 
> >  wrote:
> > >
> > > Author: tkrasnukha
> > > Date: Tue Feb 26 07:38:30 2019
> > > New Revision: 354890
> > >
> > > URL:
> > > https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewv
> > > c_
> > > llvm-2Dproject-3Frev-3D354890-26view-3Drev&d=DwIBaQ&c=DPL6_X_6JkXF
> > > x7 
> > > AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=g6rcurKPv
> > > oK 
> > > 7uD68Vi8adZfyKmJS9bRAr63MKkywSXk&s=-rE0GqyxP9jq55OdKHCMEDhWIfqRpjW
> > > Xj
> > > acBkREdhm8&e=
> > > Log:
> > > Fix short options syntax in Minidump test
> > >
> > > Modified:
> > > lldb/trunk/lit/Minidump/dump-all.test
> > >
> > > Modified: lldb/trunk/lit/Minidump/dump-all.test
> > > URL:
> > > https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewv
> > > c_
> > > llvm-2Dproject_lldb_trunk_lit_Minidump_dump-2Dall.test-3Frev-3D354
> > > 89 
> > > 0-26r1-3D354889-26r2-3D354890-26view-3Ddiff&d=DwIBaQ&c=DPL6_X_6JkX
> > > Fx 
> > > 7AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=g6rcurKP
> > > vo 
> > > K7uD68Vi8adZfyKmJS9bRAr63MKkywSXk&s=fhMMfmhf9JBV-5F86-iQ8U2aGD73sY
> > > kJ
> > > yY5lZd79lrQ&e=
> > > ==
> > > ==
> > > ==
> > > --- lldb/trunk/lit/Minidump/dump-all.test (original)
> > > +++ lldb/trunk/lit/Minidump/dump-all.test Tue Feb 26 07:38:30 2019
> > > @@ -11,32 +11,32 @@
> > >  # RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP \  # RUN:
> > > --check-prefix=CHECKSTAT --check-prefix=CHECKUP 
> > > --check-prefix=CHECKFD %s  # RUN: %lldb -c 
> > > %p/Inputs/dump-content.dmp -o 'process plugin dump --directory' | 
> > > FileCheck --check-prefix=CHECKDIR %s -# RUN: %lldb -c 
> > > %p/Inputs/dump-content.dmp -o 'process plugin dump --d' | 
> > > FileCheck --check-prefix=CHECKDIR %s
> > > +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin 
> > > +dump -d' | FileCheck --check-prefix=CHECKDIR %s
> > >  # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin 
> > > dump --linux' | \  # RUN: FileCheck --check-prefix=CHECKCPU 
> > > --check-prefix=CHECKSTATUS \  # RUN: --check-prefix=CHECKLSB 
> > > --check-prefix=C

[Lldb-commits] [lldb] r355388 - Fix embedded Python initialization according to changes in version 3.7

2019-03-05 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Mar  5 03:18:45 2019
New Revision: 355388

URL: http://llvm.org/viewvc/llvm-project?rev=355388&view=rev
Log:
Fix embedded Python initialization according to changes in version 3.7

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

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=355388&r1=355387&r2=355388&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Tue Mar  5 03:18:45 2019
@@ -156,7 +156,7 @@ public:
 if (m_was_already_initialized) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
   LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked",
-m_was_already_initialized == PyGILState_UNLOCKED ? "un" : "");
+m_gil_state == PyGILState_UNLOCKED ? "un" : "");
   PyGILState_Release(m_gil_state);
 } else {
   // We initialized the threads in this function, just unlock the GIL.
@@ -180,6 +180,18 @@ private:
   }
 
   void InitializeThreadsPrivate() {
+// Since Python 3.7 `Py_Initialize` calls `PyEval_InitThreads` inside itself,
+// so there is no way to determine whether the embedded interpreter
+// was already initialized by some external code. `PyEval_ThreadsInitialized`
+// would always return `true` and `PyGILState_Ensure/Release` flow would be
+// executed instead of unlocking GIL with `PyEval_SaveThread`. When
+// an another thread calls `PyGILState_Ensure` it would get stuck in deadlock.
+#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7) || (PY_MAJOR_VERSION > 3)
+// The only case we should go further and acquire the GIL: it is unlocked.
+if (PyGILState_Check())
+  return;
+#endif
+
 if (PyEval_ThreadsInitialized()) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
 


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


[Lldb-commits] [lldb] r355406 - Revert "Fix embedded Python initialization according to changes in version 3.7"

2019-03-05 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Mar  5 07:27:33 2019
New Revision: 355406

URL: http://llvm.org/viewvc/llvm-project?rev=355406&view=rev
Log:
Revert "Fix embedded Python initialization according to changes in version 3.7"

Testsuite hangs on Windows likely due to these changes.

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=355406&r1=355405&r2=355406&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Tue Mar  5 07:27:33 2019
@@ -156,7 +156,7 @@ public:
 if (m_was_already_initialized) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
   LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked",
-m_gil_state == PyGILState_UNLOCKED ? "un" : "");
+m_was_already_initialized == PyGILState_UNLOCKED ? "un" : "");
   PyGILState_Release(m_gil_state);
 } else {
   // We initialized the threads in this function, just unlock the GIL.
@@ -180,18 +180,6 @@ private:
   }
 
   void InitializeThreadsPrivate() {
-// Since Python 3.7 `Py_Initialize` calls `PyEval_InitThreads` inside itself,
-// so there is no way to determine whether the embedded interpreter
-// was already initialized by some external code. `PyEval_ThreadsInitialized`
-// would always return `true` and `PyGILState_Ensure/Release` flow would be
-// executed instead of unlocking GIL with `PyEval_SaveThread`. When
-// an another thread calls `PyGILState_Ensure` it would get stuck in deadlock.
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7) || (PY_MAJOR_VERSION > 3)
-// The only case we should go further and acquire the GIL: it is unlocked.
-if (PyGILState_Check())
-  return;
-#endif
-
 if (PyEval_ThreadsInitialized()) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
 


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


Re: [Lldb-commits] [lldb] r355406 - Revert "Fix embedded Python initialization according to changes in version 3.7"

2019-03-06 Thread Tatyana Krasnukha via lldb-commits
Davide, Stella, thank you for investigating the issue!
I'll re-submit changes when the build will be recovered from compilation errors.

-Original Message-
From: Stella Stamenova  
Sent: Wednesday, March 6, 2019 2:06 AM
To: Davide Italiano 
Cc: Tatyana Krasnukha ; lldb-commits 

Subject: RE: [Lldb-commits] [lldb] r355406 - Revert "Fix embedded Python 
initialization according to changes in version 3.7"

It should be safe to checkin the change now. It looks like at some point during 
the last couple of days the timing of some of the threads tests on Windows 
changed so now instead of behaving and passing or failing nicely, they are 
getting struck and never completing. This does not happen on every run and the 
python change just happened to coincide with some of the failures.

I've disabled the two tests that seemed to be the cause of the issue, so that 
the bot can go back to green.

Thanks
-Stella

-Original Message-
From: Stella Stamenova
Sent: Tuesday, March 5, 2019 10:26 AM
To: 'Davide Italiano' 
Cc: Tatyana Krasnukha ; lldb-commits 

Subject: RE: [Lldb-commits] [lldb] r355406 - Revert "Fix embedded Python 
initialization according to changes in version 3.7"

I ran the tests without that line on a machine that is equivalent to the 
Buildbot and they ran correctly, but I just noticed that while the Buildbot has 
had several runs that did not time out since the revert, there was also one 
that did time out.

I am going to let the current build on the Buildbot complete (since it should 
be green as a fix was committed for the other failure) and I'm going to restart 
it afterwards.

In the mean time, I am running the tests on the machine that is the same with 
the full python 3.7 change to confirm whether it hangs there too or if it was 
somehow bot specific.

Thanks,
-Stella

-Original Message-
From: Davide Italiano 
Sent: Tuesday, March 5, 2019 8:43 AM
To: Stella Stamenova 
Cc: Tatyana Krasnukha ; lldb-commits 

Subject: Re: [Lldb-commits] [lldb] r355406 - Revert "Fix embedded Python 
initialization according to changes in version 3.7"

On Tue, Mar 5, 2019 at 8:39 AM Stella Stamenova  wrote:
>
> The bot is running 3.6.6 and it does not have python 3.7 installed (it does 
> have python 2.7 which is needed to run Buildbot).
>
> The change that was pushed, though, did not only impact python 3.7:
>
> m_was_already_initialized == PyGILState_UNLOCKED ? "un" : "");
> m_gil_state == PyGILState_UNLOCKED ? "un" : "");
>
> It replaced m_was_already_initialized above with m_gil_state - for *any* 
> version of python. Yes, this is just in a log, but my guess is that that's 
> the source of the hang on Windows not the 3.7 specific code.
>
> If you end up with a  prototype change that you want to commit, I can run a 
> local test to see whether the tests pass with it.
>

Can you just revert that chunk of unconditional python code and try?
(it's extremely surprising to me that the change caused the bots to hang, even 
if it's unconditional, anyway).

i.e.

+// Since Python 3.7 `Py_Initialize` calls `PyEval_InitThreads` inside 
+itself, // so there is no way to determine whether the embedded 
+interpreter // was already initialized by some external code.
+`PyEval_ThreadsInitialized` // would always return `true` and 
+`PyGILState_Ensure/Release` flow would be // executed instead of 
+unlocking GIL with `PyEval_SaveThread`. When // an another thread calls 
`PyGILState_Ensure` it would get stuck in deadlock.
+#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7) || 
+(PY_MAJOR_VERSION > 3) // The only case we should go further and acquire the 
GIL: it is unlocked.
+if (PyGILState_Check())
+  return;
+#endif
+

and let us know if the bot still hangs?

Thanks,

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


[Lldb-commits] [lldb] r355523 - Re-apply "Fix embedded Python initialization according to changes in version 3.7"

2019-03-06 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Wed Mar  6 09:27:40 2019
New Revision: 355523

URL: http://llvm.org/viewvc/llvm-project?rev=355523&view=rev
Log:
Re-apply "Fix embedded Python initialization according to changes in version 
3.7"

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=355523&r1=355522&r2=355523&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Wed Mar  6 09:27:40 2019
@@ -156,7 +156,7 @@ public:
 if (m_was_already_initialized) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
   LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked",
-m_was_already_initialized == PyGILState_UNLOCKED ? "un" : "");
+m_gil_state == PyGILState_UNLOCKED ? "un" : "");
   PyGILState_Release(m_gil_state);
 } else {
   // We initialized the threads in this function, just unlock the GIL.
@@ -180,6 +180,18 @@ private:
   }
 
   void InitializeThreadsPrivate() {
+// Since Python 3.7 `Py_Initialize` calls `PyEval_InitThreads` inside itself,
+// so there is no way to determine whether the embedded interpreter
+// was already initialized by some external code. `PyEval_ThreadsInitialized`
+// would always return `true` and `PyGILState_Ensure/Release` flow would be
+// executed instead of unlocking GIL with `PyEval_SaveThread`. When
+// an another thread calls `PyGILState_Ensure` it would get stuck in deadlock.
+#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7) || (PY_MAJOR_VERSION > 3)
+// The only case we should go further and acquire the GIL: it is unlocked.
+if (PyGILState_Check())
+  return;
+#endif
+
 if (PyEval_ThreadsInitialized()) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
 


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


[Lldb-commits] [lldb] 21d09cc - [lldb-vscode] Ensure that target matches the executable file

2020-02-13 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-02-13T19:34:01+03:00
New Revision: 21d09ccf268dc071d452b0207a3dd91228a51da3

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

LOG: [lldb-vscode] Ensure that target matches the executable file

This commit fixes an issue with lldb-vscode failing to run programs that
use different architecture/platform than the "empty" in the target.
Original implementation was creating a default target without specifying
the target architecture, platform or program, and then would set
executable file through SBLaunchInfo, assuming that this would update
architecture and platform accordingly. However this wasn't really
happening, and architecture and platform would remain at whatever values
were in the "empty" target. The simple solution is to create target
already for a desired architecture and platform.

Function request_attach is updated in a similar fashion.

This commit also adds new JSON properties to "launch" and "attach"
packets to allow user to override desired platform and architecture.
This might be especially important for cases where information in ELF is
not enough to derive those values correctly.

New code has a behavior similar to LLDB MI [1], where typically IDE would
specify target file with -file-exec-and-symbols, and then only do -exec-run
command that would launch the process. In lldb-vscode those two actions are
merged into one request_launch function. Similarly in the interpreter
session, user would first do "file" command, then "process launch"

Differential Revision: https://reviews.llvm.org/D70847
Signed-off-by: Anton Kolesov 

Added: 


Modified: 
lldb/tools/lldb-vscode/VSCode.cpp
lldb/tools/lldb-vscode/VSCode.h
lldb/tools/lldb-vscode/lldb-vscode.cpp
lldb/tools/lldb-vscode/package.json

Removed: 




diff  --git a/lldb/tools/lldb-vscode/VSCode.cpp 
b/lldb/tools/lldb-vscode/VSCode.cpp
index 2f85627da4b5..ba9542a63fca 100644
--- a/lldb/tools/lldb-vscode/VSCode.cpp
+++ b/lldb/tools/lldb-vscode/VSCode.cpp
@@ -303,4 +303,52 @@ void VSCode::RunExitCommands() {
   RunLLDBCommands("Running exitCommands:", exit_commands);
 }
 
+lldb::SBTarget VSCode::CreateTargetFromArguments(
+const llvm::json::Object &arguments,
+lldb::SBError &error) {
+  // Grab the name of the program we need to debug and create a target using
+  // the given program as an argument. Executable file can be a source of 
target
+  // architecture and platform, if they 
diff er from the host. Setting exe path
+  // in launch info is useless because Target.Launch() will not change
+  // architecture and platform, therefore they should be known at the target
+  // creation. We also use target triple and platform from the launch
+  // configuration, if given, since in some cases ELF file doesn't contain
+  // enough information to determine correct arch and platform (or ELF can be
+  // omitted at all), so it is good to leave the user an apportunity to specify
+  // those. Any of those three can be left empty.
+  llvm::StringRef target_triple = GetString(arguments, "targetTriple");
+  llvm::StringRef platform_name = GetString(arguments, "platformName");
+  llvm::StringRef program = GetString(arguments, "program");
+  auto target = this->debugger.CreateTarget(
+program.data(),
+target_triple.data(),
+platform_name.data(),
+true, // Add dependent modules.
+error
+  );
+
+  if (error.Fail()) {
+// Update message if there was an error.
+error.SetErrorStringWithFormat(
+"Could not create a target for a program '%s': %s.",
+program.data(), error.GetCString());
+  }
+
+  return target;
+}
+
+void VSCode::SetTarget(const lldb::SBTarget target) {
+  this->target = target;
+
+  if (target.IsValid()) {
+// Configure breakpoint event listeners for the target.
+lldb::SBListener listener = this->debugger.GetListener();
+listener.StartListeningForEvents(
+this->target.GetBroadcaster(),
+lldb::SBTarget::eBroadcastBitBreakpointChanged);
+listener.StartListeningForEvents(this->broadcaster,
+ eBroadcastBitStopEventThread);
+  }
+}
+
 } // namespace lldb_vscode

diff  --git a/lldb/tools/lldb-vscode/VSCode.h b/lldb/tools/lldb-vscode/VSCode.h
index be8b22806a4d..5733073fcfbf 100644
--- a/lldb/tools/lldb-vscode/VSCode.h
+++ b/lldb/tools/lldb-vscode/VSCode.h
@@ -63,6 +63,8 @@ typedef llvm::DenseMap 
SourceBreakpointMap;
 typedef llvm::StringMap FunctionBreakpointMap;
 enum class OutputType { Console, Stdout, Stderr, Telemetry };
 
+enum VSCodeBroadcasterBits { eBroadcastBitStopEventThread = 1u << 0 };
+
 struct VSCode {
   InputStream input;
   OutputStream output;
@@ -132,6 +134,24 @@ struct VSCode {
   void RunPreRunCommands();
   void RunStopCommands();
   void RunExi

[Lldb-commits] [lldb] 185ef69 - [lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor

2020-02-18 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-02-18T13:49:07+03:00
New Revision: 185ef697ef5c60d7a5c801925e6abdad52226c2b

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

LOG: [lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor

Some implementations (BreakpointResolverScripted) try calling the breakpoint's 
shared_from_this(),
that makes LLDB crash.

Added: 


Modified: 
lldb/include/lldb/Breakpoint/Breakpoint.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Target/Target.cpp

lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index 553b911da0f7..c48a0ad73d4e 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -568,6 +568,11 @@ class Breakpoint : public 
std::enable_shared_from_this,
 return GetPermissions().GetAllowDelete();
   }
 
+  // This one should only be used by Target to copy breakpoints from target to
+  // target - primarily from the dummy target to prime new targets.
+  static lldb::BreakpointSP CopyFromBreakpoint(Target& new_target,
+  const Breakpoint &bp_to_copy_from);
+
 protected:
   friend class Target;
   // Protected Methods
@@ -625,9 +630,8 @@ class Breakpoint : public 
std::enable_shared_from_this,
   }
 
 private:
-  // This one should only be used by Target to copy breakpoints from target to
-  // target - primarily from the dummy target to prime new targets.
-  Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from);
+  // To call from CopyFromBreakpoint.
+  Breakpoint(Target &new_target, const Breakpoint &bp_to_copy_from);
 
   // For Breakpoint only
   bool m_being_created;

diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 78aef01d35aa..39c6828d3f09 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -55,21 +55,26 @@ Breakpoint::Breakpoint(Target &target, SearchFilterSP 
&filter_sp,
   m_being_created = false;
 }
 
-Breakpoint::Breakpoint(Target &new_target, Breakpoint &source_bp)
+Breakpoint::Breakpoint(Target &new_target, const Breakpoint &source_bp)
 : m_being_created(true), m_hardware(source_bp.m_hardware),
   m_target(new_target), m_name_list(source_bp.m_name_list),
   m_options_up(new BreakpointOptions(*source_bp.m_options_up)),
   m_locations(*this),
   m_resolve_indirect_symbols(source_bp.m_resolve_indirect_symbols),
-  m_hit_count(0) {
-  // Now go through and copy the filter & resolver:
-  m_resolver_sp = source_bp.m_resolver_sp->CopyForBreakpoint(*this);
-  m_filter_sp = source_bp.m_filter_sp->CopyForBreakpoint(*this);
-}
+  m_hit_count(0) {}
 
 // Destructor
 Breakpoint::~Breakpoint() = default;
 
+BreakpointSP Breakpoint::CopyFromBreakpoint(Target& new_target,
+const Breakpoint& bp_to_copy_from) {
+  BreakpointSP bp(new Breakpoint(new_target, bp_to_copy_from));
+  // Now go through and copy the filter & resolver:
+  bp->m_resolver_sp = bp_to_copy_from.m_resolver_sp->CopyForBreakpoint(*bp);
+  bp->m_filter_sp = bp_to_copy_from.m_filter_sp->CopyForBreakpoint(*bp);
+  return bp;
+}
+
 // Serialization
 StructuredData::ObjectSP Breakpoint::SerializeToStructuredData() {
   // Serialize the resolver:

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 9e41e90b6d7d..49cb52bb0498 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -127,12 +127,12 @@ void Target::PrimeFromDummyTarget(Target *target) {
 
   m_stop_hooks = target->m_stop_hooks;
 
-  for (BreakpointSP breakpoint_sp : target->m_breakpoint_list.Breakpoints()) {
+  for (const auto &breakpoint_sp : target->m_breakpoint_list.Breakpoints()) {
 if (breakpoint_sp->IsInternal())
   continue;
 
-BreakpointSP new_bp(new Breakpoint(*this, *breakpoint_sp.get()));
-AddBreakpoint(new_bp, false);
+BreakpointSP new_bp(Breakpoint::CopyFromBreakpoint(*this, *breakpoint_sp));
+AddBreakpoint(std::move(new_bp), false);
   }
 
   for (auto bp_name_entry : target->m_breakpoint_names) {

diff  --git 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
index 9f0ba1116867..b0b04119a4f0 100644
--- 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
+++ 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
@@ -40,8 +40,21 @@ def test_bad_command_lines(self):
 self.build()
 self.do_test_bad_options()
 
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+def test_cop

[Lldb-commits] [lldb] 7fb0679 - [lldb][NFC] Remove unused parameter

2020-02-18 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-02-18T13:49:08+03:00
New Revision: 7fb06796abfd54878378b65456d567169d409bb3

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

LOG: [lldb][NFC] Remove unused parameter

Rename search-filter's CopyForBreakpoint to CreateCopy, since they don't
do anything with breakpoints.

Added: 


Modified: 
lldb/include/lldb/Core/SearchFilter.h
lldb/include/lldb/Target/LanguageRuntime.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Target/LanguageRuntime.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/SearchFilter.h 
b/lldb/include/lldb/Core/SearchFilter.h
index 8846ec0cf922..178489a88f3d 100644
--- a/lldb/include/lldb/Core/SearchFilter.h
+++ b/lldb/include/lldb/Core/SearchFilter.h
@@ -187,7 +187,7 @@ class SearchFilter {
   /// Standard "Dump" method.  At present it does nothing.
   virtual void Dump(Stream *s) const;
 
-  lldb::SearchFilterSP CopyForBreakpoint(Breakpoint &breakpoint);
+  lldb::SearchFilterSP CreateCopy(lldb::TargetSP& target_sp);
 
   static lldb::SearchFilterSP
   CreateFromStructuredData(const lldb::TargetSP& target_sp,
@@ -261,13 +261,13 @@ class SearchFilter {
const SymbolContext &context,
Searcher &searcher);
 
-  virtual lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) = 0;
+  virtual lldb::SearchFilterSP DoCreateCopy() = 0;
 
   void SetTarget(lldb::TargetSP &target_sp) { m_target_sp = target_sp; }
 
-  lldb::TargetSP
-  m_target_sp; // Every filter has to be associated with a target for
-   // now since you need a starting place for the search.
+  lldb::TargetSP m_target_sp; // Every filter has to be associated with
+  // a target for now since you need a starting
+  // place for the search.
 private:
   unsigned char SubclassID;
 };
@@ -295,7 +295,7 @@ class SearchFilterForUnconstrainedSearches : public 
SearchFilter {
   StructuredData::ObjectSP SerializeToStructuredData() override;
 
 protected:
-  lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+  lldb::SearchFilterSP DoCreateCopy() override;
 };
 
 /// \class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h" This
@@ -341,7 +341,7 @@ class SearchFilterByModule : public SearchFilter {
   StructuredData::ObjectSP SerializeToStructuredData() override;
 
 protected:
-  lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+  lldb::SearchFilterSP DoCreateCopy() override;
 
 private:
   FileSpec m_module_spec;
@@ -394,7 +394,7 @@ class SearchFilterByModuleList : public SearchFilter {
   void SerializeUnwrapped(StructuredData::DictionarySP &options_dict_sp);
 
 protected:
-  lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+  lldb::SearchFilterSP DoCreateCopy() override;
 
 protected:
   FileSpecList m_module_spec_list;
@@ -432,7 +432,7 @@ class SearchFilterByModuleListAndCU : public 
SearchFilterByModuleList {
   StructuredData::ObjectSP SerializeToStructuredData() override;
 
 protected:
-  lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+  lldb::SearchFilterSP DoCreateCopy() override;
 
 private:
   FileSpecList m_cu_spec_list;

diff  --git a/lldb/include/lldb/Target/LanguageRuntime.h 
b/lldb/include/lldb/Target/LanguageRuntime.h
index aa132d35c0dd..2a792fe519d0 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -51,7 +51,7 @@ class ExceptionSearchFilter : public SearchFilter {
   LanguageRuntime *m_language_runtime;
   lldb::SearchFilterSP m_filter_sp;
 
-  lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+  lldb::SearchFilterSP DoCreateCopy() override;
 
   void UpdateModuleListIfNeeded();
 };

diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 09122cfc2bfa..ec6700ea2bb1 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -74,7 +74,7 @@ BreakpointSP Breakpoint::CopyFromBreakpoint(TargetSP 
new_target,
   BreakpointSP bp(new Breakpoint(*new_target, bp_to_copy_from));
   // Now go through and copy the filter & resolver:
   bp->m_resolver_sp = bp_to_copy_from.m_resolver_sp->CopyForBreakpoint(*bp);
-  bp->m_filter_sp = bp_to_copy_from.m_filter_sp->CopyForBreakpoint(*bp);
+  bp->m_filter_sp = bp_to_copy_from.m_filter_sp->CreateCopy(new_target);
   return bp;
 }
 

diff  --git a/lldb/source/Core/SearchFilter.cpp 
b/lldb/source/Core/SearchFilter.cpp
index a42fa968656f..494e88dde267 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/Sear

[Lldb-commits] [lldb] b624b7d - [lldb] Make shared_from_this-related code safer

2020-02-18 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-02-18T13:49:07+03:00
New Revision: b624b7dfd087809fb58bff0737750e75375fe450

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

LOG: [lldb] Make shared_from_this-related code safer

Pass TargetSP to filters' CreateFromStructuredData, don't let them guess
whether target object is managed by a shared_ptr.

Make Breakpoint sure that m_target.shared_from_this() is safe by passing 
TargetSP
to all its static Create*** member-functions. This should be enough, since 
Breakpoint's
constructors are private/protected and never called directly (except by Target 
itself).

Added: 


Modified: 
lldb/include/lldb/Breakpoint/Breakpoint.h
lldb/include/lldb/Core/SearchFilter.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index c48a0ad73d4e..bdff7772fc6b 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -142,7 +142,8 @@ class Breakpoint : public 
std::enable_shared_from_this,
 
   // Saving & restoring breakpoints:
   static lldb::BreakpointSP CreateFromStructuredData(
-  Target &target, StructuredData::ObjectSP &data_object_sp, Status &error);
+  lldb::TargetSP target_sp, StructuredData::ObjectSP &data_object_sp,
+  Status &error);
 
   static bool
   SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp,
@@ -570,7 +571,7 @@ class Breakpoint : public 
std::enable_shared_from_this,
 
   // This one should only be used by Target to copy breakpoints from target to
   // target - primarily from the dummy target to prime new targets.
-  static lldb::BreakpointSP CopyFromBreakpoint(Target& new_target,
+  static lldb::BreakpointSP CopyFromBreakpoint(lldb::TargetSP new_target,
   const Breakpoint &bp_to_copy_from);
 
 protected:

diff  --git a/lldb/include/lldb/Core/SearchFilter.h 
b/lldb/include/lldb/Core/SearchFilter.h
index ab5dc962230f..8846ec0cf922 100644
--- a/lldb/include/lldb/Core/SearchFilter.h
+++ b/lldb/include/lldb/Core/SearchFilter.h
@@ -190,7 +190,7 @@ class SearchFilter {
   lldb::SearchFilterSP CopyForBreakpoint(Breakpoint &breakpoint);
 
   static lldb::SearchFilterSP
-  CreateFromStructuredData(Target &target,
+  CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
 
@@ -288,7 +288,7 @@ class SearchFilterForUnconstrainedSearches : public 
SearchFilter {
   bool ModulePasses(const lldb::ModuleSP &module_sp) override;
 
   static lldb::SearchFilterSP
-  CreateFromStructuredData(Target &target,
+  CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
 
@@ -334,7 +334,7 @@ class SearchFilterByModule : public SearchFilter {
   void Search(Searcher &searcher) override;
 
   static lldb::SearchFilterSP
-  CreateFromStructuredData(Target &target,
+  CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
 
@@ -385,7 +385,7 @@ class SearchFilterByModuleList : public SearchFilter {
   void Search(Searcher &searcher) override;
 
   static lldb::SearchFilterSP
-  CreateFromStructuredData(Target &target,
+  CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
 
@@ -425,7 +425,7 @@ class SearchFilterByModuleListAndCU : public 
SearchFilterByModuleList {
   void Search(Searcher &searcher) override;
 
   static lldb::SearchFilterSP
-  CreateFromStructuredData(Target &target,
+  CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
 

diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 39c6828d3f09..09122cfc2bfa 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -66,9 +66,12 @@ Breakpoint::Breakpoint(Target &new_target, const Breakpoint 
&source_bp)
 // Destructor
 Breakpoint::~Breakpoint() = default;
 
-BreakpointSP Breakpoint::CopyFromBreakpoint(Target& new_target,
+BreakpointSP Breakpoint::CopyFromBreakpoint(TargetSP new_target,
 const Breakpoint& bp_to_copy_from) {
-  BreakpointSP bp(new Breakpoint(new_target, bp_to_copy_from));
+  if (!new_target)
+return BreakpointSP();
+
+  BreakpointSP bp(n

[Lldb-commits] [lldb] db23825 - [lldb][test] Remove expected failure decorator from test_copy_from_dummy_target (TestScriptedResolver)

2020-02-18 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-02-18T15:04:29+03:00
New Revision: db23825970b021d0b5302d43aa5355c295c133d9

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

LOG: [lldb][test] Remove expected failure decorator from 
test_copy_from_dummy_target (TestScriptedResolver)

This test case doesn't check that breakpoint's locations are resolved, and it 
passes on Windows too.

Added: 


Modified: 

lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
index b0b04119a4f0..02c0aab9149e 100644
--- 
a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
+++ 
b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
@@ -40,7 +40,6 @@ def test_bad_command_lines(self):
 self.build()
 self.do_test_bad_options()
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
 def test_copy_from_dummy_target(self):
 """Make sure we don't crash during scripted breakpoint copy from dummy 
target"""
 self.build()



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


Re: [Lldb-commits] [PATCH] D74556: [lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor

2020-02-18 Thread Tatyana Krasnukha via lldb-commits
The test was passing unexpectedly, I already removed XFAIL decorator.

-Original Message-
From: Raphael “Teemperor” Isemann  
Sent: Tuesday, February 18, 2020 3:20 PM
To: reviews+d74556+public+411e87b2a9392...@reviews.llvm.org
Cc: Tatyana Krasnukha ; Jonas Devlieghere 
; jing...@apple.com; lldb-commits@lists.llvm.org; 
liburd1...@outlook.com; sani...@subpath.org; chi...@raincode.com
Subject: Re: [PATCH] D74556: [lldb] Don't call CopyForBreakpoint from a 
Breakpoint's constructor

I assume this is causing the test to fail on Windows? 
https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_lldb-2Dx64-2Dwindows-2Dninja_builds_13896&d=DwIFAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=QVHIvP2O76mhlXu3NHpC60dV9plTxqLsbwE_fgLAJZk&s=jk0NPJjYvMlZIFBH2uPt1fo6zA543ZKEeBlU9108M_M&e=
 

> On 18. Feb 2020, at 12:26, Tatyana Krasnukha via Phabricator 
>  wrote:
> 
> tatyana-krasnukha closed this revision.
> tatyana-krasnukha added a comment.
> 
> Closed by commit 185ef697ef5c 
>   >
> 
> 
> Repository:
>  rLLDB LLDB
> 
> CHANGES SINCE LAST ACTION
>  
> https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74556_new_&d=DwIFAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=QVHIvP2O76mhlXu3NHpC60dV9plTxqLsbwE_fgLAJZk&s=wjRYSdktS4jTXskJlmyc_cPVY0vx5rODphb2Q-TWpRI&e=
>  
> 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74556&d=DwIFAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=8NZfjV_ZLY_S7gZyQMq8mj7tiN4vlymPiSt0Wl0jegw&m=QVHIvP2O76mhlXu3NHpC60dV9plTxqLsbwE_fgLAJZk&s=eSiNRVypMo66Enyp_4OaR4YA1Bp_jSqCp92hhqUo3zI&e=
>  
> 
> 
> 

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


[Lldb-commits] [lldb] b1324e7 - [lldb][NFC] Move local variables near to their usage

2020-03-04 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-04T16:56:51+03:00
New Revision: b1324e74da2661e799b9fad037948e70d002b771

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

LOG: [lldb][NFC] Move local variables near to their usage

Added: 


Modified: 
lldb/source/Breakpoint/BreakpointResolverName.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp 
b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 551cd83b093a..2eb0d3ab5888 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -249,13 +249,6 @@ void BreakpointResolverName::AddNameLookup(ConstString 
name,
 Searcher::CallbackReturn
 BreakpointResolverName::SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr) {
-  SymbolContextList func_list;
-  // SymbolContextList sym_list;
-
-  uint32_t i;
-  bool new_location;
-  Address break_addr;
-
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
 
   if (m_class_name) {
@@ -264,6 +257,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
 return Searcher::eCallbackReturnStop;
   }
 
+  SymbolContextList func_list;
   bool filter_by_cu =
   (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0;
   bool filter_by_language = (m_language != eLanguageTypeUnknown);
@@ -334,11 +328,12 @@ BreakpointResolverName::SearchCallback(SearchFilter 
&filter,
 
   BreakpointSP breakpoint_sp = GetBreakpoint();
   Breakpoint &breakpoint = *breakpoint_sp;
+  Address break_addr;
 
   // Remove any duplicates between the function list and the symbol list
   SymbolContext sc;
   if (func_list.GetSize()) {
-for (i = 0; i < func_list.GetSize(); i++) {
+for (uint32_t i = 0; i < func_list.GetSize(); i++) {
   if (func_list.GetContextAtIndex(i, sc)) {
 bool is_reexported = false;
 
@@ -381,6 +376,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
 
 if (break_addr.IsValid()) {
   if (filter.AddressPasses(break_addr)) {
+bool new_location;
 BreakpointLocationSP bp_loc_sp(
 AddLocation(break_addr, &new_location));
 bp_loc_sp->SetIsReExported(is_reexported);



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


[Lldb-commits] [lldb] 6c17cc5 - [lldb] Make BreakpointResolver hold weak_ptr instead of raw pointer to breakpoint

2020-03-04 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-04T16:56:50+03:00
New Revision: 6c17cc531f9f4ee94f2298200fc4813c02999d78

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

LOG: [lldb] Make BreakpointResolver hold weak_ptr instead of raw pointer to 
breakpoint

This prevents calling Breakpoint::shared_from_this of an object that is not 
owned by any shared_ptr.

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

Added: 


Modified: 
lldb/include/lldb/Breakpoint/BreakpointResolver.h
lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h
lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
lldb/include/lldb/Breakpoint/BreakpointResolverName.h
lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h
lldb/include/lldb/Target/LanguageRuntime.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Breakpoint/BreakpointResolver.cpp
lldb/source/Breakpoint/BreakpointResolverAddress.cpp
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Breakpoint/BreakpointResolverScripted.cpp

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h

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

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h

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

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

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
lldb/source/Target/LanguageRuntime.cpp
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/BreakpointResolver.h 
b/lldb/include/lldb/Breakpoint/BreakpointResolver.h
index 9201b643ce6f..3029f70ce9c3 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolver.h
@@ -44,7 +44,8 @@ class BreakpointResolver : public Searcher {
   ///   The breakpoint that owns this resolver.
   /// \param[in] resolverType
   ///   The concrete breakpoint resolver type for this breakpoint.
-  BreakpointResolver(Breakpoint *bkpt, unsigned char resolverType,
+  BreakpointResolver(const lldb::BreakpointSP &bkpt,
+ unsigned char resolverType,
  lldb::addr_t offset = 0);
 
   /// The Destructor is virtual, all significant breakpoint resolvers derive
@@ -55,7 +56,15 @@ class BreakpointResolver : public Searcher {
   ///
   /// \param[in] bkpt
   ///   The breakpoint that owns this resolver.
-  void SetBreakpoint(Breakpoint *bkpt);
+  void SetBreakpoint(const lldb::BreakpointSP &bkpt);
+
+  /// This gets the breakpoint for this resolver.
+  lldb::BreakpointSP GetBreakpoint() const {
+auto breakpoint_sp = m_breakpoint.expired() ? lldb::BreakpointSP() :
+  m_breakpoint.lock();
+assert(breakpoint_sp);
+return breakpoint_sp;
+  }
 
   /// This updates the offset for this breakpoint.  All the locations
   /// currently set for this breakpoint will have their offset adjusted when
@@ -149,7 +158,7 @@ class BreakpointResolver : public Searcher {
   static ResolverTy NameToResolverTy(llvm::StringRef name);
 
   virtual lldb::BreakpointResolverSP
-  CopyForBreakpoint(Breakpoint &breakpoint) = 0;
+  CopyForBreakpoint(lldb::BreakpointSP &breakpoint) = 0;
 
 protected:
   // Used for serializing resolver options:
@@ -202,15 +211,15 @@ class BreakpointResolver : public Searcher {
   lldb::BreakpointLocationSP AddLocation(Address loc_addr,
  bool *new_location = nullptr);
 
-  Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
-  lldb::addr_t m_offset;// A random offset the user asked us to add to any
-// breakpoints we set.
-
 private:
   /// Helper for \p SetSCMatchesByLine.
   void AddLocation(SearchFilter &filter, const SymbolContext &sc,
bool skip_prologue, llvm::StringRef log_ident);
 
+  lldb::BreakpointWP m_breakpoint; // This is the breakpoint we add locations 
to.
+  lldb::addr_t m_offset;// A random offset the user asked us to add to any
+// breakpoints we set.
+
   // Subclass identifier (for llvm isa/dyn_cast)
   const unsigned char SubclassID;
   DISALLOW_COPY_AND_ASSIGN(Breakp

[Lldb-commits] [lldb] a31130f - [lldb][testsuite] Create a SBDebugger instance for each test

2020-03-04 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-05T10:12:54+03:00
New Revision: a31130f6fcf27518b31a8ac1f5971a42fc24837e

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

LOG: [lldb][testsuite] Create a SBDebugger instance for each test

Some tests set settings and don't clean them up, this leads to side effects in 
other tests.
The patch removes a global debugger instance with a per-test debugger to avoid 
such effects.

>From what I see, lldb.DBG was needed to determine the platform before a test 
>is run,
lldb.selected_platform is used for this purpose now. Though, this required 
adding a new function
to the SBPlatform interface.

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

Added: 


Modified: 
lldb/bindings/interface/SBPlatform.i
lldb/include/lldb/API/SBPlatform.h
lldb/packages/Python/lldbsuite/test/decorators.py
lldb/packages/Python/lldbsuite/test/dotest.py
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/API/SBPlatform.cpp

lldb/test/API/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py

lldb/test/API/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py

lldb/test/API/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py
lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py
lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
lldb/test/API/functionalities/postmortem/elf-core/gcore/TestGCore.py

lldb/test/API/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
lldb/test/API/functionalities/postmortem/mach-core/TestMachCore.py
lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
lldb/test/API/functionalities/thread/backtrace_all/TestBacktraceAll.py

lldb/test/API/functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py
lldb/test/API/macosx/load-kext/TestLoadKext.py
lldb/test/API/python_api/file_handle/TestFileHandle.py

lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py

Removed: 




diff  --git a/lldb/bindings/interface/SBPlatform.i 
b/lldb/bindings/interface/SBPlatform.i
index 9baa2eb970c6..1f52edb0232c 100644
--- a/lldb/bindings/interface/SBPlatform.i
+++ b/lldb/bindings/interface/SBPlatform.i
@@ -115,6 +115,8 @@ public:
 
 ~SBPlatform();
 
+static SBPlatform GetHostPlatform();
+
 bool
 IsValid () const;
 

diff  --git a/lldb/include/lldb/API/SBPlatform.h 
b/lldb/include/lldb/API/SBPlatform.h
index 58dafc235c64..7fac182a0dd1 100644
--- a/lldb/include/lldb/API/SBPlatform.h
+++ b/lldb/include/lldb/API/SBPlatform.h
@@ -97,6 +97,8 @@ class LLDB_API SBPlatform {
 
   ~SBPlatform();
 
+  static SBPlatform GetHostPlatform();
+
   explicit operator bool() const;
 
   bool IsValid() const;

diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index ec17cb7c2569..b0d2db7655ff 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -172,7 +172,7 @@ def fn(self):
 skip_for_debug_info = _match_decorator_property(
 debug_info, self.getDebugInfo())
 skip_for_triple = _match_decorator_property(
-triple, lldb.DBG.GetSelectedPlatform().GetTriple())
+triple, lldb.selected_platform.GetTriple())
 skip_for_remote = _match_decorator_property(
 remote, lldb.remote_platform is not None)
 

diff  --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index 5dddc996eda5..991e29d7e6b0 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -774,16 +774,6 @@ def visit(prefix, dir, names):
 raise
 
 
-def setSetting(setting, value):
-import lldb
-ci = lldb.DBG.GetCommandInterpreter()
-res = lldb.SBCommandReturnObject()
-cmd = 'setting set %s %s'%(setting, value)
-print(cmd)
-ci.HandleCommand(cmd, res, False)
-if not res.Succeeded():
-raise Exception('failed to run "%s"'%cmd)
-
 # =

[Lldb-commits] [lldb] eecef3a - [lldb][test] Enable fix-its for the test case that expects them enabled

2020-03-04 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-05T10:31:07+03:00
New Revision: eecef3af2ca8b27f4070be41c73bff989a096f9b

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

LOG: [lldb][test] Enable fix-its for the test case that expects them enabled

Fix-its were intentionally disabled by TestBase.setUp so that incorrect 
expressions in tests
don't pass just because Clang thinks it has a fix-it.

Added: 


Modified: 
lldb/test/API/commands/expression/fixits/TestFixIts.py

Removed: 




diff  --git a/lldb/test/API/commands/expression/fixits/TestFixIts.py 
b/lldb/test/API/commands/expression/fixits/TestFixIts.py
index 75fe43ec7fe1..7aca1c5aa863 100644
--- a/lldb/test/API/commands/expression/fixits/TestFixIts.py
+++ b/lldb/test/API/commands/expression/fixits/TestFixIts.py
@@ -29,6 +29,10 @@ def test_with_target(self):
 
 def test_with_dummy_target(self):
 """Test calling expressions in the dummy target with errors that can 
be fixed by the FixIts."""
+
+# Enable fix-its as they were intentionally disabled by TestBase.setUp.
+self.runCmd("settings set target.auto-apply-fixits true")
+
 ret_val = lldb.SBCommandReturnObject()
 result = self.dbg.GetCommandInterpreter().HandleCommand("expression 
((1 << 16) - 1))", ret_val)
 self.assertEqual(result, lldb.eReturnStatusSuccessFinishResult, "The 
expression was successful.")



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


[Lldb-commits] [lldb] 7a11cc0 - [lldb][test] TestFileHandle: flush the output after write

2020-03-05 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-05T11:45:28+03:00
New Revision: 7a11cc06a4fd057f66a33830880ed567eb6d5eab

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

LOG: [lldb][test] TestFileHandle: flush the output after write

Added: 


Modified: 
lldb/test/API/python_api/file_handle/TestFileHandle.py

Removed: 




diff  --git a/lldb/test/API/python_api/file_handle/TestFileHandle.py 
b/lldb/test/API/python_api/file_handle/TestFileHandle.py
index 996077cff4b4..550aad2ad8a1 100644
--- a/lldb/test/API/python_api/file_handle/TestFileHandle.py
+++ b/lldb/test/API/python_api/file_handle/TestFileHandle.py
@@ -129,6 +129,7 @@ def test_legacy_file_out_script(self):
 # even with collect_result=True.
 self.handleCmd('script 1+1')
 self.dbg.GetOutputFileHandle().write('FOO\n')
+self.dbg.GetOutputFileHandle().flush()
 with open(self.out_filename, 'r') as f:
 self.assertEqual(readStrippedLines(f), ['2', 'FOO'])
 
@@ -246,6 +247,7 @@ def test_fileno_out(self):
 self.assertTrue(status.Success())
 self.handleCmd('script 1+2')
 self.dbg.GetOutputFile().Write(b'quux')
+self.dbg.GetOutputFile().Flush()
 
 with open(self.out_filename, 'r') as f:
 self.assertEqual(readStrippedLines(f), ['3', 'quux'])



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


[Lldb-commits] [lldb] aafd65a - [lldb][test] Replace HandleCommand with runCmd to check that a command succeeded

2020-03-05 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-05T12:37:08+03:00
New Revision: aafd65ad9ff0def1e79889074687f7d0b05313e2

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

LOG: [lldb][test] Replace HandleCommand with runCmd to check that a command 
succeeded

Added: 


Modified: 
lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py

Removed: 




diff  --git a/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py 
b/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
index 8ca26398fcac..7e3b7dfb7752 100644
--- a/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
+++ b/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
@@ -42,5 +42,5 @@ def test_ptr_refs(self):
 
 frame = thread.GetFrameAtIndex(0)
 
-self.dbg.HandleCommand("script import lldb.macosx.heap")
+self.runCmd("script import lldb.macosx.heap")
 self.expect("ptr_refs my_ptr", substrs=["malloc", "stack"])

diff  --git a/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py 
b/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py
index aade40c06b64..41a063b4ab99 100644
--- a/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py
+++ b/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py
@@ -42,6 +42,6 @@ def test_ptr_refs(self):
 
 frame = thread.GetFrameAtIndex(0)
 
-self.dbg.HandleCommand("script import lldb.macosx.heap")
+self.runCmd("script import lldb.macosx.heap")
 self.expect("ptr_refs self", substrs=["malloc", "stack"])
 



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


[Lldb-commits] [lldb] d2e397f - [lldb][test] These tests don't fail on Windows anymore

2020-03-05 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-05T12:37:08+03:00
New Revision: d2e397f15616ef998663e2c6ef698528bd69e189

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

LOG: [lldb][test] These tests don't fail on Windows anymore

Added: 


Modified: 
lldb/test/API/commands/settings/TestSettings.py
lldb/test/API/source-manager/TestSourceManager.py

Removed: 




diff  --git a/lldb/test/API/commands/settings/TestSettings.py 
b/lldb/test/API/commands/settings/TestSettings.py
index 2bc9a91b5bf5..571ada823864 100644
--- a/lldb/test/API/commands/settings/TestSettings.py
+++ b/lldb/test/API/commands/settings/TestSettings.py
@@ -58,7 +58,6 @@ def test_insert_before_and_after_target_run_args(self):
  '[3]: "b"',
  '[4]: "c"'])
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr44430")
 def test_replace_target_run_args(self):
 """Test that 'replace target.run-args' works."""
 # Set the run-args and then replace the index-0 element.
@@ -358,7 +357,6 @@ def test_settings_with_quotes(self):
 'thread-format (format-string) = "abc def   "')
 self.runCmd('settings clear thread-format')
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr44430")
 def test_settings_with_trailing_whitespace(self):
 
 # boolean

diff  --git a/lldb/test/API/source-manager/TestSourceManager.py 
b/lldb/test/API/source-manager/TestSourceManager.py
index 9e7f3b6a2722..2029bc5ed60d 100644
--- a/lldb/test/API/source-manager/TestSourceManager.py
+++ b/lldb/test/API/source-manager/TestSourceManager.py
@@ -237,7 +237,6 @@ def test_modify_source_file_while_debugging(self):
 SOURCE_DISPLAYED_CORRECTLY,
 substrs=['Hello lldb'])
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr44432")
 def test_set_breakpoint_with_absolute_path(self):
 self.build()
 hidden = self.getBuildArtifact("hidden")



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


[Lldb-commits] [lldb] ef38283 - [lldb][test] Temporarily X-fail TestPtrRefs.py and TestPtrRefsObjC.py

2020-03-05 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-05T14:38:44+03:00
New Revision: ef38283a0980c0ca3d4e866eceec189807eec7f9

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

LOG: [lldb][test] Temporarily X-fail TestPtrRefs.py and TestPtrRefsObjC.py

Bugzilla issue: llvm.org/pr45112

Added: 


Modified: 
lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py

Removed: 




diff  --git a/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py 
b/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
index 7e3b7dfb7752..e945688cbe3f 100644
--- a/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
+++ b/lldb/test/API/functionalities/ptr_refs/TestPtrRefs.py
@@ -14,6 +14,7 @@ class TestPtrRefs(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @skipUnlessDarwin
+@expectedFailureAll(oslist=["macosx"], debug_info=["dwarf", "gmodules"], 
bugnumber="llvm.org/pr45112")
 def test_ptr_refs(self):
 """Test format string functionality."""
 self.build()

diff  --git a/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py 
b/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py
index 41a063b4ab99..f8b6db1a7a5e 100644
--- a/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py
+++ b/lldb/test/API/lang/objc/ptr_refs/TestPtrRefsObjC.py
@@ -14,6 +14,7 @@ class TestPtrRefsObjC(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @skipUnlessDarwin
+@expectedFailureAll(oslist=["macosx"], debug_info=["dwarf", "gmodules"], 
bugnumber="llvm.org/pr45112")
 def test_ptr_refs(self):
 """Test the ptr_refs tool on Darwin with Objective-C"""
 self.build()



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


[Lldb-commits] [lldb] df90a15 - [lldb] Clear all settings during a test's setUp

2020-03-12 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-12T16:30:26+03:00
New Revision: df90a15b1ac938559a8c3af12126559c1e1e9558

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

LOG: [lldb] Clear all settings during a test's setUp

Global properties are shared between debugger instances and
if a test doesn't clear changes in settings it made,
this leads to side effects in other tests.

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/Commands/CommandObjectSettings.cpp
lldb/source/Commands/Options.td
lldb/test/API/commands/settings/TestSettings.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index a9d6e50ce01f..cd48747c3557 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -687,6 +687,9 @@ def getSourcePath(self, name):
 @classmethod
 def setUpCommands(cls):
 commands = [
+# First of all, clear all settings to have clean state of global 
properties.
+"settings clear -all",
+
 # Disable Spotlight lookup. The testsuite creates
 # 
diff erent binaries with the same UUID, because they only
 # 
diff er in the debug info, which is not being hashed.

diff  --git a/lldb/source/Commands/CommandObjectSettings.cpp 
b/lldb/source/Commands/CommandObjectSettings.cpp
index 4d64ae428bad..cc1080c8cc0c 100644
--- a/lldb/source/Commands/CommandObjectSettings.cpp
+++ b/lldb/source/Commands/CommandObjectSettings.cpp
@@ -1043,13 +1043,16 @@ class CommandObjectSettingsAppend : public 
CommandObjectRaw {
 };
 
 // CommandObjectSettingsClear
+#define LLDB_OPTIONS_settings_clear
+#include "CommandOptions.inc"
 
 class CommandObjectSettingsClear : public CommandObjectParsed {
 public:
   CommandObjectSettingsClear(CommandInterpreter &interpreter)
   : CommandObjectParsed(
 interpreter, "settings clear",
-"Clear a debugger setting array, dictionary, or string.", nullptr) 
{
+"Clear a debugger setting array, dictionary, or string. "
+"If '-a' option is specified, it clears all settings.", nullptr) {
 CommandArgumentEntry arg;
 CommandArgumentData var_name_arg;
 
@@ -1077,11 +1080,53 @@ class CommandObjectSettingsClear : public 
CommandObjectParsed {
   request, nullptr);
   }
 
+   Options *GetOptions() override { return &m_options; }
+
+  class CommandOptions : public Options {
+  public:
+CommandOptions() = default;
+
+~CommandOptions() override = default;
+
+Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+  ExecutionContext *execution_context) override {
+  const int short_option = m_getopt_table[option_idx].val;
+  switch (short_option) {
+  case 'a':
+m_clear_all = true;
+break;
+  default:
+llvm_unreachable("Unimplemented option");
+  }
+  return Status();
+}
+
+void OptionParsingStarting(ExecutionContext *execution_context) override {
+  m_clear_all = false;
+}
+
+llvm::ArrayRef GetDefinitions() override {
+  return llvm::makeArrayRef(g_settings_clear_options);
+}
+
+bool m_clear_all = false;
+  };
+
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 result.SetStatus(eReturnStatusSuccessFinishNoResult);
 const size_t argc = command.GetArgumentCount();
 
+if (m_options.m_clear_all) {
+  if (argc != 0) {
+result.AppendError("'settings clear --all' doesn't take any 
arguments");
+result.SetStatus(eReturnStatusFailed);
+return false;
+  }
+  GetDebugger().GetValueProperties()->Clear();
+  return result.Succeeded();
+}
+
 if (argc != 1) {
   result.AppendError("'settings clear' takes exactly one argument");
   result.SetStatus(eReturnStatusFailed);
@@ -1106,6 +1151,9 @@ class CommandObjectSettingsClear : public 
CommandObjectParsed {
 
 return result.Succeeded();
   }
+
+  private:
+CommandOptions m_options;
 };
 
 // CommandObjectMultiwordSettings

diff  --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 1456630c892f..fa8f5224cf53 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -39,6 +39,11 @@ let Command = "settings read" in {
 Desc<"The file from which to read the settings.">;
 }
 
+let Command = "settings clear" in {
+  def setclear_all : Option<"all", "a">,
+Desc<"Clear all settings.">;
+}
+
 let Command = "breakpoint list" in {
   // FIXME: We need to add an "internal" command, and then add this sort of
   

[Lldb-commits] [lldb] fe74df0 - [lldb] Specify default value for platform.module-cache-directory

2020-03-12 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-12T22:08:12+03:00
New Revision: fe74df01a909fb02528e83e90124f1b706176ddd

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

LOG: [lldb] Specify default value for platform.module-cache-directory

In addition to the commit rG352f16db87f583ec7f55f8028647b5fd8616111f,
this one fixes settings behavior on clearing - the setting should be
reverted to their default value, not an empty one.

Added: 


Modified: 
lldb/include/lldb/Target/Platform.h
lldb/source/Target/Platform.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index f347e7beae28..7c2746ddec68 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -50,6 +50,9 @@ class PlatformProperties : public Properties {
 
   FileSpec GetModuleCacheDirectory() const;
   bool SetModuleCacheDirectory(const FileSpec &dir_spec);
+
+private:
+  void SetDefaultModuleCacheDirectory(const FileSpec &dir_spec);
 };
 
 typedef std::shared_ptr PlatformPropertiesSP;

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 3739ccd7edc6..eaa71b9cbbd0 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -26,6 +26,7 @@
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/OptionParser.h"
+#include "lldb/Interpreter/OptionValueFileSpec.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Interpreter/Property.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -93,6 +94,7 @@ PlatformProperties::PlatformProperties() {
   module_cache_dir = FileSpec(user_home_dir.c_str());
   module_cache_dir.AppendPathComponent(".lldb");
   module_cache_dir.AppendPathComponent("module_cache");
+  SetDefaultModuleCacheDirectory(module_cache_dir);
   SetModuleCacheDirectory(module_cache_dir);
 }
 
@@ -117,6 +119,14 @@ bool PlatformProperties::SetModuleCacheDirectory(const 
FileSpec &dir_spec) {
   nullptr, ePropertyModuleCacheDirectory, dir_spec);
 }
 
+void PlatformProperties::SetDefaultModuleCacheDirectory(
+const FileSpec &dir_spec) {
+  auto f_spec_opt = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(
+nullptr, false, ePropertyModuleCacheDirectory);
+  assert(f_spec_opt);
+  f_spec_opt->SetDefaultValue(dir_spec);
+}
+
 /// Get the native host platform plug-in.
 ///
 /// There should only be one of these for each host that LLDB runs



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


[Lldb-commits] [lldb] 332edcc - [lldb] Remove unimplemented StackFrame::BehavesLikeZerothFrame

2020-03-16 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-16T16:20:12+03:00
New Revision: 332edcc6bd1dc1fd8fc33a0fb2f215a996d967fa

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

LOG: [lldb] Remove unimplemented StackFrame::BehavesLikeZerothFrame

Commit [1] added a declaration of function-member
StackFrame::BehavesLikeZerothFrame but hasn't added an implementation
for the function. This commit removes this declation, because the
function is not used anywhere.

[1] 31e6dbe1c6a6 Fix PC adjustment in StackFrame::GetSymbolContext

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

Patch by Anton Kolesov 

Added: 


Modified: 
lldb/include/lldb/Target/StackFrame.h

Removed: 




diff  --git a/lldb/include/lldb/Target/StackFrame.h 
b/lldb/include/lldb/Target/StackFrame.h
index c21916be44ae..667428e7d749 100644
--- a/lldb/include/lldb/Target/StackFrame.h
+++ b/lldb/include/lldb/Target/StackFrame.h
@@ -367,12 +367,6 @@ class StackFrame : public ExecutionContextScope,
   /// may have limited support for inspecting variables.
   bool IsArtificial() const;
 
-  /// Query whether this frame behaves like the zeroth frame, in the sense
-  /// that its pc value might not immediately follow a call (and thus might
-  /// be the first address of its function).  True for actual frame zero as
-  /// well as any other frame with the same trait.
-  bool BehavesLikeZerothFrame() const;
-
   /// Query this frame to find what frame it is in this Thread's
   /// StackFrameList.
   ///
@@ -517,6 +511,11 @@ class StackFrame : public ExecutionContextScope,
   bool m_cfa_is_valid; // Does this frame have a CFA?  Different from CFA ==
// LLDB_INVALID_ADDRESS
   Kind m_stack_frame_kind;
+
+  // Whether this frame behaves like the zeroth frame, in the sense
+  // that its pc value might not immediately follow a call (and thus might
+  // be the first address of its function). True for actual frame zero as
+  // well as any other frame with the same trait.
   bool m_behaves_like_zeroth_frame;
   lldb::VariableListSP m_variable_list_sp;
   ValueObjectList m_variable_list_value_objects; // Value objects for each



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


[Lldb-commits] [lldb] 0a840ef - [lldb] Copy m_behaves_like_zeroth_frame on stack frame update

2020-03-16 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-16T16:20:11+03:00
New Revision: 0a840ef80059c761109f5988590a3616c00906a1

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

LOG: [lldb] Copy m_behaves_like_zeroth_frame on stack frame update

Fix to code from https://reviews.llvm.org/D64993.

Field StackFrame::m_behaves_like_zeroth_frame was introduced in commit
[1], however that commit hasn't added a copying of the field to
UpdatePreviousFrameFromCurrentFrame, therefore the value wouldn't change
when updating frames to reflect the current situation.

The particular scenario, where this matters is following. Assume we have
function main that invokes function func1. We set breakpoint at
func1 entry and in main after the func1 call, and do not stop at
the main entry. Therefore, when debugger stops for the first time,
func1 is frame#0, while main is frame#1, thus
m_behaves_like_zeroth_frame is set to 0 for main frame. Execution is
resumed, and stops now in main, where it is now frame#0. However while
updating the frame object, m_behaves_like_zeroth_frame remains false.
This field plays an important role when calculating line information for
backtrace: for frame#0, PC is the current line, therefore line
information is retrieved for PC, however for all other frames this is
not the case - calculated PC is a return-PC, i.e. instruction after the
function call line, therefore for those frames LLDB needs to step back
by one instruction. Initial implementation did this strictly for frames
that have index != 0 (and index is updated properly in
UpdatePreviousFrameFromCurrentFrame), but m_behaves_like_zeroth_frame
added a capability for middle-of-stack frames to behave in a similar
manner. But because current code now doesn't check frame idx,
m_behaves_like_zeroth_frame must be set to true for frames with 0 index,
not only for frame that behave like one. In the described test case,
after stopping in main, LLDB would still consider frame#0 as
non-zeroth, and would subtract instruction from the PC, and would report
previous like as current line.

The error doesn't manifest itself in LLDB interpreter though - it can be
reproduced through LLDB-MI and when using SB API, but not when we
interpreter command "continue" is executed. Honestly, I didn't fully
understand why it works in interpreter, I did found that bug "fixes"
itself if I enable DEBUG_STACK_FRAMES in StackFrameList.cpp, because
that calls StackFrame::Dump and that calls
GetSymbolContext(eSymbolContextEverything), which fills the context of
frame on the first breakpoint, therefore it doesn't have to be
recalculated (improperly) on a second frame. However, on first
breakpoint symbol context is calculated for the "call" line, not the
next one, therefore it should be recalculated anyway on a second
breakpoint, and it is done correctly, even though
m_behaves_like_zeroth_frame is still incorrect, as long as
GetSymbolContext(eSymbolContextEverything) has been called.

[1] 31e6dbe1c6a6 Fix PC adjustment in StackFrame::GetSymbolContext

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

Patch by Anton Kolesov 

Added: 
lldb/test/API/functionalities/unwind/zeroth_frame/Makefile
lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py
lldb/test/API/functionalities/unwind/zeroth_frame/main.c

Modified: 
lldb/source/Target/StackFrame.cpp

Removed: 




diff  --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index a81879476cf2..56761a6d1046 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1861,6 +1861,7 @@ void 
StackFrame::UpdatePreviousFrameFromCurrentFrame(StackFrame &curr_frame) {
   m_concrete_frame_index = curr_frame.m_concrete_frame_index;
   m_reg_context_sp = curr_frame.m_reg_context_sp;
   m_frame_code_addr = curr_frame.m_frame_code_addr;
+  m_behaves_like_zeroth_frame = curr_frame.m_behaves_like_zeroth_frame;
   assert(!m_sc.target_sp || !curr_frame.m_sc.target_sp ||
  m_sc.target_sp.get() == curr_frame.m_sc.target_sp.get());
   assert(!m_sc.module_sp || !curr_frame.m_sc.module_sp ||

diff  --git a/lldb/test/API/functionalities/unwind/zeroth_frame/Makefile 
b/lldb/test/API/functionalities/unwind/zeroth_frame/Makefile
new file mode 100644
index ..15a931850e17
--- /dev/null
+++ b/lldb/test/API/functionalities/unwind/zeroth_frame/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py 
b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py
new file mode 100644
index ..b85a92e4a92f
--- /dev/null
+++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py
@@ -0,0 +1,96 @@
+"""
+Test that line inform

[Lldb-commits] [lldb] 0b18b56 - [lldb-vscode] Don't use SBLaunchInfo in request_attach

2020-03-20 Thread Tatyana Krasnukha via lldb-commits

Author: Anton Kolesov
Date: 2020-03-20T20:15:23+03:00
New Revision: 0b18b568e91a3ebe3ab33d13328a1614fb94cf07

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

LOG: [lldb-vscode] Don't use SBLaunchInfo in request_attach

If LLDB attaches to an already running target, then structure SBAttachInfo is
used instead of SBLaunchInfo. lldb-vscode function request_attach sets some
values to g_vsc.launch_info, however this field is then not passed anywhere, so
this action has no effect. This commit removes invocation of
SBLaunchInfo::SetDetachOnError, which has no equivalent in SBAttachInfo.

File package.json doesn't describe detachOnError property for "attach" request
type, therefore it is not needed to update it.

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

Added: 


Modified: 
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 080ef5b40c01..ff4a6af22af4 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -543,9 +543,6 @@ void request_attach(const llvm::json::Object &request) {
 return;
   }
 
-  const bool detatchOnError = GetBoolean(arguments, "detachOnError", false);
-  g_vsc.launch_info.SetDetachOnError(detatchOnError);
-
   // Run any pre run LLDB commands the user specified in the launch.json
   g_vsc.RunPreRunCommands();
 



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


[Lldb-commits] [lldb] ccf1c30 - [lldb][testsuite] Add lldb-server category

2020-03-26 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-26T15:05:30+03:00
New Revision: ccf1c30cde6e1e763e7c9cdd48a609a805166699

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

LOG: [lldb][testsuite] Add lldb-server category

Added: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/.categories

Modified: 
lldb/packages/Python/lldbsuite/test/test_categories.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/test_categories.py 
b/lldb/packages/Python/lldbsuite/test/test_categories.py
index 05ce2a15d844..f0d6b9ce17de 100644
--- a/lldb/packages/Python/lldbsuite/test/test_categories.py
+++ b/lldb/packages/Python/lldbsuite/test/test_categories.py
@@ -37,6 +37,7 @@
 'darwin-log': 'Darwin log tests',
 'watchpoint': 'Watchpoint-related tests',
 'lldb-vscode': 'Visual Studio Code debug adaptor tests',
+'lldb-server': 'Tests related to lldb-server',
 }
 
 

diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/.categories 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/.categories
new file mode 100644
index ..1966eb022b49
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/.categories
@@ -0,0 +1 @@
+lldb-server



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


[Lldb-commits] [lldb] 2bfe2b8 - [lldb][testsuite] Check that process is launched successfully in inline tests

2020-03-26 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-03-26T15:05:30+03:00
New Revision: 2bfe2b878a62db5b008735401d376f68dd0e34ea

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

LOG: [lldb][testsuite] Check that process is launched successfully in inline 
tests

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbinline.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbinline.py 
b/lldb/packages/Python/lldbsuite/test/lldbinline.py
index 22668b673fda..3df26356d908 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbinline.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbinline.py
@@ -137,6 +137,8 @@ def do_test(self):
 parser.set_breakpoints(target)
 
 process = target.LaunchSimple(None, None, 
self.get_process_working_directory())
+self.assertIsNotNone(process, PROCESS_IS_VALID)
+
 hit_breakpoints = 0
 
 while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint):



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


[Lldb-commits] [lldb] a92673f - [lldb-vscode] Convert launch_info and attach_info to local variables

2020-03-26 Thread Tatyana Krasnukha via lldb-commits

Author: Anton Kolesov
Date: 2020-03-26T18:48:40+03:00
New Revision: a92673fe9a08b5ed4f67cc52782bacc29cf945ec

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

LOG: [lldb-vscode] Convert launch_info and attach_info to local variables

Those fields inside of the global variable can be local variables because
they are used in only inside of one function: request_launch for launch_info
and request_attach for attach_info.

To avoid confusion an already existing local variable attach_info of
request_attach has been renamed to better reflect its purpose.

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

Added: 


Modified: 
lldb/tools/lldb-vscode/VSCode.cpp
lldb/tools/lldb-vscode/VSCode.h
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git a/lldb/tools/lldb-vscode/VSCode.cpp 
b/lldb/tools/lldb-vscode/VSCode.cpp
index 8112f4c8d0d9..36bc8ec8ebfd 100644
--- a/lldb/tools/lldb-vscode/VSCode.cpp
+++ b/lldb/tools/lldb-vscode/VSCode.cpp
@@ -28,8 +28,8 @@ namespace lldb_vscode {
 VSCode g_vsc;
 
 VSCode::VSCode()
-: launch_info(nullptr), variables(), broadcaster("lldb-vscode"),
-  num_regs(0), num_locals(0), num_globals(0), log(),
+: variables(), broadcaster("lldb-vscode"), num_regs(0), num_locals(0),
+  num_globals(0), log(),
   exception_breakpoints(
   {{"cpp_catch", "C++ Catch", lldb::eLanguageTypeC_plus_plus},
{"cpp_throw", "C++ Throw", lldb::eLanguageTypeC_plus_plus},

diff  --git a/lldb/tools/lldb-vscode/VSCode.h b/lldb/tools/lldb-vscode/VSCode.h
index f23b24d0114e..5298d7554f4d 100644
--- a/lldb/tools/lldb-vscode/VSCode.h
+++ b/lldb/tools/lldb-vscode/VSCode.h
@@ -70,8 +70,6 @@ struct VSCode {
   OutputStream output;
   lldb::SBDebugger debugger;
   lldb::SBTarget target;
-  lldb::SBAttachInfo attach_info;
-  lldb::SBLaunchInfo launch_info;
   lldb::SBValueList variables;
   lldb::SBBroadcaster broadcaster;
   int64_t num_regs;

diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 8c68dd0e7055..ec8000c264ae 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -508,13 +508,14 @@ void request_attach(const llvm::json::Object &request) {
   llvm::json::Object response;
   lldb::SBError error;
   FillResponse(request, response);
+  lldb::SBAttachInfo attach_info;
   auto arguments = request.getObject("arguments");
   const lldb::pid_t pid =
   GetUnsigned(arguments, "pid", LLDB_INVALID_PROCESS_ID);
   if (pid != LLDB_INVALID_PROCESS_ID)
-g_vsc.attach_info.SetProcessID(pid);
+attach_info.SetProcessID(pid);
   const auto wait_for = GetBoolean(arguments, "waitFor", false);
-  g_vsc.attach_info.SetWaitForLaunch(wait_for, false /*async*/);
+  attach_info.SetWaitForLaunch(wait_for, false /*async*/);
   g_vsc.init_commands = GetStrings(arguments, "initCommands");
   g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands");
   g_vsc.stop_commands = GetStrings(arguments, "stopCommands");
@@ -547,20 +548,19 @@ void request_attach(const llvm::json::Object &request) {
   g_vsc.RunPreRunCommands();
 
   if (pid == LLDB_INVALID_PROCESS_ID && wait_for) {
-char attach_info[256];
-auto attach_info_len =
-snprintf(attach_info, sizeof(attach_info),
- "Waiting to attach to \"%s\"...",
- g_vsc.target.GetExecutable().GetFilename());
-g_vsc.SendOutput(OutputType::Console, llvm::StringRef(attach_info,
-  attach_info_len));
+char attach_msg[256];
+auto attach_msg_len = snprintf(attach_msg, sizeof(attach_msg),
+   "Waiting to attach to \"%s\"...",
+   g_vsc.target.GetExecutable().GetFilename());
+g_vsc.SendOutput(OutputType::Console,
+ llvm::StringRef(attach_msg, attach_msg_len));
   }
   if (attachCommands.empty()) {
 // No "attachCommands", just attach normally.
 // Disable async events so the attach will be successful when we return 
from
 // the launch call and the launch will happen synchronously
 g_vsc.debugger.SetAsync(false);
-g_vsc.target.Attach(g_vsc.attach_info, error);
+g_vsc.target.Attach(attach_info, error);
 // Reenable async events
 g_vsc.debugger.SetAsync(true);
   } else {
@@ -1381,26 +1381,26 @@ void request_launch(const llvm::json::Object &request) {
   }
 
   // Instantiate a launch info instance for the target.
-  g_vsc.launch_info = g_vsc.target.GetLaunchInfo();
+  auto launch_info = g_vsc.target.GetLaunchInfo();
 
   // Grab the current working directory if there is one and set it in the
   // launch info.
   const auto cwd = GetString(arguments, "cwd");
   if (!cwd.empty())
-g

[Lldb-commits] [lldb] 8cdcd41 - [lldb/Interpreter][NFC] Remove explicit default initialization of members and base classes

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:18+03:00
New Revision: 8cdcd41e384b4901cd796f7be58c461647e54d18

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

LOG: [lldb/Interpreter][NFC] Remove explicit default initialization of members 
and base classes

According to clang-tidy's readability-redundant-member-init.

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionGroupPlatform.h
lldb/include/lldb/Interpreter/OptionValueArch.h
lldb/include/lldb/Interpreter/OptionValueBoolean.h
lldb/include/lldb/Interpreter/OptionValueChar.h
lldb/include/lldb/Interpreter/OptionValueDictionary.h
lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/include/lldb/Interpreter/OptionValueFormat.h
lldb/include/lldb/Interpreter/OptionValueLanguage.h
lldb/include/lldb/Interpreter/OptionValuePathMappings.h
lldb/include/lldb/Interpreter/OptionValueRegex.h
lldb/include/lldb/Interpreter/OptionValueSInt64.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h
lldb/include/lldb/Interpreter/OptionValueUUID.h
lldb/include/lldb/Interpreter/Options.h
lldb/source/Interpreter/CommandAlias.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Interpreter/OptionGroupFile.cpp
lldb/source/Interpreter/OptionGroupOutputFile.cpp
lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
lldb/source/Interpreter/OptionGroupVariable.cpp
lldb/source/Interpreter/OptionValueEnumeration.cpp
lldb/source/Interpreter/OptionValueFileColonLine.cpp
lldb/source/Interpreter/OptionValueFileSpec.cpp
lldb/source/Interpreter/OptionValueFormatEntity.cpp
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Interpreter/Property.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h 
b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
index 99945e5246fd..fed2791a6130 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
@@ -21,8 +21,7 @@ namespace lldb_private {
 class OptionGroupPlatform : public OptionGroup {
 public:
   OptionGroupPlatform(bool include_platform_option)
-  : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
-m_include_platform_option(include_platform_option) {}
+  : m_include_platform_option(include_platform_option) {}
 
   ~OptionGroupPlatform() override = default;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionValueArch.h 
b/lldb/include/lldb/Interpreter/OptionValueArch.h
index d079b3896531..22f75a6259c5 100644
--- a/lldb/include/lldb/Interpreter/OptionValueArch.h
+++ b/lldb/include/lldb/Interpreter/OptionValueArch.h
@@ -19,17 +19,15 @@ class OptionValueArch : public OptionValue {
 public:
   OptionValueArch() = default;
 
-  OptionValueArch(const char *triple)
-  : OptionValue(), m_current_value(triple), m_default_value() {
+  OptionValueArch(const char *triple) : m_current_value(triple) {
 m_default_value = m_current_value;
   }
 
   OptionValueArch(const ArchSpec &value)
-  : OptionValue(), m_current_value(value), m_default_value(value) {}
+  : m_current_value(value), m_default_value(value) {}
 
   OptionValueArch(const ArchSpec ¤t_value, const ArchSpec &default_value)
-  : OptionValue(), m_current_value(current_value),
-m_default_value(default_value) {}
+  : m_current_value(current_value), m_default_value(default_value) {}
 
   ~OptionValueArch() override = default;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h 
b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
index d0eb4362d466..6ae464bd8fb2 100644
--- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
@@ -16,10 +16,9 @@ namespace lldb_private {
 class OptionValueBoolean : public OptionValue {
 public:
   OptionValueBoolean(bool value)
-  : OptionValue(), m_current_value(value), m_default_value(value) {}
+  : m_current_value(value), m_default_value(value) {}
   OptionValueBoolean(bool current_value, bool default_value)
-  : OptionValue(), m_current_value(current_value),
-m_default_value(default_value) {}
+  : m_current_value(current_value), m_default_value(default_value) {}
 
   ~OptionValueBoolean() override = default;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionValueChar.h 
b/lldb/include/lldb/Interpreter/OptionValueChar.h
index f3fd28104067..78f91df99842 100644
--- a/lldb/include/lldb/Interpreter/OptionValueChar.h
+++ b/lldb/include/lldb/Interpreter/OptionValueChar.h
@@ -16,11 +16,10 @@ namespace lldb_private {
 class OptionVal

[Lldb-commits] [lldb] 54d03a4 - [lldb/Interpreter][NFC] Replace default constructors/destructors bodies with "=default"

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:16+03:00
New Revision: 54d03a4985bc9a0a84c4dff835ec6ed0f607582f

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

LOG: [lldb/Interpreter][NFC] Replace default constructors/destructors bodies 
with "=default"

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandHistory.h
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Interpreter/CommandReturnObject.h
lldb/include/lldb/Interpreter/OptionGroupArchitecture.h
lldb/include/lldb/Interpreter/OptionGroupBoolean.h
lldb/include/lldb/Interpreter/OptionGroupFile.h
lldb/include/lldb/Interpreter/OptionGroupFormat.h
lldb/include/lldb/Interpreter/OptionGroupOutputFile.h
lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
lldb/include/lldb/Interpreter/OptionGroupString.h
lldb/include/lldb/Interpreter/OptionGroupUInt64.h
lldb/include/lldb/Interpreter/OptionGroupUUID.h
lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
lldb/include/lldb/Interpreter/OptionGroupVariable.h
lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
lldb/include/lldb/Interpreter/OptionValueArch.h
lldb/include/lldb/Interpreter/OptionValueArgs.h
lldb/include/lldb/Interpreter/OptionValueArray.h
lldb/include/lldb/Interpreter/OptionValueBoolean.h
lldb/include/lldb/Interpreter/OptionValueChar.h
lldb/include/lldb/Interpreter/OptionValueDictionary.h
lldb/include/lldb/Interpreter/OptionValueEnumeration.h
lldb/include/lldb/Interpreter/OptionValueFileColonLine.h
lldb/include/lldb/Interpreter/OptionValueFileSpec.h
lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/include/lldb/Interpreter/OptionValueFormat.h
lldb/include/lldb/Interpreter/OptionValueFormatEntity.h
lldb/include/lldb/Interpreter/OptionValueLanguage.h
lldb/include/lldb/Interpreter/OptionValuePathMappings.h
lldb/include/lldb/Interpreter/OptionValueProperties.h
lldb/include/lldb/Interpreter/OptionValueSInt64.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h
lldb/include/lldb/Interpreter/OptionValueUUID.h
lldb/include/lldb/Interpreter/ScriptInterpreter.h
lldb/source/Interpreter/CommandHistory.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Interpreter/CommandReturnObject.cpp
lldb/source/Interpreter/OptionGroupArchitecture.cpp
lldb/source/Interpreter/OptionGroupBoolean.cpp
lldb/source/Interpreter/OptionGroupFile.cpp
lldb/source/Interpreter/OptionGroupFormat.cpp
lldb/source/Interpreter/OptionGroupOutputFile.cpp
lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
lldb/source/Interpreter/OptionGroupString.cpp
lldb/source/Interpreter/OptionGroupUInt64.cpp
lldb/source/Interpreter/OptionGroupUUID.cpp
lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
lldb/source/Interpreter/OptionGroupVariable.cpp
lldb/source/Interpreter/OptionGroupWatchpoint.cpp
lldb/source/Interpreter/OptionValueEnumeration.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandHistory.h 
b/lldb/include/lldb/Interpreter/CommandHistory.h
index fbb42247f11a..12c170ba5eeb 100644
--- a/lldb/include/lldb/Interpreter/CommandHistory.h
+++ b/lldb/include/lldb/Interpreter/CommandHistory.h
@@ -20,9 +20,9 @@ namespace lldb_private {
 
 class CommandHistory {
 public:
-  CommandHistory();
+  CommandHistory() = default;
 
-  ~CommandHistory();
+  ~CommandHistory() = default;
 
   size_t GetSize() const;
 

diff  --git a/lldb/include/lldb/Interpreter/CommandObject.h 
b/lldb/include/lldb/Interpreter/CommandObject.h
index d5ad969cda66..8bc5d3e22355 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -113,7 +113,7 @@ class CommandObject {
 llvm::StringRef help = "", llvm::StringRef syntax = "",
 uint32_t flags = 0);
 
-  virtual ~CommandObject();
+  virtual ~CommandObject() = default;
 
   static const char *
   GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);

diff  --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h 
b/lldb/include/lldb/Interpreter/CommandReturnObject.h
index 06b648517d13..c638b4bc70b2 100644
--- a/lldb/include/lldb/Interpreter/CommandReturnObject.h
+++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h
@@ -26,7 +26,7 @@ class CommandReturnObject {
 public:
   CommandReturnObject(bool colors);
 
-  ~CommandReturnObject();
+  ~CommandReturnObject() = default;
 
   llvm::StringRef GetOutputData() {
 lldb::StreamSP 
stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex))

[Lldb-commits] [lldb] b2faf30 - [lldb][NFC] Make OptionValueArgs::GetArgs constant

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:20+03:00
New Revision: b2faf30189449a894b5c1cb2bb6b0cc04986c7fe

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

LOG: [lldb][NFC] Make OptionValueArgs::GetArgs constant

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionValueArgs.h
lldb/source/Interpreter/OptionValueArgs.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionValueArgs.h 
b/lldb/include/lldb/Interpreter/OptionValueArgs.h
index 2ef6ca5573e9..8cea8ced74de 100644
--- a/lldb/include/lldb/Interpreter/OptionValueArgs.h
+++ b/lldb/include/lldb/Interpreter/OptionValueArgs.h
@@ -21,7 +21,7 @@ class OptionValueArgs : public OptionValueArray {
 
   ~OptionValueArgs() override = default;
 
-  size_t GetArgs(Args &args);
+  size_t GetArgs(Args &args) const;
 
   Type GetType() const override { return eTypeArgs; }
 };

diff  --git a/lldb/source/Interpreter/OptionValueArgs.cpp 
b/lldb/source/Interpreter/OptionValueArgs.cpp
index 9e7774a231c7..bdb5f486835a 100644
--- a/lldb/source/Interpreter/OptionValueArgs.cpp
+++ b/lldb/source/Interpreter/OptionValueArgs.cpp
@@ -13,9 +13,9 @@
 using namespace lldb;
 using namespace lldb_private;
 
-size_t OptionValueArgs::GetArgs(Args &args) {
+size_t OptionValueArgs::GetArgs(Args &args) const {
   args.Clear();
-  for (auto value : m_values) {
+  for (const auto &value : m_values) {
 llvm::StringRef string_value = value->GetStringValue();
 if (!string_value.empty())
   args.AppendArgument(string_value);



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


[Lldb-commits] [lldb] ef447fe - [lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle OptionValueArgs

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:22+03:00
New Revision: ef447fe0088cacc38027028d4c43c1938d3eb9e7

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

LOG: [lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle 
OptionValueArgs

Added: 


Modified: 
lldb/source/Interpreter/OptionValueProperties.cpp

Removed: 




diff  --git a/lldb/source/Interpreter/OptionValueProperties.cpp 
b/lldb/source/Interpreter/OptionValueProperties.cpp
index 22447a82d811..886af3269a32 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -248,38 +248,50 @@ 
OptionValueProperties::GetPropertyAtIndexAsOptionValueLanguage(
 bool OptionValueProperties::GetPropertyAtIndexAsArgs(
 const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const {
   const Property *property = GetPropertyAtIndex(exe_ctx, false, idx);
-  if (property) {
-OptionValue *value = property->GetValue().get();
-if (value) {
-  const OptionValueArray *array = value->GetAsArray();
-  if (array)
-return array->GetArgs(args);
-  else {
-const OptionValueDictionary *dict = value->GetAsDictionary();
-if (dict)
-  return dict->GetArgs(args);
-  }
-}
-  }
+  if (!property)
+return false;
+
+  OptionValue *value = property->GetValue().get();
+  if (!value)
+return false;
+
+  const OptionValueArgs *arguments = value->GetAsArgs();
+  if (arguments)
+return arguments->GetArgs(args);
+
+  const OptionValueArray *array = value->GetAsArray();
+  if (array)
+return array->GetArgs(args);
+
+  const OptionValueDictionary *dict = value->GetAsDictionary();
+  if (dict)
+return dict->GetArgs(args);
+
   return false;
 }
 
 bool OptionValueProperties::SetPropertyAtIndexFromArgs(
 const ExecutionContext *exe_ctx, uint32_t idx, const Args &args) {
   const Property *property = GetPropertyAtIndex(exe_ctx, true, idx);
-  if (property) {
-OptionValue *value = property->GetValue().get();
-if (value) {
-  OptionValueArray *array = value->GetAsArray();
-  if (array)
-return array->SetArgs(args, eVarSetOperationAssign).Success();
-  else {
-OptionValueDictionary *dict = value->GetAsDictionary();
-if (dict)
-  return dict->SetArgs(args, eVarSetOperationAssign).Success();
-  }
-}
-  }
+  if (!property)
+return false;
+
+  OptionValue *value = property->GetValue().get();
+  if (!value)
+return false;
+
+  OptionValueArgs *arguments = value->GetAsArgs();
+  if (arguments)
+return arguments->SetArgs(args, eVarSetOperationAssign).Success();
+
+  OptionValueArray *array = value->GetAsArray();
+  if (array)
+return array->SetArgs(args, eVarSetOperationAssign).Success();
+
+  OptionValueDictionary *dict = value->GetAsDictionary();
+  if (dict)
+return dict->SetArgs(args, eVarSetOperationAssign).Success();
+
   return false;
 }
 



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


[Lldb-commits] [lldb] 9182117 - [lldb/Interpreter][NFC] Remove more deleted const char* overloads

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:14+03:00
New Revision: 9182117861896a03499bbca3612fc66ca4d36944

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

LOG: [lldb/Interpreter][NFC] Remove more deleted const char* overloads

A follow-up commit to D96861.

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionGroupBoolean.h
lldb/include/lldb/Interpreter/OptionGroupFile.h
lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
lldb/include/lldb/Interpreter/OptionGroupString.h
lldb/include/lldb/Interpreter/OptionGroupUInt64.h
lldb/include/lldb/Interpreter/OptionGroupUUID.h
lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
lldb/include/lldb/Interpreter/OptionGroupVariable.h
lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionGroupBoolean.h 
b/lldb/include/lldb/Interpreter/OptionGroupBoolean.h
index 061e31340854..5411e99148e6 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupBoolean.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupBoolean.h
@@ -33,7 +33,6 @@ class OptionGroupBoolean : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupFile.h 
b/lldb/include/lldb/Interpreter/OptionGroupFile.h
index 374cf10ea30a..22b0eb4a28fa 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupFile.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupFile.h
@@ -32,7 +32,6 @@ class OptionGroupFile : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 
@@ -63,7 +62,6 @@ class OptionGroupFileList : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h 
b/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
index d4c924a44157..695a5b93c2ea 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
@@ -37,7 +37,6 @@ class OptionGroupPythonClassWithDict : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
   Status OptionParsingFinished(ExecutionContext *execution_context) override;

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupString.h 
b/lldb/include/lldb/Interpreter/OptionGroupString.h
index 1a3b5bdd88ed..de1ef0b4bf3c 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupString.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupString.h
@@ -30,7 +30,6 @@ class OptionGroupString : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupUInt64.h 
b/lldb/include/lldb/Interpreter/OptionGroupUInt64.h
index 783c4b632f00..1e21f56d4338 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupUInt64.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupUInt64.h
@@ -31,7 +31,6 @@ class OptionGroupUInt64 : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupUUID.h 
b/lldb/include/lldb/Interpreter/OptionGroupU

[Lldb-commits] [lldb] f0f183e - [lldb/Interpreter] Fix deep copying for OptionValue classes

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:25+03:00
New Revision: f0f183ee4ad952d94234cf6971c69a044e05c9df

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

LOG: [lldb/Interpreter] Fix deep copying for OptionValue classes

Some implementations of the DeepCopy function called the copy constructor that 
copied m_parent member instead of setting a new parent. Others just leaved the 
base class's members (m_parent, m_callback, m_was_set) empty.
One more problem is that not all classes override this function, e.g. 
OptionValueArgs::DeepCopy produces OptionValueArray instance, and 
Target[Process/Thread]ValueProperty::DeepCopy produces OptionValueProperty. 
This makes downcasting via static_cast invalid.

The patch implements idiom "virtual constructor" to fix these issues.
Add a test that checks DeepCopy for correct copying/setting all data members of 
the base class.

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

Added: 
lldb/include/lldb/Utility/Cloneable.h
lldb/unittests/Interpreter/TestOptionValue.cpp

Modified: 
lldb/include/lldb/Interpreter/OptionValue.h
lldb/include/lldb/Interpreter/OptionValueArch.h
lldb/include/lldb/Interpreter/OptionValueArgs.h
lldb/include/lldb/Interpreter/OptionValueArray.h
lldb/include/lldb/Interpreter/OptionValueBoolean.h
lldb/include/lldb/Interpreter/OptionValueChar.h
lldb/include/lldb/Interpreter/OptionValueDictionary.h
lldb/include/lldb/Interpreter/OptionValueEnumeration.h
lldb/include/lldb/Interpreter/OptionValueFileColonLine.h
lldb/include/lldb/Interpreter/OptionValueFileSpec.h
lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/include/lldb/Interpreter/OptionValueFormat.h
lldb/include/lldb/Interpreter/OptionValueFormatEntity.h
lldb/include/lldb/Interpreter/OptionValueLanguage.h
lldb/include/lldb/Interpreter/OptionValuePathMappings.h
lldb/include/lldb/Interpreter/OptionValueProperties.h
lldb/include/lldb/Interpreter/OptionValueRegex.h
lldb/include/lldb/Interpreter/OptionValueSInt64.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h
lldb/include/lldb/Interpreter/OptionValueUUID.h
lldb/source/Interpreter/OptionValue.cpp
lldb/source/Interpreter/OptionValueArch.cpp
lldb/source/Interpreter/OptionValueArray.cpp
lldb/source/Interpreter/OptionValueBoolean.cpp
lldb/source/Interpreter/OptionValueChar.cpp
lldb/source/Interpreter/OptionValueDictionary.cpp
lldb/source/Interpreter/OptionValueEnumeration.cpp
lldb/source/Interpreter/OptionValueFileColonLine.cpp
lldb/source/Interpreter/OptionValueFileSpec.cpp
lldb/source/Interpreter/OptionValueFileSpecList.cpp
lldb/source/Interpreter/OptionValueFormat.cpp
lldb/source/Interpreter/OptionValueFormatEntity.cpp
lldb/source/Interpreter/OptionValueLanguage.cpp
lldb/source/Interpreter/OptionValuePathMappings.cpp
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Interpreter/OptionValueRegex.cpp
lldb/source/Interpreter/OptionValueSInt64.cpp
lldb/source/Interpreter/OptionValueString.cpp
lldb/source/Interpreter/OptionValueUInt64.cpp
lldb/source/Interpreter/OptionValueUUID.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/Thread.cpp
lldb/test/API/commands/settings/TestSettings.py
lldb/unittests/Interpreter/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionValue.h 
b/lldb/include/lldb/Interpreter/OptionValue.h
index a8176e39940a..218fa6f029c1 100644
--- a/lldb/include/lldb/Interpreter/OptionValue.h
+++ b/lldb/include/lldb/Interpreter/OptionValue.h
@@ -10,6 +10,7 @@
 #define LLDB_INTERPRETER_OPTIONVALUE_H
 
 #include "lldb/Core/FormatEntity.h"
+#include "lldb/Utility/Cloneable.h"
 #include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Status.h"
@@ -87,7 +88,8 @@ class OptionValue {
 
   virtual void Clear() = 0;
 
-  virtual lldb::OptionValueSP DeepCopy() const = 0;
+  virtual lldb::OptionValueSP
+  DeepCopy(const lldb::OptionValueSP &new_parent) const;
 
   virtual void AutoComplete(CommandInterpreter &interpreter,
 CompletionRequest &request);
@@ -306,6 +308,8 @@ class OptionValue {
 m_parent_wp = parent_sp;
   }
 
+  lldb::OptionValueSP GetParent() const { return m_parent_wp.lock(); }
+
   void SetValueChangedCallback(std::function callback) {
 assert(!m_callback);
 m_callback = std::move(callback);
@@ -317,6 +321,12 @@ class OptionValue {
   }
 
 protected:
+  using TopmostBase = OptionValue;
+
+  // Must be overriden by a derived class for correct downcasting the result of
+  // DeepCopy to it. Inherit f

[Lldb-commits] [lldb] 1d6a6f3 - [lldb/Target] Remove outdated code

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:27+03:00
New Revision: 1d6a6f3b0c710ccd6558644d195cf939c4995d84

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

LOG: [lldb/Target] Remove outdated code

Arg0 callback does work.

Added: 


Modified: 
lldb/include/lldb/Target/Target.h
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index f35f4e9a44f1..737efaf30882 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -211,7 +211,7 @@ class TargetProperties : public Properties {
 
   void SetDisplayRecognizedArguments(bool b);
 
-  const ProcessLaunchInfo &GetProcessLaunchInfo();
+  const ProcessLaunchInfo &GetProcessLaunchInfo() const;
 
   void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
 

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 6cf9d54c7751..98f63a81ea17 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -4196,8 +4196,7 @@ void TargetProperties::SetNonStopModeEnabled(bool b) {
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
 }
 
-const ProcessLaunchInfo &TargetProperties::GetProcessLaunchInfo() {
-  m_launch_info.SetArg0(GetArg0()); // FIXME: Arg0 callback doesn't work
+const ProcessLaunchInfo &TargetProperties::GetProcessLaunchInfo() const {
   return m_launch_info;
 }
 



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


[Lldb-commits] [lldb] c114352 - [lldb/test] Put hardware breakpoint tests together, NFC

2020-07-29 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-07-29T21:20:04+03:00
New Revision: c114352edfe0de69050bbf1cbbc478bcfb524622

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

LOG: [lldb/test] Put hardware breakpoint tests together, NFC

Create a common base class for them to re-use supports_hw_breakpoints function 
in decorators.

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

Added: 
lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/Makefile

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/main.c

Modified: 

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

Removed: 
lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/Makefile

lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/main.c



diff  --git 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py
new file mode 100644
index ..9593a72b3d40
--- /dev/null
+++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/base.py
@@ -0,0 +1,19 @@
+"""
+Base class for hardware breakpoints tests.
+"""
+
+from lldbsuite.test.lldbtest import *
+
+class HardwareBreakpointTestBase(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+
+def supports_hw_breakpoints(self):
+self.build()
+self.runCmd("file " + self.getBuildArtifact("a.out"),
+CURRENT_EXECUTABLE_SET)
+self.runCmd("breakpoint set -b main --hardware")
+self.runCmd("run")
+if 'stopped' in self.res.GetOutput():
+return 'Hardware breakpoints are supported'
+return None

diff  --git 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
index bca7b278631f..09db3ffd3ecd 100644
--- 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -9,15 +9,18 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-class HardwareBreakpointMultiThreadTestCase(TestBase):
-NO_DEBUG_INFO_TESTCASE = True
+from functionalities.breakpoint.hardware_breakpoints.base import *
 
+class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase):
 mydir = TestBase.compute_mydir(__file__)
 
+def does_not_support_hw_breakpoints(self):
+return not super().supports_hw_breakpoints()
+
 # LLDB on linux supports hardware breakpoints for arm and aarch64
 # architectures.
 @skipUnlessPlatform(oslist=['linux'])
-@skipIf(archs=no_match(['arm', 'aarch64']))
+@skipTestIfFn(does_not_support_hw_breakpoints)
 def test_hw_break_set_delete_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
@@ -26,7 +29,7 @@ def test_hw_break_set_delete_multi_thread_linux(self):
 # LLDB on linux supports hardware breakpoints for arm and aarch64
 # architectures.
 @skipUnlessPlatform(oslist=['linux'])
-@skipIf(archs=no_match(['arm', 'aarch64']))
+@skipTestIfFn(does_not_support_hw_breakpoints)
 def test_hw_break_set_disable_multi_thread_linux(self):
 self.build()
 self.setTearDownCleanup()
@@ -36,7 +39,7 @@ def test_hw_break_set_disable_multi_thread_linux(self):
 # architectures.
 @skipUnlessDarwin
 @skipIfOutOfTreeDebugserver
-@expectedFailureAll(archs=["arm64"])
+@skipTestIfFn(does_not_support_hw_breakpoints)
 def test_hw_break_set_delete_multi_thread_macos(self):
 self.build()
 self.setTearDownCleanup()
@@ -46,7 +49,7 @@ def test_hw_break_set_delete_multi_thread_macos(self):
 # architectures.
 @skipUnlessDarwin
 @skipIfOutOfTreeDebugserver
-@expectedFailureAll(archs=["arm64"])
+@skipTestIfFn(does_not_support_hw_breakpoints)
 def test_hw_break_set_disable_multi_thread_macos(self):
 self.build()
 self.setTearDownCleanup()

diff  --git 
a/lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/Makefile 
b/lldb/test/API/functionalities/breakpoint/hardwa

[Lldb-commits] [lldb] f7ec3e3 - [lldb] Skip overlapping hardware and external breakpoints when writing memory

2020-07-29 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-07-29T21:27:23+03:00
New Revision: f7ec3e3be70d10a630ac22c64073a845b168c829

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

LOG: [lldb] Skip overlapping hardware and external breakpoints when writing 
memory

This fixes the assertion `assert(intersects);` in the Process::WriteMemory 
function.

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

Added: 

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/Makefile

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/main.cpp

Modified: 
lldb/source/Breakpoint/BreakpointSite.cpp
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/BreakpointSite.cpp 
b/lldb/source/Breakpoint/BreakpointSite.cpp
index a33fd0a1c462..bdcabd7cce5e 100644
--- a/lldb/source/Breakpoint/BreakpointSite.cpp
+++ b/lldb/source/Breakpoint/BreakpointSite.cpp
@@ -167,40 +167,39 @@ bool BreakpointSite::IntersectsRange(lldb::addr_t addr, 
size_t size,
  lldb::addr_t *intersect_addr,
  size_t *intersect_size,
  size_t *opcode_offset) const {
-  // We only use software traps for software breakpoints
-  if (!IsHardware()) {
-if (m_byte_size > 0) {
-  const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
-  const lldb::addr_t end_addr = addr + size;
-  // Is the breakpoint end address before the passed in start address?
-  if (bp_end_addr <= addr)
-return false;
-  // Is the breakpoint start address after passed in end address?
-  if (end_addr <= m_addr)
-return false;
-  if (intersect_addr || intersect_size || opcode_offset) {
-if (m_addr < addr) {
-  if (intersect_addr)
-*intersect_addr = addr;
-  if (intersect_size)
-*intersect_size =
-std::min(bp_end_addr, end_addr) - addr;
-  if (opcode_offset)
-*opcode_offset = addr - m_addr;
-} else {
-  if (intersect_addr)
-*intersect_addr = m_addr;
-  if (intersect_size)
-*intersect_size =
-std::min(bp_end_addr, end_addr) - m_addr;
-  if (opcode_offset)
-*opcode_offset = 0;
-}
+  // The function should be called only for software breakpoints.
+  lldbassert(GetType() == Type::eSoftware);
+
+  if (m_byte_size > 0) {
+const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
+const lldb::addr_t end_addr = addr + size;
+// Is the breakpoint end address before the passed in start address?
+if (bp_end_addr <= addr)
+  return false;
+// Is the breakpoint start address after passed in end address?
+if (end_addr <= m_addr)
+  return false;
+if (intersect_addr || intersect_size || opcode_offset) {
+  if (m_addr < addr) {
+if (intersect_addr)
+  *intersect_addr = addr;
+if (intersect_size)
+  *intersect_size =
+  std::min(bp_end_addr, end_addr) - addr;
+if (opcode_offset)
+  *opcode_offset = addr - m_addr;
+  } else {
+if (intersect_addr)
+  *intersect_addr = m_addr;
+if (intersect_size)
+  *intersect_size =
+  std::min(bp_end_addr, end_addr) - m_addr;
+if (opcode_offset)
+  *opcode_offset = 0;
   }
-  return true;
 }
+return true;
   }
-  return false;
 }
 
 size_t

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 3776a90e546a..36a2930f7915 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2291,6 +2291,9 @@ size_t Process::WriteMemory(addr_t addr, const void *buf, 
size_t size,
 if (error.Fail())
   return;
 
+if (bp->GetType() != BreakpointSite::eSoftware)
+  return;
+
 addr_t intersect_addr;
 size_t intersect_size;
 size_t opcode_offset;

diff  --git 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/Makefile
 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/Makefile
new file mode 100644
index ..8b20bcb0
--- /dev/null
+++ 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py
 

[Lldb-commits] [lldb] b352e62 - [lldb] Make process plugins check whether a hardware breakpoint is required

2020-07-29 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-07-29T21:27:23+03:00
New Revision: b352e62feadd0aabaa7373b6fb40701f00a6aa91

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

LOG: [lldb] Make process plugins check whether a hardware breakpoint is required

Remove @skipIfWindows as process should report the error correctly on Windows 
now.

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

Added: 


Modified: 
lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py

Removed: 




diff  --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp 
b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
index a44080640f6c..f1a424ccbca5 100644
--- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -683,6 +683,9 @@ 
ProcessFreeBSD::GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site) {
 }
 
 Status ProcessFreeBSD::EnableBreakpointSite(BreakpointSite *bp_site) {
+  if (bp_site->HardwareRequired())
+return Status("Hardware breakpoints are not supported.");
+
   return EnableSoftwareBreakpoint(bp_site);
 }
 

diff  --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp 
b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index dde25184a8c5..6e394eac6f9e 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -644,6 +644,9 @@ Status ProcessKDP::DoDeallocateMemory(lldb::addr_t addr) {
 }
 
 Status ProcessKDP::EnableBreakpointSite(BreakpointSite *bp_site) {
+  if (bp_site->HardwareRequired())
+return Status("Hardware breakpoints are not supported.");
+
   if (m_comm.LocalBreakpointsAreSupported()) {
 Status error;
 if (!bp_site->IsEnabled()) {

diff  --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 7b020f55e993..96e2603b993e 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -150,6 +150,9 @@ lldb_private::ConstString ProcessWindows::GetPluginName() {
 uint32_t ProcessWindows::GetPluginVersion() { return 1; }
 
 Status ProcessWindows::EnableBreakpointSite(BreakpointSite *bp_site) {
+  if (bp_site->HardwareRequired())
+return Status("Hardware breakpoints are not supported.");
+
   Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_BREAKPOINTS);
   LLDB_LOG(log, "bp_site = {0:x}, id={1}, addr={2:x}", bp_site,
bp_site->GetID(), bp_site->GetLoadAddress());

diff  --git 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
index c97795f7ae67..dfb946036aa2 100644
--- 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
+++ 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/require_hw_breakpoints/TestRequireHWBreakpoints.py
@@ -27,7 +27,6 @@ def test_breakpoint(self):
 breakpoint = target.BreakpointCreateByLocation("main.c", 1)
 self.assertTrue(breakpoint.IsHardware())
 
-@skipIfWindows
 @expectedFailure(supports_hw_breakpoints)
 def test_step_range(self):
 """Test stepping when hardware breakpoints are required."""
@@ -49,7 +48,6 @@ def test_step_range(self):
 self.assertTrue("Could not create hardware breakpoint for thread plan"
 in error.GetCString())
 
-@skipIfWindows
 @expectedFailure(supports_hw_breakpoints)
 def test_step_out(self):
 """Test stepping out when hardware breakpoints are required."""
@@ -70,7 +68,6 @@ def test_step_out(self):
 self.assertTrue("Could not create hardware breakpoint for thread plan"
 in error.GetCString())
 
-@skipIfWindows
 @expectedFailure(supports_hw_breakpoints)
 def test_step_over(self):
 """Test stepping over when hardware breakpoints are required."""
@@ -89,7 +86,6 @@ def test_step_over(self):
 'error: Could not create hardware breakpoint for thread plan.'
 ])
 
-@skipIfWindows
 @expectedFailure(supports_hw_breakpoints)
 def test_step_until(self):
 """Test stepping until when hardware breakpoints are required."""



___
lldb-commits mailing list
ll

[Lldb-commits] [lldb] ebaa8b1 - [lldb] Don't use hardware index to determine whether a breakpoint site is hardware

2020-07-29 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-07-29T21:27:24+03:00
New Revision: ebaa8b1c60749883c6449a7c16096f1c40ccf4bc

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

LOG: [lldb] Don't use hardware index to determine whether a breakpoint site is 
hardware

Most process plugins (if not all) don't set hardware index for breakpoints. 
They even
are not able to determine this index.

This patch makes StoppointLocation::IsHardware pure virtual and lets 
BreakpointSite
override it using more accurate BreakpointSite::Type.

It also adds assertions to be sure that a breakpoint site is hardware when this 
is required.

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

Added: 


Modified: 
lldb/include/lldb/Breakpoint/BreakpointLocation.h
lldb/include/lldb/Breakpoint/BreakpointSite.h
lldb/include/lldb/Breakpoint/StoppointLocation.h
lldb/source/Breakpoint/BreakpointLocation.cpp
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index 3fc571eaa292..04b2b8906899 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -76,6 +76,12 @@ class BreakpointLocation
   /// \b true if the breakpoint is enabled, \b false if disabled.
   bool IsEnabled() const;
 
+  /// Check if it is a hardware breakpoint.
+  ///
+  /// \return
+  /// \b true if the breakpoint is a harware breakpoint.
+  bool IsHardware() const override;
+
   /// If \a auto_continue is \b true, set the breakpoint to continue when hit.
   void SetAutoContinue(bool auto_continue);
 

diff  --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h 
b/lldb/include/lldb/Breakpoint/BreakpointSite.h
index 5ce17f511db4..6ddab5dc1460 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSite.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h
@@ -15,6 +15,7 @@
 
 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
 #include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-forward.h"
 
@@ -184,6 +185,12 @@ class BreakpointSite : public 
std::enable_shared_from_this,
   /// \b false otherwise.
   bool IsInternal() const;
 
+  bool IsHardware() const override {
+lldbassert(BreakpointSite::Type::eHardware == GetType() ||
+   !HardwareRequired());
+return BreakpointSite::Type::eHardware == GetType();
+  }
+
   BreakpointSite::Type GetType() const { return m_type; }
 
   void SetType(BreakpointSite::Type type) { m_type = type; }

diff  --git a/lldb/include/lldb/Breakpoint/StoppointLocation.h 
b/lldb/include/lldb/Breakpoint/StoppointLocation.h
index 4d6ca044ccc4..4392c7b84f9e 100644
--- a/lldb/include/lldb/Breakpoint/StoppointLocation.h
+++ b/lldb/include/lldb/Breakpoint/StoppointLocation.h
@@ -40,9 +40,7 @@ class StoppointLocation {
 
   bool HardwareRequired() const { return m_hardware; }
 
-  virtual bool IsHardware() const {
-return m_hardware_index != LLDB_INVALID_INDEX32;
-  }
+  virtual bool IsHardware() const = 0;
 
   virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
 

diff  --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 93d54c051ee5..eae1c1e033ad 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -68,6 +68,14 @@ Breakpoint &BreakpointLocation::GetBreakpoint() { return 
m_owner; }
 
 Target &BreakpointLocation::GetTarget() { return m_owner.GetTarget(); }
 
+bool BreakpointLocation::IsHardware() const {
+  if (m_bp_site_sp)
+return m_bp_site_sp->IsHardware();
+
+  // If breakpoint location is not resolved yet, it cannot be hardware.
+  return false;
+}
+
 bool BreakpointLocation::IsEnabled() const {
   if (!m_owner.IsEnabled())
 return false;

diff  --git a/lldb/source/Breakpoint/Watchpoint.cpp 
b/lldb/source/Breakpoint/Watchpoint.cpp
index df73c6a17230..481c7b7eba8c 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -95,7 +95,10 @@ void Watchpoint::SetWatchSpec(const std::string &str) {
 
 // Override default impl of StoppointLocation::IsHardware() since m_is_hardware
 // member field is more accurate.
-bool Watchpoint::IsHardware() const { return m_is_hardware; }
+bool Watchpoint::IsHardware() const {
+  lldbassert(m_is_hardware || !HardwareRequired());
+  return m_is_hardware;
+}
 
 bool Watchpoint::IsWatchVariable() const { r

[Lldb-commits] [lldb] d5c1f68 - [lldb/BreakpointSite] Handle all ways of control flow

2020-07-29 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-07-29T21:53:18+03:00
New Revision: d5c1f686e34fdd9ed8ec9b7a195799baf492e854

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

LOG: [lldb/BreakpointSite] Handle all ways of control flow

Added: 


Modified: 
lldb/source/Breakpoint/BreakpointSite.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/BreakpointSite.cpp 
b/lldb/source/Breakpoint/BreakpointSite.cpp
index bdcabd7cce5e..faa7e4c261e7 100644
--- a/lldb/source/Breakpoint/BreakpointSite.cpp
+++ b/lldb/source/Breakpoint/BreakpointSite.cpp
@@ -170,36 +170,39 @@ bool BreakpointSite::IntersectsRange(lldb::addr_t addr, 
size_t size,
   // The function should be called only for software breakpoints.
   lldbassert(GetType() == Type::eSoftware);
 
-  if (m_byte_size > 0) {
-const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
-const lldb::addr_t end_addr = addr + size;
-// Is the breakpoint end address before the passed in start address?
-if (bp_end_addr <= addr)
-  return false;
-// Is the breakpoint start address after passed in end address?
-if (end_addr <= m_addr)
-  return false;
-if (intersect_addr || intersect_size || opcode_offset) {
-  if (m_addr < addr) {
-if (intersect_addr)
-  *intersect_addr = addr;
-if (intersect_size)
-  *intersect_size =
-  std::min(bp_end_addr, end_addr) - addr;
-if (opcode_offset)
-  *opcode_offset = addr - m_addr;
-  } else {
-if (intersect_addr)
-  *intersect_addr = m_addr;
-if (intersect_size)
-  *intersect_size =
-  std::min(bp_end_addr, end_addr) - m_addr;
-if (opcode_offset)
-  *opcode_offset = 0;
-  }
+  if (m_byte_size == 0)
+return false;
+
+  const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
+  const lldb::addr_t end_addr = addr + size;
+  // Is the breakpoint end address before the passed in start address?
+  if (bp_end_addr <= addr)
+return false;
+
+  // Is the breakpoint start address after passed in end address?
+  if (end_addr <= m_addr)
+return false;
+
+  if (intersect_addr || intersect_size || opcode_offset) {
+if (m_addr < addr) {
+  if (intersect_addr)
+*intersect_addr = addr;
+  if (intersect_size)
+*intersect_size =
+std::min(bp_end_addr, end_addr) - addr;
+  if (opcode_offset)
+*opcode_offset = addr - m_addr;
+} else {
+  if (intersect_addr)
+*intersect_addr = m_addr;
+  if (intersect_size)
+*intersect_size =
+std::min(bp_end_addr, end_addr) - m_addr;
+  if (opcode_offset)
+*opcode_offset = 0;
 }
-return true;
   }
+  return true;
 }
 
 size_t



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


[Lldb-commits] [lldb] da0bba5 - [lldb/Breakpoint] Rename StoppointLocation to StoppointSite and drop its relationship with BreakpointLocation

2020-07-29 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-07-29T22:07:46+03:00
New Revision: da0bba5c9abb161ff824cf450537cf2ccf50d457

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

LOG: [lldb/Breakpoint] Rename StoppointLocation to StoppointSite and drop its 
relationship with BreakpointLocation

Both of BreakpointLocation and BreakpointSite were inherited from 
StoppointLocation. However, the only thing
they shared was hit counting logic. The patch encapsulates those logic into 
StoppointHitCounter, renames
StoppointLocation to StoppointSite, and stops BreakpointLocation's inheriting 
from it.

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

Added: 
lldb/include/lldb/Breakpoint/StoppointHitCounter.h
lldb/include/lldb/Breakpoint/StoppointSite.h
lldb/source/Breakpoint/StoppointSite.cpp

Modified: 
lldb/include/lldb/Breakpoint/Breakpoint.h
lldb/include/lldb/Breakpoint/BreakpointLocation.h
lldb/include/lldb/Breakpoint/BreakpointSite.h
lldb/include/lldb/Breakpoint/Watchpoint.h
lldb/include/lldb/lldb-forward.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Breakpoint/BreakpointLocation.cpp
lldb/source/Breakpoint/BreakpointSite.cpp
lldb/source/Breakpoint/CMakeLists.txt
lldb/source/Breakpoint/Watchpoint.cpp

Removed: 
lldb/include/lldb/Breakpoint/StoppointLocation.h
lldb/source/Breakpoint/StoppointLocation.cpp



diff  --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index d29d21070fd7..5d3e596c474b 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -20,6 +20,7 @@
 #include "lldb/Breakpoint/BreakpointName.h"
 #include "lldb/Breakpoint/BreakpointOptions.h"
 #include "lldb/Breakpoint/Stoppoint.h"
+#include "lldb/Breakpoint/StoppointHitCounter.h"
 #include "lldb/Core/SearchFilter.h"
 #include "lldb/Utility/Event.h"
 #include "lldb/Utility/StringList.h"
@@ -624,13 +625,6 @@ class Breakpoint : public 
std::enable_shared_from_this,
 
   bool IgnoreCountShouldStop();
 
-  void IncrementHitCount() { m_hit_count++; }
-
-  void DecrementHitCount() {
-assert(m_hit_count > 0);
-m_hit_count--;
-  }
-
 private:
   // To call from CopyFromBreakpoint.
   Breakpoint(Target &new_target, const Breakpoint &bp_to_copy_from);
@@ -660,10 +654,12 @@ class Breakpoint : public 
std::enable_shared_from_this,
   m_locations; // The list of locations currently found for this 
breakpoint.
   std::string m_kind_description;
   bool m_resolve_indirect_symbols;
-  uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been
-// hit.  This is kept
-  // separately from the locations hit counts, since locations can go away when
-  // their backing library gets unloaded, and we would lose hit counts.
+
+  /// Number of times this breakpoint has been hit. This is kept separately
+  /// from the locations hit counts, since locations can go away when their
+  /// backing library gets unloaded, and we would lose hit counts.
+  StoppointHitCounter m_hit_counter;
+
   BreakpointName::Permissions m_permissions;
 
   void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);

diff  --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index 04b2b8906899..4e1c57a40435 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -13,7 +13,7 @@
 #include 
 
 #include "lldb/Breakpoint/BreakpointOptions.h"
-#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Breakpoint/StoppointHitCounter.h"
 #include "lldb/Core/Address.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
@@ -35,15 +35,14 @@ namespace lldb_private {
 /// be useful if you've set options on the locations.
 
 class BreakpointLocation
-: public std::enable_shared_from_this,
-  public StoppointLocation {
+: public std::enable_shared_from_this {
 public:
-  ~BreakpointLocation() override;
+  ~BreakpointLocation();
 
   /// Gets the load address for this breakpoint location \return
   /// Returns breakpoint location load address, \b
   /// LLDB_INVALID_ADDRESS if not yet set.
-  lldb::addr_t GetLoadAddress() const override;
+  lldb::addr_t GetLoadAddress() const;
 
   /// Gets the Address for this breakpoint location \return
   /// Returns breakpoint location Address.
@@ -63,7 +62,7 @@ class BreakpointLocation
   /// \return
   /// \b true if this breakpoint location thinks we should stop,
   /// \b false otherwise.
-  bool ShouldStop(StoppointCallbackContext *context) override;
+  bool ShouldStop(StoppointCallbackContext *context);
 
   // The next section deals with various breakpoint options.
 

[Lldb-commits] [lldb] e97c693 - [lldb/Process/Windows] Attempting to kill exited/detached process in not an error

2020-08-03 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-08-03T12:52:43+03:00
New Revision: e97c693bb0ece2d9a2b0db75034927405fe3bfdf

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

LOG: [lldb/Process/Windows] Attempting to kill exited/detached process in not 
an error

The lldb test-suite on Windows reports a 'CLEANUP ERROR' when attempting to kill
an exited/detached process. This change makes ProcessWindows consistent with
the other processes which only log the error. After this change a number of
'CLEANUP ERROR' messages are now removed.

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

Added: 


Modified: 
lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp 
b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
index 8a85c8ba6f4e..07a81cdf69cc 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
@@ -227,22 +227,20 @@ Status ProcessDebugger::DestroyProcess(const 
lldb::StateType state) {
 debugger_thread = m_session_data->m_debugger;
   }
 
-  Status error;
-  if (state != eStateExited && state != eStateDetached) {
-LLDB_LOG(
-log, "Shutting down process {0}.",
-debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
-error = debugger_thread->StopDebugging(true);
-
-// By the time StopDebugging returns, there is no more debugger thread, so
-// we can be assured that no other thread will race for the session data.
-m_session_data.reset();
-  } else {
-error.SetErrorStringWithFormat("cannot destroy process %" PRIx64
-   " while state = %d",
-   GetDebuggedProcessId(), state);
-LLDB_LOG(log, "error: {0}", error);
+  if (state == eStateExited || state == eStateDetached) {
+LLDB_LOG(log, "warning: cannot destroy process {0} while state = {1}.",
+ GetDebuggedProcessId(), state);
+return Status();
   }
+
+  LLDB_LOG(log, "Shutting down process {0}.",
+   debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
+  auto error = debugger_thread->StopDebugging(true);
+
+  // By the time StopDebugging returns, there is no more debugger thread, so
+  // we can be assured that no other thread will race for the session data.
+  m_session_data.reset();
+
   return error;
 }
 



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


  1   2   >