[Lldb-commits] [PATCH] D104406: Express PathMappingList::FindFile() in terms of PathMappingList.h::RemapPath() (NFC)

2021-06-25 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

Looks good but would rather a second eye on this.


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

https://reviews.llvm.org/D104406

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


[Lldb-commits] [PATCH] D104405: Change PathMappingList::FindFile to return an optional result (NFC)

2021-06-25 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: lldb/source/Core/SourceManager.cpp:444
   if (!FileSystem::Instance().Exists(m_file_spec)) {
-FileSpec new_file_spec;
 // Check target specific source remappings first, then fall back to
 // modules objects can have individual path remappings that were

This whole comment reads awkward and does not totally make sense and ends with 
`. then`



Comment at: lldb/source/Target/PathMappingList.cpp:231
 if (orig_ref.consume_front(prefix_ref)) {
   new_spec.SetFile(entry.second.GetCString(), FileSpec::Style::native);
   new_spec.AppendPathComponent(orig_ref);

Make sense to move `FileSpec new_spec;` declaration down to here.


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

https://reviews.llvm.org/D104405

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


[Lldb-commits] [PATCH] D104951: [lldb] Use the non-locking variant of objc_copyRealizedClassList

2021-06-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGffc053385587: [lldb] Use the non-locking variant of 
objc_copyRealizedClassList (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104951

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


Index: 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -172,7 +172,7 @@
 extern "C" {
 int printf(const char * format, ...);
 void free(void *ptr);
-Class* objc_copyRealizedClassList(unsigned int *outCount);
+Class* objc_copyRealizedClassList_nolock(unsigned int *outCount);
 const char* objc_debug_class_getNameRaw(Class cls);
 }
 
@@ -199,7 +199,7 @@
 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
 
 uint32_t count = 0;
-Class* realized_class_list = objc_copyRealizedClassList();
+Class* realized_class_list = objc_copyRealizedClassList_nolock();
 DEBUG_PRINTF ("count = %u\n", count);
 
 uint32_t idx = 0;
@@ -668,7 +668,7 @@
   static const ConstString g_gdb_object_getClass("gdb_object_getClass");
   m_has_object_getClass = HasSymbol(g_gdb_object_getClass);
   static const ConstString g_objc_copyRealizedClassList(
-  "objc_copyRealizedClassList");
+  "objc_copyRealizedClassList_nolock");
   m_has_objc_copyRealizedClassList = HasSymbol(g_objc_copyRealizedClassList);
 
   RegisterObjCExceptionRecognizer(process);


Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -172,7 +172,7 @@
 extern "C" {
 int printf(const char * format, ...);
 void free(void *ptr);
-Class* objc_copyRealizedClassList(unsigned int *outCount);
+Class* objc_copyRealizedClassList_nolock(unsigned int *outCount);
 const char* objc_debug_class_getNameRaw(Class cls);
 }
 
@@ -199,7 +199,7 @@
 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
 
 uint32_t count = 0;
-Class* realized_class_list = objc_copyRealizedClassList();
+Class* realized_class_list = objc_copyRealizedClassList_nolock();
 DEBUG_PRINTF ("count = %u\n", count);
 
 uint32_t idx = 0;
@@ -668,7 +668,7 @@
   static const ConstString g_gdb_object_getClass("gdb_object_getClass");
   m_has_object_getClass = HasSymbol(g_gdb_object_getClass);
   static const ConstString g_objc_copyRealizedClassList(
-  "objc_copyRealizedClassList");
+  "objc_copyRealizedClassList_nolock");
   m_has_objc_copyRealizedClassList = HasSymbol(g_objc_copyRealizedClassList);
 
   RegisterObjCExceptionRecognizer(process);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ffc0533 - [lldb] Use the non-locking variant of objc_copyRealizedClassList

2021-06-25 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-06-25T15:02:49-07:00
New Revision: ffc0533855871f4c784f6535044ce7c2bd076392

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

LOG: [lldb] Use the non-locking variant of objc_copyRealizedClassList

Avoid standing the Objective-C runtime lock by calling
objc_copyRealizedClassList_nolock instead of objc_copyRealizedClassList.

We already guarantee that no other threads can run while we're running
this utility expression, similar to when we parse the data ourselves
from the gdb_objc_realized_classes struct.

Worst case this will crash if the list is getting edited, which won't do
any harm and we'll just try again later.

Differential revision: https://reviews.llvm.org/D104951

Added: 


Modified: 

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

Removed: 




diff  --git 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 069368c8e058..a3a0827cfe65 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -172,7 +172,7 @@ static const char *g_get_dynamic_class_info2_body = R"(
 extern "C" {
 int printf(const char * format, ...);
 void free(void *ptr);
-Class* objc_copyRealizedClassList(unsigned int *outCount);
+Class* objc_copyRealizedClassList_nolock(unsigned int *outCount);
 const char* objc_debug_class_getNameRaw(Class cls);
 }
 
@@ -199,7 +199,7 @@ __lldb_apple_objc_v2_get_dynamic_class_info2(void 
*gdb_objc_realized_classes_ptr
 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
 
 uint32_t count = 0;
-Class* realized_class_list = objc_copyRealizedClassList();
+Class* realized_class_list = objc_copyRealizedClassList_nolock();
 DEBUG_PRINTF ("count = %u\n", count);
 
 uint32_t idx = 0;
@@ -668,7 +668,7 @@ AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process,
   static const ConstString g_gdb_object_getClass("gdb_object_getClass");
   m_has_object_getClass = HasSymbol(g_gdb_object_getClass);
   static const ConstString g_objc_copyRealizedClassList(
-  "objc_copyRealizedClassList");
+  "objc_copyRealizedClassList_nolock");
   m_has_objc_copyRealizedClassList = HasSymbol(g_objc_copyRealizedClassList);
 
   RegisterObjCExceptionRecognizer(process);



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


[Lldb-commits] [lldb] 4eabb12 - Add support for the NSMutableDictionary variant: "__NSFrozenDictionaryM"

2021-06-25 Thread Jim Ingham via lldb-commits

Author: Jim Ingham
Date: 2021-06-25T14:59:26-07:00
New Revision: 4eabb12057616f360b2329f63c0379eced3135b4

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

LOG: Add support for the NSMutableDictionary variant: "__NSFrozenDictionaryM"

This was an oversight of the commit: bb93483c119b92c1ec2b7a58505e21b9dce6a333 
that
added support for the Frozen variants.  Also added a test case for the way that
currently produces one of these variants (a copy).

Added: 


Modified: 
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m

Removed: 




diff  --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp 
b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
index afb9c6951f55..326f47a10660 100644
--- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -410,6 +410,7 @@ bool lldb_private::formatters::NSDictionarySummaryProvider(
   static const ConstString g_DictionaryM("__NSDictionaryM");
   static const ConstString g_DictionaryMLegacy("__NSDictionaryM_Legacy");
   static const ConstString g_DictionaryMImmutable("__NSDictionaryM_Immutable");
+  static const ConstString g_DictionaryMFrozen("__NSFrozenDictionaryM");
   static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
   static const ConstString g_Dictionary0("__NSDictionary0");
   static const ConstString g_DictionaryCF("__CFDictionary");
@@ -427,7 +428,8 @@ bool lldb_private::formatters::NSDictionarySummaryProvider(
   return false;
 
 value &= (is_64bit ? ~0xFC00UL : ~0xFC00U);
-  } else if (class_name == g_DictionaryM || class_name == g_DictionaryMLegacy) 
{
+  } else if (class_name == g_DictionaryM || class_name == g_DictionaryMLegacy 
+ || class_name == g_DictionaryMFrozen) {
 AppleObjCRuntime *apple_runtime =
 llvm::dyn_cast_or_null(runtime);
 Status error;
@@ -509,6 +511,7 @@ 
lldb_private::formatters::NSDictionarySyntheticFrontEndCreator(
   static const ConstString g_DictionaryM("__NSDictionaryM");
   static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
   static const ConstString g_DictionaryImmutable("__NSDictionaryM_Immutable");
+  static const ConstString g_DictionaryMFrozen("__NSFrozenDictionaryM");
   static const ConstString g_DictionaryMLegacy("__NSDictionaryM_Legacy");
   static const ConstString g_Dictionary0("__NSDictionary0");
   static const ConstString g_DictionaryCF("__CFDictionary");
@@ -520,7 +523,7 @@ 
lldb_private::formatters::NSDictionarySyntheticFrontEndCreator(
 
   if (class_name == g_DictionaryI) {
 return (new NSDictionaryISyntheticFrontEnd(valobj_sp));
-  } else if (class_name == g_DictionaryM) {
+  } else if (class_name == g_DictionaryM || class_name == g_DictionaryMFrozen) 
{
 if (runtime->GetFoundationVersion() >= 1437) {
   return (new Foundation1437::NSDictionaryMSyntheticFrontEnd(valobj_sp));
 } else if (runtime->GetFoundationVersion() >= 1428) {

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
index 0ad475d7436d..26ebf28929ff 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
@@ -20,7 +20,7 @@ def test_nscontainers_with_run_command(self):
 
 def nscontainers_data_formatter_commands(self):
 self.expect(
-'frame variable newArray nsDictionary newDictionary nscfDictionary 
cfDictionaryRef newMutableDictionary newMutableDictionaryRef cfarray_ref 
mutable_array_ref',
+'frame variable newArray nsDictionary newDictionary nscfDictionary 
cfDictionaryRef newMutableDictionary copyDictionary newMutableDictionaryRef 
cfarray_ref mutable_array_ref',
 substrs=[
 '(NSArray *) newArray = ',
 ' @"50 elements"',
@@ -34,6 +34,8 @@ def nscontainers_data_formatter_commands(self):
 ' 2 key/value pairs',
 '(NSDictionary *) newMutableDictionary = ',
 ' 21 key/value pairs',
+'(NSMutableDictionary *) copyDictionary = ',
+' 21 key/value pairs',
 '(CFMutableDictionaryRef) newMutableDictionaryRef = ',
 ' 21 key/value pairs',
 '(CFArrayRef) cfarray_ref = ',
@@ -42,6 +44,9 @@ def nscontainers_data_formatter_commands(self):
 ' @"11 

[Lldb-commits] [PATCH] D104954: Implement AddSymbols method for SymbolFileNativePDB

2021-06-25 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth requested review of this revision.

In theory, this adds symbols from the module's PDB file to the symtab.  This 
implementation was modeled after the one in SymbolFilePDB, so it relies on the 
same IPDBSession abstraction as the DIA-based PDB reader. 
 Unfortunately, the native reader implementation of that interface was not 
fully implemented, so the attempt to find the public symbols comes up empty.  
The result is that this patch has no functional change (and thus there are no 
meaningful tests to write).

  

I am currently investigating whether to implement the abstraction or to use the 
lower level native PDB reader interface directly in SymbolFileNativePDB.


https://reviews.llvm.org/D104954

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


Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -48,6 +48,8 @@
 #include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
 #include "llvm/DebugInfo/PDB/Native/TpiStream.h"
 #include "llvm/DebugInfo/PDB/PDB.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
 #include "llvm/Demangle/MicrosoftDemangle.h"
 #include "llvm/Object/COFF.h"
@@ -307,8 +309,8 @@
   auto ts_or_err = m_objfile_sp->GetModule()->GetTypeSystemForLanguage(
   lldb::eLanguageTypeC_plus_plus);
   if (auto err = ts_or_err.takeError()) {
-LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
-   std::move(err), "Failed to initialize");
+Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
+LLDB_LOG_ERROR(log, std::move(err), "Failed to initialize");
   } else {
 ts_or_err->SetSymbolFile(this);
 auto *clang = llvm::cast_or_null(_or_err.get());
@@ -905,7 +907,63 @@
   return TranslateLanguage(item->m_compile_opts->getLanguage());
 }
 
-void SymbolFileNativePDB::AddSymbols(Symtab ) { return; }
+void SymbolFileNativePDB::AddSymbols(Symtab ) {
+  // Currently, we can handle only one symbol for any given address, so we'll
+  // use a `std::set` to keep track of known addresses.
+  std::set sym_addresses;
+  for (size_t i = 0; i < symtab.GetNumSymbols(); i++) {
+sym_addresses.insert(symtab.SymbolAtIndex(i)->GetFileAddress());
+  }
+
+  std::unique_ptr session_up;
+  auto error = llvm::pdb::loadDataForPDB(PDB_ReaderType::Native,
+  GetPDBFile().getFilePath(), session_up);
+  if (error) return;
+  NativeSession *native_session = static_cast(session_up.get());
+  auto global_scope_up = native_session->getGlobalScope();
+
+  auto results = global_scope_up->findAllChildren();
+  if (!results)
+return;
+
+  auto section_list = m_objfile_sp->GetSectionList();
+  if (!section_list)
+return;
+
+  while (auto pub_symbol = results->getNext()) {
+auto section_id = pub_symbol->getAddressSection();
+
+auto section = section_list->FindSectionByID(section_id);
+if (!section)
+  continue;
+
+auto offset = pub_symbol->getAddressOffset();
+
+auto file_addr = section->GetFileAddress() + offset;
+if (sym_addresses.find(file_addr) != sym_addresses.end())
+  continue;
+sym_addresses.insert(file_addr);
+
+auto size = pub_symbol->getLength();
+symtab.AddSymbol(
+Symbol(pub_symbol->getSymIndexId(),
+   pub_symbol->getName().c_str(),
+   pub_symbol->isCode() ? eSymbolTypeCode : eSymbolTypeData,
+   /* external */ true,
+   /* is_debug */ false,
+   /* is_trampoline */ false,
+   /* is_artificial */ false,
+   section,
+   offset,
+   size,
+   /* size_is_valid */ size != 0,
+   /* contains_linker_annotations */ false,
+   /* flags */ 0));
+  }
+
+  symtab.CalculateSymbolSizes();
+  symtab.Finalize();
+}
 
 size_t SymbolFileNativePDB::ParseFunctions(CompileUnit _unit) {
   std::lock_guard guard(GetModuleMutex());


Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -48,6 +48,8 @@
 #include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
 #include "llvm/DebugInfo/PDB/Native/TpiStream.h"
 #include "llvm/DebugInfo/PDB/PDB.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
 #include "llvm/Demangle/MicrosoftDemangle.h"
 #include "llvm/Object/COFF.h"
@@ -307,8 +309,8 @@
   auto ts_or_err = 

[Lldb-commits] [PATCH] D104724: Modernize Module::RemapFile to return an Optional

2021-06-25 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D104724

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


[Lldb-commits] [PATCH] D104951: [lldb] Use the non-locking variant of objc_copyRealizedClassList

2021-06-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

That seems fine to me.  We already only allow one thread to run when we make 
this call, and copyRealizedClassList is read only, so at worst this will crash 
if the list is getting edited, but it won't do any harm and we'll just try 
again later.  That's a much better failure mode than potentially stranding the 
ObjC runtime lock.


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

https://reviews.llvm.org/D104951

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


[Lldb-commits] [PATCH] D104405: Change PathMappingList::FindFile to return an optional result (NFC)

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Ping.


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

https://reviews.llvm.org/D104405

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


[Lldb-commits] [PATCH] D104404: Change PathMappingList::RemapPath to return an optional result (NFC)

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4cf7c6c6a44d: Change PathMappingList::RemapPath to return an 
optional result (NFC) (authored by aprantl).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D104404?vs=352486=354604#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104404

Files:
  lldb/include/lldb/Target/PathMappingList.h
  lldb/source/Core/Module.cpp
  lldb/source/Target/PathMappingList.cpp


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -145,18 +145,17 @@
 
 bool PathMappingList::RemapPath(ConstString path,
 ConstString _path) const {
-  std::string remapped;
-  if (RemapPath(path.GetStringRef(), remapped)) {
-new_path.SetString(remapped);
+  if (llvm::Optional remapped = RemapPath(path.GetStringRef())) {
+new_path.SetString(remapped->GetPath());
 return true;
   }
   return false;
 }
 
-bool PathMappingList::RemapPath(llvm::StringRef path,
-std::string _path) const {
+llvm::Optional
+PathMappingList::RemapPath(llvm::StringRef path) const {
   if (m_pairs.empty() || path.empty())
-return false;
+return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
   for (const auto  : m_pairs) {
 auto prefix = it.first.GetStringRef();
@@ -177,10 +176,9 @@
 }
 FileSpec remapped(it.second.GetStringRef());
 remapped.AppendPathComponent(path);
-new_path = remapped.GetPath();
-return true;
+return remapped;
   }
-  return false;
+  return {};
 }
 
 bool PathMappingList::ReverseRemapPath(const FileSpec , FileSpec ) 
const {
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1604,7 +1604,11 @@
 bool Module::RemapSourceFile(llvm::StringRef path,
  std::string _path) const {
   std::lock_guard guard(m_mutex);
-  return m_source_mappings.RemapPath(path, new_path);
+  if (auto remapped = m_source_mappings.RemapPath(path)) {
+new_path = remapped->GetPath();
+return true;
+  }
+  return false;
 }
 
 void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef 
sysroot) {
Index: lldb/include/lldb/Target/PathMappingList.h
===
--- lldb/include/lldb/Target/PathMappingList.h
+++ lldb/include/lldb/Target/PathMappingList.h
@@ -72,13 +72,9 @@
   /// \param[in] path
   /// The original source file path to try and remap.
   ///
-  /// \param[out] new_path
-  /// The newly remapped filespec that is may or may not exist.
-  ///
   /// \return
-  /// /b true if \a path was successfully located and \a new_path
-  /// is filled in with a new source path, \b false otherwise.
-  bool RemapPath(llvm::StringRef path, std::string _path) const;
+  /// The remapped filespec that may or may not exist on disk.
+  llvm::Optional RemapPath(llvm::StringRef path) const;
   bool RemapPath(const char *, std::string &) const = delete;
 
   bool ReverseRemapPath(const FileSpec , FileSpec ) const;


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -145,18 +145,17 @@
 
 bool PathMappingList::RemapPath(ConstString path,
 ConstString _path) const {
-  std::string remapped;
-  if (RemapPath(path.GetStringRef(), remapped)) {
-new_path.SetString(remapped);
+  if (llvm::Optional remapped = RemapPath(path.GetStringRef())) {
+new_path.SetString(remapped->GetPath());
 return true;
   }
   return false;
 }
 
-bool PathMappingList::RemapPath(llvm::StringRef path,
-std::string _path) const {
+llvm::Optional
+PathMappingList::RemapPath(llvm::StringRef path) const {
   if (m_pairs.empty() || path.empty())
-return false;
+return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
   for (const auto  : m_pairs) {
 auto prefix = it.first.GetStringRef();
@@ -177,10 +176,9 @@
 }
 FileSpec remapped(it.second.GetStringRef());
 remapped.AppendPathComponent(path);
-new_path = remapped.GetPath();
-return true;
+return remapped;
   }
-  return false;
+  return {};
 }
 
 bool PathMappingList::ReverseRemapPath(const FileSpec , FileSpec ) const {
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1604,7 +1604,11 @@
 bool Module::RemapSourceFile(llvm::StringRef 

[Lldb-commits] [lldb] 4cf7c6c - Change PathMappingList::RemapPath to return an optional result (NFC)

2021-06-25 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-06-25T14:15:29-07:00
New Revision: 4cf7c6c6a44dba6d7f3c13059f966412df89fe75

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

LOG: Change PathMappingList::RemapPath to return an optional result (NFC)

This is an NFC modernization refactoring that replaces the combination
of a bool return + reference argument, with an Optional return value.

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

Added: 


Modified: 
lldb/include/lldb/Target/PathMappingList.h
lldb/source/Core/Module.cpp
lldb/source/Target/PathMappingList.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/PathMappingList.h 
b/lldb/include/lldb/Target/PathMappingList.h
index bfc4da69ec0f..5d8e2a1b4d24 100644
--- a/lldb/include/lldb/Target/PathMappingList.h
+++ b/lldb/include/lldb/Target/PathMappingList.h
@@ -72,13 +72,9 @@ class PathMappingList {
   /// \param[in] path
   /// The original source file path to try and remap.
   ///
-  /// \param[out] new_path
-  /// The newly remapped filespec that is may or may not exist.
-  ///
   /// \return
-  /// /b true if \a path was successfully located and \a new_path
-  /// is filled in with a new source path, \b false otherwise.
-  bool RemapPath(llvm::StringRef path, std::string _path) const;
+  /// The remapped filespec that may or may not exist on disk.
+  llvm::Optional RemapPath(llvm::StringRef path) const;
   bool RemapPath(const char *, std::string &) const = delete;
 
   bool ReverseRemapPath(const FileSpec , FileSpec ) const;

diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 2e8163af12c4..6502518f9247 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1604,7 +1604,11 @@ bool Module::FindSourceFile(const FileSpec _spec,
 bool Module::RemapSourceFile(llvm::StringRef path,
  std::string _path) const {
   std::lock_guard guard(m_mutex);
-  return m_source_mappings.RemapPath(path, new_path);
+  if (auto remapped = m_source_mappings.RemapPath(path)) {
+new_path = remapped->GetPath();
+return true;
+  }
+  return false;
 }
 
 void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef 
sysroot) {

diff  --git a/lldb/source/Target/PathMappingList.cpp 
b/lldb/source/Target/PathMappingList.cpp
index 35e0c74fb97c..b6dbf551ea57 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -145,18 +145,17 @@ void PathMappingList::Clear(bool notify) {
 
 bool PathMappingList::RemapPath(ConstString path,
 ConstString _path) const {
-  std::string remapped;
-  if (RemapPath(path.GetStringRef(), remapped)) {
-new_path.SetString(remapped);
+  if (llvm::Optional remapped = RemapPath(path.GetStringRef())) {
+new_path.SetString(remapped->GetPath());
 return true;
   }
   return false;
 }
 
-bool PathMappingList::RemapPath(llvm::StringRef path,
-std::string _path) const {
+llvm::Optional
+PathMappingList::RemapPath(llvm::StringRef path) const {
   if (m_pairs.empty() || path.empty())
-return false;
+return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
   for (const auto  : m_pairs) {
 auto prefix = it.first.GetStringRef();
@@ -177,10 +176,9 @@ bool PathMappingList::RemapPath(llvm::StringRef path,
 }
 FileSpec remapped(it.second.GetStringRef());
 remapped.AppendPathComponent(path);
-new_path = remapped.GetPath();
-return true;
+return remapped;
   }
-  return false;
+  return {};
 }
 
 bool PathMappingList::ReverseRemapPath(const FileSpec , FileSpec ) 
const {



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


[Lldb-commits] [PATCH] D104951: [lldb] Use the non-locking variant of objc_copyRealizedClassList

2021-06-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: jingham.
JDevlieghere requested review of this revision.

Avoid standing the Objective-C runtime lock by calling 
`objc_copyRealizedClassList_nolock` instead of `objc_copyRealizedClassList`. We 
already guarantee that no other threads can run while we're running this 
utility expression, similar to when we parse the data ourself from the 
`gdb_objc_realized_classes` struct.


https://reviews.llvm.org/D104951

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


Index: 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -172,7 +172,7 @@
 extern "C" {
 int printf(const char * format, ...);
 void free(void *ptr);
-Class* objc_copyRealizedClassList(unsigned int *outCount);
+Class* objc_copyRealizedClassList_nolock(unsigned int *outCount);
 const char* objc_debug_class_getNameRaw(Class cls);
 }
 
@@ -199,7 +199,7 @@
 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
 
 uint32_t count = 0;
-Class* realized_class_list = objc_copyRealizedClassList();
+Class* realized_class_list = objc_copyRealizedClassList_nolock();
 DEBUG_PRINTF ("count = %u\n", count);
 
 uint32_t idx = 0;
@@ -668,7 +668,7 @@
   static const ConstString g_gdb_object_getClass("gdb_object_getClass");
   m_has_object_getClass = HasSymbol(g_gdb_object_getClass);
   static const ConstString g_objc_copyRealizedClassList(
-  "objc_copyRealizedClassList");
+  "objc_copyRealizedClassList_nolock");
   m_has_objc_copyRealizedClassList = HasSymbol(g_objc_copyRealizedClassList);
 
   RegisterObjCExceptionRecognizer(process);


Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -172,7 +172,7 @@
 extern "C" {
 int printf(const char * format, ...);
 void free(void *ptr);
-Class* objc_copyRealizedClassList(unsigned int *outCount);
+Class* objc_copyRealizedClassList_nolock(unsigned int *outCount);
 const char* objc_debug_class_getNameRaw(Class cls);
 }
 
@@ -199,7 +199,7 @@
 ClassInfo *class_infos = (ClassInfo *)class_infos_ptr;
 
 uint32_t count = 0;
-Class* realized_class_list = objc_copyRealizedClassList();
+Class* realized_class_list = objc_copyRealizedClassList_nolock();
 DEBUG_PRINTF ("count = %u\n", count);
 
 uint32_t idx = 0;
@@ -668,7 +668,7 @@
   static const ConstString g_gdb_object_getClass("gdb_object_getClass");
   m_has_object_getClass = HasSymbol(g_gdb_object_getClass);
   static const ConstString g_objc_copyRealizedClassList(
-  "objc_copyRealizedClassList");
+  "objc_copyRealizedClassList_nolock");
   m_has_objc_copyRealizedClassList = HasSymbol(g_objc_copyRealizedClassList);
 
   RegisterObjCExceptionRecognizer(process);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104407: Improve path remapping in cross-debugging scenarios

2021-06-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM with a few nits




Comment at: lldb/source/Target/PathMappingList.cpp:160
+auto e = llvm::sys::path::end(components);
+if (component != e &&
+llvm::sys::path::is_separator(*component->data(), style))

Can we rely on the path being normalized? If not, should this be `while` 
instead of `if`? 



Comment at: lldb/source/Target/PathMappingList.cpp:204
   continue;
-fixed.SetFile(it.first.GetStringRef(), FileSpec::Style::native);
-fixed.AppendPathComponent(path_ref);
+auto orig = it.first.GetStringRef();
+auto orig_style = FileSpec::GuessPathStyle(orig).getValueOr(

`orig_file`? 


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

https://reviews.llvm.org/D104407

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


[Lldb-commits] [PATCH] D104407: Improve path remapping in cross-debugging scenarios

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Ping.


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

https://reviews.llvm.org/D104407

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


[Lldb-commits] [PATCH] D104724: Modernize Module::RemapFile to return an Optional

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Ping.


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

https://reviews.llvm.org/D104724

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


[Lldb-commits] [PATCH] D104406: Express PathMappingList::FindFile() in terms of PathMappingList.h::RemapPath() (NFC)

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Ping.


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

https://reviews.llvm.org/D104406

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


[Lldb-commits] [PATCH] D104488: Create synthetic symbol names on demand to improve memory consumption and startup times.

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/source/Symbol/Symtab.cpp:642
+  Symbol *symbol = FindSymbolByID(uid);
+  if (symbol == nullptr)
+return 0;

`if (!symbol)` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104488

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


[Lldb-commits] [PATCH] D104404: Change PathMappingList::RemapPath to return an optional result (NFC)

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

> if the return type of the new function is not too awful to type, maybe don't 
> use auto? It says it's returning a path, which is usually a string, not a 
> FileSpec... But that's more a matter of taste.

I think that's generally advice. In this particular case, the code gets deleted 
by a subsequent patch in this stack anyway.


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

https://reviews.llvm.org/D104404

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


[Lldb-commits] [PATCH] D104404: Change PathMappingList::RemapPath to return an optional result (NFC)

2021-06-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

LGTM.

If the return type of the new function is not too awful to type, maybe don't 
use auto?  It says it's returning a path, which is usually a string, not a 
FileSpec...  But that's more a matter of taste.




Comment at: lldb/source/Core/Module.cpp:1607
   std::lock_guard guard(m_mutex);
-  return m_source_mappings.RemapPath(path, new_path);
+  if (auto remapped = m_source_mappings.RemapPath(path)) {
+new_path = remapped->GetPath();

RemapPath doesn't make it obvious you are getting a FileSpec back.  Is the 
actual return something awful to type?


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

https://reviews.llvm.org/D104404

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


[Lldb-commits] [PATCH] D93479: [lldb] Simplify the is_finalized logic in process and make it thread safe.

2021-06-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Huh...  I fear you are going to have to debug this further on your end.  I 
can't see anything else suspect in this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93479

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


[Lldb-commits] [PATCH] D104404: Change PathMappingList::RemapPath to return an optional result (NFC)

2021-06-25 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Ping.


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

https://reviews.llvm.org/D104404

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


[Lldb-commits] [lldb] 4d8156e - [lldb-vscode] Make extension contribute breakpoints use new package.json schema

2021-06-25 Thread Raphael Isemann via lldb-commits

Author: Chris Bond
Date: 2021-06-25T18:21:26+02:00
New Revision: 4d8156ef87f8bc6fdb8ed03b2f87123d02ac7321

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

LOG: [lldb-vscode] Make extension contribute breakpoints use new package.json 
schema

See 
https://code.visualstudio.com/updates/v1_42#_implement-a-debug-adapter-inside-an-extension

Reviewed By: clayborg

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

Added: 


Modified: 
lldb/tools/lldb-vscode/package.json

Removed: 




diff  --git a/lldb/tools/lldb-vscode/package.json 
b/lldb/tools/lldb-vscode/package.json
index e4116e38efbcc..a5c79911f6e9f 100644
--- a/lldb/tools/lldb-vscode/package.json
+++ b/lldb/tools/lldb-vscode/package.json
@@ -49,6 +49,53 @@
 "scopeName": "source.disassembly",
 "path": "./syntaxes/disassembly.json"
 }
+],
+"breakpoints": [
+  {
+"language": "ada"
+  },
+  {
+"language": "arm"
+  },
+  {
+"language": "asm"
+  },
+  {
+"language": "c"
+  },
+  {
+"language": "cpp"
+  },
+  {
+"language": "crystal"
+  },
+  {
+"language": "d"
+  },
+  {
+"language": "fortan"
+  },
+  {
+"language": "fortran-modern"
+  },
+  {
+"language": "nim"
+  },
+  {
+"language": "objective-c"
+  },
+  {
+"language": "objectpascal"
+  },
+  {
+"language": "pascal"
+  },
+  {
+"language": "rust"
+  },
+  {
+"language": "swift"
+  }
 ],
"debuggers": [
{



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


[Lldb-commits] [PATCH] D104882: makes extension contribute breakpoints using new package.json schema:https://code.visualstudio.com/updates/v1_42#_implement-a-debug-adapter-inside-an-extension

2021-06-25 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4d8156ef87f8: [lldb-vscode] Make extension contribute 
breakpoints use new package.json schema (authored by chrisbond, committed by 
teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104882

Files:
  lldb/tools/lldb-vscode/package.json


Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -49,6 +49,53 @@
 "scopeName": "source.disassembly",
 "path": "./syntaxes/disassembly.json"
 }
+],
+"breakpoints": [
+  {
+"language": "ada"
+  },
+  {
+"language": "arm"
+  },
+  {
+"language": "asm"
+  },
+  {
+"language": "c"
+  },
+  {
+"language": "cpp"
+  },
+  {
+"language": "crystal"
+  },
+  {
+"language": "d"
+  },
+  {
+"language": "fortan"
+  },
+  {
+"language": "fortran-modern"
+  },
+  {
+"language": "nim"
+  },
+  {
+"language": "objective-c"
+  },
+  {
+"language": "objectpascal"
+  },
+  {
+"language": "pascal"
+  },
+  {
+"language": "rust"
+  },
+  {
+"language": "swift"
+  }
 ],
"debuggers": [
{


Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -49,6 +49,53 @@
 "scopeName": "source.disassembly",
 "path": "./syntaxes/disassembly.json"
 }
+],
+"breakpoints": [
+  {
+"language": "ada"
+  },
+  {
+"language": "arm"
+  },
+  {
+"language": "asm"
+  },
+  {
+"language": "c"
+  },
+  {
+"language": "cpp"
+  },
+  {
+"language": "crystal"
+  },
+  {
+"language": "d"
+  },
+  {
+"language": "fortan"
+  },
+  {
+"language": "fortran-modern"
+  },
+  {
+"language": "nim"
+  },
+  {
+"language": "objective-c"
+  },
+  {
+"language": "objectpascal"
+  },
+  {
+"language": "pascal"
+  },
+  {
+"language": "rust"
+  },
+  {
+"language": "swift"
+  }
 ],
 		"debuggers": [
 			{
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104882: makes extension contribute breakpoints using new package.json schema:https://code.visualstudio.com/updates/v1_42#_implement-a-debug-adapter-inside-an-extension

2021-06-25 Thread Chris Bond via Phabricator via lldb-commits
chrisbond added a comment.

Thanks. Since I don't yet have commit access, could you go ahead and commit 
this change for me?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104882

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


[Lldb-commits] [PATCH] D103349: [lldb] Don't print script output twice in HandleCommand

2021-06-25 Thread Nico Weber via Phabricator via lldb-commits
thakis added inline comments.



Comment at: lldb/lldb/test/Shell/Breakpoint/breakpoint-command.test:1
+# RUN: %build %p/Inputs/dummy-target.c -o %t.out
+# RUN: %lldb %t.out -o 'b main' -o 'break command add 1 -o "script print(95000 
+ 126)"' -o 'r'

Did you mean to put this file in 
lldb/lldb/test/Shell/Breakpoint/breakpoint-command.test or should it be in 
lldb/test/Shell/Breakpoint/breakpoint-command.test (just one "lldb/")?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103349

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


[Lldb-commits] [PATCH] D104914: [lldb] Correct format of qMemTags type field

2021-06-25 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added a subscriber: kristof.beyls.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The type field is a signed integer.
(https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html)

However it's not packed in the packet in the way
you might think. For example the type -1 should be:
qMemTags:,:
Instead of:
qMemTags:,:-1

This change makes lldb-server's parsing more strict
and adds more tests to check that we handle negative types
correctly in lldb and lldb-server.

We only support one tag type value at this point,
for AArch64 MTE, which is positive. So this doesn't change
any of those interactions. It just brings us in line with GDB.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104914

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -17,6 +17,7 @@
 #include "llvm/Testing/Support/Error.h"
 #include "gmock/gmock.h"
 #include 
+#include 
 
 using namespace lldb_private::process_gdb_remote;
 using namespace lldb_private;
@@ -468,19 +469,18 @@
 
 static void
 check_qmemtags(TestClient , MockServer , size_t read_len,
-   const char *packet, llvm::StringRef response,
+   int32_t type, const char *packet, llvm::StringRef response,
llvm::Optional> expected_tag_data) {
-  const auto  = [&](size_t len, const char *packet,
-   llvm::StringRef response) {
+  const auto  = [&]() {
 std::future result = std::async(std::launch::async, [&] {
-  return client.ReadMemoryTags(0xDEF0, read_len, 1);
+  return client.ReadMemoryTags(0xDEF0, read_len, type);
 });
 
 HandlePacket(server, packet, response);
 return result.get();
   };
 
-  auto result = ReadMemoryTags(0, packet, response);
+  auto result = ReadMemoryTags();
   if (expected_tag_data) {
 ASSERT_TRUE(result);
 llvm::ArrayRef expected(*expected_tag_data);
@@ -493,40 +493,52 @@
 
 TEST_F(GDBRemoteCommunicationClientTest, ReadMemoryTags) {
   // Zero length reads are valid
-  check_qmemtags(client, server, 0, "qMemTags:def0,0:1", "m",
+  check_qmemtags(client, server, 0, 1, "qMemTags:def0,0:1", "m",
  std::vector{});
 
+  // Type can be negative. Put into the packet as the raw bytes
+  // (as opposed to a literal -1)
+  check_qmemtags(client, server, 0, -1, "qMemTags:def0,0:", "m",
+ std::vector{});
+  check_qmemtags(client, server, 0, std::numeric_limits::min(),
+ "qMemTags:def0,0:8000", "m", std::vector{});
+  check_qmemtags(client, server, 0, std::numeric_limits::max(),
+ "qMemTags:def0,0:7fff", "m", std::vector{});
+
   // The client layer does not check the length of the received data.
   // All we need is the "m" and for the decode to use all of the chars
-  check_qmemtags(client, server, 32, "qMemTags:def0,20:1", "m09",
+  check_qmemtags(client, server, 32, 2, "qMemTags:def0,20:2", "m09",
  std::vector{0x9});
 
   // Zero length response is fine as long as the "m" is present
-  check_qmemtags(client, server, 0, "qMemTags:def0,0:1", "m",
+  check_qmemtags(client, server, 0, 0x34, "qMemTags:def0,0:34", "m",
  std::vector{});
 
   // Normal responses
-  check_qmemtags(client, server, 16, "qMemTags:def0,10:1", "m66",
+  check_qmemtags(client, server, 16, 1, "qMemTags:def0,10:1", "m66",
  std::vector{0x66});
-  check_qmemtags(client, server, 32, "qMemTags:def0,20:1", "m0102",
+  check_qmemtags(client, server, 32, 1, "qMemTags:def0,20:1", "m0102",
  std::vector{0x1, 0x2});
 
   // Empty response is an error
-  check_qmemtags(client, server, 17, "qMemTags:def0,11:1", "", llvm::None);
+  check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "", llvm::None);
   // Usual error response
-  check_qmemtags(client, server, 17, "qMemTags:def0,11:1", "E01", llvm::None);
+  check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "E01",
+ llvm::None);
   // Leading m missing
-  check_qmemtags(client, server, 17, "qMemTags:def0,11:1", "01", llvm::None);
+  check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "01", llvm::None);
   // Anything other than m is an error
-  check_qmemtags(client, server, 17, "qMemTags:def0,11:1", "z01", llvm::None);
+  check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "z01",
+ llvm::None);
   // Decoding tag data 

[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf7b1fa6f5ebe: [NFC] remove unreferenced function 
ResolveIPV4HostName (authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104856

Files:
  lldb/tools/debugserver/source/RNBSocket.cpp


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t ) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, );
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), );
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t ) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, );
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), );
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f7b1fa6 - [NFC] remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread via lldb-commits

Author: serge-sans-paille
Date: 2021-06-25T13:45:11+02:00
New Revision: f7b1fa6f5ebec5780e626aa48d582f2519a01632

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

LOG: [NFC] remove unreferenced function ResolveIPV4HostName

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

Added: 


Modified: 
lldb/tools/debugserver/source/RNBSocket.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBSocket.cpp 
b/lldb/tools/debugserver/source/RNBSocket.cpp
index f2c4880fd4157..1282ea221625a 100644
--- a/lldb/tools/debugserver/source/RNBSocket.cpp
+++ b/lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t ) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, );
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), );
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {



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


[Lldb-commits] [PATCH] D93479: [lldb] Simplify the is_finalized logic in process and make it thread safe.

2021-06-25 Thread Adam Brouwers-Harries via Phabricator via lldb-commits
aharries-upmem added a comment.

In D93479#2840497 , @aharries-upmem 
wrote:

> I'm also a little suspicious of (in `Process::Finalize`):
>
>   if (m_finalizing.exchange(true))
> return;
>
> rather than
>
>   m_finalize_called = true;

I've also tried replacing this with `m_finalizing.exchange(true);`, which also 
(sadly) doesn't seem to stop the deadlock.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93479

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


[Lldb-commits] [PATCH] D93479: [lldb] Simplify the is_finalized logic in process and make it thread safe.

2021-06-25 Thread Adam Brouwers-Harries via Phabricator via lldb-commits
aharries-upmem added a comment.

In D93479#2839076 , @jingham wrote:

> I wonder if instead of doing:
>
>   // Use our target to get a shared pointer to ourselves...
>   if (m_finalize_called && !PrivateStateThreadIsValid())
> BroadcastEvent(event_sp);
>   else
> m_private_state_broadcaster.BroadcastEvent(event_sp);
>
> ->
>
>   m_private_state_broadcaster.BroadcastEvent(event_sp);
>
> we should have just replaced m_finalize_called with m_finalizing?  If you 
> tried to sent the exited event to the private event broadcaster after it was 
> shut down, that event would never get to the public process event queue.

Hi Jim, I've tried reverting this check and replacing `m_finalize_called` with 
`m_finalizing`, but sadly the code still seems to deadlock.

I'm also a little suspicious of (in `Process::Finalize`):

  if (m_finalizing.exchange(true))
return;

rather than

  m_finalize_called = true;

As it would seem (to me) to introduce the possibility of an early exit where 
there wasn't one before. I don't know if that was intended (to avoid things 
being done twice?), but it's the only other place I can see a clear change in 
control flow.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93479

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


[Lldb-commits] [lldb] 6e5c4a4 - [lldb] Re-enable GDB server client memory tag read tests

2021-06-25 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2021-06-25T10:09:52Z
New Revision: 6e5c4a443d7e354a37d7dcb82a65216679ab1b40

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

LOG: [lldb] Re-enable GDB server client memory tag read tests

These were disabled in 473a3a773ea565612e836ae6c2093178c5a9eb72
because they failed on 32 bit platforms. (Arm for sure but I assume
any 32 bit)

This was due to the printf formatter used. These assumed
that types like uint64_t/size_t would be certain size/type and
that changes on 32 bit.

Instead use "z" to print the size_t and PRI<...> formatters
for the addr_t (always uint64_t) and the int32_t.

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index a7fcf084fa60c..0e529d221495e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -590,7 +590,7 @@ DataBufferSP 
GDBRemoteCommunicationClient::ReadMemoryTags(lldb::addr_t addr,
   size_t len,
   int32_t type) {
   StreamString packet;
-  packet.Printf("qMemTags:%lx,%lx:%x", addr, len, type);
+  packet.Printf("qMemTags:%" PRIx64 ",%zx:%" PRIx32, addr, len, type);
   StringExtractorGDBRemote response;
 
   Log *log = ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_MEMORY);

diff  --git 
a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp 
b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 91e63451d949c..b9fc107527a21 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -465,7 +465,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetQOffsets) {
   EXPECT_EQ(llvm::None, GetQOffsets("TextSeg=0x1234"));
   EXPECT_EQ(llvm::None, GetQOffsets("TextSeg=12345678123456789"));
 }
-#if 0
+
 static void
 check_qmemtags(TestClient , MockServer , size_t read_len,
const char *packet, llvm::StringRef response,
@@ -530,4 +530,3 @@ TEST_F(GDBRemoteCommunicationClientTest, ReadMemoryTags) {
   check_qmemtags(client, server, 32, "qMemTags:def0,20:1", "m01020",
  llvm::None);
 }
-#endif



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


[Lldb-commits] [lldb] c3549d4 - [lldb] Skip TestDataFormatterSynthVal.py with GCC as the test compiler

2021-06-25 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-25T11:48:12+02:00
New Revision: c3549d4d7a04d83ff559d2be77a9e74e798fdef4

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

LOG: [lldb] Skip TestDataFormatterSynthVal.py with GCC as the test compiler

Added: 


Modified: 

lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
index 79c0dfb4dbc0e..0deaf799a7a12 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
@@ -21,6 +21,7 @@ def setUp(self):
 # Find the line number to break at.
 self.line = line_number('main.cpp', 'break here')
 
+@expectedFailureAll(bugnumber="llvm.org/pr50814", compiler="gcc")
 def test_with_run_command(self):
 """Test using Python synthetic children provider to provide a value."""
 self.build()



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


[Lldb-commits] [lldb] 0adc66f - [lldb] Skip libstdc++ tests failing with GCC

2021-06-25 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-25T11:45:59+02:00
New Revision: 0adc66ff8377d26d1600fef36c9e2d8a962414d4

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

LOG: [lldb] Skip libstdc++ tests failing with GCC

Tracked in llvm.org/pr50861

These tests fail with all GCC versions I tested (8.5, 9.4, 10.3, 11.1).

Added: 


Modified: 

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
index 52387a414849f..cac5411f56b0a 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
@@ -21,6 +21,7 @@ def setUp(self):
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
 @add_test_categories(["libstdcxx"])
+@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
 def test_with_run_command(self):
 """Test that libstdcpp iterators format properly."""
 self.build()

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
index c65393f39bbf9..03131ccfde2f8 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
@@ -25,6 +25,7 @@ def setUp(self):
 'main.cpp', '// Set final break point at this line.')
 
 @add_test_categories(["libstdcxx"])
+@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""
 self.build()

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
index 861b24b3a08ba..e3e2e1b0ee999 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
@@ -21,6 +21,7 @@ def setUp(self):
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
 @add_test_categories(["libstdcxx"])
+@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""
 self.build()

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
index df213a03c72ac..6876dee232c45 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
@@ -13,6 +13,7 @@ class StdSmartPtrDataFormatterTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @add_test_categories(["libstdcxx"])
+@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
 def test_with_run_command(self):
 self.build()
 self.runCmd("file " + 

[Lldb-commits] [lldb] 487ac0b - [lldb] Skip tests failing with GCC due to LLDB not being able to call constructors

2021-06-25 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-25T11:33:09+02:00
New Revision: 487ac0b3eef22ba8f1707779d363ec7f49cc7702

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

LOG: [lldb] Skip tests failing with GCC due to LLDB not being able to call 
constructors

Tracked in llvm.org/pr50814

These tests fail with all GCC versions I tested (8.5, 9.4, 10.3, 11.1).

Added: 


Modified: 

lldb/test/API/commands/expression/deleting-implicit-copy-constructor/TestDeletingImplicitCopyConstructor.py
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
lldb/test/API/lang/cpp/operators/TestCppOperators.py

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/deleting-implicit-copy-constructor/TestDeletingImplicitCopyConstructor.py
 
b/lldb/test/API/commands/expression/deleting-implicit-copy-constructor/TestDeletingImplicitCopyConstructor.py
index c8308c16011e0..e14f160f1e576 100644
--- 
a/lldb/test/API/commands/expression/deleting-implicit-copy-constructor/TestDeletingImplicitCopyConstructor.py
+++ 
b/lldb/test/API/commands/expression/deleting-implicit-copy-constructor/TestDeletingImplicitCopyConstructor.py
@@ -1,4 +1,5 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals())
+lldbinline.MakeInlineTest(__file__, globals(),
+  [decorators.expectedFailureAll(bugnumber="llvm.org/pr50814", 
compiler="gcc")])

diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 3e368d7125a9a..611af25dc239e 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -7,6 +7,7 @@ class TestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+@expectedFailureAll(bugnumber="llvm.org/pr50814", compiler="gcc")
 def test_constructors(self):
 self.build()
 lldbutil.run_to_source_breakpoint(self,"// break here", 
lldb.SBFileSpec("main.cpp"))

diff  --git 
a/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py 
b/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
index 5dce40843cf5b..904f709157314 100644
--- a/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
+++ b/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
@@ -13,12 +13,10 @@ class NamespaceDefinitionsTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+# See also llvm.org/pr28948
 @expectedFailureAll(
-bugnumber="llvm.org/pr28948",
-compiler="gcc",
-compiler_version=[
-"<",
-"4.9"])
+bugnumber="llvm.org/pr50814",
+compiler="gcc")
 @expectedFailureAll(
 bugnumber="llvm.org/pr28948",
 oslist=['linux'], compiler="gcc", archs=['arm','aarch64'])

diff  --git a/lldb/test/API/lang/cpp/operators/TestCppOperators.py 
b/lldb/test/API/lang/cpp/operators/TestCppOperators.py
index c8308c16011e0..e14f160f1e576 100644
--- a/lldb/test/API/lang/cpp/operators/TestCppOperators.py
+++ b/lldb/test/API/lang/cpp/operators/TestCppOperators.py
@@ -1,4 +1,5 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals())
+lldbinline.MakeInlineTest(__file__, globals(),
+  [decorators.expectedFailureAll(bugnumber="llvm.org/pr50814", 
compiler="gcc")])



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


[Lldb-commits] [PATCH] D95602: [lldb][AArch64] Add MTE memory tag reading to lldb

2021-06-25 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

This was fixed by Omair in 
https://reviews.llvm.org/rG9ca0171a9ffdef5fdb1511d197a3fd72490362de.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95602

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


[Lldb-commits] [lldb] 64f98aa - [lldb] Fix memory tag unsupported test

2021-06-25 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2021-06-25T08:57:05Z
New Revision: 64f98aae40894cb0b281723c7f91e73705f551ce

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

LOG: [lldb] Fix memory tag unsupported test

This corrects the test added in
31f9960c38529ce805edf9764535eb0ce188cadf
and temporarily patched in
3b4aad1186e8e8e6f6c7887cb5e8d9bfd7d3ce2f.

This test checks that the memory tag read
command errors when you use it on a platform
without memory tagging.
(which is why we skip the test if you actually
have MTE)

The problem with this test is that there's
two levels of unsupported each with it's own
specific error.

On anything that isn't AArch64, there's no
tagging extension we support. So you're told
that that is the case. As in "this won't ever work".

When you're on AArch64 we know that MTE could
be present on the remote and when we find that it
isn't, we tell you that instead.

Expect a different error message on AArch64 to fix
the test.

Added: 


Modified: 
lldb/test/API/functionalities/memory/tag/TestMemoryTag.py

Removed: 




diff  --git a/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py 
b/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
index 04bc4cc4b6a65..d2827239caf4a 100644
--- a/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
+++ b/lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
@@ -18,7 +18,7 @@ class MemoryTagTestCase(TestBase):
 
 def test_memory_tag_read_unsupported(self):
 """Test that "memory tag read" errors on unsupported platforms"""
-if not self.isAArch64MTE():
+if self.isAArch64MTE():
 self.skipTest("Requires a target without AArch64 MTE.")
 
 self.build()
@@ -30,6 +30,12 @@ def test_memory_tag_read_unsupported(self):
 num_expected_locations=1)
 self.runCmd("run", RUN_SUCCEEDED)
 
-self.expect("memory tag read 0 1",
-substrs=["error: This architecture does not support memory 
tagging"],
-error=True)
+# If you're on AArch64 you could have MTE but the remote process
+# must also support it. If you're on any other arhcitecture you
+# won't have any tagging at all. So the error message is 
diff erent.
+if self.getArchitecture() == "aarch64":
+expected = "error: Process does not support memory tagging"
+else:
+expected = "error: This architecture does not support memory 
tagging"
+
+self.expect("memory tag read 0 1", substrs=[expected], error=True)



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


[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.

LGTM


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

https://reviews.llvm.org/D104856

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


[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

What a simpler patch!


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

https://reviews.llvm.org/D104856

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


[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 354443.
serge-sans-paille retitled this revision from "[lldb] replace gethostbyname 
call by getaddrinfo" to "[NFC] Remove unreferenced function 
ResolveIPV4HostName".
serge-sans-paille edited the summary of this revision.
serge-sans-paille added a comment.

Just remove the function


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

https://reviews.llvm.org/D104856

Files:
  lldb/tools/debugserver/source/RNBSocket.cpp


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t ) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, );
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), );
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t ) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, );
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), );
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104882: makes extension contribute breakpoints using new package.json schema:https://code.visualstudio.com/updates/v1_42#_implement-a-debug-adapter-inside-an-extension

2021-06-25 Thread Chris Bond via Phabricator via lldb-commits
chrisbond updated this revision to Diff 354435.
chrisbond added a comment.

restore deprecated enableBreakpointsFor section to package.json to support 
older vscode releases. newer releases ignore this section.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104882

Files:
  lldb/tools/lldb-vscode/package.json


Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -49,6 +49,53 @@
 "scopeName": "source.disassembly",
 "path": "./syntaxes/disassembly.json"
 }
+],
+"breakpoints": [
+  {
+"language": "ada"
+  },
+  {
+"language": "arm"
+  },
+  {
+"language": "asm"
+  },
+  {
+"language": "c"
+  },
+  {
+"language": "cpp"
+  },
+  {
+"language": "crystal"
+  },
+  {
+"language": "d"
+  },
+  {
+"language": "fortan"
+  },
+  {
+"language": "fortran-modern"
+  },
+  {
+"language": "nim"
+  },
+  {
+"language": "objective-c"
+  },
+  {
+"language": "objectpascal"
+  },
+  {
+"language": "pascal"
+  },
+  {
+"language": "rust"
+  },
+  {
+"language": "swift"
+  }
 ],
"debuggers": [
{


Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -49,6 +49,53 @@
 "scopeName": "source.disassembly",
 "path": "./syntaxes/disassembly.json"
 }
+],
+"breakpoints": [
+  {
+"language": "ada"
+  },
+  {
+"language": "arm"
+  },
+  {
+"language": "asm"
+  },
+  {
+"language": "c"
+  },
+  {
+"language": "cpp"
+  },
+  {
+"language": "crystal"
+  },
+  {
+"language": "d"
+  },
+  {
+"language": "fortan"
+  },
+  {
+"language": "fortran-modern"
+  },
+  {
+"language": "nim"
+  },
+  {
+"language": "objective-c"
+  },
+  {
+"language": "objectpascal"
+  },
+  {
+"language": "pascal"
+  },
+  {
+"language": "rust"
+  },
+  {
+"language": "swift"
+  }
 ],
 		"debuggers": [
 			{
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits