[Lldb-commits] [PATCH] D55757: ELF: Don't create sections for section 0

2018-12-17 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, krytarowski, joerg.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

The first section header does not define a real section. Instead it is
used for various elf extensions. This patch skips creation of a section
for index 0.

This has one furtunate side-effect, as it allows us to use the section
header index as the Section ID (where 0 is also invalid), and allows us
to get rid of a lot of spurious +1s in the ObjectFileELF code.


https://reviews.llvm.org/D55757

Files:
  lit/Modules/ELF/many-sections.s
  lit/Modules/MachO/subsections.yaml
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -732,6 +732,7 @@
 assert(S);
 AutoIndent Indent(Printer, 2);
 Printer.formatLine("Index: {0}", I);
+Printer.formatLine("ID: {0}", S->GetID());
 Printer.formatLine("Name: {0}", S->GetName().GetStringRef());
 Printer.formatLine("Type: {0}", S->GetTypeAsCString());
 Printer.formatLine("Permissions: {0}", GetPermissionsAsCString(S->GetPermissions()));
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.h
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -220,10 +220,10 @@
   /// The address class for each symbol in the elf file
   FileAddressToAddressClassMap m_address_class_map;
 
-  /// Returns a 1 based index of the given section header.
+  /// Returns the index of the given section header.
   size_t SectionIndex(const SectionHeaderCollIter &I);
 
-  /// Returns a 1 based index of the given section header.
+  /// Returns the index of the given section header.
   size_t SectionIndex(const SectionHeaderCollConstIter &I) const;
 
   // Parses the ELF program headers.
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -889,11 +889,11 @@
 }
 
 size_t ObjectFileELF::SectionIndex(const SectionHeaderCollIter &I) {
-  return std::distance(m_section_headers.begin(), I) + 1u;
+  return std::distance(m_section_headers.begin(), I);
 }
 
 size_t ObjectFileELF::SectionIndex(const SectionHeaderCollConstIter &I) const {
-  return std::distance(m_section_headers.begin(), I) + 1u;
+  return std::distance(m_section_headers.begin(), I);
 }
 
 bool ObjectFileELF::ParseHeader() {
@@ -1081,7 +1081,7 @@
 return 0;
   // sh_link: section header index of string table used by entries in the
   // section.
-  Section *dynstr = section_list->FindSectionByID(header->sh_link + 1).get();
+  Section *dynstr = section_list->FindSectionByID(header->sh_link).get();
   if (!dynstr)
 return 0;
 
@@ -1717,10 +1717,10 @@
 
 const ObjectFileELF::ELFSectionHeaderInfo *
 ObjectFileELF::GetSectionHeaderByIndex(lldb::user_id_t id) {
-  if (!id || !ParseSectionHeaders())
+  if (!ParseSectionHeaders())
 return NULL;
 
-  if (--id < m_section_headers.size())
+  if (id < m_section_headers.size())
 return &m_section_headers[id];
 
   return NULL;
@@ -1853,7 +1853,7 @@
 m_sections_ap.reset(new SectionList());
 
 VMAddressProvider address_provider(CalculateType());
-for (SectionHeaderCollIter I = m_section_headers.begin();
+for (SectionHeaderCollIter I = std::next(m_section_headers.begin());
  I != m_section_headers.end(); ++I) {
   const ELFSectionHeaderInfo &header = *I;
 
@@ -2000,7 +2000,7 @@
   symbol_type = eSymbolTypeUndefined;
   break;
 default:
-  symbol_section_sp = section_list->GetSectionAtIndex(section_idx);
+  symbol_section_sp = section_list->FindSectionByID(section_idx);
   break;
 }
 
@@ -2282,9 +2282,8 @@
   assert(symtab_hdr->sh_type == SHT_SYMTAB ||
  symtab_hdr->sh_type == SHT_DYNSYM);
 
-  // sh_link: section header index of associated string table. Section ID's are
-  // ones based.
-  user_id_t strtab_id = symtab_hdr->sh_link + 1;
+  // sh_link: section header index of associated string table.
+  user_id_t strtab_id = symtab_hdr->sh_link;
   Section *strtab = section_list->FindSectionByID(strtab_id).get();
 
   if (symtab && strtab) {
@@ -2494,10 +2493,6 @@
   if (!symtab_id || !plt_id)
 return 0;
 
-  // Section ID's are ones based;
-  symtab_id++;
-  plt_id++;
-
   const ELFSectionHeaderInfo *plt_hdr = GetSectionHeaderByIndex(plt_id);
   if (!plt_hdr)
 return 0;
@@ -2523,7 +2518,7 @@
 return 0;
 
   // sh_link points to associated string table.
-  Section *strtab = section_list->FindSectionByID(sym_hdr->sh_link + 1).get();
+  Section *strtab = section_list->FindSectionByID(sym_hdr->sh_link

[Lldb-commits] [PATCH] D55761: lldb-test ir-memory-map: Use IntervalMap::contains

2018-12-17 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added a reviewer: vsk.

Simplify the code by using the contains implementation in IntervalMap.

There is a slight change of behavior here: We now treat an allocation of
size 0, as if it was size 1. This guarantees that the returned addresses
will be unique, whereas previously we would allow the allocation
function to return the same zero-sized region multiple times, as long as
it is not null, and not in the middle of an existing interval (but the
situation when we were placing an larger interval over a zero-sized one
was not detected).

I think this behavior makes more sense, as that is pretty much the same
guarantee as offered by malloc (except that is permitted to also return
nullptr).


https://reviews.llvm.org/D55761

Files:
  tools/lldb-test/lldb-test.cpp


Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -209,7 +209,6 @@
   : Target(Target), Map(Target), Allocations(IntervalMapAllocator) {}
 };
 
-bool areAllocationsOverlapping(const AllocationT &L, const AllocationT &R);
 bool evalMalloc(StringRef Line, IRMemoryMapTestState &State);
 bool evalFree(StringRef Line, IRMemoryMapTestState &State);
 int evaluateMemoryMapCommands(Debugger &Dbg);
@@ -808,13 +807,6 @@
   return HadErrors;
 }
 
-/// Check if two half-open intervals intersect:
-///   http://world.std.com/~swmcd/steven/tech/interval.html
-bool opts::irmemorymap::areAllocationsOverlapping(const AllocationT &L,
-  const AllocationT &R) {
-  return R.first < L.second && L.first < R.second;
-}
-
 bool opts::irmemorymap::evalMalloc(StringRef Line,
IRMemoryMapTestState &State) {
   // ::=  = malloc  
@@ -861,28 +853,21 @@
 exit(1);
   }
 
-  // Check that the allocation does not overlap another allocation. Do so by
-  // testing each allocation which may cover the interval [Addr, EndOfRegion).
-  addr_t EndOfRegion = Addr + Size;
-  auto Probe = State.Allocations.begin();
-  Probe.advanceTo(Addr); //< First interval s.t stop >= Addr.
-  AllocationT NewAllocation = {Addr, EndOfRegion};
-  while (Probe != State.Allocations.end() && Probe.start() < EndOfRegion) {
-AllocationT ProbeAllocation = {Probe.start(), Probe.stop()};
-if (areAllocationsOverlapping(ProbeAllocation, NewAllocation)) {
-  outs() << "Malloc error: overlapping allocation detected"
- << formatv(", previous allocation at [{0:x}, {1:x})\n",
-Probe.start(), Probe.stop());
-  exit(1);
-}
-++Probe;
+  // In case of Size == 0, we still expect the returned address to be unique 
and
+  // non-overlapping.
+  addr_t EndOfRegion = Addr + std::max(Size, 1);
+  if (State.Allocations.contains(Addr, EndOfRegion)) {
+auto I = State.Allocations.find(Addr);
+outs() << "Malloc error: overlapping allocation detected"
+   << formatv(", previous allocation at [{0:x}, {1:x})\n", I.start(),
+  I.stop());
+exit(1);
   }
 
   // Insert the new allocation into the interval map. Use unique allocation
   // IDs to inhibit interval coalescing.
   static unsigned AllocationID = 0;
-  if (Size)
-State.Allocations.insert(Addr, EndOfRegion, AllocationID++);
+  State.Allocations.insert(Addr, EndOfRegion, AllocationID++);
 
   // Store the label -> address mapping.
   State.Label2AddrMap[Label] = Addr;


Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -209,7 +209,6 @@
   : Target(Target), Map(Target), Allocations(IntervalMapAllocator) {}
 };
 
-bool areAllocationsOverlapping(const AllocationT &L, const AllocationT &R);
 bool evalMalloc(StringRef Line, IRMemoryMapTestState &State);
 bool evalFree(StringRef Line, IRMemoryMapTestState &State);
 int evaluateMemoryMapCommands(Debugger &Dbg);
@@ -808,13 +807,6 @@
   return HadErrors;
 }
 
-/// Check if two half-open intervals intersect:
-///   http://world.std.com/~swmcd/steven/tech/interval.html
-bool opts::irmemorymap::areAllocationsOverlapping(const AllocationT &L,
-  const AllocationT &R) {
-  return R.first < L.second && L.first < R.second;
-}
-
 bool opts::irmemorymap::evalMalloc(StringRef Line,
IRMemoryMapTestState &State) {
   // ::=  = malloc  
@@ -861,28 +853,21 @@
 exit(1);
   }
 
-  // Check that the allocation does not overlap another allocation. Do so by
-  // testing each allocation which may cover the interval [Addr, EndOfRegion).
-  addr_t EndOfRegion = Addr + Size;
-  auto Probe = State.Allocations.begin();
-  Probe.advanceTo(Addr); //< First interval s.t stop >= Addr.
-  AllocationT NewAllocation = {Addr, EndOfRegion};
-  while (Probe != State.Allocations.end() && Probe.start() < EndOfRegi

[Lldb-commits] [lldb] r349360 - [Clang AST Context] Add a few helper functions.

2018-12-17 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Dec 17 08:15:13 2018
New Revision: 349360

URL: http://llvm.org/viewvc/llvm-project?rev=349360&view=rev
Log:
[Clang AST Context] Add a few helper functions.

The first one allows us to add an enumerator to an enum if we
already have an APSInt, since ultimately the implementation just
constructs one anyway.  The second is just a general utility
function to covert a CompilerType to a clang::TagDecl.

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/ClangUtil.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/ClangUtil.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=349360&r1=349359&r2=349360&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Mon Dec 17 08:15:13 2018
@@ -24,6 +24,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ExternalASTMerger.h"
 #include "clang/AST/TemplateBase.h"
+#include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/SmallVector.h"
 
 #include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
@@ -902,6 +903,9 @@ public:
   clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
   const CompilerType &enum_type, const Declaration &decl, const char *name,
   int64_t enum_value, uint32_t enum_value_bit_size);
+  clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
+  const CompilerType &enum_type, const Declaration &decl, const char *name,
+  const llvm::APSInt &value);
 
   CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type);
 

Modified: lldb/trunk/include/lldb/Symbol/ClangUtil.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangUtil.h?rev=349360&r1=349359&r2=349360&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangUtil.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangUtil.h Mon Dec 17 08:15:13 2018
@@ -16,6 +16,10 @@
 
 #include "lldb/Symbol/CompilerType.h"
 
+namespace clang {
+class TagDecl;
+}
+
 namespace lldb_private {
 struct ClangUtil {
   static bool IsClangType(const CompilerType &ct);
@@ -25,6 +29,8 @@ struct ClangUtil {
   static clang::QualType GetCanonicalQualType(const CompilerType &ct);
 
   static CompilerType RemoveFastQualifiers(const CompilerType &ct);
+
+  static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
 };
 }
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=349360&r1=349359&r2=349360&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Dec 17 08:15:13 2018
@@ -7827,11 +7827,7 @@ clang::RecordDecl *ClangASTContext::GetA
 }
 
 clang::TagDecl *ClangASTContext::GetAsTagDecl(const CompilerType &type) {
-  clang::QualType qual_type = ClangUtil::GetCanonicalQualType(type);
-  if (qual_type.isNull())
-return nullptr;
-  else
-return qual_type->getAsTagDecl();
+  return ClangUtil::GetAsTagDecl(type);
 }
 
 clang::TypedefNameDecl *
