[Lldb-commits] [lldb] r353381 - Fix documentation formatting for ShellExpandArguments

2019-02-07 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Feb  7 01:47:57 2019
New Revision: 353381

URL: http://llvm.org/viewvc/llvm-project?rev=353381&view=rev
Log:
Fix documentation formatting for ShellExpandArguments

Modified:
lldb/trunk/include/lldb/Host/Host.h
lldb/trunk/include/lldb/Target/Platform.h

Modified: lldb/trunk/include/lldb/Host/Host.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=353381&r1=353380&r2=353381&view=diff
==
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Thu Feb  7 01:47:57 2019
@@ -206,9 +206,9 @@ public:
   //--
   /// Perform expansion of the command-line for this launch info This can
   /// potentially involve wildcard expansion
-  //  environment variable replacement, and whatever other
-  //  argument magic the platform defines as part of its typical
-  //  user experience
+  /// environment variable replacement, and whatever other
+  /// argument magic the platform defines as part of its typical
+  /// user experience
   //--
   static Status ShellExpandArguments(ProcessLaunchInfo &launch_info);
 

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=353381&r1=353380&r2=353381&view=diff
==
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Thu Feb  7 01:47:57 2019
@@ -364,9 +364,9 @@ public:
   //--
   /// Perform expansion of the command-line for this launch info This can
   /// potentially involve wildcard expansion
-  //  environment variable replacement, and whatever other
-  //  argument magic the platform defines as part of its typical
-  //  user experience
+  /// environment variable replacement, and whatever other
+  /// argument magic the platform defines as part of its typical
+  /// user experience
   //--
   virtual Status ShellExpandArguments(ProcessLaunchInfo &launch_info);
 


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


[Lldb-commits] [PATCH] D57880: Add assert for 'bad' code path in GetUniqueNamespaceDeclaration

2019-02-07 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: shafik.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.

If we call this function with a non-namespace as a second argument (and a 
nullptr name), we currently
only get a nullptr as a return when we hit the "Bad!!!" code path. This patch 
just adds an assert as this
seems to be a programming error in the calling code.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57880

Files:
  source/Symbol/ClangASTContext.cpp


Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1941,7 +1941,8 @@
 assert(namespace_decl ==
parent_namespace_decl->getAnonymousNamespace());
   } else {
-// BAD!!!
+assert(false && "GetUniqueNamespaceDeclaration called with no name and 
"
+"no namespace as decl_ctx");
   }
 }
   }


Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1941,7 +1941,8 @@
 assert(namespace_decl ==
parent_namespace_decl->getAnonymousNamespace());
   } else {
-// BAD!!!
+assert(false && "GetUniqueNamespaceDeclaration called with no name and "
+"no namespace as decl_ctx");
   }
 }
   }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57402: build: remove custom variables

2019-02-07 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

> it is pretty reasonable to ask that the user tell us where LLVM and Clang are 
> built

Yes, and `Clang_DIR` should default to the build-/install-tree specified via 
`LLVM_DIR`. In the vast majority of cases we build against one tree that has 
both, Clang and LLVM. If we then pass 
`-DLLVM_DIR=/path/to/llvm-build-root/lib/cmake/llvm`, I think we should not 
need to pass `-DClang_DIR=/path/to/llvm-build-root/lib/cmake/clang` explicitly. 
`LLDB_PATH_TO_CLANG_BUILD` so far defaults to `LLDB_PATH_TO_LLVM_BUILD` and 
both of them would have a path like `/path/to/llvm-build-root`. This behavior 
should be preserved, but I don't see how it works in the new version. Note that 
the path expected for `LLVM_DIR` is "the directory where LLVMConfig.cmake is 
found" (https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project), which 
is different from the one we used to pass to `LLDB_PATH_TO_LLVM_BUILD`.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D57402



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


[Lldb-commits] [PATCH] D56595: SymbolFileBreakpad: Add line table support

