[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D55859#1336470 , @jankratochvil 
wrote:

> Is the patch OK for check-in now? Thanks.


I'd still like the update the description of the setting controlling this. As 
it stands now, I don't think it accurately describes what's happening here.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859



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


[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-20 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 179028.
jankratochvil added a comment.
Herald added a subscriber: krytarowski.

Updated symbols.enable-external-lookup description in detail.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
  source/Core/ModuleList.cpp
  source/Host/common/Symbols.cpp

Index: source/Host/common/Symbols.cpp
===
--- source/Host/common/Symbols.cpp
+++ source/Host/common/Symbols.cpp
@@ -247,6 +247,8 @@
   return result;
 }
 
+// Keep "symbols.enable-external-lookup" description in sync with this function.
+
 FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
   FileSpec symbol_file_spec = module_spec.GetSymbolFileSpec();
   if (symbol_file_spec.IsAbsolute() &&
@@ -270,30 +272,33 @@
   debug_file_search_paths.AppendIfUnique(file_spec);
 }
 
-// Add current working directory.
-{
-  FileSpec file_spec(".");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+if (ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) {
+
+  // Add current working directory.
+  {
+FileSpec file_spec(".");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 
 #ifndef _WIN32
 #if defined(__NetBSD__)
-// Add /usr/libdata/debug directory.
-{
-  FileSpec file_spec("/usr/libdata/debug");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+  // Add /usr/libdata/debug directory.
+  {
+FileSpec file_spec("/usr/libdata/debug");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 #else
-// Add /usr/lib/debug directory.
-{
-  FileSpec file_spec("/usr/lib/debug");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+  // Add /usr/lib/debug directory.
+  {
+FileSpec file_spec("/usr/lib/debug");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 #endif
 #endif // _WIN32
+}
 
 std::string uuid_str;
 const UUID &module_uuid = module_spec.GetUUID();
Index: source/Core/ModuleList.cpp
===
--- source/Core/ModuleList.cpp
+++ source/Core/ModuleList.cpp
@@ -70,8 +70,22 @@
 {"enable-external-lookup", OptionValue::eTypeBoolean, true, true, nullptr,
  {},
  "Control the use of external tools or libraries to locate symbol files. "
- "On macOS, Spotlight is used to locate a matching .dSYM bundle based on "
- "the UUID of the executable."},
+ "Directories listed in target.debug-file-search-paths and directory of "
+ "the executable are always checked first for separate debug info files. "
+ "Then depending on this setting:"
+#ifdef __APPLE__
+ " On macOS, Spotlight would be also used to locate a matching .dSYM "
+ "bundle based on the UUID of the executable."
+#endif
+#ifndef _WIN32
+#ifdef __NetBSD__
+ " On NetBSD, directory /usr/libdata/debug would be also searched."
+#else // !__NetBSD__
+ " On platforms other than NetBSD directory /usr/lib/debug would be "
+ "also searched."
+#endif // !__NetBSD__
+#endif // _WIN32
+},
 {"clang-modules-cache-path", OptionValue::eTypeFileSpec, true, 0, nullptr,
  {},
  "The path to the clang modules cache directory (-fmodules-cache-path)."}};
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
@@ -1,2 +1,3 @@
+settings set symbols.enable-external-lookup false
 -file-exec-and-symbols a.out
 -break-ins -f main
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -237,7 +237,11 @@
 
 # Prepared source file
 sourceFile = self.copyScript("start_script_error")
-self.spawnLldbMi(args="--source %s" % sourceFile)
+self.spawnLldbMi(args="--source %s" % sourceFile, preconfig=Fal

[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] [PATCH] D55472: Speadup memory regions handling and cleanup related code

2018-12-20 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB349766: Replace MemoryRegionInfoSP with values and 
cleanup related code (authored by tkrasnukha, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55472?vs=178941&id=179072#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55472

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

Index: source/API/SBMemoryRegionInfoList.cpp
===
--- source/API/SBMemoryRegionInfoList.cpp
+++ source/API/SBMemoryRegionInfoList.cpp
@@ -32,31 +32,47 @@
 return *this;
   }
 
-  uint32_t GetSize() { return m_regions.size(); }
+  size_t GetSize() const { return m_regions.size(); }
 
-  void Append(const lldb::SBMemoryRegionInfo &sb_region) {
+  void Reserve(size_t capacity) { return m_regions.reserve(capacity); }
+
+  void Append(const MemoryRegionInfo &sb_region) {
 m_regions.push_back(sb_region);
   }
 
   void Append(const MemoryRegionInfoListImpl &list) {
-for (auto val : list.m_regions)
+Reserve(GetSize() + list.GetSize());
+
+for (const auto &val : list.m_regions)
   Append(val);
   }
 
   void Clear() { m_regions.clear(); }
 
-  bool GetMemoryRegionInfoAtIndex(uint32_t index,
-  SBMemoryRegionInfo ®ion_info) {
+  bool GetMemoryRegionInfoAtIndex(size_t index,
+  MemoryRegionInfo ®ion_info) {
 if (index >= GetSize())
   return false;
 region_info = m_regions[index];
 return true;
   }
 
+  MemoryRegionInfos &Ref() { return m_regions; }
+
+  const MemoryRegionInfos &Ref() const { return m_regions; }
+
 private:
-  std::vector m_regions;
+  MemoryRegionInfos m_regions;
 };
 
+MemoryRegionInfos &SBMemoryRegionInfoList::ref() {
+  return m_opaque_ap->Ref();
+}
+
+const MemoryRegionInfos &SBMemoryRegionInfoList::ref() const {
+  return m_opaque_ap->Ref();
+}
+
 SBMemoryRegionInfoList::SBMemoryRegionInfoList()
 : m_opaque_ap(new MemoryRegionInfoListImpl()) {}
 
@@ -82,7 +98,7 @@
 uint32_t idx, SBMemoryRegionInfo ®ion_info) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
 
-  bool result = m_opaque_ap->GetMemoryRegionInfoAtIndex(idx, region_info);
+  bool result = m_opaque_ap->GetMemoryRegionInfoAtIndex(idx, region_info.ref());
 
   if (log) {
 SBStream sstr;
@@ -100,7 +116,7 @@
 void SBMemoryRegionInfoList::Clear() { m_opaque_ap->Clear(); }
 
 void SBMemoryRegionInfoList::Append(SBMemoryRegionInfo &sb_region) {
-  m_opaque_ap->Append(sb_region);
+  m_opaque_ap->Append(sb_region.ref());
 }
 
 void SBMemoryRegionInfoList::Append(SBMemoryRegionInfoList &sb_region_list) {
Index: source/API/SBProcess.cpp
===
--- source/API/SBProcess.cpp
+++ source/API/SBProcess.cpp
@@ -1358,18 +1358,14 @@
SBMemoryRegionInfo &sb_region_info) {
   lldb::SBError sb_error;
   ProcessSP process_sp(GetSP());
-  MemoryRegionInfoSP region_info_sp =
-  std::make_shared();
   if (process_sp) {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process_sp->GetRunLock())) {
   std::lock_guard guard(
   process_sp->GetTarget().GetAPIMutex());
+
   sb_error.ref() =
-  process_sp->GetMemoryRegionInfo(load_addr, *region_info_sp);
-  if (sb_error.Success()) {
-sb_region_info.ref() = *region_info_sp;
-  }
+  process_sp->GetMemoryRegionInfo(load_addr, sb_region_info.ref());
 } else {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
   if (log)
@@ -1385,35 +1381,23 @@
 }
 
 lldb::SBMemoryRegionInfoList SBProcess::GetMemoryRegions() {
-  lldb::SBError sb_error;
   lldb::SBMemoryRegionInfoList sb_region_list;
+
   ProcessSP process_sp(GetSP());
-  if (process_sp) {
-Process::StopLocker stop_locker;
-if (stop_locker.TryLock(&process_sp->GetRunLock())) {
-  std::lock_guard guard(
-  process_sp->GetTarget().GetAPIMutex());
-  std::vector region_list;
-  sb_error.ref() = process_sp->GetMemoryRegions(region_list);
-  if (sb_error.Success()) {
-std::vector::iterator end = region_list.end();
-for (std::vector::iterator it = region_list.begin();
- it != end; it++) {
-  SBMemoryRegionInfo sb_region_info(it->get());
-  sb_region_list.Append(sb_region_info);
-}
-  }
-} else {
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-log->Printf(
-"SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
-static_cast(proc

[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] [PATCH] D55841: GetMemoryRegions for the ProcessMinidump

2018-12-20 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349767: Overload GetMemoryRegions for the ProcessMinidump 
(authored by tkrasnukha, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55841?vs=178931&id=179073#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55841

Files:
  
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

Index: lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
===
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
@@ -242,6 +242,8 @@
 return {};
 
   std::vector result;
+  result.reserve(header->num_of_entries);
+
   for (uint64_t i = 0; i < header->num_of_entries; ++i) {
 result.push_back(reinterpret_cast(
 data.data() + i * header->size_of_entry));
Index: lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h
===
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h
@@ -12,6 +12,7 @@
 
 #include "MinidumpTypes.h"
 
+#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/DataBuffer.h"
 #include "lldb/Utility/Status.h"
@@ -87,6 +88,8 @@
 
   MemoryRegionInfo GetMemoryRegionInfo(lldb::addr_t load_addr);
 
+  const MemoryRegionInfos &GetMemoryRegions();
+
   // Perform consistency checks and initialize internal data structures
   Status Initialize();
 
@@ -106,7 +109,7 @@
   lldb::DataBufferSP m_data_sp;
   llvm::DenseMap m_directory_map;
   ArchSpec m_arch;
-  std::vector m_regions;
+  MemoryRegionInfos m_regions;
   bool m_parsed_regions = false;
 };
 
Index: lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -11,7 +11,6 @@
 #include "NtStructures.h"
 #include "RegisterContextMinidump_x86_32.h"
 
-#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "Plugins/Process/Utility/LinuxProcMaps.h"
 
@@ -537,6 +536,12 @@
 
 MemoryRegionInfo
 MinidumpParser::GetMemoryRegionInfo(lldb::addr_t load_addr) {
+  if (!m_parsed_regions)
+GetMemoryRegions();
+  return FindMemoryRegion(load_addr);
+}
+
+const MemoryRegionInfos &MinidumpParser::GetMemoryRegions() {
   if (!m_parsed_regions) {
 m_parsed_regions = true;
 // We haven't cached our memory regions yet we will create the region cache
@@ -552,7 +557,7 @@
   CreateRegionsCacheFromMemory64List(*this, m_regions);
 std::sort(m_regions.begin(), m_regions.end());
   }
-  return FindMemoryRegion(load_addr);
+  return m_regions;
 }
 
 Status MinidumpParser::Initialize() {
Index: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h
===
--- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h
+++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h
@@ -80,6 +80,9 @@
   Status GetMemoryRegionInfo(lldb::addr_t load_addr,
  MemoryRegionInfo &range_info) override;
 
+  Status GetMemoryRegions(
+  lldb_private::MemoryRegionInfos ®ion_list) override;
+
   bool GetProcessInfo(ProcessInstanceInfo &info) override;
 
   Status WillResume() override {
Index: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -295,6 +295,12 @@
   return Status();
 }
 
+Status ProcessMinidump::GetMemoryRegions(
+lldb_private::MemoryRegionInfos ®ion_list) {
+  region_list = m_minidump_parser.GetMemoryRegions();
+  return Status();
+}
+
 void ProcessMinidump::Clear() { Process::m_thread_list.Clear(); }
 
 bool ProcessMinidump::UpdateThreadList(ThreadList &old_thread_list,
Index: lldb/trunk/scripts/interface/SBMemoryRegionInfo.i
===
--- lldb/trunk/scripts/interface/SBMemoryRegionInfo.i
+++ lldb/trunk/scripts/interface/SBMemoryRegionInfo.i
@@ -44,6 +44,9 @@
 bool
 IsMapped ();
 

[Lldb-commits] [lldb] r349775 - [lldbsuite] Skip TestConflictingSymbol (test_shadowed) on Windows

2018-12-20 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Thu Dec 20 09:19:56 2018
New Revision: 349775

URL: http://llvm.org/viewvc/llvm-project?rev=349775&view=rev
Log:
[lldbsuite] Skip TestConflictingSymbol (test_shadowed) on Windows

The test is "passing" on windows, but it is a false positive. Skip it on 
Windows until it is fixed on all platforms.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py?rev=349775&r1=349774&r2=349775&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py
 Thu Dec 20 09:19:56 2018
@@ -93,6 +93,7 @@ class TestConflictingSymbols(TestBase):
 "Multiple internal symbols"])
 
 @expectedFailureAll(bugnumber="llvm.org/pr35043")
+@skipIfWindows # This test is "passing" on Windows, but it is a false 
positive.
 def test_shadowed(self):
 self.build()
 exe = self.getBuildArtifact("a.out")


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


[Lldb-commits] [lldb] r349781 - [lldbsuite] Un-xfail TestEvents on Windows

2018-12-20 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Thu Dec 20 10:00:20 2018
New Revision: 349781

URL: http://llvm.org/viewvc/llvm-project?rev=349781&view=rev
Log:
[lldbsuite] Un-xfail TestEvents on Windows

There are a couple of tests in TestEvents that are now passing.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py?rev=349781&r1=349780&r2=349781&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py 
Thu Dec 20 10:00:20 2018
@@ -31,7 +31,6 @@ class EventAPITestCase(TestBase):
 @expectedFailureAll(
 oslist=["linux"],
 bugnumber="llvm.org/pr23730 Flaky, fails ~1/10 cases")
-@skipIfWindows # This test will hang on windows llvm.org/pr21753
 def test_listen_for_and_print_event(self):
 """Exercise SBEvent API."""
 self.build()
@@ -120,7 +119,6 @@ class EventAPITestCase(TestBase):
 
 @add_test_categories(['pyapi'])
 @expectedFlakeyLinux("llvm.org/pr23730")  # Flaky, fails ~1/100 cases
-@expectedFlakeyOS(oslist=["windows"])
 def test_wait_for_event(self):
 """Exercise SBListener.WaitForEvent() API."""
 self.build()
@@ -199,7 +197,6 @@ class EventAPITestCase(TestBase):
 @expectedFailureAll(
 oslist=["linux"],
 bugnumber="llvm.org/pr23617 Flaky, fails ~1/10 cases")
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
 def test_add_listener_to_broadcaster(self):
 """Exercise some SBBroadcaster APIs."""
 self.build()


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


[Lldb-commits] [lldb] r349783 - [lldbsuite] Un-xfail TestMiniDump and TestThreadJump

2018-12-20 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Thu Dec 20 10:21:17 2018
New Revision: 349783

URL: http://llvm.org/viewvc/llvm-project?rev=349783&view=rev
Log:
[lldbsuite] Un-xfail TestMiniDump and TestThreadJump

Both of these are now passing. I've resolved the bugs as well for verification.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py?rev=349783&r1=349782&r2=349783&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
 Thu Dec 20 10:21:17 2018
@@ -80,7 +80,6 @@ class MiniDumpTestCase(TestBase):
 self.assertEqual(module.file.fullpath, expected['filename'])
 self.assertEqual(module.GetUUIDString(), expected['uuid'])
 
-@expectedFailureAll(bugnumber="llvm.org/pr35193", hostoslist=["windows"])
 def test_stack_info_in_mini_dump(self):
 """Test that we can see a trivial stack in a VS-generate mini dump."""
 # target create -c fizzbuzz_no_heap.dmp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py?rev=349783&r1=349782&r2=349783&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
 Thu Dec 20 10:21:17 2018
@@ -17,7 +17,6 @@ class ThreadJumpTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343")
 def test(self):
 """Test thread jump handling."""
 self.build(dictionary=self.getBuildFlags())


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


[Lldb-commits] [lldb] r349784 - [lit] Skip stop-hook test on Windows

2018-12-20 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Thu Dec 20 10:23:08 2018
New Revision: 349784

URL: http://llvm.org/viewvc/llvm-project?rev=349784&view=rev
Log:
[lit] Skip stop-hook test on Windows

This test is now marked as unsupported on Windows - it is not technically  
"unsupported" on Windows, but it fails because "expr ptr" does not evaluate 
correctly. However, the error message contains the expected string, so the test 
"passes" despite the fact that the commands failed
The following bug has been opened for it: llvm.org/pr40119

Modified:
lldb/trunk/lit/ExecControl/StopHook/stop-hook.test

Modified: lldb/trunk/lit/ExecControl/StopHook/stop-hook.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/stop-hook.test?rev=349784&r1=349783&r2=349784&view=diff
==
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook.test (original)
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook.test Thu Dec 20 10:23:08 2018
@@ -6,7 +6,11 @@
 # RUN: %lldb -b -s %p/Inputs/stop-hook-2.lldbinit -s %s -f %t | FileCheck %s
 # Test setting stop-hook with multi-line expression
 # RUN: %lldb -b -s %p/Inputs/stop-hook-3.lldbinit -s %s -f %t | FileCheck %s
-# XFAIL: system-windows
+# This test is not "unsupported" on Windows, but it fails because "expr ptr"
+# does not evaluate correctly. However, the error message contains the expected
+# string, so the test "passes" despite the fact that the commands failed
+# llvm.org/pr40119
+# UNSUPPORTED: system-windows
 
 break set -f stop-hook.c -p "// Set breakpoint here to test target stop-hook"
 break set -f stop-hook.c -p "// Another breakpoint which is outside of the 
stop-hook range"


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


[Lldb-commits] [PATCH] D55835: [dotest] Consider unexpected passes as failures.

2018-12-20 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks good to me. Modifying this code is not ideal, but this is a pretty small 
but fundamental change in how unittest works. Changing the treatment of 
unexpected successes anywhere else would be a hack. It also looks like this is 
not the first change we've made in this piece of code.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55835



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


[Lldb-commits] [lldb] r349813 - [lldbsuite] Un-xfail several tests in TestInferiorCrashing on Windows

2018-12-20 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Thu Dec 20 12:26:05 2018
New Revision: 349813

URL: http://llvm.org/viewvc/llvm-project?rev=349813&view=rev
Log:
[lldbsuite] Un-xfail several tests in TestInferiorCrashing on Windows

Several of the tests are now passing. This change is enabling them.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py?rev=349813&r1=349812&r2=349813&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
 Thu Dec 20 12:26:05 2018
@@ -16,59 +16,42 @@ class CrashingInferiorTestCase(TestBase)
 
 mydir = TestBase.compute_mydir(__file__)
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24778, This actually works, but the test relies 
on the output format instead of the API")
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
 def test_inferior_crashing(self):
 """Test that lldb reliably catches the inferior crashing (command)."""
 self.build()
 self.inferior_crashing()
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24778, This actually works, but the test relies 
on the output format instead of the API")
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
 def test_inferior_crashing_register(self):
 """Test that lldb reliably reads registers from the inferior after 
crashing (command)."""
 self.build()
 self.inferior_crashing_registers()
 
 @add_test_categories(['pyapi'])
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24778, This actually works, but the test relies 
on the output format instead of the API")
 def test_inferior_crashing_python(self):
 """Test that lldb reliably catches the inferior crashing (Python 
API)."""
 self.build()
 self.inferior_crashing_python()
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24778, This actually works, but the test relies 
on the output format instead of the API")
 def test_inferior_crashing_expr(self):
 """Test that the lldb expression interpreter can read from the 
inferior after crashing (command)."""
 self.build()
 self.inferior_crashing_expr()
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24778, This actually works, but the test relies 
on the output format instead of the API")
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
 def test_inferior_crashing_step(self):
 """Test that stepping after a crash behaves correctly."""
 self.build()
 self.inferior_crashing_step()
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24778, This actually works, but the test relies 
on the output format instead of the API")
 @skipIfTargetAndroid()  # debuggerd interferes with this test on Android
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
 def test_inferior_crashing_step_after_break(self):
 """Test that lldb functions correctly after stepping through a 
crash."""
 self.build()
 self.inferior_crashing_step_after_break()
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24778, This actually works, but the test relies 
on the output format instead of the API")
 # Inferior exits after stepping after a segfault. This is working as
 # intended IMHO.
 @skipIfLinux


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


[Lldb-commits] [lldb] r349818 - [dotest] Consider unexpected passes as failures.

2018-12-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Dec 20 12:44:23 2018
New Revision: 349818

URL: http://llvm.org/viewvc/llvm-project?rev=349818&view=rev
Log:
[dotest] Consider unexpected passes as failures.

Unexpected successes should be considered failures because they can hide
regressions when not addressed. When a test is fixed and not re-enabled,
it can easily regress without us noticing.

I couldn't find a good way to make this change other than changing it in
the unittest2 framework. I know this is less than optimal but since we
have the dependency checked in and the change is pretty fundamental to
the framework I think it's not unreasonable.

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

Modified:
lldb/trunk/lit/Suite/lldbtest.py
lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py

Modified: lldb/trunk/lit/Suite/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lldbtest.py?rev=349818&r1=349817&r2=349818&view=diff
==
--- lldb/trunk/lit/Suite/lldbtest.py (original)
+++ lldb/trunk/lit/Suite/lldbtest.py Thu Dec 20 12:44:23 2018
@@ -94,11 +94,10 @@ class LLDBTest(TestFormat):
 litConfig.maxIndividualTestTime))
 
 if exitCode:
-return lit.Test.FAIL, out + err
-
-unexpected_test_line = 'XPASS'
-if unexpected_test_line in out or unexpected_test_line in err:
-return lit.Test.XPASS, ''
+if 'FAIL:' in out or 'FAIL:' in err:
+return lit.Test.FAIL, out + err
+if 'XPASS:' in out or 'XPASS:' in err:
+return lit.Test.XPASS, out + err
 
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:

Modified: lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py?rev=349818&r1=349817&r2=349818&view=diff
==
--- lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py 
(original)
+++ lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py Thu Dec 
20 12:44:23 2018
@@ -148,7 +148,9 @@ class TestResult(unittest.TestResult):
 
 def wasSuccessful(self):
 "Tells whether or not this result was a success"
-return (len(self.failures) + len(self.errors) == 0)
+return (len(self.failures) +
+len(self.errors) +
+len(self.unexpectedSuccesses) == 0)
 
 def stop(self):
 "Indicates that the tests should be aborted"


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


[Lldb-commits] [PATCH] D55835: [dotest] Consider unexpected passes as failures.

2018-12-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349818: [dotest] Consider unexpected passes as failures. 
(authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55835?vs=178712&id=179132#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55835

Files:
  lldb/trunk/lit/Suite/lldbtest.py
  lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py


Index: lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py
===
--- lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py
+++ lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py
@@ -148,7 +148,9 @@
 
 def wasSuccessful(self):
 "Tells whether or not this result was a success"
-return (len(self.failures) + len(self.errors) == 0)
+return (len(self.failures) +
+len(self.errors) +
+len(self.unexpectedSuccesses) == 0)
 
 def stop(self):
 "Indicates that the tests should be aborted"
Index: lldb/trunk/lit/Suite/lldbtest.py
===
--- lldb/trunk/lit/Suite/lldbtest.py
+++ lldb/trunk/lit/Suite/lldbtest.py
@@ -94,11 +94,10 @@
 litConfig.maxIndividualTestTime))
 
 if exitCode:
-return lit.Test.FAIL, out + err
-
-unexpected_test_line = 'XPASS'
-if unexpected_test_line in out or unexpected_test_line in err:
-return lit.Test.XPASS, ''
+if 'FAIL:' in out or 'FAIL:' in err:
+return lit.Test.FAIL, out + err
+if 'XPASS:' in out or 'XPASS:' in err:
+return lit.Test.XPASS, out + err
 
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:


Index: lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py
===
--- lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py
+++ lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py
@@ -148,7 +148,9 @@
 
 def wasSuccessful(self):
 "Tells whether or not this result was a success"
-return (len(self.failures) + len(self.errors) == 0)
+return (len(self.failures) +
+len(self.errors) +
+len(self.unexpectedSuccesses) == 0)
 
 def stop(self):
 "Indicates that the tests should be aborted"
Index: lldb/trunk/lit/Suite/lldbtest.py
===
--- lldb/trunk/lit/Suite/lldbtest.py
+++ lldb/trunk/lit/Suite/lldbtest.py
@@ -94,11 +94,10 @@
 litConfig.maxIndividualTestTime))
 
 if exitCode:
-return lit.Test.FAIL, out + err
-
-unexpected_test_line = 'XPASS'
-if unexpected_test_line in out or unexpected_test_line in err:
-return lit.Test.XPASS, ''
+if 'FAIL:' in out or 'FAIL:' in err:
+return lit.Test.FAIL, out + err
+if 'XPASS:' in out or 'XPASS:' in err:
+return lit.Test.XPASS, out + err
 
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r349821 - [API] Remove redundants get() from smart pointers. NFC

2018-12-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Dec 20 13:02:55 2018
New Revision: 349821

URL: http://llvm.org/viewvc/llvm-project?rev=349821&view=rev
Log:
[API] Remove redundants get() from smart pointers. NFC

Removes redundant calls to ::get() from smart pointers in the source/API
directory..

Modified:
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBBreakpointName.cpp
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/API/SBCommandReturnObject.cpp
lldb/trunk/source/API/SBDeclaration.cpp
lldb/trunk/source/API/SBError.cpp
lldb/trunk/source/API/SBFileSpec.cpp
lldb/trunk/source/API/SBFileSpecList.cpp
lldb/trunk/source/API/SBLineEntry.cpp
lldb/trunk/source/API/SBMemoryRegionInfoList.cpp
lldb/trunk/source/API/SBProcessInfo.cpp
lldb/trunk/source/API/SBSourceManager.cpp
lldb/trunk/source/API/SBStream.cpp
lldb/trunk/source/API/SBStringList.cpp
lldb/trunk/source/API/SBSymbolContext.cpp
lldb/trunk/source/API/SBSymbolContextList.cpp
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/API/SBTypeEnumMember.cpp
lldb/trunk/source/API/SBTypeSummary.cpp
lldb/trunk/source/API/SBValueList.cpp
lldb/trunk/source/API/SBVariablesOptions.cpp

Modified: lldb/trunk/source/API/SBAddress.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=349821&r1=349820&r2=349821&view=diff
==
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Thu Dec 20 13:02:55 2018
@@ -62,7 +62,7 @@ bool lldb::operator==(const SBAddress &l
 }
 
 bool SBAddress::IsValid() const {
-  return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid();
+  return m_opaque_ap != NULL && m_opaque_ap->IsValid();
 }
 
 void SBAddress::Clear() { m_opaque_ap.reset(new Address()); }
@@ -156,7 +156,7 @@ Address *SBAddress::operator->() { retur
 const Address *SBAddress::operator->() const { return m_opaque_ap.get(); }
 
 Address &SBAddress::ref() {
-  if (m_opaque_ap.get() == NULL)
+  if (m_opaque_ap == NULL)
 m_opaque_ap.reset(new Address());
   return *m_opaque_ap;
 }

Modified: lldb/trunk/source/API/SBBreakpointName.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointName.cpp?rev=349821&r1=349820&r2=349821&view=diff
==
--- lldb/trunk/source/API/SBBreakpointName.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointName.cpp Thu Dec 20 13:02:55 2018
@@ -164,11 +164,11 @@ const SBBreakpointName &SBBreakpointName
 }
 
 bool SBBreakpointName::operator==(const lldb::SBBreakpointName &rhs) {
-  return *m_impl_up.get() == *rhs.m_impl_up.get();
+  return *m_impl_up == *rhs.m_impl_up;
 }
 
 bool SBBreakpointName::operator!=(const lldb::SBBreakpointName &rhs) {
-  return *m_impl_up.get() != *rhs.m_impl_up.get();
+  return *m_impl_up != *rhs.m_impl_up;
 }
 
 bool SBBreakpointName::IsValid() const {

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=349821&r1=349820&r2=349821&view=diff
==
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Thu Dec 20 13:02:55 2018
@@ -98,7 +98,7 @@ SBCommandInterpreterRunOptions::get() co
 
 lldb_private::CommandInterpreterRunOptions &
 SBCommandInterpreterRunOptions::ref() const {
-  return *m_opaque_up.get();
+  return *m_opaque_up;
 }
 
 class CommandPluginInterfaceImplementation : public CommandObjectParsed {

Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=349821&r1=349820&r2=349821&view=diff
==
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Thu Dec 20 13:02:55 2018
@@ -48,9 +48,7 @@ operator=(const SBCommandReturnObject &r
   return *this;
 }
 
-bool SBCommandReturnObject::IsValid() const {
-  return m_opaque_ap.get() != nullptr;
-}
+bool SBCommandReturnObject::IsValid() const { return m_opaque_ap != nullptr; }
 
 const char *SBCommandReturnObject::GetOutput() {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));

Modified: lldb/trunk/source/API/SBDeclaration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDeclaration.cpp?rev=349821&r1=349820&r2=349821&view=diff
==
--- lldb/trunk/source/API/SBDeclaration.cpp (original)
+++ lldb/trunk/source/API/SBDeclaration.cpp Thu Dec 20 13:02:55 2018
@@ -75,7 +75,7 @@ uint32_t SBDeclaration::GetLine() const
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
 
   uint32_t line =

[Lldb-commits] [PATCH] D55954: [ldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default

2018-12-20 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek created this revision.
kubamracek added a reviewer: jingham.
kubamracek added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D55954

Files:
  include/lldb/API/SBTarget.h
  include/lldb/API/SBVariablesOptions.h
  include/lldb/Target/Target.h
  scripts/interface/SBVariablesOptions.i
  source/API/SBFrame.cpp
  source/API/SBVariablesOptions.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -3356,6 +3356,8 @@
 {"display-runtime-support-values", OptionValue::eTypeBoolean, false, false,
  nullptr, {}, "If true, LLDB will show variables that are meant to "
   "support the operation of a language's runtime support."},
+{"display-recognized-arguments", OptionValue::eTypeBoolean, false, false,
+ nullptr, {}, "Show recognized arguments in variable listings by default."},
 {"non-stop-mode", OptionValue::eTypeBoolean, false, 0, nullptr, {},
  "Disable lock-step debugging, instead control threads independently."},
 {"require-hardware-breakpoint", OptionValue::eTypeBoolean, false, 0,
@@ -3404,6 +3406,7 @@
   ePropertyDisplayExpressionsInCrashlogs,
   ePropertyTrapHandlerNames,
   ePropertyDisplayRuntimeSupportValues,
+  ePropertyDisplayRecognizedArguments,
   ePropertyNonStopModeEnabled,
   ePropertyRequireHardwareBreakpoints,
   ePropertyExperimental,
@@ -3963,6 +3966,16 @@
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
 }
 
+bool TargetProperties::GetDisplayRecognizedArguments() const {
+  const uint32_t idx = ePropertyDisplayRecognizedArguments;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, false);
+}
+
+void TargetProperties::SetDisplayRecognizedArguments(bool b) {
+  const uint32_t idx = ePropertyDisplayRecognizedArguments;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
 bool TargetProperties::GetNonStopModeEnabled() const {
   const uint32_t idx = ePropertyNonStopModeEnabled;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, false);
Index: source/API/SBVariablesOptions.cpp
===
--- source/API/SBVariablesOptions.cpp
+++ source/API/SBVariablesOptions.cpp
@@ -9,6 +9,10 @@
 //===--===//
 
 #include "lldb/API/SBVariablesOptions.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/Target/Target.h"
+
+#include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -16,9 +20,10 @@
 class VariablesOptionsImpl {
 public:
   VariablesOptionsImpl()
-  : m_include_arguments(false), m_include_recognized_arguments(false),
-m_include_locals(false), m_include_statics(false),
-m_in_scope_only(false), m_include_runtime_support_values(false),
+  : m_include_arguments(false), m_include_locals(false),
+m_include_statics(false), m_in_scope_only(false),
+m_include_runtime_support_values(false),
+m_include_recognized_arguments(eLazyBoolCalculate),
 m_use_dynamic(lldb::eNoDynamicValues) {}
 
   VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
@@ -31,12 +36,14 @@
 
   void SetIncludeArguments(bool b) { m_include_arguments = b; }
 
-  bool GetIncludeRecognizedArguments() const {
-return m_include_recognized_arguments;
+  bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
+if (m_include_recognized_arguments != eLazyBoolCalculate)
+return m_include_recognized_arguments;
+return target_sp->GetDisplayRecognizedArguments();
   }
 
   void SetIncludeRecognizedArguments(bool b) {
-m_include_recognized_arguments = b;
+m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
   }
 
   bool GetIncludeLocals() const { return m_include_locals; }
@@ -65,11 +72,11 @@
 
 private:
   bool m_include_arguments : 1;
-  bool m_include_recognized_arguments : 1;
   bool m_include_locals : 1;
   bool m_include_statics : 1;
   bool m_in_scope_only : 1;
   bool m_include_runtime_support_values : 1;
+  LazyBool m_include_recognized_arguments; // can be overridden with a setting
   lldb::DynamicValueType m_use_dynamic;
 };
 
@@ -99,8 +106,9 @@
   m_opaque_ap->SetIncludeArguments(arguments);
 }
 
-bool SBVariablesOptions::GetIncludeRecognizedArguments() const {
-  return m_opaque_ap->GetIncludeRecognizedArguments();
+bool SBVariablesOptions::GetIncludeRecognizedArguments(
+const lldb::SBTarget &target) const {
+  return m_opaque_ap->GetIncludeRecognizedArguments(target.GetSP());
 }
 
 void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
Index: source/API/SBFrame.cpp
===
--- source/API/SBFrame.cpp
+++ source/API/SBFrame.cpp
@@ -957,7 +957,8 @@
 
   const bool statics = options.GetIncludeStatics();
   const 

[Lldb-commits] [PATCH] D55954: [ldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default

2018-12-20 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

That's great.  Can you add a test that if you make a default SBVariableOption 
and then flip the target setting you get the target's default value?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55954



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


[Lldb-commits] [PATCH] D55954: [lldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default

2018-12-20 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek updated this revision to Diff 179170.
kubamracek retitled this revision from "[ldb] Add a 
"display-recognized-arguments" target setting to show recognized arguments by 
default" to "[lldb] Add a "display-recognized-arguments" target setting to show 
recognized arguments by default".
kubamracek added a comment.

Adding test.


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

https://reviews.llvm.org/D55954

Files:
  include/lldb/API/SBTarget.h
  include/lldb/API/SBVariablesOptions.h
  include/lldb/Target/Target.h
  
packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
  scripts/interface/SBVariablesOptions.i
  source/API/SBFrame.cpp
  source/API/SBVariablesOptions.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -3356,6 +3356,8 @@
 {"display-runtime-support-values", OptionValue::eTypeBoolean, false, false,
  nullptr, {}, "If true, LLDB will show variables that are meant to "
   "support the operation of a language's runtime support."},
+{"display-recognized-arguments", OptionValue::eTypeBoolean, false, false,
+ nullptr, {}, "Show recognized arguments in variable listings by default."},
 {"non-stop-mode", OptionValue::eTypeBoolean, false, 0, nullptr, {},
  "Disable lock-step debugging, instead control threads independently."},
 {"require-hardware-breakpoint", OptionValue::eTypeBoolean, false, 0,
@@ -3404,6 +3406,7 @@
   ePropertyDisplayExpressionsInCrashlogs,
   ePropertyTrapHandlerNames,
   ePropertyDisplayRuntimeSupportValues,
+  ePropertyDisplayRecognizedArguments,
   ePropertyNonStopModeEnabled,
   ePropertyRequireHardwareBreakpoints,
   ePropertyExperimental,
@@ -3963,6 +3966,16 @@
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
 }
 
+bool TargetProperties::GetDisplayRecognizedArguments() const {
+  const uint32_t idx = ePropertyDisplayRecognizedArguments;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, false);
+}
+
+void TargetProperties::SetDisplayRecognizedArguments(bool b) {
+  const uint32_t idx = ePropertyDisplayRecognizedArguments;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
 bool TargetProperties::GetNonStopModeEnabled() const {
   const uint32_t idx = ePropertyNonStopModeEnabled;
   return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, false);
Index: source/API/SBVariablesOptions.cpp
===
--- source/API/SBVariablesOptions.cpp
+++ source/API/SBVariablesOptions.cpp
@@ -9,6 +9,10 @@
 //===--===//
 
 #include "lldb/API/SBVariablesOptions.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/Target/Target.h"
+
+#include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -16,9 +20,10 @@
 class VariablesOptionsImpl {
 public:
   VariablesOptionsImpl()
-  : m_include_arguments(false), m_include_recognized_arguments(false),
-m_include_locals(false), m_include_statics(false),
-m_in_scope_only(false), m_include_runtime_support_values(false),
+  : m_include_arguments(false), m_include_locals(false),
+m_include_statics(false), m_in_scope_only(false),
+m_include_runtime_support_values(false),
+m_include_recognized_arguments(eLazyBoolCalculate),
 m_use_dynamic(lldb::eNoDynamicValues) {}
 
   VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
@@ -31,12 +36,14 @@
 
   void SetIncludeArguments(bool b) { m_include_arguments = b; }
 
-  bool GetIncludeRecognizedArguments() const {
-return m_include_recognized_arguments;
+  bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
+if (m_include_recognized_arguments != eLazyBoolCalculate)
+return m_include_recognized_arguments;
+return target_sp ? target_sp->GetDisplayRecognizedArguments() : false;
   }
 
   void SetIncludeRecognizedArguments(bool b) {
-m_include_recognized_arguments = b;
+m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
   }
 
   bool GetIncludeLocals() const { return m_include_locals; }
@@ -65,11 +72,11 @@
 
 private:
   bool m_include_arguments : 1;
-  bool m_include_recognized_arguments : 1;
   bool m_include_locals : 1;
   bool m_include_statics : 1;
   bool m_in_scope_only : 1;
   bool m_include_runtime_support_values : 1;
+  LazyBool m_include_recognized_arguments; // can be overridden with a setting
   lldb::DynamicValueType m_use_dynamic;
 };
 
@@ -99,8 +106,9 @@
   m_opaque_ap->SetIncludeArguments(arguments);
 }
 
-bool SBVariablesOptions::GetIncludeRecognizedArguments() const {
-  return m_opaque_ap->GetIncludeRecognizedArguments();
+bool SBVariablesOptions::GetIncludeRecognizedArguments(
+const lldb::SBTarget &target) const {
+ 

[Lldb-commits] [lldb] r349851 - Disable a few tests on the green dragon sanitzier bot.

2018-12-20 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Dec 20 15:16:47 2018
New Revision: 349851

URL: http://llvm.org/viewvc/llvm-project?rev=349851&view=rev
Log:
Disable a few tests on the green dragon sanitzier bot.

These are tests that found actual, but hard to fix, bugs that are
tracked elsewhere. Leaving them red only distracts from new failures
this bot finds.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/decorators.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py

lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=349851&r1=349850&r2=349851&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Thu Dec 20 15:16:47 
2018
@@ -806,3 +806,10 @@ def skipUnlessFeature(feature):
 except subprocess.CalledProcessError:
 return "%s is not supported on this system." % feature
 return skipTestIfFn(is_feature_enabled)
+
+def skipIfSanitized(func):
+"""Skip this test if the environment is set up to run LLDB itself under 
ASAN."""
+def is_sanitized():
+return (('DYLD_INSERT_LIBRARIES' in os.env) and
+'libclang_rt.asan' in os.env['DYLD_INSERT_LIBRARIES'])
+return skipTestIfFn(is_sanitized)(func)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py?rev=349851&r1=349850&r2=349851&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
Thu Dec 20 15:16:47 2018
@@ -31,12 +31,14 @@ class ExecTestCase(TestBase):
 @skipUnlessDarwin
 @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
 @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], 
bugnumber="rdar://problem/34559552") # this exec test has problems on ios 
systems
+@skipIfSanitized # rdar://problem/43756823
 def test_hitting_exec (self):
 self.do_test(False)
 
 @skipUnlessDarwin
 @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
 @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], 
bugnumber="rdar://problem/34559552") # this exec test has problems on ios 
systems
+@skipIfSanitized # rdar://problem/43756823
 def test_skipping_exec (self):
 self.do_test(True)
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py?rev=349851&r1=349850&r2=349851&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
 Thu Dec 20 15:16:47 2018
@@ -107,6 +107,7 @@ class HelloWorldTestCase(TestBase):
 
 @add_test_categories(['pyapi'])
 @skipIfiOSSimulator
+@skipIfSanitized # FIXME: Hangs indefinitely.
 def test_with_attach_to_process_with_name_api(self):
 """Create target, spawn a process, and attach to it with process 
name."""
 exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())


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


[Lldb-commits] [lldb] r349854 - [NativePDB] Create VarDecls for global variables.

2018-12-20 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Dec 20 15:32:37 2018
New Revision: 349854

URL: http://llvm.org/viewvc/llvm-project?rev=349854&view=rev
Log:
[NativePDB] Create VarDecls for global variables.

Previously we would create these for local variables but not for
global variables.

Also updated existing tests which created global variables to check
for them in the resulting AST.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit?rev=349854&r1=349853&r2=349854&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit 
(original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit Thu 
Dec 20 15:32:37 2018
@@ -216,5 +216,7 @@ target variable CRC32_42
 target variable CRWC1
 target variable CRWCP
 
+target modules dump ast
+
 
 quit
\ No newline at end of file

Modified: lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp?rev=349854&r1=349853&r2=349854&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp Thu Dec 20 15:32:37 
2018
@@ -285,6 +285,7 @@ constexpr References ReferencesInstance;
 // CHECK: | |-FieldDecl {{.*}} k 'long long'
 // CHECK: | |-FieldDecl {{.*}} l 'char'
 // CHECK: | `-FieldDecl {{.*}} m 'long long'
+// CHECK: |-VarDecl {{.*}} ClassWithPaddingInstance 'const ClassWithPadding'
 // CHECK: |-CXXRecordDecl {{.*}} class ClassNoPadding definition
 // CHECK: | |-FieldDecl {{.*}} a 'unsigned char'
 // CHECK: | |-FieldDecl {{.*}} b 'char'
@@ -302,23 +303,27 @@ constexpr References ReferencesInstance;
 // CHECK: | |-FieldDecl {{.*}} n 'unsigned long long'
 // CHECK: | |-FieldDecl {{.*}} o 'long long'
 // CHECK: | `-FieldDecl {{.*}} p 'int [5]'
+// CHECK: |-VarDecl {{.*}} ClassNoPaddingInstance 'const ClassNoPadding'
 // CHECK: |-EnumDecl {{.*}} EnumType
 // CHECK: | |-EnumConstantDecl {{.*}} A 'EnumType'
 // CHECK: | `-EnumConstantDecl {{.*}} B 'EnumType'
 // CHECK: |-CXXRecordDecl {{.*}} struct DerivedClass definition
 // CHECK: | |-public 'BaseClass'
 // CHECK: | `-FieldDecl {{.*}} DerivedMember 'int'
+// CHECK: |-VarDecl {{.*}} DC 'const DerivedClass'
 // CHECK: |-CXXRecordDecl {{.*}} struct BaseClass definition
 // CHECK: | `-FieldDecl {{.*}} BaseMember 'int'
 // CHECK: |-CXXRecordDecl {{.*}} struct EBO definition
 // CHECK: | |-public 'EmptyBase'
 // CHECK: | `-FieldDecl {{.*}} Member 'int'
+// CHECK: |-VarDecl {{.*}} EBOC 'const EBO'
 // CHECK: |-CXXRecordDecl {{.*}} struct EmptyBase definition
 // CHECK: |-CXXRecordDecl {{.*}} struct PaddedBases definition
 // CHECK: | |-public 'BaseClass'
 // CHECK: | |-public 'BaseClass'
 // CHECK: | |-public 'BaseClass'
 // CHECK: | `-FieldDecl {{.*}} DerivedMember 'long long'
+// CHECK: |-VarDecl {{.*}} PBC 'const PaddedBases'
 // CHECK: |-CXXRecordDecl {{.*}} struct BaseClass definition
 // CHECK: | `-FieldDecl {{.*}} BaseMember 'int'
 // CHECK: |-CXXRecordDecl {{.*}} struct BaseClass definition
@@ -326,6 +331,7 @@ constexpr References ReferencesInstance;
 // CHECK: |-CXXRecordDecl {{.*}} struct  
definition
 // CHECK: | |-FieldDecl {{.*}} x 'int'
 // CHECK: | `-FieldDecl {{.*}} EBOC 'EBO'
+// CHECK: |-VarDecl {{.*}} UnnamedClassInstance 'const 
'
 // CHECK: |-CXXRecordDecl {{.*}} struct Pointers definition
 // CHECK: | |-FieldDecl {{.*}} a 'void *'
 // CHECK: | |-FieldDecl {{.*}} b 'char *'
@@ -341,6 +347,7 @@ constexpr References ReferencesInstance;
 // CHECK: | |-FieldDecl {{.*}} m 'double *'
 // CHECK: | |-FieldDecl {{.*}} n 'unsigned long long *'
 // CHECK: | `-FieldDecl {{.*}} o 'long long *'
+// CHECK: |-VarDecl {{.*}} PointersInstance 'const Pointers'
 // CHECK: |-CXXRecordDecl {{.*}} struct References definition
 // CHECK: | |-FieldDecl {{.*}} a 'char &'
 // CHECK: | |-FieldDecl {{.*}} b 'bool &'
@@ -355,6 +362,7 @@ constexpr References ReferencesInstance;
 // CHECK: | |-FieldDecl {{.*}} k 'double &'
 // CHECK: | |-FieldDecl {{.*}} l 'unsigned long long &'
 // CHECK: | `-FieldDecl {{.*}} m 'long long &'
+// CHECK: |-VarDecl {{

[Lldb-commits] [PATCH] D55954: [lldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default

2018-12-20 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.

Excellent!


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

https://reviews.llvm.org/D55954



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


[Lldb-commits] [lldb] r349856 - [lldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default

2018-12-20 Thread Kuba Mracek via lldb-commits
Author: kuba.brecka
Date: Thu Dec 20 15:38:19 2018
New Revision: 349856

URL: http://llvm.org/viewvc/llvm-project?rev=349856&view=rev
Log:
[lldb] Add a "display-recognized-arguments" target setting to show recognized 
arguments by default

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


Modified:
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/include/lldb/API/SBVariablesOptions.h
lldb/trunk/include/lldb/Target/Target.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
lldb/trunk/scripts/interface/SBVariablesOptions.i
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBVariablesOptions.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=349856&r1=349855&r2=349856&view=diff
==
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Thu Dec 20 15:38:19 2018
@@ -903,6 +903,7 @@ protected:
   friend class SBSourceManager;
   friend class SBSymbol;
   friend class SBValue;
+  friend class SBVariablesOptions;
 
   //--
   // Constructors are private, use static Target::Create function to create an

Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=349856&r1=349855&r2=349856&view=diff
==
--- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original)
+++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Thu Dec 20 15:38:19 2018
@@ -33,7 +33,7 @@ public:
 
   void SetIncludeArguments(bool);
 
-  bool GetIncludeRecognizedArguments() const;
+  bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const;
 
   void SetIncludeRecognizedArguments(bool);
 

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=349856&r1=349855&r2=349856&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Dec 20 15:38:19 2018
@@ -188,6 +188,10 @@ public:
 
   void SetDisplayRuntimeSupportValues(bool b);
 
+  bool GetDisplayRecognizedArguments() const;
+
+  void SetDisplayRecognizedArguments(bool b);
+
   const ProcessLaunchInfo &GetProcessLaunchInfo();
 
   void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py?rev=349856&r1=349855&r2=349856&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
 Thu Dec 20 15:38:19 2018
@@ -67,9 +67,24 @@ class FrameRecognizerTestCase(TestBase):
 self.expect("frame variable",
 substrs=['(int) a = 42', '(int) b = 56'])
 
-opts = lldb.SBVariablesOptions();
-opts.SetIncludeRecognizedArguments(True);
-variables = frame.GetVariables(opts);
+# Recognized arguments don't show up by default...
+variables = frame.GetVariables(lldb.SBVariablesOptions())
+self.assertEqual(variables.GetSize(), 0)
+
+# ...unless you set target.display-recognized-arguments to 1...
+self.runCmd("settings set target.display-recognized-arguments 1")
+variables = frame.GetVariables(lldb.SBVariablesOptions())
+self.assertEqual(variables.GetSize(), 2)
+
+# ...and you can reset it back to 0 to hide them again...
+self.runCmd("settings set target.display-recognized-arguments 0")
+variables = frame.GetVariables(lldb.SBVariablesOptions())
+self.assertEqual(variables.GetSize(), 0)
+
+# ... or explicitly ask for them with 
SetIncludeRecognizedArguments(True).
+opts = lldb.SBVariablesOptions()
+opts.SetIncludeRecognizedArguments(True)
+variables = frame.GetVariables(opts)
 
 self.assertEqual(variables.GetSize(), 2)
 self.assertEqual(variables.GetValueAtIndex(0).name, "a")

Modified: lldb/trunk/scripts/interface/SBVariablesOptions.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBVariablesOptions.i?rev=349856&r1=349855&r2=349856&view=diff
==
--- lldb/trunk/scripts/interf

[Lldb-commits] [PATCH] D55954: [lldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default

2018-12-20 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB349856: [lldb] Add a 
"display-recognized-arguments" target setting to show recognized… 
(authored by kuba.brecka, committed by ).

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55954

Files:
  include/lldb/API/SBTarget.h
  include/lldb/API/SBVariablesOptions.h
  include/lldb/Target/Target.h
  
packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
  scripts/interface/SBVariablesOptions.i
  source/API/SBFrame.cpp
  source/API/SBVariablesOptions.cpp
  source/Target/Target.cpp

Index: source/API/SBFrame.cpp
===
--- source/API/SBFrame.cpp
+++ source/API/SBFrame.cpp
@@ -957,7 +957,8 @@
 
   const bool statics = options.GetIncludeStatics();
   const bool arguments = options.GetIncludeArguments();
-  const bool recognized_arguments = options.GetIncludeRecognizedArguments();
+  const bool recognized_arguments =
+options.GetIncludeRecognizedArguments(SBTarget(exe_ctx.GetTargetSP()));
   const bool locals = options.GetIncludeLocals();
   const bool in_scope_only = options.GetInScopeOnly();
   const bool include_runtime_support_values =
Index: source/API/SBVariablesOptions.cpp
===
--- source/API/SBVariablesOptions.cpp
+++ source/API/SBVariablesOptions.cpp
@@ -9,6 +9,10 @@
 //===--===//
 
 #include "lldb/API/SBVariablesOptions.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/Target/Target.h"
+
+#include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -16,9 +20,10 @@
 class VariablesOptionsImpl {
 public:
   VariablesOptionsImpl()
-  : m_include_arguments(false), m_include_recognized_arguments(false),
-m_include_locals(false), m_include_statics(false),
-m_in_scope_only(false), m_include_runtime_support_values(false),
+  : m_include_arguments(false), m_include_locals(false),
+m_include_statics(false), m_in_scope_only(false),
+m_include_runtime_support_values(false),
+m_include_recognized_arguments(eLazyBoolCalculate),
 m_use_dynamic(lldb::eNoDynamicValues) {}
 
   VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
@@ -31,12 +36,14 @@
 
   void SetIncludeArguments(bool b) { m_include_arguments = b; }
 
-  bool GetIncludeRecognizedArguments() const {
-return m_include_recognized_arguments;
+  bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
+if (m_include_recognized_arguments != eLazyBoolCalculate)
+return m_include_recognized_arguments;
+return target_sp ? target_sp->GetDisplayRecognizedArguments() : false;
   }
 
   void SetIncludeRecognizedArguments(bool b) {
-m_include_recognized_arguments = b;
+m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
   }
 
   bool GetIncludeLocals() const { return m_include_locals; }
@@ -65,11 +72,11 @@
 
 private:
   bool m_include_arguments : 1;
-  bool m_include_recognized_arguments : 1;
   bool m_include_locals : 1;
   bool m_include_statics : 1;
   bool m_in_scope_only : 1;
   bool m_include_runtime_support_values : 1;
+  LazyBool m_include_recognized_arguments; // can be overridden with a setting
   lldb::DynamicValueType m_use_dynamic;
 };
 
@@ -97,8 +104,9 @@
   m_opaque_ap->SetIncludeArguments(arguments);
 }
 
-bool SBVariablesOptions::GetIncludeRecognizedArguments() const {
-  return m_opaque_ap->GetIncludeRecognizedArguments();
+bool SBVariablesOptions::GetIncludeRecognizedArguments(
+const lldb::SBTarget &target) const {
+  return m_opaque_ap->GetIncludeRecognizedArguments(target.GetSP());
 }
 
 void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -3356,6 +3356,8 @@
 {"display-runtime-support-values", OptionValue::eTypeBoolean, false, false,
  nullptr, {}, "If true, LLDB will show variables that are meant to "
   "support the operation of a language's runtime support."},
+{"display-recognized-arguments", OptionValue::eTypeBoolean, false, false,
+ nullptr, {}, "Show recognized arguments in variable listings by default."},
 {"non-stop-mode", OptionValue::eTypeBoolean, false, 0, nullptr, {},
  "Disable lock-step debugging, instead control threads independently."},
 {"require-hardware-breakpoint", OptionValue::eTypeBoolean, false, 0,
@@ -3404,6 +3406,7 @@
   ePropertyDisplayExpressionsInCrashlogs,
   ePropertyTrapHandlerNames,
   ePropertyDisplayRuntimeSupportValues,
+  ePropertyDisplayRecognizedArguments,
   ePropertyNonStopModeEnabled,
   ePropertyRequireHardwareBreakpoints,
   ePropertyEx

[Lldb-commits] [lldb] r349858 - Fix stack-buffer-overflow in lldb_private::Host::FindProcesses

2018-12-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Dec 20 15:45:26 2018
New Revision: 349858

URL: http://llvm.org/viewvc/llvm-project?rev=349858&view=rev
Log:
Fix stack-buffer-overflow in lldb_private::Host::FindProcesses

Found by the address sanitizer on GreenDragon:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-sanitized/1628/console

Modified:
lldb/trunk/source/Host/macosx/objcxx/Host.mm

Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=349858&r1=349857&r2=349858&view=diff
==
--- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Thu Dec 20 15:45:26 2018
@@ -627,7 +627,7 @@ uint32_t Host::FindProcesses(const Proce
   int mib[3] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL};
 
   size_t pid_data_size = 0;
-  if (::sysctl(mib, 4, NULL, &pid_data_size, NULL, 0) != 0)
+  if (::sysctl(mib, 3, NULL, &pid_data_size, NULL, 0) != 0)
 return 0;
 
   // Add a few extra in case a few more show up


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


[Lldb-commits] [lldb] r349861 - Fix typo

2018-12-20 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Dec 20 15:50:32 2018
New Revision: 349861

URL: http://llvm.org/viewvc/llvm-project?rev=349861&view=rev
Log:
Fix typo

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=349861&r1=349860&r2=349861&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Thu Dec 20 15:50:32 
2018
@@ -810,6 +810,6 @@ def skipUnlessFeature(feature):
 def skipIfSanitized(func):
 """Skip this test if the environment is set up to run LLDB itself under 
ASAN."""
 def is_sanitized():
-return (('DYLD_INSERT_LIBRARIES' in os.env) and
-'libclang_rt.asan' in os.env['DYLD_INSERT_LIBRARIES'])
+return (('DYLD_INSERT_LIBRARIES' in os.environ) and
+'libclang_rt.asan' in os.environ['DYLD_INSERT_LIBRARIES'])
 return skipTestIfFn(is_sanitized)(func)


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


[Lldb-commits] [lldb] r349864 - Remove ineffective (misspelled) sanitizer option

2018-12-20 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Dec 20 17:09:14 2018
New Revision: 349864

URL: http://llvm.org/viewvc/llvm-project?rev=349864&view=rev
Log:
Remove ineffective (misspelled) sanitizer option

Modified:
lldb/trunk/lit/Suite/lit.cfg

Modified: lldb/trunk/lit/Suite/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.cfg?rev=349864&r1=349863&r2=349864&view=diff
==
--- lldb/trunk/lit/Suite/lit.cfg (original)
+++ lldb/trunk/lit/Suite/lit.cfg Thu Dec 20 17:09:14 2018
@@ -29,7 +29,7 @@ if 'Address' in config.llvm_use_sanitize
   runtime = os.path.join(resource_dir, 'lib', 'darwin',
  'libclang_rt.asan_osx_dynamic.dylib')
   config.environment['ASAN_OPTIONS'] = \
-'detect_stack_use_after_return=1:container_overflow=0'
+'detect_stack_use_after_return=1'
   config.environment['DYLD_INSERT_LIBRARIES'] = runtime
 
 # Build dotest command.


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


[Lldb-commits] [lldb] r349865 - Add an assertion to aid in tracking down a bug

2018-12-20 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Dec 20 17:09:15 2018
New Revision: 349865

URL: http://llvm.org/viewvc/llvm-project?rev=349865&view=rev
Log:
Add an assertion to aid in tracking down a bug

Modified:
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/source/Target/Thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=349865&r1=349864&r2=349865&view=diff
==
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu Dec 20 17:09:15 2018
@@ -1038,9 +1038,11 @@ void Thread::PushPlan(ThreadPlanSP &thre
   if (thread_plan_sp) {
 // If the thread plan doesn't already have a tracer, give it its parent's
 // tracer:
-if (!thread_plan_sp->GetThreadPlanTracer())
+if (!thread_plan_sp->GetThreadPlanTracer()) {
+  assert(!m_plan_stack.empty());
   thread_plan_sp->SetThreadPlanTracer(
   m_plan_stack.back()->GetThreadPlanTracer());
+}
 m_plan_stack.push_back(thread_plan_sp);
 
 thread_plan_sp->DidPush();


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


[Lldb-commits] [lldb] r349869 - Fix stack-buffer-overflow in lldb_private::Host::FindProcesses (2/2)

2018-12-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Dec 20 17:22:58 2018
New Revision: 349869

URL: http://llvm.org/viewvc/llvm-project?rev=349869&view=rev
Log:
Fix stack-buffer-overflow in lldb_private::Host::FindProcesses (2/2)

This fixes the second call at line 640 that I missed in r349858.

Modified:
lldb/trunk/source/Host/macosx/objcxx/Host.mm

Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=349869&r1=349868&r2=349869&view=diff
==
--- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Thu Dec 20 17:22:58 2018
@@ -627,7 +627,7 @@ uint32_t Host::FindProcesses(const Proce
   int mib[3] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL};
 
   size_t pid_data_size = 0;
-  if (::sysctl(mib, 3, NULL, &pid_data_size, NULL, 0) != 0)
+  if (::sysctl(mib, 3, nullptr, &pid_data_size, nullptr, 0) != 0)
 return 0;
 
   // Add a few extra in case a few more show up
@@ -637,7 +637,7 @@ uint32_t Host::FindProcesses(const Proce
   kinfos.resize(estimated_pid_count);
   pid_data_size = kinfos.size() * sizeof(struct kinfo_proc);
 
-  if (::sysctl(mib, 4, &kinfos[0], &pid_data_size, NULL, 0) != 0)
+  if (::sysctl(mib, 3, &kinfos[0], &pid_data_size, nullptr, 0) != 0)
 return 0;
 
   const size_t actual_pid_count = (pid_data_size / sizeof(struct kinfo_proc));


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


[Lldb-commits] [lldb] r349874 - "help finish" tells you it is an alias. "help fin" doesn't.

2018-12-20 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Dec 20 17:45:28 2018
New Revision: 349874

URL: http://llvm.org/viewvc/llvm-project?rev=349874&view=rev
Log:
"help finish" tells you it is an alias.  "help fin" doesn't.

They both run the same command, and people get used to typing the shortest
string they can, so we should support alias info on shortened strings as well.



Modified:
lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py
lldb/trunk/source/Commands/CommandObjectHelp.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py?rev=349874&r1=349873&r2=349874&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/help/TestHelp.py Thu Dec 20 
17:45:28 2018
@@ -231,6 +231,17 @@ class HelpCommandTestCase(TestBase):
 self.expect("help averyfriendlyalias", matching=True,
 substrs=['I am a very friendly alias'])
 @no_debug_info_test
+def test_alias_prints_origin(self):
+"""Test that 'help ' prints the alias origin."""
+def cleanup():
+self.runCmd('command unalias alongaliasname', check=False)
+
+self.addTearDownHook(cleanup)
+self.runCmd('command alias alongaliasname help')
+self.expect("help alongaliasna", matching=True,
+substrs=["'alongaliasna' is an abbreviation for 'help'"])
+
+@no_debug_info_test
 def test_help_format_output(self):
 """Test that help output reaches TerminalWidth."""
 self.runCmd(

Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=349874&r1=349873&r2=349874&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Thu Dec 20 17:45:28 2018
@@ -167,10 +167,13 @@ bool CommandObjectHelp::DoExecute(Args &
   }
 
   sub_cmd_obj->GenerateHelpText(result);
-
-  if (m_interpreter.AliasExists(command_name)) {
+  std::string alias_full_name;
+  // Don't use AliasExists here, that only checks exact name matches.  If
+  // the user typed a shorter unique alias name, we should still tell them
+  // it was an alias.
+  if (m_interpreter.GetAliasFullName(command_name, alias_full_name)) {
 StreamString sstr;
-m_interpreter.GetAlias(command_name)->GetAliasExpansion(sstr);
+m_interpreter.GetAlias(alias_full_name)->GetAliasExpansion(sstr);
 result.GetOutputStream().Printf("\n'%s' is an abbreviation for %s\n",
 command[0].c_str(), sstr.GetData());
   }


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