@@ -8937,7 +8933,7 @@ bool ClangASTContext::CompleteTagDeclara
 
 clang::EnumConstantDecl *ClangASTContext::AddEnumerationValueToEnumerationType(
 const CompilerType &enum_type, const Declaration &decl, const char *name,
-int64_t enum_value, uint32_t enum_value_bit_size) {
+const llvm::APSInt &value) {
 
   if (!enum_type || ConstString(name).IsEmpty())
 return nullptr;
@@ -8950,14 +8946,9 @@ clang::EnumConstantDecl *ClangASTContext
   if (!enum_opaque_compiler_type)
 return nullptr;
 
-  CompilerType underlying_type =
-  GetEnumerationIntegerType(enum_type.GetOpaqueQualType());
-
   clang::QualType enum_qual_type(
   GetCanonicalQualType(enum_opaque_compiler_type));
 
-  bool is_signed = false;
-  underlying_type.IsIntegerType(is_signed);
   const clang::Type *clang_type = enum_qual_type.getTypePtr();
 
   if (!clang_type)
@@ -8968,12 +8959,10 @@ clang::EnumConstantDecl *ClangASTContext
   if (!enutype)
 return nullptr;
 
-  llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed);
-  enum_llvm_apsint = enum_value;
   clang::EnumConstantDecl *enumerator_decl = clang::EnumConstantDecl::Create(
   *getASTContext(), enutype->getDecl(), clang::SourceLocation(),
   name ? &getASTContext()->Idents.get(name) : nullptr, // Identifier
-  clang::QualType(enutype, 0), nullptr, enum_llvm_apsint);
+  clang::QualType(enutype, 0), nullptr, value);
 
   if (!enumerator_decl)
 return nullptr;
@@ -8987,6 +8976,20 @@ clang::EnumConstantDecl *ClangASTContext
   return enumerator_decl;
 }
 
+clang::EnumC

[Lldb-commits] [PATCH] D55142: Minidump debugging using the native PDB reader

2018-12-17 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

I thought about what my "ideal" design would look like.  I'm not suggesting 
anyone should actually go off and do this, but since we're brainstorming design 
anyway, it doesn't hurt to consider what an optimal one should look like (and 
for the record, there may be things I haven't considered that cuase this design 
to not work or be suboptimal or not work at all).  Just throwing it out there.

1. Rename `ObjectFile` to `ModuleFile` to indicate that a) it makes no sense 
without a Module, and b) it doesn't make sense for symbol-only files.

2. Rename `SymbolVendor` to `SymbolFileLocator`.  Mostly cosmetic, but more 
clearly differentiates the responsibilities of the two classes.  (e.g. wouldn't 
you expect SymbolFiles to be able to "vend" symbols)?

3. `SymbolFileLocator` returns a `unique_ptr`.  Nothing more.  It 
has no other methods.

4. `Target` contains a `vector>` as well as 
methods `AddSymbolFileLocator(unique_ptr)` and 
`unique_ptr LocateSymboleFile(Module&)`.  The former gives things 
like the Platform or Process the ability to customize the behavior.  The 
latter, when called, will iterate through the list of `SymbolFileLocators`, 
trying to find one that works.

5. `Module` contains a `unique_ptr`.  When `GetSymbolFile()` is 
called for the first time, it calls `Target::LocateSymbolFile(*this)` and 
updates its member variable.

6. `ModuleFile` is updated to support "capabilities" much like `SymbolFile` is 
today.  One of these capabilities can be "has unwind info".  Likewise, "has 
unwind info is added to `SymbolFile` capabilities as well.  `Module` can then 
select the best provider of unwind info using this approach.

And finally

7. `SymbolFile` now stores a variable `m_module` instead of `m_obj_file` since 
this is usually what the `SymbolFile` requires anyway, and it also eliminates 
the dependency on `SymbolFile` being backed by an `ObjectFile`.  Note that in 
this case, a `SymbolFileBreakpad` for example would have its `m_module` 
variable set to the actual module that its providing symbols for.


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

https://reviews.llvm.org/D55142



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


[Lldb-commits] [PATCH] D55757: ELF: Don't create sections for section header index 0

2018-12-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good. See inline comment and fix if you agree.




Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1993
 SymbolType symbol_type = eSymbolTypeInvalid;
 Elf64_Half section_idx = symbol.st_shndx;
 

Should we rename "section_idx" to "shndx" to make sure people know it is not a 
section index, but the ELF version of it?


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

https://reviews.llvm.org/D55757



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


[Lldb-commits] [PATCH] D55608: Make crashlog.py work or binaries with spaces in their names

2018-12-17 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 178476.
aprantl added a comment.

Got rid of the no_uuid regex and added even more testcases.


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

https://reviews.llvm.org/D55608

Files:
  examples/python/crashlog.py
  lit/Python/crashlog.test

Index: lit/Python/crashlog.test
===
--- /dev/null
+++ lit/Python/crashlog.test
@@ -0,0 +1,98 @@
+# -*- python -*-
+# RUN: cd %S/../../examples/python && %lldb -S %s | FileCheck %s
+# CHECK-LABEL: {{S}}KIP BEYOND CHECKS
+script
+import crashlog
+cl = crashlog.CrashLog
+images = [
+"0x10b60b000 - 0x10f707fff com.apple.LLDB.framework (1.1000.11.38.2 - 1000.11.38.2) <96E36F5C-1A83-39A1-8713-5FDD9701C3F1> /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB",
+# CHECK: 0x10b60b000
+# CHECK: 0x10f707fff
+# CHECK: com.apple.LLDB.framework
+# CHECK: 96E36F5C-1A83-39A1-8713-5FDD9701C3F1
+# CHECK: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB
+
+"0x104591000 - 0x1055cfff7 +llvm-dwarfdump (0)  /Users/USER 1/Documents/*/llvm-dwarfdump",
+# CHECK: 0x104591000
+# CHECK: 0x1055cfff7
+# CHECK: llvm-dwarfdump
+# CHECK: (0)
+# CHECK: B104CFA1-046A-36A6-8EB4-07DDD7CC2DF3
+# CHECK: /Users/USER 1/Documents/*/llvm-dwarfdump
+
+"0x7fff63f2 - 0x7fff63f77ff7  libc++.1.dylib (400.9.4)  /usr/lib/libc++.1.dylib",
+# CHECK: 0x7fff63f2
+# CHECK: 0x7fff63f77ff7
+# CHECK: libc++.1.dylib
+# CHECK: (400.9.4)
+# CHECK: D4AB366F-48A9-3C7D-91BD-41198F69DD57
+# CHECK: /usr/lib/libc++.1.dylib
+
+"0x111 - 0x2 +MyApp Pro arm64  <01234> /tmp/MyApp Pro.app/MyApp Pro",
+# CHECK: 0x111
+# CHECK: 0x2
+# CHECK: MyApp Pro arm64
+# CHECK: None
+# CHECK: 01234
+# CHECK: /tmp/MyApp Pro.app/MyApp Pro
+
+"0x111 - 0x2 +MyApp Pro (0) <01234> /tmp/MyApp Pro.app/MyApp Pro",
+# CHECK: 0x111
+# CHECK: 0x2
+# CHECK: MyApp Pro
+# CHECK: (0)
+# CHECK: 01234
+# CHECK: /tmp/MyApp Pro.app/MyApp Pro
+
+"0x7fff63f2 - 0x7fff63f77ff7  libc++.1.dylib (400.9.4) /usr/lib/libc++.1.dylib"
+# CHECK: 0x7fff63f2
+# CHECK: 0x7fff63f77ff7
+# CHECK: libc++.1.dylib
+# CHECK: (400.9.4)
+# CHECK: None
+# CHECK: /usr/lib/libc++.1.dylib
+]
+# CHECK-LABEL: FRAMES
+frames = [
+"0 libsystem_kernel.dylib	0x7fff684b78a6 read + 10",
+# CHECK: 0
+# CHECK: libsystem_kernel.dylib
+# CHECK: 0x7fff684b78a6
+# CHECK: read + 10
+"1   com.apple.LLDB.framework  	0x00010f7954af lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 105",
+# CHECK: 1
+# CHECK: com.apple.LLDB.framework
+# CHECK: 0x00010f7954af
+# CHECK: lldb_private{{.*}} + 105
+"2   MyApp Pro arm64	0x00019b0db3a8 foo + 72",
+# CHECK: 2
+# CHECK: MyApp Pro arm64
+# CHECK: 0x00019b0db3a8
+# CHECK: foo + 72
+"3   He 0x1	0x00019b0db3a8 foo + 72"
+# CHECK: 3
+# CHECK: He 0x1
+# CHECK: 0x00019b0db3a8
+# CHECK: foo + 72
+]
+
+
+# Avoid matching the text inside the input.
+print("SKIP BEYOND CHECKS")
+for image in images:
+print('"%s"'%image)
+print("--")
+match = cl.image_regex_uuid.search(image)
+for group in match.groups():
+print(group)
+
+print("FRAMES")
+for frame in frames:
+print('"%s"'%frame)
+print("--")
+match = cl.frame_regex.search(frame)
+for group in match.groups():
+print(group)
+
+exit()
+quit
Index: examples/python/crashlog.py
===
--- examples/python/crashlog.py
+++ examples/python/crashlog.py
@@ -94,11 +94,9 @@
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
-frame_regex = re.compile('^([0-9]+)\s+([^ ]+)\s+(0x[0-9a-fA-F]+) +(.*)')
+frame_regex = re.compile('^([0-9]+)\s+(.+?)\s+(0x[0-9a-fA-F]{7}[0-9a-fA-F]+) +(.*)')
 image_regex_uuid = re.compile(
-'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^<]+)<([-0-9a-fA-F]+)> (.*)')
-image_regex_no_uuid = re.compile(
-'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^/]+)/(.*)')
+'(0x[0-9a-fA-F]+)[-\s]+(0x[0-9a-fA-F]+)\s+[+]?(.+?)\s+(\(.+\))?\s?(<([-0-9a-fA-F]+)>)? (.*)')
 empty_line_regex = re.compile('^$')
 
 class Thread:
@@ -481,21 +479,11 @@
  int(image_match.group(2), 0),
  image_match.group(3).strip(),
  image_match.group(4).strip(),
- uuid.UUID(image_match.group(5)),
- image_match.group(6))
+ uuid.UUID(image_match.group(6)),
+ image_match.group(7))
   

[Lldb-commits] [PATCH] D55608: Make crashlog.py work or binaries with spaces in their names

2018-12-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Looks good


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

https://reviews.llvm.org/D55608



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


[Lldb-commits] [PATCH] D55761: lldb-test ir-memory-map: Use IntervalMap::contains

2018-12-17 Thread Vedant Kumar via Phabricator via lldb-commits
vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

Thanks, lgtm!


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

https://reviews.llvm.org/D55761



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


[Lldb-commits] [PATCH] D55724: [ARC] Add SystemV ABI

2018-12-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55724



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


[Lldb-commits] [lldb] r349366 - Make crashlog.py work when a .dSYM is present, but a binary is missing

2018-12-17 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Mon Dec 17 09:25:57 2018
New Revision: 349366

URL: http://llvm.org/viewvc/llvm-project?rev=349366&view=rev
Log:
Make crashlog.py work when a .dSYM is present, but a binary is missing