2019-02-07 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL353404: SymbolFileBreakpad: Add line table support (authored 
by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56595?vs=185557&id=185752#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56595

Files:
  lldb/trunk/include/lldb/Core/FileSpecList.h
  lldb/trunk/include/lldb/Core/RangeMap.h
  
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table-discontinuous-file-ids.syms
  lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table-edgecases.syms
  lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table-missing-file.syms
  lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table.syms
  lldb/trunk/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test
  lldb/trunk/lit/SymbolFile/Breakpad/line-table-edgecases.test
  lldb/trunk/lit/SymbolFile/Breakpad/line-table-missing-file.test
  lldb/trunk/lit/SymbolFile/Breakpad/line-table.test
  lldb/trunk/source/Core/FileSpecList.cpp
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h

Index: lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -13,7 +13,9 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Host/FileSystem.h"
+#include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/SymbolVendor.h"
 #include "lldb/Symbol/TypeMap.h"
 #include "lldb/Utility/Log.h"
 #include "llvm/ADT/StringExtras.h"
@@ -22,64 +24,141 @@
 using namespace lldb_private;
 using namespace lldb_private::breakpad;
 
-namespace {
-class LineIterator {
+class SymbolFileBreakpad::LineIterator {
 public:
   // begin iterator for sections of given type
   LineIterator(ObjectFile &obj, Record::Kind section_type)
   : m_obj(&obj), m_section_type(toString(section_type)),
-m_next_section_idx(0) {
+m_next_section_idx(0), m_next_line(llvm::StringRef::npos) {
 ++*this;
   }
 
+  // An iterator starting at the position given by the bookmark.
+  LineIterator(ObjectFile &obj, Record::Kind section_type, Bookmark bookmark);
+
   // end iterator
   explicit LineIterator(ObjectFile &obj)
   : m_obj(&obj),
-m_next_section_idx(m_obj->GetSectionList()->GetNumSections(0)) {}
+m_next_section_idx(m_obj->GetSectionList()->GetNumSections(0)),
+m_current_line(llvm::StringRef::npos),
+m_next_line(llvm::StringRef::npos) {}
 
   friend bool operator!=(const LineIterator &lhs, const LineIterator &rhs) {
 assert(lhs.m_obj == rhs.m_obj);
 if (lhs.m_next_section_idx != rhs.m_next_section_idx)
   return true;
-if (lhs.m_next_text.data() != rhs.m_next_text.data())
+if (lhs.m_current_line != rhs.m_current_line)
   return true;
-assert(lhs.m_current_text == rhs.m_current_text);
-assert(rhs.m_next_text == rhs.m_next_text);
+assert(lhs.m_next_line == rhs.m_next_line);
 return false;
   }
 
   const LineIterator &operator++();
-  llvm::StringRef operator*() const { return m_current_text; }
+  llvm::StringRef operator*() const {
+return m_section_text.slice(m_current_line, m_next_line);
+  }
+
+  Bookmark GetBookmark() const {
+return Bookmark{m_next_section_idx, m_current_line};
+  }
 
 private:
   ObjectFile *m_obj;
   ConstString m_section_type;
   uint32_t m_next_section_idx;
-  llvm::StringRef m_current_text;
-  llvm::StringRef m_next_text;
+  llvm::StringRef m_section_text;
+  size_t m_current_line;
+  size_t m_next_line;
+
+  void FindNextLine() {
+m_next_line = m_section_text.find('\n', m_current_line);
+if (m_next_line != llvm::StringRef::npos) {
+  ++m_next_line;
+  if (m_next_line >= m_section_text.size())
+m_next_line = llvm::StringRef::npos;
+}
+  }
 };
-} // namespace
 
-const LineIterator &LineIterator::operator++() {
+SymbolFileBreakpad::LineIterator::LineIterator(ObjectFile &obj,
+   Record::Kind section_type,
+   Bookmark bookmark)
+: m_obj(&obj), m_section_type(toString(section_type)),
+  m_next_section_idx(bookmark.section), m_current_line(bookmark.offset) {
+  Section § =
+  *obj.GetSectionList()->GetSectionAtIndex(m_next_section_idx - 1);
+  assert(sect.GetName() == m_section_type);
+
+  DataExtractor data;
+  obj.ReadSectionData(§, data);
+  m_section_text = toStringRef(data.GetData());
+
+  assert(m_current_line < m_section_text.size());
+  FindNextLine();
+}
+
+const SymbolFileBreakpad::LineIterator &
+SymbolFileBreakpad::LineIterator::o

[Lldb-commits] [lldb] r353404 - SymbolFileBreakpad: Add line table support

2019-02-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Feb  7 05:42:32 2019
New Revision: 353404

URL: http://llvm.org/viewvc/llvm-project?rev=353404&view=rev
Log:
SymbolFileBreakpad: Add line table support

Summary:
This patch teaches SymbolFileBreakpad to parse the line information in
breakpad files and present it to lldb.

The trickiest question here was what kind of "compile units" to present
to lldb, as there really isn't enough information in breakpad files to
correctly reconstruct those.

A couple of options were considered
- have the entire file be one compile unit
- have one compile unit for each FILE record
- have one compile unit for each FUNC record

The main drawback of the first approach is that all of the files would
be considered "headers" by lldb, and so they wouldn't be searched if
target.inline-breakpoint-strategy=never. The single compile unit would
also be huge, and there isn't a good way to name it.

The second approach will create mostly correct compile units for cpp
files, but it will still be wrong for headers. However, the biggest
drawback here seemed to be the fact that this can cause a compile unit
to change mid-function (for example when a function from another file is
inlined or another file is #included into a function). While I don't
know of any specific thing that would break in this case, it does sound
like a thing that we should avoid.

In the end, we chose the third option, as it didn't seem to have any
major disadvantages, though it was not ideal either. One disadvantage
here is that this generates a large number of compile units, and there
is still a question on how to name it. We chose to simply name it after
the first line record in that function. This should be correct 99.99% of
the time, though it can produce somewhat strange results if the very
first line record comes from an #included file.

Reviewers: clayborg, zturner, lemo, markmentovai

Subscribers: lldb-commits

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

Added:

lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table-discontinuous-file-ids.syms
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table-edgecases.syms
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table-missing-file.syms
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/line-table.syms
lldb/trunk/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test
lldb/trunk/lit/SymbolFile/Breakpad/line-table-edgecases.test
lldb/trunk/lit/SymbolFile/Breakpad/line-table-missing-file.test
lldb/trunk/lit/SymbolFile/Breakpad/line-table.test
Modified:
lldb/trunk/include/lldb/Core/FileSpecList.h
lldb/trunk/include/lldb/Core/RangeMap.h
lldb/trunk/source/Core/FileSpecList.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h

Modified: lldb/trunk/include/lldb/Core/FileSpecList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpecList.h?rev=353404&r1=353403&r2=353404&view=diff
==
--- lldb/trunk/include/lldb/Core/FileSpecList.h (original)
+++ lldb/trunk/include/lldb/Core/FileSpecList.h Thu Feb  7 05:42:32 2019
@@ -37,15 +37,14 @@ public:
   //--
   FileSpecList();
 
-  //--
   /// Copy constructor.
-  ///
-  /// Initialize this object with a copy of the file list from \a rhs.
-  ///
-  /// @param[in] rhs
-  /// A const reference to another file list object.
-  //--
-  FileSpecList(const FileSpecList &rhs);
+  FileSpecList(const FileSpecList &rhs) = default;
+
+  /// Move constructor
+  FileSpecList(FileSpecList &&rhs) = default;
+
+  /// Initialize this object from a vector of FileSpecs
+  FileSpecList(std::vector &&rhs) : m_files(std::move(rhs)) {}
 
   //--
   /// Destructor.
@@ -63,7 +62,10 @@ public:
   /// @return
   /// A const reference to this object.
   //--
-  const FileSpecList &operator=(const FileSpecList &rhs);
+  FileSpecList &operator=(const FileSpecList &rhs) = default;
+
+  /// Move-assignment operator.
+  FileSpecList &operator=(FileSpecList &&rhs) = default;
 
   //--
   /// Append a FileSpec object to the list.

Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=353404&r1=353403&r2=353404&view=diff
==
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Thu Feb  7 05:42:32 2019
@@ -715,6 +715,7 @@ public:
 
   // Clients must ensure that "i" is a

[Lldb-commits] [lldb] r353405 - Fix some warnings introduced in r353324 (ReproducerInstrumentation patch)

2019-02-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Feb  7 05:51:38 2019
New Revision: 353405

URL: http://llvm.org/viewvc/llvm-project?rev=353405&view=rev
Log:
Fix some warnings introduced in r353324 (ReproducerInstrumentation patch)

GetIndexForObjectImpl generated a bunch of "conversion casts away
constness warnings". Change the function to use "const void *" (and
static_cast, while I'm at it), to avoid this.

Driver.cpp: unused variable "replay" (this was actually caused by a
subsequent partial revert of this patch). I just finish the revert by
removing the variable completely.

Modified:
lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
lldb/trunk/source/Utility/ReproducerInstrumentation.cpp
lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=353405&r1=353404&r2=353405&view=diff
==
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Thu Feb  7 
05:51:38 2019
@@ -431,13 +431,13 @@ struct invoke
 class ObjectToIndex {
 public:
   template  unsigned GetIndexForObject(T *t) {
-return GetIndexForObjectImpl((void *)t);
+return GetIndexForObjectImpl(static_cast(t));
   }
 
 private:
-  unsigned GetIndexForObjectImpl(void *object);
+  unsigned GetIndexForObjectImpl(const void *object);
 
-  llvm::DenseMap m_mapping;
+  llvm::DenseMap m_mapping;
 };
 
 /// Serializes functions, their arguments and their return type to a stream.

Modified: lldb/trunk/source/Utility/ReproducerInstrumentation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ReproducerInstrumentation.cpp?rev=353405&r1=353404&r2=353405&view=diff
==
--- lldb/trunk/source/Utility/ReproducerInstrumentation.cpp (original)
+++ lldb/trunk/source/Utility/ReproducerInstrumentation.cpp Thu Feb  7 05:51:38 
2019
@@ -68,7 +68,7 @@ unsigned Registry::GetID(uintptr_t addr)
   return id;
 }
 
-unsigned ObjectToIndex::GetIndexForObjectImpl(void *object) {
+unsigned ObjectToIndex::GetIndexForObjectImpl(const void *object) {
   unsigned index = m_mapping.size() + 1;
   auto it = m_mapping.find(object);
   if (it == m_mapping.end())

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=353405&r1=353404&r2=353405&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Thu Feb  7 05:51:38 2019
@@ -888,9 +888,6 @@ main(int argc, char const *argv[])
  << '\n';
   }
 
-  // Remember if we're in replay mode for later.
-  bool replay = false;
-
   SBInitializerOptions options;
   if (auto *arg = input_args.getLastArg(OPT_capture)) {
 auto arg_value = arg->getValue();
@@ -902,7 +899,6 @@ main(int argc, char const *argv[])
 auto arg_value = arg->getValue();
 options.SetReplayReproducer(true);
 options.SetReproducerPath(arg_value);
-replay = true;
   }
 
   SBError error = SBDebugger::Initialize(options);


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


[Lldb-commits] [lldb] r353406 - use_lldb_suite.py: Fix potential infinite loop

2019-02-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Feb  7 06:03:43 2019
New Revision: 353406

URL: http://llvm.org/viewvc/llvm-project?rev=353406&view=rev
Log:
use_lldb_suite.py: Fix potential infinite loop

The loop searching for use_lldb_suite_root had a bug where if the marker
file happened to be missing, it would enter an infinite loop. While this
shouldn't happen in normal circumstances, it can happen accidentally,
and debugging it is not very pleasant.

The loop had an exit condition, but it was incorrent (os.path.dirname
returning None). This will never happen as dirname will just return the
same folder over and over again once it reaches the root folder. This
fixes the exit condition to account for that.

Modified:
lldb/trunk/scripts/use_lldb_suite.py

Modified: lldb/trunk/scripts/use_lldb_suite.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/use_lldb_suite.py?rev=353406&r1=353405&r2=353406&view=diff
==
--- lldb/trunk/scripts/use_lldb_suite.py (original)
+++ lldb/trunk/scripts/use_lldb_suite.py Thu Feb  7 06:03:43 2019
@@ -6,9 +6,10 @@ import sys
 def find_lldb_root():
 lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
 while True:
-lldb_root = os.path.dirname(lldb_root)
-if lldb_root is None:
-return None
+parent = os.path.dirname(lldb_root)
+if parent == lldb_root: # dirname('/') == '/'
+break
+lldb_root = parent
 
 test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")
 if os.path.isfile(test_path):


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


[Lldb-commits] [lldb] r353410 - Breakpad: temporarily XFAIL line-table tests

2019-02-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Feb  7 06:47:12 2019
New Revision: 353410

URL: http://llvm.org/viewvc/llvm-project?rev=353410&view=rev
Log:
Breakpad: temporarily XFAIL line-table tests

The tests are failing on windows because the paths in the symbol file
are parsed using the host path style. I'm working on a patch to have
SymbolFileBreakpad auto-detect the correct path style (similar to dwarf
r351328).

I originally wanted to make this a part of the initial line-table patch,
but then I simply forgot.

Modified:
lldb/trunk/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test
lldb/trunk/lit/SymbolFile/Breakpad/line-table-edgecases.test
lldb/trunk/lit/SymbolFile/Breakpad/line-table-missing-file.test
lldb/trunk/lit/SymbolFile/Breakpad/line-table.test

Modified: 
lldb/trunk/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test?rev=353410&r1=353409&r2=353410&view=diff
==
--- lldb/trunk/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test 
(original)
+++ lldb/trunk/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test 
Thu Feb  7 06:47:12 2019
@@ -1,5 +1,7 @@
 # Test that we handle files which has gaps in the FILE record IDs.
 
+# XFAIL: system-windows
+
 # RUN: yaml2obj %S/Inputs/basic-elf.yaml > 
%T/line-table-discontinuous-file-ids.out
 # RUN: %lldb %T/line-table-discontinuous-file-ids.out \
 # RUN:   -o "target symbols add -s line-table-discontinuous-file-ids.out 
%S/Inputs/line-table-discontinuous-file-ids.syms" \

Modified: lldb/trunk/lit/SymbolFile/Breakpad/line-table-edgecases.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/Breakpad/line-table-edgecases.test?rev=353410&r1=353409&r2=353410&view=diff
==
--- lldb/trunk/lit/SymbolFile/Breakpad/line-table-edgecases.test (original)
+++ lldb/trunk/lit/SymbolFile/Breakpad/line-table-edgecases.test Thu Feb  7 
06:47:12 2019
@@ -2,6 +2,8 @@
 # input contains a LINE record which does not belong to any function as well as
 # a FUNC record without any LINE records.
 
+# XFAIL: system-windows
+
 # RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/line-table-edgecases.out
 # RUN: %lldb %T/line-table-edgecases.out \
 # RUN:   -o "target symbols add -s line-table-edgecases.out 
%S/Inputs/line-table-edgecases.syms" \

Modified: lldb/trunk/lit/SymbolFile/Breakpad/line-table-missing-file.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/Breakpad/line-table-missing-file.test?rev=353410&r1=353409&r2=353410&view=diff
==
--- lldb/trunk/lit/SymbolFile/Breakpad/line-table-missing-file.test (original)
+++ lldb/trunk/lit/SymbolFile/Breakpad/line-table-missing-file.test Thu Feb  7 
06:47:12 2019
@@ -3,6 +3,8 @@
 # Right now, "something reasonable" means creating a line entry with an empty
 # file.
 
+# XFAIL: system-windows
+
 # RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/line-table-missing-file.out
 # RUN: %lldb %T/line-table-missing-file.out \
 # RUN:   -o "target symbols add -s line-table-missing-file.out 
%S/Inputs/line-table-missing-file.syms" \

Modified: lldb/trunk/lit/SymbolFile/Breakpad/line-table.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/Breakpad/line-table.test?rev=353410&r1=353409&r2=353410&view=diff
==
--- lldb/trunk/lit/SymbolFile/Breakpad/line-table.test (original)
+++ lldb/trunk/lit/SymbolFile/Breakpad/line-table.test Thu Feb  7 06:47:12 2019
@@ -1,3 +1,5 @@
+# XFAIL: system-windows
+
 # RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/line-table.out
 # RUN: %lldb %T/line-table.out -o "target symbols add -s line-table.out 
%S/Inputs/line-table.syms" \
 # RUN:   -s %s -o exit | FileCheck %s


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


[Lldb-commits] [PATCH] D57895: Breakpad: auto-detect path style of file entries

2019-02-07 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, lemo, JDevlieghere.
Herald added a subscriber: aprantl.

This adds support for auto-detection of path style to SymbolFileBreakpad
(similar to how r351328 did the same for DWARF). We guess each file
entry separately, as we have no idea which file came from which compile
units (and different compile units can have different path styles). The
breakpad generates should have already converted the paths to absolute
ones, so this guess should be reasonable accurate, but as always with
these kinds of things, it is hard to give guarantees about anything.

In an attempt to bring some unity to the path guessing logic, I move the
guessing logic from inside SymbolFileDWARF into the FileSpec class and
have both symbol files use it to implent their desired behavior.


https://reviews.llvm.org/D57895

Files:
  include/lldb/Utility/FileSpec.h
  lit/SymbolFile/Breakpad/Inputs/line-table-mixed-path-styles.syms
  lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test
  lit/SymbolFile/Breakpad/line-table-edgecases.test
  lit/SymbolFile/Breakpad/line-table-missing-file.test
  lit/SymbolFile/Breakpad/line-table-mixed-path-styles.test
  lit/SymbolFile/Breakpad/line-table.test
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Utility/FileSpec.cpp
  unittests/Utility/FileSpecTest.cpp

Index: unittests/Utility/FileSpecTest.cpp
===
--- unittests/Utility/FileSpecTest.cpp
+++ unittests/Utility/FileSpecTest.cpp
@@ -189,6 +189,17 @@
   }
 }
 
+TEST(FileSpecTest, GuessPathStyle) {
+  EXPECT_EQ(FileSpec::Style::posix, FileSpec::GuessPathStyle("/foo/bar.txt"));
+  EXPECT_EQ(FileSpec::Style::posix, FileSpec::GuessPathStyle("//net/bar.txt"));
+  EXPECT_EQ(FileSpec::Style::windows,
+FileSpec::GuessPathStyle(R"(C:\foo.txt)"));
+  EXPECT_EQ(FileSpec::Style::windows,
+FileSpec::GuessPathStyle(R"(\\net\foo.txt)"));
+  EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo.txt"));
+  EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt"));
+}
+
 TEST(FileSpecTest, GetNormalizedPath) {
   std::pair posix_tests[] = {
   {"/foo/.././bar", "/bar"},
Index: source/Utility/FileSpec.cpp
===
--- source/Utility/FileSpec.cpp
+++ source/Utility/FileSpec.cpp
@@ -365,6 +365,16 @@
   return a == b;
 }
 
+llvm::Optional FileSpec::GuessPathStyle(llvm::StringRef path) {
+  if (path.startswith("/"))
+return Style::posix;
+  if (path.startswith(R"(\\)"))
+return Style::windows;
+  if (path.size() > 3 && llvm::isAlpha(path[0]) && path.substr(1, 2) == R"(:\)")
+return Style::windows;
+  return llvm::None;
+}
+
 //--
 // Dump the object to the supplied stream. If the object contains a valid
 // directory name, it will be displayed followed by a directory delimiter, and
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -820,22 +820,19 @@
   if (!die)
 return;
 
-  auto guess = [](llvm::StringRef str) {
-if (str.startswith("/"))
-  return FileSpec::Style::posix;
-if (str.size() > 3 && llvm::isAlpha(str[0]) && str.substr(1, 2) == ":\\")
-  return FileSpec::Style::windows;
-return FileSpec::Style::native;
-  };
   llvm::StringRef comp_dir = removeHostnameFromPathname(
   die->GetAttributeValueAsString(m_dwarf, this, DW_AT_comp_dir, NULL));
   if (!comp_dir.empty()) {
-m_comp_dir = resolveCompDir(FileSpec(comp_dir, guess(comp_dir)));
+FileSpec::Style comp_dir_style =
+FileSpec::GuessPathStyle(comp_dir).getValueOr(FileSpec::Style::native);
+m_comp_dir = resolveCompDir(FileSpec(comp_dir, comp_dir_style));
   } else {
 // Try to detect the style based on the DW_AT_name attribute, but just store
 // the detected style in the m_comp_dir field.
-m_comp_dir = FileSpec("", guess(die->GetAttributeValueAsString(
-  m_dwarf, this, DW_AT_name, NULL)));
+const char *name =
+die->GetAttributeValueAsString(m_dwarf, this, DW_AT_name, NULL);
+m_comp_dir = FileSpec(
+"", FileSpec::GuessPathStyle(name).getValueOr(FileSpec::Style::native));
   }
 }
 
Index: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -398,7 +398,9 @@
 
 if (record->Number >= m_files->size())
   m_files->resize(record->Number + 1);
-(*m_files)[record->Number] = FileSpec(record->Name);
+FileSpec::Style style = FileSpec::GuessPathStyle(record->Name)
+

[Lldb-commits] [lldb] r353419 - Fix incorrect log messages in NativeProcessLinux (pr40588)

2019-02-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Feb  7 07:56:35 2019
New Revision: 353419

URL: http://llvm.org/viewvc/llvm-project?rev=353419&view=rev
Log:
Fix incorrect log messages in NativeProcessLinux (pr40588)

The "signal" argument was removed from the MonitorCallback function, but
not from the log statements within it. This wasn't noticed because the
name "signal" suddenly started referring to the libc function with that
name.

This fixes that.

Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=353419&r1=353418&r2=353419&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Thu Feb  7 
07:56:35 2019
@@ -412,9 +412,9 @@ void NativeProcessLinux::MonitorCallback
   // Handle when the thread exits.
   if (exited) {
 LLDB_LOG(log,
- "got exit signal({0}) , tid = {1} ({2} main thread), process "
+ "got exit status({0}) , tid = {1} ({2} main thread), process "
  "state = {3}",
- signal, pid, is_main_thread ? "is" : "is not", GetState());
+ status, pid, is_main_thread ? "is" : "is not", GetState());
 
 // This is a thread that exited.  Ensure we're not tracking it anymore.
 StopTrackingThread(pid);
@@ -495,9 +495,9 @@ void NativeProcessLinux::MonitorCallback
   const bool thread_found = StopTrackingThread(pid);
 
   LLDB_LOG(log,
-   "GetSignalInfo failed: {0}, tid = {1}, signal = {2}, "
+   "GetSignalInfo failed: {0}, tid = {1}, status = {2}, "
"status = {3}, main_thread = {4}, thread_found: {5}",
-   info_err, pid, signal, status, is_main_thread, thread_found);
+   info_err, pid, status, status, is_main_thread, thread_found);
 
   if (is_main_thread) {
 // Notify the delegate - our process is not available but appears to


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


[Lldb-commits] [lldb] r353420 - Fix signed/unsigned mismatches in ProcessInfoTest.cpp

2019-02-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Feb  7 07:56:40 2019
New Revision: 353420

URL: http://llvm.org/viewvc/llvm-project?rev=353420&view=rev
Log:
Fix signed/unsigned mismatches in ProcessInfoTest.cpp

Modified:
lldb/trunk/unittests/Host/ProcessInfoTest.cpp

Modified: lldb/trunk/unittests/Host/ProcessInfoTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/ProcessInfoTest.cpp?rev=353420&r1=353419&r2=353420&view=diff
==
--- lldb/trunk/unittests/Host/ProcessInfoTest.cpp (original)
+++ lldb/trunk/unittests/Host/ProcessInfoTest.cpp Thu Feb  7 07:56:40 2019
@@ -16,5 +16,5 @@ TEST(ProcessInfoTest, Constructor) {
   ProcessInfo Info("foo", ArchSpec("x86_64-pc-linux"), 47);
   EXPECT_STREQ("foo", Info.GetName());
   EXPECT_EQ(ArchSpec("x86_64-pc-linux"), Info.GetArchitecture());
-  EXPECT_EQ(47, Info.GetProcessID());
+  EXPECT_EQ(47u, Info.GetProcessID());
 }


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


[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-02-07 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 185783.
Herald added a reviewer: serge-sans-paille.

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

https://reviews.llvm.org/D56230

Files:
  packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
  packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
  source/Host/windows/ProcessLauncherWindows.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -123,14 +123,14 @@
 
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::SendPacketNoLock(llvm::StringRef payload) {
-StreamString packet(0, 4, eByteOrderBig);
-packet.PutChar('$');
-packet.Write(payload.data(), payload.size());
-packet.PutChar('#');
-packet.PutHex8(CalculcateChecksum(payload));
-std::string packet_str = packet.GetString();
-
-return SendRawPacketNoLock(packet_str);
+  StreamString packet(0, 4, eByteOrderBig);
+  packet.PutChar('$');
+  packet.Write(payload.data(), payload.size());
+  packet.PutChar('#');
+  packet.PutHex8(CalculcateChecksum(payload));
+  std::string packet_str = packet.GetString();
+
+  return SendRawPacketNoLock(packet_str);
 }
 
 GDBRemoteCommunication::PacketResult
@@ -949,16 +949,18 @@
   char debugserver_path[PATH_MAX];
   FileSpec &debugserver_file_spec = launch_info.GetExecutableFile();
 
+  Environment host_env = Host::GetEnvironment();
+
   // Always check to see if we have an environment override for the path to the
   // debugserver to use and use it if we do.
-  const char *env_debugserver_path = getenv("LLDB_DEBUGSERVER_PATH");
-  if (env_debugserver_path) {
+  std::string env_debugserver_path = host_env.lookup("LLDB_DEBUGSERVER_PATH");
+  if (!env_debugserver_path.empty()) {
 debugserver_file_spec.SetFile(env_debugserver_path,
   FileSpec::Style::native);
 if (log)
   log->Printf("GDBRemoteCommunication::%s() gdb-remote stub exe path set "
   "from environment variable: %s",
-  __FUNCTION__, env_debugserver_path);
+  __FUNCTION__, env_debugserver_path.c_str());
   } else
 debugserver_file_spec = g_debugserver_file_spec;
   bool debugserver_exists =
@@ -1001,7 +1003,6 @@
 
 Args &debugserver_args = launch_info.GetArguments();
 debugserver_args.Clear();
-char arg_cstr[PATH_MAX];
 
 // Start args with "debugserver /file/path -r --"
 debugserver_args.AppendArgument(llvm::StringRef(debugserver_path));
@@ -,29 +1112,27 @@
 }
   }
 }
-
-const char *env_debugserver_log_file = getenv("LLDB_DEBUGSERVER_LOG_FILE");
-if (env_debugserver_log_file) {
-  ::snprintf(arg_cstr, sizeof(arg_cstr), "--log-file=%s",
- env_debugserver_log_file);
-  debugserver_args.AppendArgument(llvm::StringRef(arg_cstr));
+std::string env_debugserver_log_file =
+host_env.lookup("LLDB_DEBUGSERVER_LOG_FILE");
+if (!env_debugserver_log_file.empty()) {
+  debugserver_args.AppendArgument(
+  llvm::formatv("--log-file={0}", env_debugserver_log_file).str());
 }
 
 #if defined(__APPLE__)
 const char *env_debugserver_log_flags =
 getenv("LLDB_DEBUGSERVER_LOG_FLAGS");
 if (env_debugserver_log_flags) {
-  ::snprintf(arg_cstr, sizeof(arg_cstr), "--log-flags=%s",
- env_debugserver_log_flags);
-  debugserver_args.AppendArgument(llvm::StringRef(arg_cstr));
+  debugserver_args.AppendArgument(
+  llvm::formatv("--log-flags={0}", env_debugserver_log_flags).str());
 }
 #else
-const char *env_debugserver_log_channels =
-getenv("LLDB_SERVER_LOG_CHANNELS");
-if (env_debugserver_log_channels) {
-  ::snprintf(arg_cstr, sizeof(arg_cstr), "--log-channels=%s",
- env_debugserver_log_channels);
-  debugserver_args.AppendArgument(llvm::StringRef(arg_cstr));
+std::string env_debugserver_log_channels =
+host_env.lookup("LLDB_SERVER_LOG_CHANNELS");
+if (!env_debugserver_log_channels.empty()) {
+  debugserver_args.AppendArgument(
+  llvm::formatv("--log-channels={0}", env_debugserver_log_channels)
+  .str());
 }
 #endif
 
@@ -1145,15 +1144,15 @@
   char env_var_name[64];
   snprintf(env_var_name, sizeof(env_var_name),
"LLDB_DEBUGSERVER_EXTRA_ARG_%" PRIu32, env_var_index++);
-  const char *extra_arg = getenv(env_var_name);
-  has_env_var = extra_arg != nullptr;
+  std::string extra_arg = host_env.lookup(env_var_name);
+  has_env_var = !extra_arg.empty();
 
   if (has_env_var) {
 debugserver_args.AppendArgument(llvm::StringRef(extra_arg));
 if (log)
   log->Printf("GDBRemoteCommunic

[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-02-07 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 185784.

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

https://reviews.llvm.org/D56230

Files:
  packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
  packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
  source/Host/windows/ProcessLauncherWindows.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -123,14 +123,14 @@
 
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::SendPacketNoLock(llvm::StringRef payload) {
-StreamString packet(0, 4, eByteOrderBig);
-packet.PutChar('$');
-packet.Write(payload.data(), payload.size());
-packet.PutChar('#');
-packet.PutHex8(CalculcateChecksum(payload));
-std::string packet_str = packet.GetString();
-
-return SendRawPacketNoLock(packet_str);
+  StreamString packet(0, 4, eByteOrderBig);
+  packet.PutChar('$');
+  packet.Write(payload.data(), payload.size());
+  packet.PutChar('#');
+  packet.PutHex8(CalculcateChecksum(payload));
+  std::string packet_str = packet.GetString();
+
+  return SendRawPacketNoLock(packet_str);
 }
 
 GDBRemoteCommunication::PacketResult
@@ -949,16 +949,18 @@
   char debugserver_path[PATH_MAX];
   FileSpec &debugserver_file_spec = launch_info.GetExecutableFile();
 
+  Environment host_env = Host::GetEnvironment();
+
   // Always check to see if we have an environment override for the path to the
   // debugserver to use and use it if we do.
-  const char *env_debugserver_path = getenv("LLDB_DEBUGSERVER_PATH");
-  if (env_debugserver_path) {
+  std::string env_debugserver_path = host_env.lookup("LLDB_DEBUGSERVER_PATH");
+  if (!env_debugserver_path.empty()) {
 debugserver_file_spec.SetFile(env_debugserver_path,
   FileSpec::Style::native);
 if (log)
   log->Printf("GDBRemoteCommunication::%s() gdb-remote stub exe path set "
   "from environment variable: %s",
-  __FUNCTION__, env_debugserver_path);
+  __FUNCTION__, env_debugserver_path.c_str());
   } else
 debugserver_file_spec = g_debugserver_file_spec;
   bool debugserver_exists =
@@ -1001,7 +1003,6 @@
 
 Args &debugserver_args = launch_info.GetArguments();
 debugserver_args.Clear();
-char arg_cstr[PATH_MAX];
 
 // Start args with "debugserver /file/path -r --"
 debugserver_args.AppendArgument(llvm::StringRef(debugserver_path));
@@ -,29 +1112,27 @@
 }
   }
 }
-
-const char *env_debugserver_log_file = getenv("LLDB_DEBUGSERVER_LOG_FILE");
-if (env_debugserver_log_file) {
-  ::snprintf(arg_cstr, sizeof(arg_cstr), "--log-file=%s",
- env_debugserver_log_file);
-  debugserver_args.AppendArgument(llvm::StringRef(arg_cstr));
+std::string env_debugserver_log_file =
+host_env.lookup("LLDB_DEBUGSERVER_LOG_FILE");
+if (!env_debugserver_log_file.empty()) {
+  debugserver_args.AppendArgument(
+  llvm::formatv("--log-file={0}", env_debugserver_log_file).str());
 }
 
 #if defined(__APPLE__)
 const char *env_debugserver_log_flags =
 getenv("LLDB_DEBUGSERVER_LOG_FLAGS");
 if (env_debugserver_log_flags) {
-  ::snprintf(arg_cstr, sizeof(arg_cstr), "--log-flags=%s",
- env_debugserver_log_flags);
-  debugserver_args.AppendArgument(llvm::StringRef(arg_cstr));
+  debugserver_args.AppendArgument(
+  llvm::formatv("--log-flags={0}", env_debugserver_log_flags).str());
 }
 #else
-const char *env_debugserver_log_channels =
-getenv("LLDB_SERVER_LOG_CHANNELS");
-if (env_debugserver_log_channels) {
-  ::snprintf(arg_cstr, sizeof(arg_cstr), "--log-channels=%s",
- env_debugserver_log_channels);
-  debugserver_args.AppendArgument(llvm::StringRef(arg_cstr));
+std::string env_debugserver_log_channels =
+host_env.lookup("LLDB_SERVER_LOG_CHANNELS");
+if (!env_debugserver_log_channels.empty()) {
+  debugserver_args.AppendArgument(
+  llvm::formatv("--log-channels={0}", env_debugserver_log_channels)
+  .str());
 }
 #endif
 
@@ -1145,15 +1144,15 @@
   char env_var_name[64];
   snprintf(env_var_name, sizeof(env_var_name),
"LLDB_DEBUGSERVER_EXTRA_ARG_%" PRIu32, env_var_index++);
-  const char *extra_arg = getenv(env_var_name);
-  has_env_var = extra_arg != nullptr;
+  std::string extra_arg = host_env.lookup(env_var_name);
+  has_env_var = !extra_arg.empty();
 
   if (has_env_var) {
 debugserver_args.AppendArgument(llvm::StringRef(extra_arg));
 if (log)
   log->Printf("GDBRemoteCommunication::%s adding env var %s contents "
 

[Lldb-commits] [PATCH] D56322: [Reproducers] SBReproducer framework

2019-02-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Btw, I've just noticed that the files you've added here still have the old 
license header.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56322



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


[Lldb-commits] [PATCH] D55122: [PDB] Fix location retrieval for function local variables and arguments that are stored relative to VFRAME

2019-02-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.
Herald added a subscriber: llvm-commits.

It looks like the files you've added here still have the old headers. Could you 
please update that?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55122



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


[Lldb-commits] [lldb] r353429 - Fix headers for files added in r353047

2019-02-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Feb  7 09:16:25 2019
New Revision: 353429

URL: http://llvm.org/viewvc/llvm-project?rev=353429&view=rev
Log:
Fix headers for files added in r353047

I started working on that patch before the headers were updated. Since
they were new files, I didn't get any conflicts during rebase.

Modified:
lldb/trunk/unittests/Host/FileActionTest.cpp
lldb/trunk/unittests/Host/ProcessInfoTest.cpp
lldb/trunk/unittests/Host/ProcessLaunchInfoTest.cpp

Modified: lldb/trunk/unittests/Host/FileActionTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileActionTest.cpp?rev=353429&r1=353428&r2=353429&view=diff
==
--- lldb/trunk/unittests/Host/FileActionTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileActionTest.cpp Thu Feb  7 09:16:25 2019
@@ -1,9 +1,8 @@
 //===-- FileActionTest.cpp --*- C++ 
-*-===//
 //
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 

Modified: lldb/trunk/unittests/Host/ProcessInfoTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/ProcessInfoTest.cpp?rev=353429&r1=353428&r2=353429&view=diff
==
--- lldb/trunk/unittests/Host/ProcessInfoTest.cpp (original)
+++ lldb/trunk/unittests/Host/ProcessInfoTest.cpp Thu Feb  7 09:16:25 2019
@@ -1,9 +1,8 @@
 //===-- ProcessInfoTest.cpp -*- C++ 
-*-===//
 //
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 

Modified: lldb/trunk/unittests/Host/ProcessLaunchInfoTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/ProcessLaunchInfoTest.cpp?rev=353429&r1=353428&r2=353429&view=diff
==
--- lldb/trunk/unittests/Host/ProcessLaunchInfoTest.cpp (original)
+++ lldb/trunk/unittests/Host/ProcessLaunchInfoTest.cpp Thu Feb  7 09:16:25 2019
@@ -1,9 +1,8 @@
 //===-- ProcessLaunchInfoTest.cpp ---*- C++ 
-*-===//
 //
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 


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


[Lldb-commits] [PATCH] D56322: [Reproducers] SBReproducer framework

2019-02-07 Thread Roman Lebedev via Phabricator via lldb-commits
lebedev.ri added a comment.

In D56322#1389013 , @labath wrote:

> Btw, I've just noticed that the files you've added here still have the old 
> license header.


Would be good to get at least an automatic Herald rule for this
I suspect there might be more occurrences of patches/diffs/commits with old 
license in the time to come.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56322



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


[Lldb-commits] [PATCH] D57895: Breakpad: auto-detect path style of file entries

2019-02-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

LGTM


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

https://reviews.llvm.org/D57895



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


[Lldb-commits] [PATCH] D57907: lldb: Fix compilation on OpenBSD

2019-02-07 Thread Todd Mortimer via Phabricator via lldb-commits
mortimer created this revision.
mortimer added a reviewer: krytarowski.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Update the OpenBSD Host.cpp for the new SetFile() function signature. Fixes 
compiling lldb on OpenBSD.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57907

Files:
  lldb/source/Host/openbsd/Host.cpp


Index: lldb/source/Host/openbsd/Host.cpp
===
--- lldb/source/Host/openbsd/Host.cpp
+++ lldb/source/Host/openbsd/Host.cpp
@@ -67,8 +67,7 @@
 
   cstr = data.GetCStr(&offset);
   if (cstr) {
-process_info.GetExecutableFile().SetFile(cstr, false,
- FileSpec::Style::native);
+process_info.GetExecutableFile().SetFile(cstr, 
FileSpec::Style::native);
 
 if (!(match_info_ptr == NULL ||
   NameMatches(


Index: lldb/source/Host/openbsd/Host.cpp
===
--- lldb/source/Host/openbsd/Host.cpp
+++ lldb/source/Host/openbsd/Host.cpp
@@ -67,8 +67,7 @@
 
   cstr = data.GetCStr(&offset);
   if (cstr) {
-process_info.GetExecutableFile().SetFile(cstr, false,
- FileSpec::Style::native);
+process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native);
 
 if (!(match_info_ptr == NULL ||
   NameMatches(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57689: Adds property to force enabling of GDB JIT loader for MacOS

2019-02-07 Thread Yury Delendik via Phabricator via lldb-commits
yurydelendik updated this revision to Diff 185807.
yurydelendik added a comment.
Herald added a reviewer: serge-sans-paille.

- Add tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57689

Files:
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.c
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp

Index: lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -57,11 +57,29 @@
 
 namespace {
 
+enum EnableJITLoaderGDB {
+  eEnableJITLoaderGDBDefault,
+  eEnableJITLoaderGDBOn,
+  eEnableJITLoaderGDBOff,
+};
+
+static constexpr OptionEnumValueElement g_enable_jit_loader_gdb_enumerators[] = {
+{eEnableJITLoaderGDBDefault, "default", "Enable JIT compilation interface "
+ "for all platforms except macOS"},
+{eEnableJITLoaderGDBOn, "on", "Enable JIT compilation interface"},
+{eEnableJITLoaderGDBOff, "off", "Disable JIT compilation interface"}
+ };
+
 static constexpr PropertyDefinition g_properties[] = {
+{"enable", OptionValue::eTypeEnum, true,
+ eEnableJITLoaderGDBDefault, nullptr,
+ OptionEnumValues(g_enable_jit_loader_gdb_enumerators),
+ "Enable GDB's JIT compilation interface (default: enabled on "
+ "all platforms except macOS)"},
 {"enable-jit-breakpoint", OptionValue::eTypeBoolean, true, true, nullptr,
  {}, "Enable breakpoint on __jit_debug_register_code."}};
 
-enum { ePropertyEnableJITBreakpoint };
+enum { ePropertyEnable, ePropertyEnableJITBreakpoint };
 
 class PluginProperties : public Properties {
 public:
@@ -79,6 +97,12 @@
 nullptr, ePropertyEnableJITBreakpoint,
 g_properties[ePropertyEnableJITBreakpoint].default_uint_value != 0);
   }
+
+  EnableJITLoaderGDB GetEnable() const {
+return (EnableJITLoaderGDB)m_collection_sp->GetPropertyAtIndexAsEnumeration(
+nullptr, ePropertyEnable,
+g_properties[ePropertyEnable].default_uint_value);
+  }
 };
 
 typedef std::shared_ptr JITLoaderGDBPropertiesSP;
@@ -400,8 +424,20 @@
 
 JITLoaderSP JITLoaderGDB::CreateInstance(Process *process, bool force) {
   JITLoaderSP jit_loader_sp;
-  ArchSpec arch(process->GetTarget().GetArchitecture());
-  if (arch.GetTriple().getVendor() != llvm::Triple::Apple)
+  bool enable;
+  switch (GetGlobalPluginProperties()->GetEnable()) {
+case EnableJITLoaderGDB::eEnableJITLoaderGDBOn:
+  enable = true;
+  break;
+case EnableJITLoaderGDB::eEnableJITLoaderGDBOff:
+  enable = false;
+  break;
+case EnableJITLoaderGDB::eEnableJITLoaderGDBDefault:
+  ArchSpec arch(process->GetTarget().GetArchitecture());
+  enable = arch.GetTriple().getVendor() != llvm::Triple::Apple;
+  break;
+  }
+  if (enable)
 jit_loader_sp.reset(new JITLoaderGDB(process));
   return jit_loader_sp;
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
===
--- lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
+++ lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
@@ -1,5 +1,6 @@
 LEVEL = ../../make
 
-C_SOURCES := main.c
+C_SOURCES := simple.c
+EXE = simple
 
 include $(LEVEL)/Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.c
@@ -0,0 +1,20 @@
+#include 
+
+// GDB JIT interface stub
+struct
+{
+uint32_t version;
+uint32_t action_flag;
+void* relevant_entry;
+void* first_entry;
+} __jit_debug_descriptor = { 1, 0, 0, 0 };
+
+void __jit_debug_register_code()
+{
+}
+// end GDB JIT interface stub
+
+int main()
+{
+return 0;
+}
Index: lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
@@ -10,6 +10,7 @@
 from lldbsuite.test.lldbtest import *
 import re
 
+file_index = 0
 
 class JITLoaderGDBTestCase(TestBase):
 
@@ -38,3 +39,80 @@
 
 self.assertEqual(process.GetState(), lldb.eStateExited)
 self.assertEqual(process.GetExitStatus(), 0)
+
+def gen_log_file(self):
+global file_index
+++file_index
+logfile = os.path.join(
+self.

[Lldb-commits] [PATCH] D57689: Adds property to force enabling of GDB JIT loader for MacOS

2019-02-07 Thread Yury Delendik via Phabricator via lldb-commits
yurydelendik updated this revision to Diff 185809.
yurydelendik added a comment.

- Remove enable-jit-breakpoint option


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57689

Files:
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.c
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp

Index: lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -57,11 +57,27 @@
 
 namespace {
 
+enum EnableJITLoaderGDB {
+  eEnableJITLoaderGDBDefault,
+  eEnableJITLoaderGDBOn,
+  eEnableJITLoaderGDBOff,
+};
+
+static constexpr OptionEnumValueElement g_enable_jit_loader_gdb_enumerators[] = {
+{eEnableJITLoaderGDBDefault, "default", "Enable JIT compilation interface "
+ "for all platforms except macOS"},
+{eEnableJITLoaderGDBOn, "on", "Enable JIT compilation interface"},
+{eEnableJITLoaderGDBOff, "off", "Disable JIT compilation interface"}
+ };
+
 static constexpr PropertyDefinition g_properties[] = {
-{"enable-jit-breakpoint", OptionValue::eTypeBoolean, true, true, nullptr,
- {}, "Enable breakpoint on __jit_debug_register_code."}};
+{"enable", OptionValue::eTypeEnum, true,
+ eEnableJITLoaderGDBDefault, nullptr,
+ OptionEnumValues(g_enable_jit_loader_gdb_enumerators),
+ "Enable GDB's JIT compilation interface (default: enabled on "
+ "all platforms except macOS)"}};
 
-enum { ePropertyEnableJITBreakpoint };
+enum { ePropertyEnable, ePropertyEnableJITBreakpoint };
 
 class PluginProperties : public Properties {
 public:
@@ -74,10 +90,10 @@
 m_collection_sp->Initialize(g_properties);
   }
 
-  bool GetEnableJITBreakpoint() const {
-return m_collection_sp->GetPropertyAtIndexAsBoolean(
-nullptr, ePropertyEnableJITBreakpoint,
-g_properties[ePropertyEnableJITBreakpoint].default_uint_value != 0);
+  EnableJITLoaderGDB GetEnable() const {
+return (EnableJITLoaderGDB)m_collection_sp->GetPropertyAtIndexAsEnumeration(
+nullptr, ePropertyEnable,
+g_properties[ePropertyEnable].default_uint_value);
   }
 };
 
@@ -163,9 +179,6 @@
 // Setup the JIT Breakpoint
 //--
 void JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList &module_list) {
-  if (!GetGlobalPluginProperties()->GetEnableJITBreakpoint())
-return;
-
   if (DidSetJITBreakpoint())
 return;
 
@@ -400,8 +413,20 @@
 
 JITLoaderSP JITLoaderGDB::CreateInstance(Process *process, bool force) {
   JITLoaderSP jit_loader_sp;
-  ArchSpec arch(process->GetTarget().GetArchitecture());
-  if (arch.GetTriple().getVendor() != llvm::Triple::Apple)
+  bool enable;
+  switch (GetGlobalPluginProperties()->GetEnable()) {
+case EnableJITLoaderGDB::eEnableJITLoaderGDBOn:
+  enable = true;
+  break;
+case EnableJITLoaderGDB::eEnableJITLoaderGDBOff:
+  enable = false;
+  break;
+case EnableJITLoaderGDB::eEnableJITLoaderGDBDefault:
+  ArchSpec arch(process->GetTarget().GetArchitecture());
+  enable = arch.GetTriple().getVendor() != llvm::Triple::Apple;
+  break;
+  }
+  if (enable)
 jit_loader_sp.reset(new JITLoaderGDB(process));
   return jit_loader_sp;
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
===
--- lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
+++ lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
@@ -1,5 +1,6 @@
 LEVEL = ../../make
 
-C_SOURCES := main.c
+C_SOURCES := simple.c
+EXE = simple
 
 include $(LEVEL)/Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.c
@@ -0,0 +1,20 @@
+#include 
+
+// GDB JIT interface stub
+struct
+{
+uint32_t version;
+uint32_t action_flag;
+void* relevant_entry;
+void* first_entry;
+} __jit_debug_descriptor = { 1, 0, 0, 0 };
+
+void __jit_debug_register_code()
+{
+}
+// end GDB JIT interface stub
+
+int main()
+{
+return 0;
+}
Index: lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py

[Lldb-commits] [PATCH] D57689: Adds property to force enabling of GDB JIT loader for MacOS

2019-02-07 Thread Yury Delendik via Phabricator via lldb-commits
yurydelendik added a comment.

In D57689#1384148 , @jingham wrote:

> Could you add a test for this setting to the 
> ./functionalities/jitloader_gdb/TestJITLoaderGDB.py test?


Added tests

In D57689#1384894 , @labath wrote:

> Do we need both this and the `enable-jit-breakpoint` setting? My impression 
> was that the latter was meant to be used for disabling the gdb jit feature. 
> Is the gdb plugin useful for anything if it does not set the breakpoint (i.e. 
> enable = on, but enable-jit-bkpt = off). If it isn't, then could we just 
> remove the latter?


Every time I tried to investigate that, I came to conclusion that it was just 
added as alternative for `enable`, but with intent to test plugin 
instantiation. Remoing in this patch. I can revert this change as needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57689



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


[Lldb-commits] [lldb] r353440 - [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-02-07 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Thu Feb  7 10:22:00 2019
New Revision: 353440

URL: http://llvm.org/viewvc/llvm-project?rev=353440&view=rev
Log:
[gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

Reviewers: zturner, llvm-commits, labath, serge-sans-paille

Reviewed By: labath

Subscribers: Hui, labath, lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py?rev=353440&r1=353439&r2=353440&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
 Thu Feb  7 10:22:00 2019
@@ -48,6 +48,7 @@ class PlatformCommandTestCase(TestBase):
 'Kernel',
 'Hostname'])
 
+@expectedFailureAll(oslist=["windows"])
 @no_debug_info_test
 def test_shell(self):
 """ Test that the platform shell command can invoke ls. """

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py?rev=353440&r1=353439&r2=353440&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py 
Thu Feb  7 10:22:00 2019
@@ -28,7 +28,6 @@ class SettingsCommandTestCase(TestBase):
 def test_no_quote(self):
 self.do_test_args("a b c", "a\0b\0c\0")
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24557")
 @no_debug_info_test
 def test_single_quote(self):
 self.do_test_args("'a b c'", "a b c\0")
@@ -37,17 +36,14 @@ class SettingsCommandTestCase(TestBase):
 def test_double_quote(self):
 self.do_test_args('"a b c"', "a b c\0")
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24557")
 @no_debug_info_test
 def test_single_quote_escape(self):
 self.do_test_args("'a b\\' c", "a b\\\0c\0")
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24557")
 @no_debug_info_test
 def test_double_quote_escape(self):
 self.do_test_args('"a b\\" c"', 'a b" c\0')
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24557")
 @no_debug_info_test
 def test_double_quote_escape2(self):
 self.do_test_args('"a b" c', 'a b\\\0c\0')
@@ -56,7 +52,6 @@ class SettingsCommandTestCase(TestBase):
 def test_single_in_double(self):
 self.do_test_args('"a\'b"', "a'b\0")
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24557")
 @no_debug_info_test
 def test_double_in_single(self):
 self.do_test_args("'a\"b'", 'a"b\0')
@@ -69,7 +64,6 @@ class SettingsCommandTestCase(TestBase):
 def test_bare_single(self):
 self.do_test_args("a\\'b", "a'b\0")
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24557")
 @no_debug_info_test
 def test_bare_double(self):
 self.do_test_args('a\\"b', 'a"b\0')

Modified: lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp?rev=353440&r1=353439&r2=353440&view=diff
==
--- lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp Thu Feb  7 
10:22:00 2019
@@ -12,6 +12,7 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/Program.h"
 
 #include 
 #include 
@@ -37,7 +38,19 @@ void CreateEnvironmentBuffer(const Envir
   buffer.push_back(0);
   buffer.push_back(0);
 }
+
+bool GetFlattenedWindowsCommandString(Args args, std::string &command) {
+  if (args.empty())
+return false;
+
+  std::vector args_ref;
+  for (auto &entry : args.entries())
+args_ref.push_back(entry.ref);
+
+  command = llvm::sys::flattenWindowsCommandLine(args_ref);
+  return true;
 }
+} // namespace
 
 HostProcess
 ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
@@ -84,7 +97,7 @@ ProcessLauncherWindows::LaunchProcess(co
 env_block = environ

[Lldb-commits] [PATCH] D56231: [lldb-server] Improve support on Windows

2019-02-07 Thread Aaron Smith via Phabricator via lldb-commits
asmith added a comment.

Any other comments on this one?


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

https://reviews.llvm.org/D56231



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


[Lldb-commits] [PATCH] D57912: [lldb] [unittests] Disable MainLoopTest::DetectsEOF on NetBSD

2019-02-07 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 185815.

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

https://reviews.llvm.org/D57912

Files:
  lldb/unittests/Host/MainLoopTest.cpp


Index: lldb/unittests/Host/MainLoopTest.cpp
===
--- lldb/unittests/Host/MainLoopTest.cpp
+++ lldb/unittests/Host/MainLoopTest.cpp
@@ -108,6 +108,9 @@
 }
 
 #ifdef LLVM_ON_UNIX
+// NetBSD currently does not report slave pty EOF via kevent
+// causing this test to hang forever.
+#ifndef __NetBSD__
 TEST_F(MainLoopTest, DetectsEOF) {
   PseudoTerminal term;
   ASSERT_TRUE(term.OpenFirstAvailableMaster(O_RDWR, nullptr, 0));
@@ -125,6 +128,7 @@
   ASSERT_TRUE(loop.Run().Success());
   ASSERT_EQ(1u, callback_count);
 }
+#endif
 
 TEST_F(MainLoopTest, Signal) {
   MainLoop loop;


Index: lldb/unittests/Host/MainLoopTest.cpp
===
--- lldb/unittests/Host/MainLoopTest.cpp
+++ lldb/unittests/Host/MainLoopTest.cpp
@@ -108,6 +108,9 @@
 }
 
 #ifdef LLVM_ON_UNIX
+// NetBSD currently does not report slave pty EOF via kevent
+// causing this test to hang forever.
+#ifndef __NetBSD__
 TEST_F(MainLoopTest, DetectsEOF) {
   PseudoTerminal term;
   ASSERT_TRUE(term.OpenFirstAvailableMaster(O_RDWR, nullptr, 0));
@@ -125,6 +128,7 @@
   ASSERT_TRUE(loop.Run().Success());
   ASSERT_EQ(1u, callback_count);
 }
+#endif
 
 TEST_F(MainLoopTest, Signal) {
   MainLoop loop;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57912: [lldb] [unittests] Disable MainLoopTest::DetectsEOF on NetBSD

2019-02-07 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, krytarowski.
Herald added a project: LLDB.
mgorny updated this revision to Diff 185815.

The NetBSD kernel currently does not support detecting closed slave pty
via kevent on master pty.  This causes the test to hang forever.  To
avoid that, disable the test until the kernel is fixed.


https://reviews.llvm.org/D57912

Files:
  lldb/unittests/Host/MainLoopTest.cpp


Index: lldb/unittests/Host/MainLoopTest.cpp
===
--- lldb/unittests/Host/MainLoopTest.cpp
+++ lldb/unittests/Host/MainLoopTest.cpp
@@ -108,6 +108,9 @@
 }
 
 #ifdef LLVM_ON_UNIX
+// NetBSD currently does not report slave pty EOF via kevent
+// causing this test to hang forever.
+#ifndef __NetBSD__
 TEST_F(MainLoopTest, DetectsEOF) {
   PseudoTerminal term;
   ASSERT_TRUE(term.OpenFirstAvailableMaster(O_RDWR, nullptr, 0));
@@ -125,6 +128,7 @@
   ASSERT_TRUE(loop.Run().Success());
   ASSERT_EQ(1u, callback_count);
 }
+#endif
 
 TEST_F(MainLoopTest, Signal) {
   MainLoop loop;


Index: lldb/unittests/Host/MainLoopTest.cpp
===
--- lldb/unittests/Host/MainLoopTest.cpp
+++ lldb/unittests/Host/MainLoopTest.cpp
@@ -108,6 +108,9 @@
 }
 
 #ifdef LLVM_ON_UNIX
+// NetBSD currently does not report slave pty EOF via kevent
+// causing this test to hang forever.
+#ifndef __NetBSD__
 TEST_F(MainLoopTest, DetectsEOF) {
   PseudoTerminal term;
   ASSERT_TRUE(term.OpenFirstAvailableMaster(O_RDWR, nullptr, 0));
@@ -125,6 +128,7 @@
   ASSERT_TRUE(loop.Run().Success());
   ASSERT_EQ(1u, callback_count);
 }
+#endif
 
 TEST_F(MainLoopTest, Signal) {
   MainLoop loop;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r353444 - [lldb-instr] Make lldb-instr a test dependency

2019-02-07 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Feb  7 10:41:59 2019
New Revision: 353444

URL: http://llvm.org/viewvc/llvm-project?rev=353444&view=rev
Log:
[lldb-instr] Make lldb-instr a test dependency

Modified:
lldb/trunk/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=353444&r1=353443&r2=353444&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Feb  7 10:41:59 2019
@@ -89,6 +89,10 @@ if(LLDB_INCLUDE_TESTS)
 list(APPEND LLDB_TEST_DEPS lldb-mi)
   endif()
 
+  if(TARGET lldb-instr)
+list(APPEND LLDB_TEST_DEPS lldb-instr)
+  endif()
+
   if(NOT LLDB_BUILT_STANDALONE)
 list(APPEND LLDB_TEST_DEPS yaml2obj)
   endif()


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


[Lldb-commits] [PATCH] D56231: [lldb-server] Improve support on Windows

2019-02-07 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 185817.

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

https://reviews.llvm.org/D56231

Files:
  include/lldb/Host/File.h
  include/lldb/Host/FileSystem.h
  source/Host/common/File.cpp
  source/Host/common/FileSystem.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -10,7 +10,6 @@
 
 #include 
 
-
 #ifdef __APPLE__
 #include 
 #endif
@@ -214,8 +213,7 @@
   if (sub != LLDB_INVALID_CPUTYPE)
 response.Printf("cpusubtype:%u;", sub);
 
-  if (cpu == llvm::MachO::CPU_TYPE_ARM
-  || cpu == llvm::MachO::CPU_TYPE_ARM64) {
+  if (cpu == llvm::MachO::CPU_TYPE_ARM || cpu == llvm::MachO::CPU_TYPE_ARM64) {
 // Indicate the OS type.
 #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1
 response.PutCString("ostype:tvos;");
@@ -510,18 +508,19 @@
   packet.GetHexByteStringTerminatedBy(path, ',');
   if (!path.empty()) {
 if (packet.GetChar() == ',') {
-  uint32_t flags =
-  File::ConvertOpenOptionsForPOSIXOpen(packet.GetHexMaxU32(false, 0));
+  uint32_t flags = packet.GetHexMaxU32(false, 0);
   if (packet.GetChar() == ',') {
 mode_t mode = packet.GetHexMaxU32(false, 0600);
-Status error;
 FileSpec path_spec(path);
 FileSystem::Instance().Resolve(path_spec);
-int fd = ::open(path_spec.GetCString(), flags, mode);
-const int save_errno = fd == -1 ? errno : 0;
+File file;
+// Do not close fd.
+Status error =
+FileSystem::Instance().Open(file, path_spec, flags, mode, false);
+const int save_errno = error.GetError();
 StreamString response;
 response.PutChar('F');
-response.Printf("%i", fd);
+response.Printf("%i", file.GetDescriptor());
 if (save_errno)
   response.Printf(",%i", save_errno);
 return SendPacketNoLock(response.GetString());
@@ -536,12 +535,13 @@
 StringExtractorGDBRemote &packet) {
   packet.SetFilePos(::strlen("vFile:close:"));
   int fd = packet.GetS32(-1);
-  Status error;
   int err = -1;
   int save_errno = 0;
   if (fd >= 0) {
-err = close(fd);
-save_errno = err == -1 ? errno : 0;
+File file(fd, true);
+Status error = file.Close();
+err = 0;
+save_errno = error.GetError();
   } else {
 save_errno = EINVAL;
   }
@@ -556,26 +556,23 @@
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerCommon::Handle_vFile_pRead(
 StringExtractorGDBRemote &packet) {
-#ifdef _WIN32
-  // Not implemented on Windows
-  return SendUnimplementedResponse(
-  "GDBRemoteCommunicationServerCommon::Handle_vFile_pRead() unimplemented");
-#else
   StreamGDBRemote response;
   packet.SetFilePos(::strlen("vFile:pread:"));
   int fd = packet.GetS32(-1);
   if (packet.GetChar() == ',') {
-uint64_t count = packet.GetU64(UINT64_MAX);
+size_t count = packet.GetU64(UINT64_MAX);
 if (packet.GetChar() == ',') {
-  uint64_t offset = packet.GetU64(UINT32_MAX);
+  off_t offset = packet.GetU64(UINT32_MAX);
   if (count == UINT64_MAX) {
 response.Printf("F-1:%i", EINVAL);
 return SendPacketNoLock(response.GetString());
   }
 
   std::string buffer(count, 0);
-  const ssize_t bytes_read = ::pread(fd, &buffer[0], buffer.size(), offset);
-  const int save_errno = bytes_read == -1 ? errno : 0;
+  File file(fd, false);
+  Status error = file.Read(static_cast(&buffer[0]), count, offset);
+  const ssize_t bytes_read = error.Success() ? count : -1;
+  const int save_errno = error.GetError();
   response.PutChar('F');
   response.Printf("%zi", bytes_read);
   if (save_errno)
@@ -588,17 +585,11 @@
 }
   }
   return SendErrorResponse(21);
-
-#endif
 }
 
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerCommon::Handle_vFile_pWrite(
 StringExtractorGDBRemote &packet) {
-#ifdef _WIN32
-  return SendUnimplementedResponse("GDBRemoteCommunicationServerCommon::Handle_"
-   "vFile_pWrite() unimplemented");
-#else
   packet.SetFilePos(::strlen("vFile:pwrite:"));
 
   StreamGDBRemote response;
@@ -610,9 +601,12 @@
 if (packet.GetChar() == ',') {
   std::string buffer;
   if (packet.GetEscapedBinaryData(buffer)) {
-const ssize_t bytes_written =
-::pwrite(fd, buffer.data(), buffer.size(), offset);
-const int save_errno = bytes_written == -1 ? errno : 0;
+File file(fd, false);
+size_t count = buffer.size();
+Status error =
+file.Write(static_cast(&buffer[0]), count, offset);
+const ssize_t bytes_written = error.Success() ? count : -1;
+   

[Lldb-commits] [lldb] r353446 - [lldb-server] Improve support on Windows

2019-02-07 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Thu Feb  7 10:46:25 2019
New Revision: 353446

URL: http://llvm.org/viewvc/llvm-project?rev=353446&view=rev
Log:
[lldb-server] Improve support on Windows

Summary:
This commit contains the following changes:

  - Rewrite vfile close/read/write packet handlers with portable routines from 
lldb.
This removes #if(s) and allows the handlers to work on Windows.

  - Fix a bug in File::Write. This is intended to write data at an offset to a 
file
but actually writes at the current position of the file.

  - Add a default boolean argument 'should_close_fd' to FileSystem::Open to
let the user decide whether to close the fd or not.

Reviewers: zturner, llvm-commits, labath

Reviewed By: zturner

Subscribers: Hui, labath, abidh, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/File.h
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/source/Host/common/File.cpp
lldb/trunk/source/Host/common/FileSystem.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Modified: lldb/trunk/include/lldb/Host/File.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=353446&r1=353445&r2=353446&view=diff
==
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Thu Feb  7 10:46:25 2019
@@ -14,6 +14,7 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-private.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -420,6 +421,7 @@ protected:
   LazyBool m_is_interactive;
   LazyBool m_is_real_terminal;
   LazyBool m_supports_colors;
+  std::mutex offset_access_mutex;
 
 private:
   DISALLOW_COPY_AND_ASSIGN(File);

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=353446&r1=353445&r2=353446&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Feb  7 10:46:25 2019
@@ -64,7 +64,8 @@ public:
   int Open(const char *path, int flags, int mode);
 
   Status Open(File &File, const FileSpec &file_spec, uint32_t options,
-  uint32_t permissions = lldb::eFilePermissionsFileDefault);
+  uint32_t permissions = lldb::eFilePermissionsFileDefault,
+  bool should_close_fd = true);
 
   /// Get a directory iterator.
   /// @{

Modified: lldb/trunk/source/Host/common/File.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=353446&r1=353445&r2=353446&view=diff
==
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Thu Feb  7 10:46:25 2019
@@ -178,7 +178,7 @@ Status File::Close() {
 
 void File::Clear() {
   m_stream = nullptr;
-  m_descriptor = -1;
+  m_descriptor = kInvalidDescriptor;
   m_options = 0;
   m_own_stream = false;
   m_is_interactive = m_supports_colors = m_is_real_terminal =
@@ -503,6 +503,7 @@ Status File::Read(void *buf, size_t &num
 error.SetErrorString("invalid file handle");
   }
 #else
+  std::lock_guard guard(offset_access_mutex);
   long cur = ::lseek(m_descriptor, 0, SEEK_CUR);
   SeekFromStart(offset);
   error = Read(buf, num_bytes);
@@ -602,7 +603,9 @@ Status File::Write(const void *buf, size
   num_bytes = bytes_written;
 }
 #else
+std::lock_guard guard(offset_access_mutex);
 long cur = ::lseek(m_descriptor, 0, SEEK_CUR);
+SeekFromStart(offset);
 error = Write(buf, num_bytes);
 long after = ::lseek(m_descriptor, 0, SEEK_CUR);
 

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=353446&r1=353445&r2=353446&view=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Feb  7 10:46:25 2019
@@ -408,7 +408,7 @@ static mode_t GetOpenMode(uint32_t permi
 }
 
 Status FileSystem::Open(File &File, const FileSpec &file_spec, uint32_t 
options,
-uint32_t permissions) {
+uint32_t permissions, bool should_close_fd) {
   if (m_collector)
 m_collector->AddFile(file_spec);
 
@@ -431,7 +431,7 @@ Status FileSystem::Open(File &File, cons
 File.SetDescriptor(descriptor, false);
 error.SetErrorToErrno();
   } else {
-File.SetDescriptor(descriptor, true);
+File.SetDescriptor(descriptor, should_close_fd);
 File.SetOptions(options);
   }
   return error;

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Pl

[Lldb-commits] [lldb] r353447 - Add missing overrides

2019-02-07 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Thu Feb  7 10:52:22 2019
New Revision: 353447

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

Modified:
lldb/trunk/include/lldb/Host/windows/PipeWindows.h

Modified: lldb/trunk/include/lldb/Host/windows/PipeWindows.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PipeWindows.h?rev=353447&r1=353446&r2=353447&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/PipeWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PipeWindows.h Thu Feb  7 10:52:22 2019
@@ -48,8 +48,8 @@ public:
   bool CanRead() const override;
   bool CanWrite() const override;
 
-  lldb::pipe_t GetReadPipe() const { return lldb::pipe_t(m_read); }
-  lldb::pipe_t GetWritePipe() const { return lldb::pipe_t(m_write); }
+  lldb::pipe_t GetReadPipe() const override { return lldb::pipe_t(m_read); }
+  lldb::pipe_t GetWritePipe() const override { return lldb::pipe_t(m_write); }
 
   int GetReadFileDescriptor() const override;
   int GetWriteFileDescriptor() const override;


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


[Lldb-commits] [lldb] r353468 - Silence fallthrough warnings in debugserver.

2019-02-07 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Feb  7 13:22:38 2019
New Revision: 353468

URL: http://llvm.org/viewvc/llvm-project?rev=353468&view=rev
Log:
Silence fallthrough warnings in debugserver.

Modified:
lldb/trunk/include/lldb/module.modulemap
lldb/trunk/tools/debugserver/source/debugserver.cpp

Modified: lldb/trunk/include/lldb/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/module.modulemap?rev=353468&r1=353467&r2=353468&view=diff
==
--- lldb/trunk/include/lldb/module.modulemap (original)
+++ lldb/trunk/include/lldb/module.modulemap Thu Feb  7 13:22:38 2019
@@ -47,7 +47,7 @@ module lldb_Host {
   module SafeMachO { header "Host/SafeMachO.h" export * }
   module SocketAddress { header "Host/SocketAddress.h" export * }
   module Socket { header "Host/Socket.h" export * }
-  module StringConvert { header "Host/StringConvert.h" export * }
+  module StringConvert { textual header "Host/StringConvert.h" export * }
   module Symbols { header "Host/Symbols.h" export * }
   module TaskPool { header "Host/TaskPool.h" export * }
   module Terminal { header "Host/Terminal.h" export * }

Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=353468&r1=353467&r2=353468&view=diff
==
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Thu Feb  7 13:22:38 2019
@@ -492,6 +492,7 @@ RNBRunLoopMode HandleProcessStateChange(
 
   case eStateExited:
 remote->HandlePacket_last_signal(NULL);
+return eRNBRunLoopModeExit;
   case eStateDetached:
 return eRNBRunLoopModeExit;
   }
@@ -1000,7 +1001,8 @@ int main(int argc, char *argv[]) {
 
   case optional_argument:
 short_options[short_options_idx++] = ':';
-  // Fall through to required_argument case below...
+short_options[short_options_idx++] = ':';
+break;
   case required_argument:
 short_options[short_options_idx++] = ':';
 break;
@@ -1670,6 +1672,7 @@ int main(int argc, char *argv[]) {
 
 default:
   mode = eRNBRunLoopModeExit;
+  break;
 case eRNBRunLoopModeExit:
   break;
 }


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


[Lldb-commits] [lldb] r353472 - [CommandInterpreter] Early return on error (NFC)

2019-02-07 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Feb  7 13:51:20 2019
New Revision: 353472

URL: http://llvm.org/viewvc/llvm-project?rev=353472&view=rev
Log:
[CommandInterpreter] Early return on error (NFC)

We save two levels of indentation by returning early if the given file
doesn't exists or cannot be opened.

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

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=353472&r1=353471&r2=353472&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Feb  7 13:51:20 
2019
@@ -2364,138 +2364,134 @@ enum {
 void CommandInterpreter::HandleCommandsFromFile(
 FileSpec &cmd_file, ExecutionContext *context,
 CommandInterpreterRunOptions &options, CommandReturnObject &result) {
-  if (FileSystem::Instance().Exists(cmd_file)) {
-StreamFileSP input_file_sp(new StreamFile());
-
-std::string cmd_file_path = cmd_file.GetPath();
-Status error = FileSystem::Instance().Open(input_file_sp->GetFile(),
-   cmd_file, 
File::eOpenOptionRead);
-if (error.Success()) {
-  Debugger &debugger = GetDebugger();
-
-  uint32_t flags = 0;
-
-  if (options.m_stop_on_continue == eLazyBoolCalculate) {
-if (m_command_source_flags.empty()) {
-  // Stop on continue by default
-  flags |= eHandleCommandFlagStopOnContinue;
-} else if (m_command_source_flags.back() &
-   eHandleCommandFlagStopOnContinue) {
-  flags |= eHandleCommandFlagStopOnContinue;
-}
-  } else if (options.m_stop_on_continue == eLazyBoolYes) {
-flags |= eHandleCommandFlagStopOnContinue;
-  }
-
-  if (options.m_stop_on_error == eLazyBoolCalculate) {
-if (m_command_source_flags.empty()) {
-  if (GetStopCmdSourceOnError())
-flags |= eHandleCommandFlagStopOnError;
-} else if (m_command_source_flags.back() &
-   eHandleCommandFlagStopOnError) {
-  flags |= eHandleCommandFlagStopOnError;
-}
-  } else if (options.m_stop_on_error == eLazyBoolYes) {
-flags |= eHandleCommandFlagStopOnError;
-  }
-
-  // stop-on-crash can only be set, if it is present in all levels of
-  // pushed flag sets.
-  if (options.GetStopOnCrash()) {
-if (m_command_source_flags.empty()) {
-  flags |= eHandleCommandFlagStopOnCrash;
-} else if (m_command_source_flags.back() &
-   eHandleCommandFlagStopOnCrash) {
-  flags |= eHandleCommandFlagStopOnCrash;
-}
-  }
-
-  if (options.m_echo_commands == eLazyBoolCalculate) {
-if (m_command_source_flags.empty()) {
-  // Echo command by default
-  flags |= eHandleCommandFlagEchoCommand;
-} else if (m_command_source_flags.back() &
-   eHandleCommandFlagEchoCommand) {
-  flags |= eHandleCommandFlagEchoCommand;
-}
-  } else if (options.m_echo_commands == eLazyBoolYes) {
-flags |= eHandleCommandFlagEchoCommand;
-  }
-
-  // We will only ever ask for this flag, if we echo commands in general.
-  if (options.m_echo_comment_commands == eLazyBoolCalculate) {
-if (m_command_source_flags.empty()) {
-  // Echo comments by default
-  flags |= eHandleCommandFlagEchoCommentCommand;
-} else if (m_command_source_flags.back() &
-   eHandleCommandFlagEchoCommentCommand) {
-  flags |= eHandleCommandFlagEchoCommentCommand;
-}
-  } else if (options.m_echo_comment_commands == eLazyBoolYes) {
-flags |= eHandleCommandFlagEchoCommentCommand;
-  }
-
-  if (options.m_print_results == eLazyBoolCalculate) {
-if (m_command_source_flags.empty()) {
-  // Print output by default
-  flags |= eHandleCommandFlagPrintResult;
-} else if (m_command_source_flags.back() &
-   eHandleCommandFlagPrintResult) {
-  flags |= eHandleCommandFlagPrintResult;
-}
-  } else if (options.m_print_results == eLazyBoolYes) {
-flags |= eHandleCommandFlagPrintResult;
-  }
-
-  if (flags & eHandleCommandFlagPrintResult) {
-debugger.GetOutputFile()->Printf("Executing commands in '%s'.\n",
- cmd_file_path.c_str());
-  }
-
-  // Used for inheriting the right settings when "command source" might
-  // have nested "command source" commands
-  lldb::StreamFileSP empty_stream_sp;
-  m_command_source_flags.push_back(flags);
-  IOHandlerSP io_handler_sp(new IOHandlerEditline(
-  debugger, IOHandler::Type::CommandInterpreter, input_file_sp,
-  empty_stream_sp, // Pass in a

[Lldb-commits] [PATCH] D57928: Fix x86 return pattern detection

2019-02-07 Thread Todd Mortimer via Phabricator via lldb-commits
mortimer created this revision.
mortimer added a reviewer: jasonmolenda.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Replace 0xc9 (LEAVE) with 0xcb (RETF) in ret_pattern_p(). Also put 0xc3 first, 
since it is the most common form and will match first.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57928

Files:
  lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp


Index: lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
===
--- lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
+++ lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
@@ -665,10 +665,10 @@
   return false;
 }
 
-// ret [0xc9] or [0xc2 imm8] or [0xca imm8]
+// ret [0xc3] or [0xcb] or [0xc2 imm16] or [0xca imm16]
 bool x86AssemblyInspectionEngine::ret_pattern_p() {
   uint8_t *p = m_cur_insn;
-  return *p == 0xc9 || *p == 0xc2 || *p == 0xca || *p == 0xc3;
+  return *p == 0xc3 || *p == 0xc2 || *p == 0xca || *p == 0xcb;
 }
 
 uint32_t x86AssemblyInspectionEngine::extract_4(uint8_t *b) {


Index: lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
===
--- lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
+++ lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
@@ -665,10 +665,10 @@
   return false;
 }
 
-// ret [0xc9] or [0xc2 imm8] or [0xca imm8]
+// ret [0xc3] or [0xcb] or [0xc2 imm16] or [0xca imm16]
 bool x86AssemblyInspectionEngine::ret_pattern_p() {
   uint8_t *p = m_cur_insn;
-  return *p == 0xc9 || *p == 0xc2 || *p == 0xca || *p == 0xc3;
+  return *p == 0xc3 || *p == 0xc2 || *p == 0xca || *p == 0xcb;
 }
 
 uint32_t x86AssemblyInspectionEngine::extract_4(uint8_t *b) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57895: Breakpad: auto-detect path style of file entries

2019-02-07 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added inline comments.



Comment at: include/lldb/Utility/FileSpec.h:250
+  /// unreliable (e.g. "c:\foo.txt" is a valid relative posix path).
+  static llvm::Optional

[Lldb-commits] [lldb] r353487 - Removing some unimplemented methods from the SB headers

2019-02-07 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Feb  7 16:34:04 2019
New Revision: 353487

URL: http://llvm.org/viewvc/llvm-project?rev=353487&view=rev
Log:
Removing some unimplemented methods from the SB headers
NFC

Modified:
lldb/trunk/include/lldb/API/SBCommandInterpreter.h
lldb/trunk/include/lldb/API/SBExecutionContext.h
lldb/trunk/include/lldb/API/SBExpressionOptions.h
lldb/trunk/include/lldb/API/SBQueue.h
lldb/trunk/include/lldb/API/SBSourceManager.h

Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=353487&r1=353486&r2=353487&view=diff
==
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Thu Feb  7 16:34:04 2019
@@ -255,8 +255,6 @@ protected:
 private:
   friend class SBDebugger;
 
-  static void InitializeSWIG();
-
   lldb_private::CommandInterpreter *m_opaque_ptr;
 };
 

Modified: lldb/trunk/include/lldb/API/SBExecutionContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExecutionContext.h?rev=353487&r1=353486&r2=353487&view=diff
==
--- lldb/trunk/include/lldb/API/SBExecutionContext.h (original)
+++ lldb/trunk/include/lldb/API/SBExecutionContext.h Thu Feb  7 16:34:04 2019
@@ -50,8 +50,6 @@ public:
   SBFrame GetFrame() const;
 
 protected:
-  ExecutionContextRefSP &GetSP() const;
-
   void reset(lldb::ExecutionContextRefSP &event_sp);
 
   lldb_private::ExecutionContextRef *get() const;

Modified: lldb/trunk/include/lldb/API/SBExpressionOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExpressionOptions.h?rev=353487&r1=353486&r2=353487&view=diff
==
--- lldb/trunk/include/lldb/API/SBExpressionOptions.h (original)
+++ lldb/trunk/include/lldb/API/SBExpressionOptions.h Thu Feb  7 16:34:04 2019
@@ -97,9 +97,6 @@ public:
   void SetAllowJIT(bool allow);
 
 protected:
-  SBExpressionOptions(
-  lldb_private::EvaluateExpressionOptions &expression_options);
-
   lldb_private::EvaluateExpressionOptions *get() const;
 
   lldb_private::EvaluateExpressionOptions &ref() const;

Modified: lldb/trunk/include/lldb/API/SBQueue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBQueue.h?rev=353487&r1=353486&r2=353487&view=diff
==
--- lldb/trunk/include/lldb/API/SBQueue.h (original)
+++ lldb/trunk/include/lldb/API/SBQueue.h Thu Feb  7 16:34:04 2019
@@ -58,10 +58,6 @@ protected:
 
   void SetQueue(const lldb::QueueSP &queue_sp);
 
-  void FetchThreads();
-
-  void FetchItems();
-
 private:
   std::shared_ptr m_opaque_sp;
 };

Modified: lldb/trunk/include/lldb/API/SBSourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSourceManager.h?rev=353487&r1=353486&r2=353487&view=diff
==
--- lldb/trunk/include/lldb/API/SBSourceManager.h (original)
+++ lldb/trunk/include/lldb/API/SBSourceManager.h Thu Feb  7 16:34:04 2019
@@ -38,8 +38,6 @@ protected:
   friend class SBCommandInterpreter;
   friend class SBDebugger;
 
-  SBSourceManager(lldb_private::SourceManager *source_manager);
-
 private:
   std::unique_ptr m_opaque_ap;
 };


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