Often users have a crash log an d a .dSYM bundle, but not the original
application binary. It turns out that for crash symbolication, we can
safely fall back to using the binary inside the .dSYM bundle.

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

Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=349366&r1=349365&r2=349366&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Mon Dec 17 09:25:57 2018
@@ -246,6 +246,25 @@ class CrashLog(symbolication.Symbolicato
 self.identifier = identifier
 self.version = version
 
+def find_matching_slice(self):
+dwarfdump_cmd_output = commands.getoutput(
+'dwarfdump --uuid "%s"' % self.path)
+self_uuid = self.get_uuid()
+for line in dwarfdump_cmd_output.splitlines():
+match = self.dwarfdump_uuid_regex.search(line)
+if match:
+dwarf_uuid_str = match.group(1)
+dwarf_uuid = uuid.UUID(dwarf_uuid_str)
+if self_uuid == dwarf_uuid:
+self.resolved_path = self.path
+self.arch = match.group(2)
+return True
+if not self.resolved_path:
+self.unavailable = True
+print("error\nerror: unable to locate '%s' with UUID %s"
+  % (self.path, uuid_str))
+return False
+
 def locate_module_and_debug_symbols(self):
 # Don't load a module twice...
 if self.resolved:
@@ -277,22 +296,25 @@ class CrashLog(symbolication.Symbolicato
 plist['DBGSymbolRichExecutable'])
 self.resolved_path = self.path
 if not self.resolved_path and os.path.exists(self.path):
-dwarfdump_cmd_output = commands.getoutput(
-'dwarfdump --uuid "%s"' % self.path)
-self_uuid = self.get_uuid()
-for line in dwarfdump_cmd_output.splitlines():
-match = self.dwarfdump_uuid_regex.search(line)
-if match:
-dwarf_uuid_str = match.group(1)
-dwarf_uuid = uuid.UUID(dwarf_uuid_str)
-if self_uuid == dwarf_uuid:
-self.resolved_path = self.path
-self.arch = match.group(2)
-break
-if not self.resolved_path:
-self.unavailable = True
-print "error\nerror: unable to locate '%s' with UUID 
%s" % (self.path, uuid_str)
+if not self.find_matching_slice():
 return False
+if not self.resolved_path and not os.path.exists(self.path):
+try:
+import subprocess
+dsym = subprocess.check_output(
+["/usr/bin/mdfind",
+ "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+if dsym and os.path.exists(dsym):
+print('falling back to binary inside "%s"'%dsym)
+self.symfile = dsym
+dwarf_dir = os.path.join(dsym, 
'Contents/Resources/DWARF')
+for filename in os.listdir(dwarf_dir):
+self.path = os.path.join(dwarf_dir, filename)
+if not self.find_matching_slice():
+return False
+break
+except:
+pass
 if (self.resolved_path and os.path.exists(self.resolved_path)) or (
 self.path and os.path.exists(self.path)):
 print 'ok'


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


[Lldb-commits] [lldb] r349367 - Make crashlog.py work or binaries with spaces in their names

2018-12-17 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Mon Dec 17 09:26:04 2018
New Revision: 349367

URL: http://llvm.org/viewvc/llvm-project?rev=349367&view=rev
Log:
Make crashlog.py work or binaries with spaces in their names

This is a little dangerous since the crashlog files aren't 100%
unambiguous, but the risk is mitigated by using a non-greedy +?
pattern.

rdar://problem/38478511

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

Added:
lldb/trunk/lit/Python/
lldb/trunk/lit/Python/crashlog.test
Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=349367&r1=349366&r2=349367&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Mon Dec 17 09:26:04 2018
@@ -94,11 +94,9 @@ class CrashLog(symbolication.Symbolicato
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
-frame_regex = re.compile('^([0-9]+)\s+([^ ]+)\s+(0x[0-9a-fA-F]+) +(.*)')
+frame_regex = 
re.compile('^([0-9]+)\s+(.+?)\s+(0x[0-9a-fA-F]{7}[0-9a-fA-F]+) +(.*)')
 image_regex_uuid = re.compile(
-'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) 
+([^<]+)<([-0-9a-fA-F]+)> (.*)')
-image_regex_no_uuid = re.compile(
-'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^/]+)/(.*)')
+
'(0x[0-9a-fA-F]+)[-\s]+(0x[0-9a-fA-F]+)\s+[+]?(.+?)\s+(\(.+\))?\s?(<([-0-9a-fA-F]+)>)?
 (.*)')
 empty_line_regex = re.compile('^$')
 
 class Thread:
@@ -477,25 +475,16 @@ class CrashLog(symbolication.Symbolicato
 elif parse_mode == PARSE_MODE_IMAGES:
 image_match = self.image_regex_uuid.search(line)
 if image_match:
-image = CrashLog.DarwinImage(int(image_match.group(1), 0),
- int(image_match.group(2), 0),
- image_match.group(3).strip(),
- image_match.group(4).strip(),
- 
uuid.UUID(image_match.group(5)),
- image_match.group(6))
+(img_lo, img_hi, img_name, img_version,
+ _, img_uuid, img_path) = image_match.groups()
+image = CrashLog.DarwinImage(int(img_lo, 0), int(img_hi, 
0),
+ img_name.strip(),
+ img_version.strip()
+ if img_version else "",
+ uuid.UUID(img_uuid), img_path)
 self.images.append(image)
 else:
-image_match = self.image_regex_no_uuid.search(line)
-if image_match:
-image = CrashLog.DarwinImage(int(image_match.group(1), 
0),
- int(image_match.group(2), 
0),
- 
image_match.group(3).strip(),
- 
image_match.group(4).strip(),
- None,
- image_match.group(5))
-self.images.append(image)
-else:
-print "error: image regex failed for: %s" % line
+print "error: image regex failed for: %s" % line
 
 elif parse_mode == PARSE_MODE_THREGS:
 stripped_line = line.strip()

Added: lldb/trunk/lit/Python/crashlog.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Python/crashlog.test?rev=349367&view=auto
==
--- lldb/trunk/lit/Python/crashlog.test (added)
+++ lldb/trunk/lit/Python/crashlog.test Mon Dec 17 09:26:04 2018
@@ -0,0 +1,99 @@
+# -*- python 
-*-
+# RUN: cd %S/../../examples/python && %lldb -S %s | FileCheck %s
+# REQUIRES : system-darwin
+# CHECK-LABEL: {{S}}KIP BEYOND CHECKS
+script
+import crashlog
+cl = crashlog.CrashLog
+images = [
+"0x10b60b000 - 0x10f707fff com.apple.LLDB.framework (1.1000.11.38.2 - 
1000.11.38.2) <96E36F5C-1A83-39A1-8713-5FDD9701C3F1> 
/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB",
+# CHECK: 0x10b60b000
+# CHECK: 0x10f707fff
+# CHECK: com.apple.LLDB.framework
+# CHECK: 96E36F5C-1A83-39A1-8713-5FDD9701C3F1
+# CHECK: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB
+
+"0x104591000 - 0x1055cfff7 +llvm-dwarfdump (0) 
 /Users/USER 
1/Doc

[Lldb-commits] [PATCH] D55608: Make crashlog.py work or binaries with spaces in their names

2018-12-17 Thread Phabricator via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349367: Make crashlog.py work or binaries with spaces in 
their names (authored by adrian, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55608?vs=178476&id=178481#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55608

Files:
  lldb/trunk/examples/python/crashlog.py
  lldb/trunk/lit/Python/crashlog.test

Index: lldb/trunk/lit/Python/crashlog.test
===
--- lldb/trunk/lit/Python/crashlog.test
+++ lldb/trunk/lit/Python/crashlog.test
@@ -0,0 +1,99 @@
+# -*- python -*-
+# RUN: cd %S/../../examples/python && %lldb -S %s | FileCheck %s
+# REQUIRES : system-darwin
+# CHECK-LABEL: {{S}}KIP BEYOND CHECKS
+script
+import crashlog
+cl = crashlog.CrashLog
+images = [
+"0x10b60b000 - 0x10f707fff com.apple.LLDB.framework (1.1000.11.38.2 - 1000.11.38.2) <96E36F5C-1A83-39A1-8713-5FDD9701C3F1> /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB",
+# CHECK: 0x10b60b000
+# CHECK: 0x10f707fff
+# CHECK: com.apple.LLDB.framework
+# CHECK: 96E36F5C-1A83-39A1-8713-5FDD9701C3F1
+# CHECK: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB
+
+"0x104591000 - 0x1055cfff7 +llvm-dwarfdump (0)  /Users/USER 1/Documents/*/llvm-dwarfdump",
+# CHECK: 0x104591000
+# CHECK: 0x1055cfff7
+# CHECK: llvm-dwarfdump
+# CHECK: (0)
+# CHECK: B104CFA1-046A-36A6-8EB4-07DDD7CC2DF3
+# CHECK: /Users/USER 1/Documents/*/llvm-dwarfdump
+
+"0x7fff63f2 - 0x7fff63f77ff7  libc++.1.dylib (400.9.4)  /usr/lib/libc++.1.dylib",
+# CHECK: 0x7fff63f2
+# CHECK: 0x7fff63f77ff7
+# CHECK: libc++.1.dylib
+# CHECK: (400.9.4)
+# CHECK: D4AB366F-48A9-3C7D-91BD-41198F69DD57
+# CHECK: /usr/lib/libc++.1.dylib
+
+"0x111 - 0x2 +MyApp Pro arm64  <01234> /tmp/MyApp Pro.app/MyApp Pro",
+# CHECK: 0x111
+# CHECK: 0x2
+# CHECK: MyApp Pro arm64
+# CHECK: None
+# CHECK: 01234
+# CHECK: /tmp/MyApp Pro.app/MyApp Pro
+
+"0x111 - 0x2 +MyApp Pro (0) <01234> /tmp/MyApp Pro.app/MyApp Pro",
+# CHECK: 0x111
+# CHECK: 0x2
+# CHECK: MyApp Pro
+# CHECK: (0)
+# CHECK: 01234
+# CHECK: /tmp/MyApp Pro.app/MyApp Pro
+
+"0x7fff63f2 - 0x7fff63f77ff7  libc++.1.dylib (400.9.4) /usr/lib/libc++.1.dylib"
+# CHECK: 0x7fff63f2
+# CHECK: 0x7fff63f77ff7
+# CHECK: libc++.1.dylib
+# CHECK: (400.9.4)
+# CHECK: None
+# CHECK: /usr/lib/libc++.1.dylib
+]
+# CHECK-LABEL: FRAMES
+frames = [
+"0 libsystem_kernel.dylib	0x7fff684b78a6 read + 10",
+# CHECK: 0
+# CHECK: libsystem_kernel.dylib
+# CHECK: 0x7fff684b78a6
+# CHECK: read + 10
+"1   com.apple.LLDB.framework  	0x00010f7954af lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 105",
+# CHECK: 1
+# CHECK: com.apple.LLDB.framework
+# CHECK: 0x00010f7954af
+# CHECK: lldb_private{{.*}} + 105
+"2   MyApp Pro arm64	0x00019b0db3a8 foo + 72",
+# CHECK: 2
+# CHECK: MyApp Pro arm64
+# CHECK: 0x00019b0db3a8
+# CHECK: foo + 72
+"3   He 0x1	0x00019b0db3a8 foo + 72"
+# CHECK: 3
+# CHECK: He 0x1
+# CHECK: 0x00019b0db3a8
+# CHECK: foo + 72
+]
+
+
+# Avoid matching the text inside the input.
+print("SKIP BEYOND CHECKS")
+for image in images:
+print('"%s"'%image)
+print("--")
+match = cl.image_regex_uuid.search(image)
+for group in match.groups():
+print(group)
+
+print("FRAMES")
+for frame in frames:
+print('"%s"'%frame)
+print("--")
+match = cl.frame_regex.search(frame)
+for group in match.groups():
+print(group)
+
+exit()
+quit
Index: lldb/trunk/examples/python/crashlog.py
===
--- lldb/trunk/examples/python/crashlog.py
+++ lldb/trunk/examples/python/crashlog.py
@@ -94,11 +94,9 @@
 thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
 app_backtrace_regex = re.compile(
 '^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
-frame_regex = re.compile('^([0-9]+)\s+([^ ]+)\s+(0x[0-9a-fA-F]+) +(.*)')
+frame_regex = re.compile('^([0-9]+)\s+(.+?)\s+(0x[0-9a-fA-F]{7}[0-9a-fA-F]+) +(.*)')
 image_regex_uuid = re.compile(
-'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^<]+)<([-0-9a-fA-F]+)> (.*)')
-image_regex_no_uuid = re.compile(
-'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^/]+)/(.*)')
+'(0x[0-9a-fA-F]+)[-\s]+(0x[0-9a-fA-F]+)\s+[+]?(.+?)\s+(\(.+\))?\s?(<([-0-9a-fA-F]+)>)? (.*)')
 empty_line_regex = re.compile('^$')
 
 class Thread:
@@ -477,25 +475,16 @@
 elif parse_mode == PARSE_MODE_IMAGES:
 image_match = self.image_regex_uuid.search(line)
 if ima

[Lldb-commits] [PATCH] D55607: Make crashlog.py work when a .dSYM is present, but a binary is missing

2018-12-17 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349366: Make crashlog.py work when a .dSYM is present, but a 
binary is missing (authored by adrian, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55607?vs=177886&id=178480#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55607

Files:
  lldb/trunk/examples/python/crashlog.py


Index: lldb/trunk/examples/python/crashlog.py
===
--- lldb/trunk/examples/python/crashlog.py
+++ lldb/trunk/examples/python/crashlog.py
@@ -246,6 +246,25 @@
 self.identifier = identifier
 self.version = version
 
+def find_matching_slice(self):
+dwarfdump_cmd_output = commands.getoutput(
+'dwarfdump --uuid "%s"' % self.path)
+self_uuid = self.get_uuid()
+for line in dwarfdump_cmd_output.splitlines():
+match = self.dwarfdump_uuid_regex.search(line)
+if match:
+dwarf_uuid_str = match.group(1)
+dwarf_uuid = uuid.UUID(dwarf_uuid_str)
+if self_uuid == dwarf_uuid:
+self.resolved_path = self.path
+self.arch = match.group(2)
+return True
+if not self.resolved_path:
+self.unavailable = True
+print("error\nerror: unable to locate '%s' with UUID %s"
+  % (self.path, uuid_str))
+return False
+
 def locate_module_and_debug_symbols(self):
 # Don't load a module twice...
 if self.resolved:
@@ -277,22 +296,25 @@
 plist['DBGSymbolRichExecutable'])
 self.resolved_path = self.path
 if not self.resolved_path and os.path.exists(self.path):
-dwarfdump_cmd_output = commands.getoutput(
-'dwarfdump --uuid "%s"' % self.path)
-self_uuid = self.get_uuid()
-for line in dwarfdump_cmd_output.splitlines():
-match = self.dwarfdump_uuid_regex.search(line)
-if match:
-dwarf_uuid_str = match.group(1)
-dwarf_uuid = uuid.UUID(dwarf_uuid_str)
-if self_uuid == dwarf_uuid:
-self.resolved_path = self.path
-self.arch = match.group(2)
-break
-if not self.resolved_path:
-self.unavailable = True
-print "error\nerror: unable to locate '%s' with UUID 
%s" % (self.path, uuid_str)
+if not self.find_matching_slice():
 return False
+if not self.resolved_path and not os.path.exists(self.path):
+try:
+import subprocess
+dsym = subprocess.check_output(
+["/usr/bin/mdfind",
+ "com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
+if dsym and os.path.exists(dsym):
+print('falling back to binary inside "%s"'%dsym)
+self.symfile = dsym
+dwarf_dir = os.path.join(dsym, 
'Contents/Resources/DWARF')
+for filename in os.listdir(dwarf_dir):
+self.path = os.path.join(dwarf_dir, filename)
+if not self.find_matching_slice():
+return False
+break
+except:
+pass
 if (self.resolved_path and os.path.exists(self.resolved_path)) or (
 self.path and os.path.exists(self.path)):
 print 'ok'


Index: lldb/trunk/examples/python/crashlog.py
===
--- lldb/trunk/examples/python/crashlog.py
+++ lldb/trunk/examples/python/crashlog.py
@@ -246,6 +246,25 @@
 self.identifier = identifier
 self.version = version
 
+def find_matching_slice(self):
+dwarfdump_cmd_output = commands.getoutput(
+'dwarfdump --uuid "%s"' % self.path)
+self_uuid = self.get_uuid()
+for line in dwarfdump_cmd_output.splitlines():
+match = self.dwarfdump_uuid_regex.search(line)
+if match:
+dwarf_uuid_str = match.group(1)
+dwarf_uuid = uuid.UUID(dwarf_uuid_str)
+if self_uuid == dwarf_uuid:
+self.resolved_path = self.path
+self.arch = match.group(2)
+   

[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2018-12-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

It would be nice to see context when you submit diffs. with SVN:

  svn diff -x -U999 ...

Or git:

  git diff -U999




Comment at: include/lldb/Core/Architecture.h:15
 
+class DynamicRegisterInfo;
+

Is DynamicRegisterInfo really in the top level namespace?



Comment at: include/lldb/Core/Architecture.h:18
 namespace lldb_private {
+class ArchSpec;
 

include the lldb-forward.h and remove this



Comment at: include/lldb/Utility/ArchSpec.h:91-92
 
+  // ARC configuration flags
+  enum ARCflags { eARC_rf32 = 0 /*0b00*/, eARC_rf16 = 2 /*0b10*/ };
+

It would be great to find a way that ArchSpec.h doesn't get polluted with 
everyone's flags by putting the flag definitions in the Architecture.h file. 
Not mandatory for this patch, but something to think about.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:76-93
+void ArchitectureArc::AdjustRegisterInfo(DynamicRegisterInfo ®_info) const {
+  auto reg_count = reg_info.GetNumRegisters();
+  decltype(reg_count) dwarf_index = 0;
+  for (decltype(reg_count) i = 0; i < reg_count; ++i) {
+auto ® = *reg_info.GetRegisterInfoAtIndex(i);
+auto ®_num = reg.kinds[eRegisterKindDWARF];
+if (LLDB_INVALID_REGNUM == reg_num) {

What is this code doing? Please add comments. Also, you have a 
ConfigureArchitecture in ProcessGDBRemote.cpp, can't you just do this work in 
that function and avoid the need to add Architecture::AdjustRegisterInfo() in 
the first place? And if so, is the architecture plug-in even needed?



Comment at: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp:625
 
+case llvm::Triple::arc:
+  {

Context would really help here to see the surrounding code.



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4530-4541
+  const RegisterInfo *rf_build_info = nullptr;
+
+  const auto reg_count = dyn_reg_info.GetNumRegisters();
+  // At least 16 first registers are not BCRs.
+  decltype(reg_count) skip_gpr = 16u;
+  for (auto reg_num = skip_gpr; reg_num < reg_count; ++reg_num) {
+const auto reg_info = dyn_reg_info.GetRegisterInfoAtIndex(reg_num);

Make:
```
const lldb_private::RegisterInfo *DynamicRegisterInfo::GetRegisterInfo(const 
lldb_private::ConstString ®_name) const;
```
public and call it. No need to duplicate the name search here.. Code will be:
```
const RegisterInfo *rf_build_info = dyn_reg_info.GetRegisterInfo(reg_name);
```



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4683-4691
+  if (llvm::Triple::arc == arch_to_use.GetMachine()) {
+if (!ConfigureArchitecture(*this, m_register_info, arch_to_use))
+  return false;
+GetTarget().SetArchitecture(arch_to_use);
   }
+
+  auto arch_plugin = GetTarget().GetArchitecturePlugin();

This code seems like it could be cleaned up. 
- ConfigureArchitecture should be named ConfigureARCArchitecture if it truly is 
ARC specfic
- why doesn't ConfigureArchitecture call 
GetTarget().SetArchitecture(arch_to_use) itself?
- Do we really want to return if ConfigureArchitecture() returns false? Do we 
not want to adjust the register info?
- why doesn't ConfigureArchitecture just fix up the dynamic register info and 
avoid the call to AdjustRegisterInfo in an architecture plug-in




Comment at: source/Target/Platform.cpp:1872-1876
+  case llvm::Triple::arc: {
+static const uint8_t g_hex_opcode[] = { 0xff, 0x7f };
+trap_opcode = g_hex_opcode;
+trap_opcode_size = sizeof(g_hex_opcode);
+  } break;

The software breakpoint opcode would be a great candidate to move to the 
Architecture plug-ins. Not needed for this patch since this is how is has been 
done for all architectures up till now, but just noting this here.



Comment at: source/Target/Target.cpp:70
 : m_spec(spec),
-  m_plugin_up(PluginManager::CreateArchitectureInstance(spec)) {}
+  m_plugin_up(PluginManager::CreateArchitectureInstance(m_spec)) {}
 

is this change needed?



Comment at: source/Target/Target.cpp:74
   m_spec = spec;
-  m_plugin_up = PluginManager::CreateArchitectureInstance(spec);
+  m_plugin_up = PluginManager::CreateArchitectureInstance(m_spec);
   return *this;

is this change needed?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718



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


[Lldb-commits] [PATCH] D55736: build.py: inherit environment in the gcc builder

2018-12-17 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova accepted this revision.
stella.stamenova added a comment.
This revision is now accepted and ready to land.

This does fix the issues. Thanks!


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

https://reviews.llvm.org/D55736



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


[Lldb-commits] [lldb] r349371 - [Driver] Fix --repl argument.

2018-12-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Dec 17 10:11:48 2018
New Revision: 349371

URL: http://llvm.org/viewvc/llvm-project?rev=349371&view=rev
Log:
[Driver] Fix --repl argument.

The --repl option was incorrectly defined as "Separate" (option and
value separated by a space). This resulted in the option not being
picked up when no value was specified.

This patch fixes the driver so that `--repl` is recognized again. I
split the option into two:

 - A flag: `--repl` and `-r` which take no arguments.
 - A joined option: `--repl=` and `-r=` that forward its
   values to the repl.

This should match the driver's old behavior.

Modified:
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Options.td

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=349371&r1=349370&r2=349371&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Dec 17 10:11:48 2018
@@ -373,13 +373,14 @@ SBError Driver::ProcessArgs(const opt::I
 }
   }
 
-  if (auto *arg = args.getLastArg(OPT_repl)) {
-auto arg_value = arg->getValue();
+  if (args.hasArg(OPT_repl)) {
 m_option_data.m_repl = true;
-if (arg_value && arg_value[0])
+  }
+
+  if (auto *arg = args.getLastArg(OPT_repl_)) {
+m_option_data.m_repl = true;
+if (auto arg_value = arg->getValue())
   m_option_data.m_repl_options = arg_value;
-else
-  m_option_data.m_repl_options.clear();
   }
 
   // We need to process the options below together as their relative order

Modified: lldb/trunk/tools/driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Options.td?rev=349371&r1=349370&r2=349371&view=diff
==
--- lldb/trunk/tools/driver/Options.td (original)
+++ lldb/trunk/tools/driver/Options.td Mon Dec 17 10:11:48 2018
@@ -46,7 +46,8 @@ def: Flag<["-"], "P">,
   HelpText<"Alias for --python-path">,
   Group;
 
-def script_language: Separate<["--", "-"], "script-language">, 
MetaVarName<"">,
+def script_language: Separate<["--", "-"], "script-language">,
+  MetaVarName<"">,
   HelpText<"Tells the debugger to use the specified scripting language for 
user-defined scripts.">,
   Group;
 def: Separate<["-"], "l">,
@@ -57,13 +58,22 @@ def: Separate<["-"], "l">,
 // Repl options.
 def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
 
-def repl: Separate<["--", "-"], "repl">,
+def repl: Flag<["--", "-"], "repl">,
   HelpText<"Runs lldb in REPL mode with a stub process.">,
   Group;
-def: Separate<["-"], "r">,
+def: Flag<["-"], "r">,
   Alias,
   HelpText<"Alias for --repl">,
   Group;
+def repl_: Joined<["--", "-"], "repl=">,
+  MetaVarName<"">,
+  HelpText<"Runs lldb in REPL mode with a stub process with the given flags.">,
+  Group;
+def: Joined<["-"], "r=">,
+  MetaVarName<"">,
+  Alias,
+  HelpText<"Alias for --repl=">,
+  Group;
 
 def repl_language: Separate<["--", "-"], "repl-language">,
   MetaVarName<"">,


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


[Lldb-commits] [PATCH] D55776: Fix lldb's macosx/heap.py cstr command

2018-12-17 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. Thanks Davide!


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

https://reviews.llvm.org/D55776



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


[Lldb-commits] [lldb] r349372 - Fix lldb's macosx/heap.py cstr command.

2018-12-17 Thread Davide Italiano via lldb-commits
Author: davide
Date: Mon Dec 17 10:21:51 2018
New Revision: 349372

URL: http://llvm.org/viewvc/llvm-project?rev=349372&view=rev
Log:
Fix lldb's macosx/heap.py cstr command.



Added:
lldb/trunk/lit/Heap/
lldb/trunk/lit/Heap/Inputs/
lldb/trunk/lit/Heap/Inputs/cstr.c
lldb/trunk/lit/Heap/heap-cstr.test
Modified:
lldb/trunk/examples/darwin/heap_find/heap.py

Modified: lldb/trunk/examples/darwin/heap_find/heap.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=349372&r1=349371&r2=349372&view=diff
==
--- lldb/trunk/examples/darwin/heap_find/heap.py (original)
+++ lldb/trunk/examples/darwin/heap_find/heap.py Mon Dec 17 10:21:51 2018
@@ -1036,7 +1036,7 @@ range_callback_t range_callback = [](tas
 callback_baton_t *lldb_info = (callback_baton_t *)baton;
 if (lldb_info->cstr_len < ptr_size) {
 const char *begin = (const char *)ptr_addr;
-const char *end = begin + ptr_size - info->cstr_len;
+const char *end = begin + ptr_size - lldb_info->cstr_len;
 for (const char *s = begin; s < end; ++s) {
 if ((int)memcmp(s, lldb_info->cstr, lldb_info->cstr_len) == 0) {
 if (lldb_info->num_matches < MAX_MATCHES) {

Added: lldb/trunk/lit/Heap/Inputs/cstr.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Heap/Inputs/cstr.c?rev=349372&view=auto
==
--- lldb/trunk/lit/Heap/Inputs/cstr.c (added)
+++ lldb/trunk/lit/Heap/Inputs/cstr.c Mon Dec 17 10:21:51 2018
@@ -0,0 +1,17 @@
+#include 
+
+int main(void) {
+  char *str;
+  int size = 9; //strlen("patatino") + 1
+  str = (char *)malloc(sizeof(char)*size);
+  *(str+0) = 'p';
+  *(str+1) = 'a';
+  *(str+2) = 't';
+  *(str+3) = 'a';
+  *(str+4) = 't';
+  *(str+5) = 'i';
+  *(str+6) = 'n';
+  *(str+7) = 'o';
+  *(str+8) = '\0';
+  return 0;
+}

Added: lldb/trunk/lit/Heap/heap-cstr.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Heap/heap-cstr.test?rev=349372&view=auto
==
--- lldb/trunk/lit/Heap/heap-cstr.test (added)
+++ lldb/trunk/lit/Heap/heap-cstr.test Mon Dec 17 10:21:51 2018
@@ -0,0 +1,10 @@
+# REQUIRES: system-darwin
+# RUN: %clang %p/Inputs/cstr.c -g -o %t
+# RUN: %lldb -b -s %s -f %t | FileCheck %s
+
+br set -p return
+command script import lldb.macosx.heap
+run
+cstr "patatino"
+
+# CHECK: {{.*}}: malloc(16) -> {{.*}}


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


[Lldb-commits] [PATCH] D55776: Fix lldb's macosx/heap.py cstr command

2018-12-17 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.

commit 44b5014ce138fa293238afeaa53cfd4c2f5b12d2 (HEAD -> master)
Author: Davide Italiano 
Date:   Mon Dec 17 10:23:44 2018 -0800

  Fix lldb's macosx/heap.py cstr command.
  
  


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

https://reviews.llvm.org/D55776



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


Re: [Lldb-commits] [lldb] r349372 - Fix lldb's macosx/heap.py cstr command.

2018-12-17 Thread Davide Italiano via lldb-commits
For the masses, this is https://reviews.llvm.org/D55776

On Mon, Dec 17, 2018 at 10:24 AM Davide Italiano via lldb-commits
 wrote:
>
> Author: davide
> Date: Mon Dec 17 10:21:51 2018
> New Revision: 349372
>
> URL: http://llvm.org/viewvc/llvm-project?rev=349372&view=rev
> Log:
> Fix lldb's macosx/heap.py cstr command.
>
> 
>
> Added:
> lldb/trunk/lit/Heap/
> lldb/trunk/lit/Heap/Inputs/
> lldb/trunk/lit/Heap/Inputs/cstr.c
> lldb/trunk/lit/Heap/heap-cstr.test
> Modified:
> lldb/trunk/examples/darwin/heap_find/heap.py
>
> Modified: lldb/trunk/examples/darwin/heap_find/heap.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=349372&r1=349371&r2=349372&view=diff
> ==
> --- lldb/trunk/examples/darwin/heap_find/heap.py (original)
> +++ lldb/trunk/examples/darwin/heap_find/heap.py Mon Dec 17 10:21:51 2018
> @@ -1036,7 +1036,7 @@ range_callback_t range_callback = [](tas
>  callback_baton_t *lldb_info = (callback_baton_t *)baton;
>  if (lldb_info->cstr_len < ptr_size) {
>  const char *begin = (const char *)ptr_addr;
> -const char *end = begin + ptr_size - info->cstr_len;
> +const char *end = begin + ptr_size - lldb_info->cstr_len;
>  for (const char *s = begin; s < end; ++s) {
>  if ((int)memcmp(s, lldb_info->cstr, lldb_info->cstr_len) == 0) {
>  if (lldb_info->num_matches < MAX_MATCHES) {
>
> Added: lldb/trunk/lit/Heap/Inputs/cstr.c
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Heap/Inputs/cstr.c?rev=349372&view=auto
> ==
> --- lldb/trunk/lit/Heap/Inputs/cstr.c (added)
> +++ lldb/trunk/lit/Heap/Inputs/cstr.c Mon Dec 17 10:21:51 2018
> @@ -0,0 +1,17 @@
> +#include 
> +
> +int main(void) {
> +  char *str;
> +  int size = 9; //strlen("patatino") + 1
> +  str = (char *)malloc(sizeof(char)*size);
> +  *(str+0) = 'p';
> +  *(str+1) = 'a';
> +  *(str+2) = 't';
> +  *(str+3) = 'a';
> +  *(str+4) = 't';
> +  *(str+5) = 'i';
> +  *(str+6) = 'n';
> +  *(str+7) = 'o';
> +  *(str+8) = '\0';
> +  return 0;
> +}
>
> Added: lldb/trunk/lit/Heap/heap-cstr.test
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Heap/heap-cstr.test?rev=349372&view=auto
> ==
> --- lldb/trunk/lit/Heap/heap-cstr.test (added)
> +++ lldb/trunk/lit/Heap/heap-cstr.test Mon Dec 17 10:21:51 2018
> @@ -0,0 +1,10 @@
> +# REQUIRES: system-darwin
> +# RUN: %clang %p/Inputs/cstr.c -g -o %t
> +# RUN: %lldb -b -s %s -f %t | FileCheck %s
> +
> +br set -p return
> +command script import lldb.macosx.heap
> +run
> +cstr "patatino"
> +
> +# CHECK: {{.*}}: malloc(16) -> {{.*}}
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55776: Fix lldb's macosx/heap.py cstr command

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

nice! A lot of great commands in heap.py. Like see them fixed and improved


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

https://reviews.llvm.org/D55776



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


[Lldb-commits] [lldb] r349383 - [NativePDB] Decouple AST reconstruction from lldb Symbol creation.

2018-12-17 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Dec 17 11:43:33 2018
New Revision: 349383

URL: http://llvm.org/viewvc/llvm-project?rev=349383&view=rev
Log:
[NativePDB] Decouple AST reconstruction from lldb Symbol creation.

Previously the code that parsed debug info to create lldb's Symbol
objects such as Variable, Type, Function, etc was tightly coupled
to the AST reconstruction code.  This made it difficult / impossible
to implement functions such as ParseDeclsForContext() that were only
supposed to be operating on clang AST's.  By splitting these apart,
the logic becomes much cleaner and we have a clear separation of
responsibilities.

Added:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h

Modified: lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp?rev=349383&r1=349382&r2=349383&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp Mon Dec 17 
11:43:33 2018
@@ -108,10 +108,10 @@ auto incomplete = &three definition
-// CHECK: |-CXXRecordDecl {{.*}} struct TC> definition
-// CHECK: |-CXXRecordDecl {{.*}} struct TC definition
-// CHECK: |-CXXRecordDecl {{.*}} struct TC definition
+// CHECK: |   `-CXXRecordDecl {{.*}} struct S
+// CHECK: |-CXXRecordDecl {{.*}} struct TC
+// CHECK: |-CXXRecordDecl {{.*}} struct TC>
+// CHECK: |-CXXRecordDecl {{.*}} struct TC
+// CHECK: |-CXXRecordDecl {{.*}} struct TC
 // CHECK: |-CXXRecordDecl {{.*}} struct Incomplete
 
 int main(int argc, char **argv) {

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt?rev=349383&r1=349382&r2=349383&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt Mon Dec 17 
11:43:33 2018
@@ -1,6 +1,7 @@
 add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
   CompileUnitIndex.cpp
   DWARFLocationExpression.cpp
+  PdbASTBuilder.cpp
   PdbIndex.cpp
   PdbSymUid.cpp
   PdbUtil.cpp

Added: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp?rev=349383&view=auto
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp (added)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp Mon Dec 17 
11:43:33 2018
@@ -0,0 +1,865 @@
+#include "PdbAstBuilder.h"
+
+#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
+#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
+#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
+#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
+#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
+#include "llvm/Demangle/MicrosoftDemangle.h"
+
+#include "lldb/Core/Module.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
+#include "lldb/Symbol/ClangUtil.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/LLDBAssert.h"
+
+#include "PdbUtil.h"
+#include "UdtRecordCompleter.h"
+
+using namespace lldb_private;
+using namespace lldb_private::npdb;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+static llvm::Optional FindSymbolScope(PdbIndex &index,
+ PdbCompilandSymId id) 
{
+  CVSymbol sym = index.ReadSymbolRecord(id);
+  if (symbolOpensScope(sym.kind())) {
+// If this exact symbol opens a scope, we can just directly access its
+// parent.
+id.offset = getScopeParentOffset(sym);
+// Global symbols have parent offset of 0.  Return llvm::None to indicate
+// this.
+if (id.offset == 0)
+  return llvm::None;
+return id;
+  }
+
+  // Otherwise we need to start at the beginning an

[Lldb-commits] [lldb] r349398 - Reflow readme

2018-12-17 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Mon Dec 17 13:18:12 2018
New Revision: 349398

URL: http://llvm.org/viewvc/llvm-project?rev=349398&view=rev
Log:
Reflow readme

Modified:
lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite

Modified: lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite?rev=349398&r1=349397&r2=349398&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite Mon Dec 17 
13:18:12 2018
@@ -1,7 +1,7 @@
-This README file describes the files and directories related to the Python test
-suite under the current 'test' directory.
+This README file describes the files and directories related   -*- rst -*-
+to the Python test suite under the current 'test' directory.
 
-o dotest.py
+- dotest.py
 
   Provides the test driver for the test suite.  To invoke it, cd to the 'test'
   directory and issue the './dotest.py' command or './dotest.py -v' for more
@@ -20,7 +20,7 @@ o dotest.py
  This runs the test suite, with logging turned on for the lldb as well as
  the process.gdb-remote channels and directs the run log to a file.
 
-o lldbtest.py
+- lldbtest.py
 
   Provides an abstract base class of lldb test case named 'TestBase', which in
   turn inherits from Python's unittest.TestCase.  The concrete subclass can
@@ -41,7 +41,7 @@ o lldbtest.py
   test case on its own.  To run the whole test suite, 'dotest.py' is all you
   need to do.
 
-o subdirectories of 'test'
+- subdirectories of 'test'
 
   Most of them predate the introduction of the python test suite and contain
   example C/C++/ObjC source files which get compiled into executables which are
@@ -58,7 +58,7 @@ o subdirectories of 'test'
   testcase that run a process to a breakpoint and check a local variable.  
These
   are convenient starting points for adding new tests.
 
-o make directory
+- make directory
 
   Contains Makefile.rules, which can be utilized by test cases to write 
Makefile
   based rules to build binaries for the inferiors.
@@ -95,12 +95,12 @@ o make directory
   The exe names for the two test methods are equal to the test method names and
   are therefore guaranteed different.
 
-o plugins directory
+- plugins directory
 
   Contains platform specific plugin to build binaries with dsym/dwarf debugging
   info.  Other platform specific functionalities may be added in the future.
 
-o unittest2 directory
+- unittest2 directory
 
   Many new features were added to unittest in Python 2.7, including test
   discovery. unittest2 allows you to use these features with earlier versions 
of
@@ -114,7 +114,7 @@ o unittest2 directory
   Later versions of unittest2 include changes in unittest made in Python 3.2 
and
   onwards after the release of Python 2.7.
 
-o dotest.pl
+- dotest.pl
 
   In case you wonder, there is also a 'dotest.pl' perl script file.  It was
   created to visit each Python test case under the specified directory and
@@ -127,47 +127,56 @@ o dotest.pl
 
   Note: dotest.pl has been moved to the attic directory.
 
-o Profiling dotest.py runs
+- Profiling dotest.py runs
 
   I used the following command line thingy to do the profiling on a SnowLeopard
   machine:
 
-$ DOTEST_PROFILE=YES DOTEST_SCRIPT_DIR=/Volumes/data/lldb/svn/trunk/test 
/System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/cProfile.py
 -o my.profile ./dotest.py -v -w 2> ~/Developer/Log/lldbtest.log
+$ DOTEST_PROFILE=YES DOTEST_SCRIPT_DIR=/Volumes/data/lldb/svn/trunk/test 
/System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/cProfile.py
 -o my.profile ./dotest.py -v -w 2> ~/Developer/Log/lldbtest.log
 
   After that, I used the pstats.py module to browse the statistics:
 
-$ python 
/System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/pstats.py
 my.profile 
+$ python 
/System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/pstats.py
 my.profile 
 
-o Writing test cases:
+- Writing test cases:
 
- We strongly prefer writing test cases using the SB API's rather than the 
runCmd & expect.  
- Unless you are actually testing some feature of the command line, please 
don't write 
- command based tests.  For historical reasons there are plenty of examples of 
tests in the 
- test suite that use runCmd where they shouldn't, but don't copy them, copy 
the plenty that 
- do use the SB API's instead.  
-
- The reason for this is that our policy is that we will maintain compatibility 
with the 
- SB API's.  But we don't make any similar guarantee about the details of 
command result format.  
- If your test is using the command line, it is going to have to check against 
the command result
- text, and you either end up writing your check  pattern by checking as little 
as possible so 
- you won

[Lldb-commits] [lldb] r349397 - Remove sleep() synchronisation from teststcase and

2018-12-17 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Mon Dec 17 13:18:11 2018
New Revision: 349397

URL: http://llvm.org/viewvc/llvm-project?rev=349397&view=rev
Log:
Remove sleep() synchronisation from teststcase and
make the executable name more unique.

This test is failing sporadically on some bots. By removing the sleep
synchronisation, I'm hoping to get it to fail more reproducibly so I
can investigate what is going on.

Modified:

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

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=349397&r1=349396&r2=349397&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
 Mon Dec 17 13:18:11 2018
@@ -35,7 +35,7 @@ class HelloWorldTestCase(TestBase):
 def test_with_process_launch_api(self):
 """Create target, breakpoint, launch a process, and then kill it."""
 # Get the full path to our executable to be attached/debugged.
-exe = self.getBuildArtifact(self.testMethodName)
+exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
 d = {'EXE': exe}
 self.build(dictionary=d)
 self.setTearDownCleanup(dictionary=d)
@@ -82,7 +82,7 @@ class HelloWorldTestCase(TestBase):
 @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], 
bugnumber="") # old lldb-server has race condition, 
launching an inferior and then launching debugserver in quick succession 
sometimes fails
 def test_with_attach_to_process_with_id_api(self):
 """Create target, spawn a process, and attach to it with process id."""
-exe = self.getBuildArtifact(self.testMethodName)
+exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
 d = {'EXE': exe}
 self.build(dictionary=d)
 self.setTearDownCleanup(dictionary=d)
@@ -92,9 +92,6 @@ class HelloWorldTestCase(TestBase):
 popen = self.spawnSubprocess(exe, ["abc", "xyz"])
 self.addTearDownHook(self.cleanupSubprocesses)
 
-# Give the subprocess time to start and wait for user input
-time.sleep(0.25)
-
 listener = lldb.SBListener("my.attach.listener")
 error = lldb.SBError()
 process = target.AttachToProcessWithID(listener, popen.pid, error)
@@ -114,7 +111,7 @@ class HelloWorldTestCase(TestBase):
 @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], 
bugnumber="") # old lldb-server has race condition, 
launching an inferior and then launching debugserver in quick succession 
sometimes fails
 def test_with_attach_to_process_with_name_api(self):
 """Create target, spawn a process, and attach to it with process 
name."""
-exe = self.getBuildArtifact(self.testMethodName)
+exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
 d = {'EXE': exe}
 self.build(dictionary=d)
 self.setTearDownCleanup(dictionary=d)
@@ -124,9 +121,6 @@ class HelloWorldTestCase(TestBase):
 popen = self.spawnSubprocess(exe, ["abc", "xyz"])
 self.addTearDownHook(self.cleanupSubprocesses)
 
-# Give the subprocess time to start and wait for user input
-time.sleep(0.25)
-
 listener = lldb.SBListener("my.attach.listener")
 error = lldb.SBError()
 # Pass 'False' since we don't want to wait for new instance of


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


[Lldb-commits] [lldb] r349399 - Fix case of source file in CMakeLists.txt

2018-12-17 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Dec 17 13:33:08 2018
New Revision: 349399

URL: http://llvm.org/viewvc/llvm-project?rev=349399&view=rev
Log:
Fix case of source file in CMakeLists.txt

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt?rev=349399&r1=349398&r2=349399&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt Mon Dec 17 
13:33:08 2018
@@ -1,7 +1,7 @@
 add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
   CompileUnitIndex.cpp
   DWARFLocationExpression.cpp
-  PdbASTBuilder.cpp
+  PdbAstBuilder.cpp
   PdbIndex.cpp
   PdbSymUid.cpp
   PdbUtil.cpp


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


[Lldb-commits] [lldb] r349401 - [lit] Detect unexpected passes in lldbtest.

2018-12-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Dec 17 13:40:37 2018
New Revision: 349401

URL: http://llvm.org/viewvc/llvm-project?rev=349401&view=rev
Log:
[lit] Detect unexpected passes in lldbtest.

This patch will have lit report unexpected passes when dotest reports at
least one XPASS and no failures.

Modified:
lldb/trunk/lit/Suite/lldbtest.py

Modified: lldb/trunk/lit/Suite/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lldbtest.py?rev=349401&r1=349400&r2=349401&view=diff
==
--- lldb/trunk/lit/Suite/lldbtest.py (original)
+++ lldb/trunk/lit/Suite/lldbtest.py Mon Dec 17 13:40:37 2018
@@ -96,6 +96,10 @@ class LLDBTest(TestFormat):
 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, ''
+
 passing_test_line = 'RESULT: PASSED'
 if passing_test_line not in out and passing_test_line not in err:
 msg = ('Unable to find %r in dotest output:\n\n%s%s' %


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


[Lldb-commits] [lldb] r349406 - Add PdbAstBuilder.cpp.

2018-12-17 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Dec 17 14:07:39 2018
New Revision: 349406

URL: http://llvm.org/viewvc/llvm-project?rev=349406&view=rev
Log:
Add PdbAstBuilder.cpp.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=349406&r1=349405&r2=349406&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Dec 17 14:07:39 2018
@@ -579,6 +579,7 @@
4CA0C6CC20F929C700CFE6BB /* PDBLocationToDWARFExpression.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CA0C6CA20F929C600CFE6BB /* 
PDBLocationToDWARFExpression.cpp */; };
268900EE13353E6F00698AC0 /* PathMappingList.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 495BBACB119A0DBE00418BEA /* PathMappingList.cpp 
*/; };
2668A2EE20AF417D00D94111 /* PathMappingListTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2668A2ED20AF417D00D94111 /* 
PathMappingListTest.cpp */; };
+   AF815DF921C855B400023A34 /* PdbAstBuilder.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF815DF721C855B400023A34 /* PdbAstBuilder.cpp 
*/; };
AFD966BA217140B6006714AC /* PdbIndex.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = AFD966B6217140B6006714AC /* PdbIndex.cpp */; };
AF0F459E219FA1C800C1E612 /* PdbSymUid.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = AF0F459D219FA1C800C1E612 /* PdbSymUid.cpp */; };
AFD966B9217140B6006714AC /* PdbUtil.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = AFD966B5217140B6006714AC /* PdbUtil.cpp */; };
@@ -2403,6 +2404,8 @@
495BBACB119A0DBE00418BEA /* PathMappingList.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PathMappingList.cpp; path = source/Target/PathMappingList.cpp; 
sourceTree = ""; };
495BBACF119A0DE700418BEA /* PathMappingList.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
PathMappingList.h; path = include/lldb/Target/PathMappingList.h; sourceTree = 
""; };
2668A2ED20AF417D00D94111 /* PathMappingListTest.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PathMappingListTest.cpp; path = Target/PathMappingListTest.cpp; 
sourceTree = ""; };
+   AF815DF721C855B400023A34 /* PdbAstBuilder.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PdbAstBuilder.cpp; path = 
source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp; sourceTree = 
SOURCE_ROOT; };
+   AF815DF821C855B400023A34 /* PdbAstBuilder.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
PdbAstBuilder.h; path = source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h; 
sourceTree = SOURCE_ROOT; };
AFD966B6217140B6006714AC /* PdbIndex.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PdbIndex.cpp; path = source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp; 
sourceTree = SOURCE_ROOT; };
AFD966BF217140C8006714AC /* PdbIndex.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PdbIndex.h; path = 
source/Plugins/SymbolFile/NativePDB/PdbIndex.h; sourceTree = SOURCE_ROOT; };
AF0F459D219FA1C800C1E612 /* PdbSymUid.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PdbSymUid.cpp; path = source/Plugins/SymbolFile/NativePDB/PdbSymUid.cpp; 
sourceTree = SOURCE_ROOT; };
@@ -6823,6 +6826,8 @@
AFD966BD217140C8006714AC /* CompileUnitIndex.h 
*/,
4C38996221B9AECC002BAEF4 /* 
DWARFLocationExpression.cpp */,
4C38996321B9AECC002BAEF4 /* 
DWARFLocationExpression.h */,
+   AF815DF721C855B400023A34 /* PdbAstBuilder.cpp 
*/,
+   AF815DF821C855B400023A34 /* PdbAstBuilder.h */,
AFD966B6217140B6006714AC /* PdbIndex.cpp */,
AFD966BF217140C8006714AC /* PdbIndex.h */,
AF0F459D219FA1C800C1E612 /* PdbSymUid.cpp */,
@@ -7842,6 +7847,7 @@
964463EC1A330C0500154ED8 /* 
CompactUnwindInfo.cpp in Sources */,
94B638531B8F8E6C004FE1E4 /* Language.cpp in 
Sources */,
AF395C03219254F300894EC3 /* 
MSVCUndecoratedNameParser.cpp in Sources */,
+   AF815DF921C855B400023A34 /* PdbAstBuilder.cpp 
in Sources */,
2689001D13353DDE00698AC0 /* 
CommandObjectLog.cpp in Sources */,

[Lldb-commits] [lldb] r349409 - Document the DBGSourcePathRemapping dictionary that may be

2018-12-17 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Dec 17 14:25:54 2018
New Revision: 349409

URL: http://llvm.org/viewvc/llvm-project?rev=349409&view=rev
Log:
Document the DBGSourcePathRemapping dictionary that may be 
present in the dSYM per-uuid plist, its precedence order with
the older DBGBuildSourcePath/DBGSourcePath, and note that
must be present and have a value of 3 or the dictionary
will be ignored.
 

Modified:
lldb/trunk/www/symbols.html

Modified: lldb/trunk/www/symbols.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/symbols.html?rev=349409&r1=349408&r2=349409&view=diff
==
--- lldb/trunk/www/symbols.html (original)
+++ lldb/trunk/www/symbols.html Mon Dec 17 14:25:54 2018
@@ -262,6 +262,17 @@ A40597AA-5529-3337-8C09-D8A014EB1578.pli
/path/to/foo.dSYM/Contents/Resources/DWARF/foo
DBGSymbolRichExecutable
/path/to/unstripped/executable
+   DBGVersion
+   3
+   DBGSourcePathRemapping
+   
+   /path/to/build/time/src/location1
+   /path/to/debug/time/src/location
+   /path/to/build/time/src/location2
+   /path/to/debug/time/src/location
+   
+   DBGSymbolRichExecutable
+   /path/to/unstripped/executable
 
 
 
@@ -271,6 +282,22 @@ so making the results of your shell scri
 combining two plists into a single one where you take the UUID and use it a
  string key, and the value is the contents of the plist.
 
+LLDB will read the following entries from the per-UUID plist file in the 
dSYM
+bundle:  DBGSymbolRichExecutable, DBGBuildSourcePath and
+DBGSourcePath, and DBGSourcePathRemapping if DBGVersion 
is 3
+or higher.  DBGBuildSourcePath and DBGSourcePath are for 
remapping
+a single file path.  For instance, the files may be in 
/BuildDir/SheetApp/SheetApp-37
+when built, but they are in /SourceDir/SheetApp/SheetApp-37 at debug time, 
those
+two paths could be listed in those keys.  If there are multiple source path
+remappings, the DBGSourcePathRemapping dictionary can be used, where an
+arbitrary number of entries may be present.  DBGVersion should be 3 or
+DBGSourcePathRemapping will not be read.  If both 
DBGSourcePathRemapping
+AND DBGBuildSourcePath/DBGSourcePath are present in the plist, 
the
+DBGSourcePathRemapping entries will be used for path remapping first.  
This
+may allow for more specific remappings in the DBGSourcePathRemapping
+dictionary and a less specific remapping in the
+DBGBuildSourcePath/DBGSourcePath pair as a last resort.
+
 




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


[Lldb-commits] [lldb] r349417 - A few small updates to the testsuite for running against an iOS device.

2018-12-17 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Dec 17 15:33:40 2018
New Revision: 349417

URL: http://llvm.org/viewvc/llvm-project?rev=349417&view=rev
Log:
A few small updates to the testsuite for running against an iOS device.
Remove the expected-fails for 34538611; using an alternate platform
implementation handles these correctly.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

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

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py
lldb/trunk/source/Target/Process.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py?rev=349417&r1=349416&r2=349417&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
 Mon Dec 17 15:33:40 2018
@@ -158,6 +158,7 @@ class LoadUnloadTestCase(TestBase):
 @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase 
support
 @expectedFailureAndroid  # wrong source file shows up for hidden library
 @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic 
libraries work differently
+@skipIfDarwinEmbedded
 def test_dyld_library_path(self):
 """Test (DY)LD_LIBRARY_PATH after moving libd.dylib, which defines 
d_function, somewhere else."""
 self.copy_shlibs_to_remote(hidden_dir=True)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py?rev=349417&r1=349416&r2=349417&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
 Mon Dec 17 15:33:40 2018
@@ -23,7 +23,6 @@ class ProcessAttachTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 @skipIfiOSSimulator
-@expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], 
bugnumber="") # old lldb-server has race condition, 
launching an inferior and then launching debugserver in quick succession 
sometimes fails
 def test_attach_to_process_by_id(self):
 """Test attach by process id"""
 self.build()
@@ -40,7 +39,6 @@ class ProcessAttachTestCase(TestBase):
 process = target.GetProcess()
 self.assertTrue(process, PROCESS_IS_VALID)
 
-@expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], 
bugnumber="") # old lldb-server has race condition, 
launching an inferior and then launching debugserver in quick succession 
sometimes fails
 def test_attach_to_process_from_different_dir_by_id(self):
 """Test attach by process id"""
 newdir = self.getBuildArtifact("newdir")
@@ -67,7 +65,6 @@ class ProcessAttachTestCase(TestBase):
 process = target.GetProcess()
 self.assertTrue(process, PROCESS_IS_VALID)
 
-@expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], 
bugnumber="") # old lldb-server has race condition, 
launching an inferior and then launching debugserver in quick succession 
sometimes fails
 def test_attach_to_process_by_name(self):
 """Test attach by process name"""
 self.build()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py?rev=349417&r1=349416&r2=349417&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
 Mon Dec 17 15:33:40 2018
@@ -24,7 +24,6 @@ class ChangeProcessGroupTestCase(TestBas
 @skipIfFreeBSD  # Times

[Lldb-commits] [PATCH] D55727: Add "dump" command as a custom "process plugin" subcommand when ProcessMinidump is used.

2018-12-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg updated this revision to Diff 178549.
clayborg added a comment.

Fixed all requested changes. Added a complete test in lit.


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

https://reviews.llvm.org/D55727

Files:
  lit/Minidump/Inputs/dump-content.dmp
  lit/Minidump/dump-all.test
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/Process/minidump/MinidumpParser.h
  source/Plugins/Process/minidump/MinidumpTypes.h
  source/Plugins/Process/minidump/ProcessMinidump.cpp
  source/Plugins/Process/minidump/ProcessMinidump.h
  unittests/Process/minidump/Inputs/dump-content.dmp

Index: source/Plugins/Process/minidump/ProcessMinidump.h
===
--- source/Plugins/Process/minidump/ProcessMinidump.h
+++ source/Plugins/Process/minidump/ProcessMinidump.h
@@ -49,6 +49,8 @@
   bool CanDebug(lldb::TargetSP target_sp,
 bool plugin_specified_by_name) override;
 
+  CommandObject *GetPluginCommandObject() override;
+
   Status DoLoadCore() override;
 
   DynamicLoader *GetDynamicLoader() override { return nullptr; }
@@ -104,6 +106,7 @@
   FileSpec m_core_file;
   llvm::ArrayRef m_thread_list;
   const MinidumpExceptionStream *m_active_exception;
+  lldb::CommandObjectSP m_command_sp;
   bool m_is_wow64;
 };
 
Index: source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -10,10 +10,17 @@
 #include "ProcessMinidump.h"
 #include "ThreadMinidump.h"
 
+#include "lldb/Core/DumpDataExtractor.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Interpreter/CommandObjectMultiword.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
+#include "lldb/Interpreter/OptionGroupBoolean.h"
 #include "lldb/Target/JITLoaderList.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/SectionLoadList.h"
@@ -398,3 +405,237 @@
   }
   return *m_jit_loaders_ap;
 }
+
+#define INIT_BOOL(VAR, LONG, SHORT, DESC) \
+VAR(LLDB_OPT_SET_1, false, LONG, SHORT, DESC, false, true)
+#define APPEND_OPT(VAR) \
+m_option_group.Append(&VAR, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1)
+
+class CommandObjectProcessMinidumpDump : public CommandObjectParsed {
+private:
+  OptionGroupOptions m_option_group;
+  OptionGroupBoolean m_dump_all;
+  OptionGroupBoolean m_dump_directory;
+  OptionGroupBoolean m_dump_linux_cpuinfo;
+  OptionGroupBoolean m_dump_linux_proc_status;
+  OptionGroupBoolean m_dump_linux_lsb_release;
+  OptionGroupBoolean m_dump_linux_cmdline;
+  OptionGroupBoolean m_dump_linux_environ;
+  OptionGroupBoolean m_dump_linux_auxv;
+  OptionGroupBoolean m_dump_linux_maps;
+  OptionGroupBoolean m_dump_linux_proc_stat;
+  OptionGroupBoolean m_dump_linux_proc_uptime;
+  OptionGroupBoolean m_dump_linux_proc_fd;
+  OptionGroupBoolean m_dump_linux_all;
+
+  void SetDefaultOptionsIfNoneAreSet() {
+if (m_dump_all.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_all.GetOptionValue().GetCurrentValue() ||
+m_dump_directory.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_cpuinfo.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_proc_status.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_lsb_release.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_cmdline.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_environ.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_auxv.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_maps.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_proc_stat.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_proc_uptime.GetOptionValue().GetCurrentValue() ||
+m_dump_linux_proc_fd.GetOptionValue().GetCurrentValue())
+  return;
+// If no options were set, then dump everything
+m_dump_all.GetOptionValue().SetCurrentValue(true);
+  }
+  bool DumpAll() const {
+return m_dump_all.GetOptionValue().GetCurrentValue();
+  }
+  bool DumpDirectory() const {
+return DumpAll() ||
+m_dump_directory.GetOptionValue().GetCurrentValue();
+  }
+  bool DumpLinux() const {
+return DumpAll() || m_dump_linux_all.GetOptionValue().GetCurrentValue();
+  }
+  bool DumpLinuxCPUInfo() const {
+return DumpLinux() ||
+m_dump_linux_cpuinfo.GetOptionValue().GetCurrentValue();
+  }
+  bool DumpLinuxProcStatus() const {
+return DumpLinux() ||
+m_dump_linux_proc_status.GetOptionValue().GetCurrentValue();
+  }
+  bool DumpLinuxProcStat() const {
+return DumpLinux() ||
+m_dump_linux_proc_stat.GetOptionValue().GetCurrentValue();
+  }
+  bool DumpLinuxLSBRel

[Lldb-commits] [PATCH] D55727: Add "dump" command as a custom "process plugin" subcommand when ProcessMinidump is used.

2018-12-17 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB349429: Add "dump" command as a custom 
"process plugin" subcommand when ProcessMinidump… (authored by 
gclayton, committed by ).
Herald added a subscriber: abidh.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55727

Files:
  lit/Minidump/Inputs/dump-content.dmp
  lit/Minidump/dump-all.test
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/Process/minidump/MinidumpParser.h
  source/Plugins/Process/minidump/MinidumpTypes.h
  source/Plugins/Process/minidump/ProcessMinidump.cpp
  source/Plugins/Process/minidump/ProcessMinidump.h
  unittests/Process/minidump/Inputs/dump-content.dmp

Index: source/Plugins/Process/minidump/MinidumpParser.h
===
--- source/Plugins/Process/minidump/MinidumpParser.h
+++ source/Plugins/Process/minidump/MinidumpParser.h
@@ -90,6 +90,13 @@
   // Perform consistency checks and initialize internal data structures
   Status Initialize();
 
+  static llvm::StringRef GetStreamTypeAsString(uint32_t stream_type);
+
+  const llvm::DenseMap &
+  GetDirectoryMap() const {
+return m_directory_map;
+  }
+
 private:
   MinidumpParser(const lldb::DataBufferSP &data_buf_sp);
 
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -660,3 +660,48 @@
 
   return error;
 }
+
+#define ENUM_TO_CSTR(ST) case (uint32_t)MinidumpStreamType::ST: return #ST
+
+llvm::StringRef
+MinidumpParser::GetStreamTypeAsString(uint32_t stream_type) {
+  switch (stream_type) {
+ENUM_TO_CSTR(Unused);
+ENUM_TO_CSTR(Reserved0);
+ENUM_TO_CSTR(Reserved1);
+ENUM_TO_CSTR(ThreadList);
+ENUM_TO_CSTR(ModuleList);
+ENUM_TO_CSTR(MemoryList);
+ENUM_TO_CSTR(Exception);
+ENUM_TO_CSTR(SystemInfo);
+ENUM_TO_CSTR(ThreadExList);
+ENUM_TO_CSTR(Memory64List);
+ENUM_TO_CSTR(CommentA);
+ENUM_TO_CSTR(CommentW);
+ENUM_TO_CSTR(HandleData);
+ENUM_TO_CSTR(FunctionTable);
+ENUM_TO_CSTR(UnloadedModuleList);
+ENUM_TO_CSTR(MiscInfo);
+ENUM_TO_CSTR(MemoryInfoList);
+ENUM_TO_CSTR(ThreadInfoList);
+ENUM_TO_CSTR(HandleOperationList);
+ENUM_TO_CSTR(Token);
+ENUM_TO_CSTR(JavascriptData);
+ENUM_TO_CSTR(SystemMemoryInfo);
+ENUM_TO_CSTR(ProcessVMCounters);
+ENUM_TO_CSTR(BreakpadInfo);
+ENUM_TO_CSTR(AssertionInfo);
+ENUM_TO_CSTR(LinuxCPUInfo);
+ENUM_TO_CSTR(LinuxProcStatus);
+ENUM_TO_CSTR(LinuxLSBRelease);
+ENUM_TO_CSTR(LinuxCMDLine);
+ENUM_TO_CSTR(LinuxEnviron);
+ENUM_TO_CSTR(LinuxAuxv);
+ENUM_TO_CSTR(LinuxMaps);
+ENUM_TO_CSTR(LinuxDSODebug);
+ENUM_TO_CSTR(LinuxProcStat);
+ENUM_TO_CSTR(LinuxProcUptime);
+ENUM_TO_CSTR(LinuxProcFD);
+  }
+  return "unknown stream type";
+}
Index: source/Plugins/Process/minidump/ProcessMinidump.h
===
--- source/Plugins/Process/minidump/ProcessMinidump.h
+++ source/Plugins/Process/minidump/ProcessMinidump.h
@@ -49,6 +49,8 @@
   bool CanDebug(lldb::TargetSP target_sp,
 bool plugin_specified_by_name) override;
 
+  CommandObject *GetPluginCommandObject() override;
+
   Status DoLoadCore() override;
 
   DynamicLoader *GetDynamicLoader() override { return nullptr; }
@@ -104,6 +106,7 @@
   FileSpec m_core_file;
   llvm::ArrayRef m_thread_list;
   const MinidumpExceptionStream *m_active_exception;
+  lldb::CommandObjectSP m_command_sp;
   bool m_is_wow64;
 };
 
Index: source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -10,10 +10,17 @@
 #include "ProcessMinidump.h"
 #include "ThreadMinidump.h"
 
+#include "lldb/Core/DumpDataExtractor.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Interpreter/CommandObjectMultiword.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
+#include "lldb/Interpreter/OptionGroupBoolean.h"
 #include "lldb/Target/JITLoaderList.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/SectionLoadList.h"
@@ -398,3 +405,237 @@
   }
   return *m_jit_loaders_ap;
 }
+
+#define INIT_BOOL(VAR, LONG, SHORT, DESC) \
+VAR(LLDB_OPT_SET_1, false, LONG, SHORT, DESC, false, true)
+#define APPEND_OPT(VAR) \
+m_option_group.Append(&VAR, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1)
+
+class CommandObjectProcessMinidumpDump : public CommandObjectPar

[Lldb-commits] [lldb] r349429 - Add "dump" command as a custom "process plugin" subcommand when ProcessMinidump is used.

2018-12-17 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Mon Dec 17 16:50:11 2018
New Revision: 349429

URL: http://llvm.org/viewvc/llvm-project?rev=349429&view=rev
Log:
Add "dump" command as a custom "process plugin" subcommand when ProcessMinidump 
is used.

Each process plug-in can create its own custom commands. I figured it would be 
nice to be able to dump things from the minidump file from the lldb command 
line, so I added the start of the some custom commands.

Currently you can dump:

minidump stream directory
all linux specifc streams, most of which are strings
each linux stream individually if desired, or all with --linux
The idea is we can expand the command set to dump more things, search for data 
in the core file, and much more. This patch gets us started.

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

Added:
lldb/trunk/lit/Minidump/
lldb/trunk/lit/Minidump/Inputs/
lldb/trunk/lit/Minidump/Inputs/dump-content.dmp   (with props)
lldb/trunk/lit/Minidump/dump-all.test
lldb/trunk/unittests/Process/minidump/Inputs/dump-content.dmp   (with props)
Modified:
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h
lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.h
lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.h

Added: lldb/trunk/lit/Minidump/Inputs/dump-content.dmp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/Inputs/dump-content.dmp?rev=349429&view=auto
==
Binary file - no diff available.

Propchange: lldb/trunk/lit/Minidump/Inputs/dump-content.dmp
--
svn:mime-type = application/octet-stream

Added: lldb/trunk/lit/Minidump/dump-all.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/dump-all.test?rev=349429&view=auto
==
--- lldb/trunk/lit/Minidump/dump-all.test (added)
+++ lldb/trunk/lit/Minidump/dump-all.test Mon Dec 17 16:50:11 2018
@@ -0,0 +1,86 @@
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --all' | \
+# RUN: FileCheck --check-prefix=CHECKDIR --check-prefix=CHECKCPU \
+# RUN: --check-prefix=CHECKSTATUS --check-prefix=CHECKLSB \
+# RUN: --check-prefix=CHECKCMD --check-prefix=CHECKENV \
+# RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP \
+# RUN: --check-prefix=CHECKSTAT --check-prefix=CHECKUP --check-prefix=CHECKFD 
%s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -a' | \
+# RUN: FileCheck --check-prefix=CHECKDIR --check-prefix=CHECKCPU \
+# RUN: --check-prefix=CHECKSTATUS --check-prefix=CHECKLSB \
+# RUN: --check-prefix=CHECKCMD --check-prefix=CHECKENV \
+# RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP \
+# RUN: --check-prefix=CHECKSTAT --check-prefix=CHECKUP --check-prefix=CHECKFD 
%s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
--directory' | FileCheck --check-prefix=CHECKDIR %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --d' | 
FileCheck --check-prefix=CHECKDIR %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --linux' | \
+# RUN: FileCheck --check-prefix=CHECKCPU --check-prefix=CHECKSTATUS \
+# RUN: --check-prefix=CHECKLSB --check-prefix=CHECKCMD --check-prefix=CHECKENV 
\
+# RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP 
--check-prefix=CHECKSTAT \
+# RUN: --check-prefix=CHECKUP --check-prefix=CHECKFD %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cpuinfo' 
| FileCheck --check-prefix=CHECKCPU %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --C' | 
FileCheck --check-prefix=CHECKCPU %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --status' | 
FileCheck --check-prefix=CHECKSTATUS %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --s' | 
FileCheck --check-prefix=CHECKSTATUS %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump 
--lsb-release' | FileCheck --check-prefix=CHECKLSB %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --r' | 
FileCheck --check-prefix=CHECKLSB %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cmdline' 
| FileCheck --check-prefix=CHECKCMD %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --c' | 
FileCheck --check-prefix=CHECKCMD %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --environ' 
| FileCheck --check-prefix=CHECKENV %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --e' | 
FileCheck --check-prefix=CHECKENV %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --auxv' | 
FileCheck --check-prefix=CHECKAUX %s
+# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dum

[Lldb-commits] [PATCH] D55607: Make crashlog.py work when a .dSYM is present, but a binary is missing

2018-12-17 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

This change made the Windows test get stuck: 
http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/2340

They are now being killed after running for 40 minutes instead of completing in 
under 2.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55607



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


[Lldb-commits] [PATCH] D55631: Delay replacing the process till after we've finalized it

2018-12-17 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349435: Call DeleteCurrentProcess before we replace the old 
process. (authored by jingham, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55631?vs=178306&id=178575#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55631

Files:
  lldb/trunk/source/Target/Target.cpp


Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -2864,22 +2864,15 @@
   log->Printf("Target::%s asking the platform to debug the process",
   __FUNCTION__);
 
-// Get a weak pointer to the previous process if we have one
-ProcessWP process_wp;
-if (m_process_sp)
-  process_wp = m_process_sp;
+// If there was a previous process, delete it before we make the new one.
+// One subtle point, we delete the process before we release the reference
+// to m_process_sp.  That way even if we are the last owner, the process
+// will get Finalized before it gets destroyed.
+DeleteCurrentProcess();
+
 m_process_sp =
 GetPlatform()->DebugProcess(launch_info, debugger, this, error);
 
-// Cleanup the old process since someone might still have a strong
-// reference to this process and we would like to allow it to cleanup as
-// much as it can without the object being destroyed. We try to lock the
-// shared pointer and if that works, then someone else still has a strong
-// reference to the process.
-
-ProcessSP old_process_sp(process_wp.lock());
-if (old_process_sp)
-  old_process_sp->Finalize();
   } else {
 if (log)
   log->Printf("Target::%s the platform doesn't know how to debug a "


Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -2864,22 +2864,15 @@
   log->Printf("Target::%s asking the platform to debug the process",
   __FUNCTION__);
 
-// Get a weak pointer to the previous process if we have one
-ProcessWP process_wp;
-if (m_process_sp)
-  process_wp = m_process_sp;
+// If there was a previous process, delete it before we make the new one.
+// One subtle point, we delete the process before we release the reference
+// to m_process_sp.  That way even if we are the last owner, the process
+// will get Finalized before it gets destroyed.
+DeleteCurrentProcess();
+
 m_process_sp =
 GetPlatform()->DebugProcess(launch_info, debugger, this, error);
 
-// Cleanup the old process since someone might still have a strong
-// reference to this process and we would like to allow it to cleanup as
-// much as it can without the object being destroyed. We try to lock the
-// shared pointer and if that works, then someone else still has a strong
-// reference to the process.
-
-ProcessSP old_process_sp(process_wp.lock());
-if (old_process_sp)
-  old_process_sp->Finalize();
   } else {
 if (log)
   log->Printf("Target::%s the platform doesn't know how to debug a "
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r349435 - Call DeleteCurrentProcess before we replace the old process.

2018-12-17 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon Dec 17 17:49:02 2018
New Revision: 349435

URL: http://llvm.org/viewvc/llvm-project?rev=349435&view=rev
Log:
Call DeleteCurrentProcess before we replace the old process.

We need to ensure that Finalize gets called before we start
to destroy the old Process or the weak_ptr->shared_ptr link
from Threads to Target gets broken before the threads are 
destroyed.



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

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

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=349435&r1=349434&r2=349435&view=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Dec 17 17:49:02 2018
@@ -2864,22 +2864,15 @@ Status Target::Launch(ProcessLaunchInfo
   log->Printf("Target::%s asking the platform to debug the process",
   __FUNCTION__);
 
-// Get a weak pointer to the previous process if we have one
-ProcessWP process_wp;
-if (m_process_sp)
-  process_wp = m_process_sp;
+// If there was a previous process, delete it before we make the new one.
+// One subtle point, we delete the process before we release the reference
+// to m_process_sp.  That way even if we are the last owner, the process
+// will get Finalized before it gets destroyed.
+DeleteCurrentProcess();
+
 m_process_sp =
 GetPlatform()->DebugProcess(launch_info, debugger, this, error);
 
-// Cleanup the old process since someone might still have a strong
-// reference to this process and we would like to allow it to cleanup as
-// much as it can without the object being destroyed. We try to lock the
-// shared pointer and if that works, then someone else still has a strong
-// reference to the process.
-
-ProcessSP old_process_sp(process_wp.lock());
-if (old_process_sp)
-  old_process_sp->Finalize();
   } else {
 if (log)
   log->Printf("Target::%s the platform doesn't know how to debug a "


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