[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

2019-09-27 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

@jankratochvil it looks like this PR broke the green dragon build: 
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/1926/

The specific test that is failing is `TestFunctionStarts.py` see the more 
detailed log here: 
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/1926/testReport/junit/lldb-Suite/macosx_function-starts/TestFunctionStarts_py/


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67589



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


[Lldb-commits] [lldb] r373102 - [Reproducer] Always use absolute paths for capture & replay.

2019-09-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 27 10:30:40 2019
New Revision: 373102

URL: http://llvm.org/viewvc/llvm-project?rev=373102&view=rev
Log:
[Reproducer] Always use absolute paths for capture & replay.

The VFS requires files to be have absolute paths. The file collector
makes paths relative to the reproducer root. If the root is a relative
path, this would trigger an assert in the VFS. This patch ensures that
we always make the given path absolute.

Thank you Ted Woodward for pointing this out!

Added:
lldb/trunk/lit/Reproducer/TestRelativePath.test
Modified:
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/source/Utility/Reproducer.cpp

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=373102&r1=373101&r2=373102&view=diff
==
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Fri Sep 27 10:30:40 2019
@@ -215,7 +215,7 @@ private:
 class Generator final {
 
 public:
-  Generator(const FileSpec &root);
+  Generator(FileSpec root);
   ~Generator();
 
   /// Method to indicate we want to keep the reproducer. If reproducer
@@ -272,7 +272,7 @@ private:
 
 class Loader final {
 public:
-  Loader(const FileSpec &root);
+  Loader(FileSpec root);
 
   template  FileSpec GetFile() {
 if (!HasFile(T::file))

Added: lldb/trunk/lit/Reproducer/TestRelativePath.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestRelativePath.test?rev=373102&view=auto
==
--- lldb/trunk/lit/Reproducer/TestRelativePath.test (added)
+++ lldb/trunk/lit/Reproducer/TestRelativePath.test Fri Sep 27 10:30:40 2019
@@ -0,0 +1,8 @@
+# This tests relative capture paths.
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: rm -rf ./foo
+# RUN: %clang %S/Inputs/simple.c -g -o %t/reproducer.out
+# RUN: %lldb -x -b -s %S/Inputs/FileCapture.in -o 'reproducer dump -p files' 
--capture --capture-path ./foo %t/reproducer.out
+# RUN: %lldb --replay ./foo

Modified: lldb/trunk/source/Utility/Reproducer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Reproducer.cpp?rev=373102&r1=373101&r2=373102&view=diff
==
--- lldb/trunk/source/Utility/Reproducer.cpp (original)
+++ lldb/trunk/source/Utility/Reproducer.cpp Fri Sep 27 10:30:40 2019
@@ -136,7 +136,15 @@ FileSpec Reproducer::GetReproducerPath()
   return {};
 }
 
-Generator::Generator(const FileSpec &root) : m_root(root), m_done(false) {}
+static FileSpec MakeAbsolute(FileSpec file_spec) {
+  SmallString<128> path;
+  file_spec.GetPath(path, false);
+  llvm::sys::fs::make_absolute(path);
+  return FileSpec(path, file_spec.GetPathStyle());
+}
+
+Generator::Generator(FileSpec root)
+: m_root(MakeAbsolute(std::move(root))), m_done(false) {}
 
 Generator::~Generator() {}
 
@@ -188,7 +196,8 @@ void Generator::AddProvidersToIndex() {
   yout << files;
 }
 
-Loader::Loader(const FileSpec &root) : m_root(root), m_loaded(false) {}
+Loader::Loader(FileSpec root)
+: m_root(MakeAbsolute(std::move(root))), m_loaded(false) {}
 
 llvm::Error Loader::LoadIndex() {
   if (m_loaded)


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


[Lldb-commits] [PATCH] D68130: [lldb] Don't emit artificial constructor declarations as global functions

2019-09-27 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a subscriber: labath.
vsk added a comment.

Great find. The changes in this patch makes sense to me locally, but I'm having 
trouble picking up on the context necessary to confidently 'lgtm'. + 
@JDevlieghere & @labath to get some more experienced people.

I'd love to see the big switch in ParseTypeFromDWARF broken up into small, 
well-commented functions bit-by-bit -- when that's done, I think I'll have a 
much better chance at reviewing changes. If folks agree that that's a 
reasonable refactor, I'd be happy to send a few patches (perhaps starting with 
the DW_TAG_subroutine_type handling).




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:1401
   type_handled = cxx_method_decl != NULL;
+  // Artificial methods are always handled even when don't
+  // create a new declaration for them.

nit: we don't ?


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

https://reviews.llvm.org/D68130



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


[Lldb-commits] [PATCH] D68069: Explicitly set entry point arch when it's thumb

2019-09-27 Thread António Afonso via Phabricator via lldb-commits
aadsm added a comment.

>   Not everyone has both of these things enabled (particularly having lld is 
> less common), but they are things that one _can_ enable no matter what is his 
> host or target architecture, so I am not worried by that. And as tests like 
> these become more common, I expect more people will start having these 
> enabled by default.

Will the tests running on the build bots have lld, arm enabled?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68069



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


[Lldb-commits] [lldb] r373105 - [CMake] Make Core depend on ClangDriverOptions (NFC)

2019-09-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 27 10:55:49 2019
New Revision: 373105

URL: http://llvm.org/viewvc/llvm-project?rev=373105&view=rev
Log:
[CMake] Make Core depend on ClangDriverOptions (NFC)

ModuleList.cpp includes clang/Driver/Driver.h which depends on
clang/Driver/Options.inc. This patch adds the corresponding TableGen
target to Core.

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

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=373105&r1=373104&r2=373105&view=diff
==
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Fri Sep 27 10:55:49 2019
@@ -65,6 +65,9 @@ add_lldb_library(lldbCore
   ValueObjectSyntheticFilter.cpp
   ValueObjectVariable.cpp
 
+  DEPENDS
+ClangDriverOptions
+
   LINK_LIBS
 clangAST
 clangDriver


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


[Lldb-commits] [PATCH] D68152: refactor: move IOObject::m_should_close_fd into subclasses

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna created this revision.
lawrence_danna added reviewers: labath, JDevlieghere, jasonmolenda.
Herald added a project: LLDB.

m_should_close_fd doesn't need to be in IOObject.   It will be useful
for my next change to move it down into File and Socket.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68152

Files:
  lldb/include/lldb/Host/File.h
  lldb/include/lldb/Host/Socket.h
  lldb/include/lldb/Utility/IOObject.h
  lldb/source/Host/common/File.cpp
  lldb/source/Host/common/Socket.cpp

Index: lldb/source/Host/common/Socket.cpp
===
--- lldb/source/Host/common/Socket.cpp
+++ lldb/source/Host/common/Socket.cpp
@@ -74,9 +74,10 @@
 
 Socket::Socket(SocketProtocol protocol, bool should_close,
bool child_processes_inherit)
-: IOObject(eFDTypeSocket, should_close), m_protocol(protocol),
+: IOObject(eFDTypeSocket), m_protocol(protocol),
   m_socket(kInvalidSocketValue),
-  m_child_processes_inherit(child_processes_inherit) {}
+  m_child_processes_inherit(child_processes_inherit),
+  m_should_close_fd(should_close) {}
 
 Socket::~Socket() { Close(); }
 
Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -98,7 +98,7 @@
 if (DescriptorIsValid()) {
   const char *mode = GetStreamOpenModeFromOptions(m_options);
   if (mode) {
-if (!m_should_close_fd) {
+if (!m_own_descriptor) {
 // We must duplicate the file descriptor if we don't own it because when you
 // call fdopen, the stream will own the fd
 #ifdef _WIN32
@@ -106,7 +106,7 @@
 #else
   m_descriptor = dup(GetDescriptor());
 #endif
-  m_should_close_fd = true;
+  m_own_descriptor = true;
 }
 
 m_stream =
@@ -117,7 +117,7 @@
 
 if (m_stream) {
   m_own_stream = true;
-  m_should_close_fd = false;
+  m_own_descriptor = false;
 }
   }
 }
@@ -148,7 +148,7 @@
   error.SetErrorToErrno();
   }
 
-  if (DescriptorIsValid() && m_should_close_fd) {
+  if (DescriptorIsValid() && m_own_descriptor) {
 if (::close(m_descriptor) != 0)
   error.SetErrorToErrno();
   }
@@ -156,7 +156,7 @@
   m_stream = kInvalidStream;
   m_options = 0;
   m_own_stream = false;
-  m_should_close_fd = false;
+  m_own_descriptor = false;
   m_is_interactive = eLazyBoolCalculate;
   m_is_real_terminal = eLazyBoolCalculate;
   return error;
Index: lldb/include/lldb/Utility/IOObject.h
===
--- lldb/include/lldb/Utility/IOObject.h
+++ lldb/include/lldb/Utility/IOObject.h
@@ -29,8 +29,7 @@
   typedef int WaitableHandle;
   static const WaitableHandle kInvalidHandleValue;
 
-  IOObject(FDType type, bool should_close)
-  : m_fd_type(type), m_should_close_fd(should_close) {}
+  IOObject(FDType type) : m_fd_type(type) {}
   virtual ~IOObject();
 
   virtual Status Read(void *buf, size_t &num_bytes) = 0;
@@ -44,8 +43,6 @@
 
 protected:
   FDType m_fd_type;
-  bool m_should_close_fd; // True if this class should close the file descriptor
-  // when it goes away.
 
 private:
   DISALLOW_COPY_AND_ASSIGN(IOObject);
Index: lldb/include/lldb/Host/Socket.h
===
--- lldb/include/lldb/Host/Socket.h
+++ lldb/include/lldb/Host/Socket.h
@@ -122,6 +122,7 @@
   SocketProtocol m_protocol;
   NativeSocket m_socket;
   bool m_child_processes_inherit;
+  bool m_should_close_fd;
 };
 
 } // namespace lldb_private
Index: lldb/include/lldb/Host/File.h
===
--- lldb/include/lldb/Host/File.h
+++ lldb/include/lldb/Host/File.h
@@ -51,22 +51,23 @@
   static mode_t ConvertOpenOptionsForPOSIXOpen(uint32_t open_options);
 
   File()
-  : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
-m_stream(kInvalidStream), m_options(0), m_own_stream(false),
-m_is_interactive(eLazyBoolCalculate),
+  : IOObject(eFDTypeFile), m_descriptor(kInvalidDescriptor),
+m_own_descriptor(false), m_stream(kInvalidStream), m_options(0),
+m_own_stream(false), m_is_interactive(eLazyBoolCalculate),
 m_is_real_terminal(eLazyBoolCalculate),
 m_supports_colors(eLazyBoolCalculate) {}
 
   File(FILE *fh, bool transfer_ownership)
-  : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
-m_stream(fh), m_options(0), m_own_stream(transfer_ownership),
-m_is_interactive(eLazyBoolCalculate),
+  : IOObject(eFDTypeFile), m_descriptor(kInvalidDescriptor),
+m_own_descriptor(false), m_stream(fh), m_options(0),
+m_own_stream(transfer_ownership), m_is_interactive(eLazyBoolCalculate),
 m_is_real_terminal(eLazyBoolCalculate),
 m_supports_colors(eLazyB

[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

2019-09-27 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D67589#1686150 , @shafik wrote:

> @jankratochvil it looks like this PR broke the green dragon build: 
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/1926/


This PR is not yet checked-in.  Let's move this discussion to rL373061 
.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67589



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


[Lldb-commits] [lldb] r373110 - Revert: [lldb] [testsuite] Remove redundant MAKE_DSYM := NO

2019-09-27 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Fri Sep 27 11:52:34 2019
New Revision: 373110

URL: http://llvm.org/viewvc/llvm-project?rev=373110&view=rev
Log:
Revert: [lldb] [testsuite] Remove redundant MAKE_DSYM := NO

Revert: llvm-svn: 373061

It broke OSX testsuite:
https://reviews.llvm.org/D67589#1686150

lldb/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py

Modified:
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/Makefile
lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/Makefile

lldb/trunk/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/Makefile

lldb/trunk/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/create-empty-corefile.mk
lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/frame/Makefile
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/Makefile

lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/Makefile
lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/Makefile
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/Makefile

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile?rev=373110&r1=373109&r2=373110&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile 
Fri Sep 27 11:52:34 2019
@@ -1,3 +1,5 @@
+MAKE_DSYM := NO
+
 ENABLE_THREADS := YES
 CXX_SOURCES := multi-process-driver.cpp testprog.cpp
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile?rev=373110&r1=373109&r2=373110&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile Fri 
Sep 27 11:52:34 2019
@@ -1,3 +1,5 @@
+MAKE_DSYM := NO
+
 ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile?rev=373110&r1=373109&r2=373110&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile 
Fri Sep 27 11:52:34 2019
@@ -1,6 +1,7 @@
 OBJC_SOURCES := main.m
 
 CFLAGS_EXTRAS := -g0 # No debug info.
+MAKE_DSYM := NO
 
 
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile?rev=373110&r1=373109&r2=373110&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile 
Fri Sep 27 11:52:34 2019
@@ -1,5 +1,6 @@
 C_SOURCES := main.c
 
+MAKE_DSYM := NO
 ARCHIVE_NAME := libfoo.a
 ARCHIVE_C_SOURCES := a.c b.c
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile?rev=373110&r1=373109&r2=373110&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile 
Fri Sep 27 11:52:34 2019
@@ -11,4 +11,6 @@ else
 LDFLAGS = $(CFLAGS) -Wl,--gc-sections
 endif
 
+MAKE_DSYM := NO
+
 include Makefile.rules

Modified: 
lldb/trunk/packages/Python/lldbsuit

[Lldb-commits] [PATCH] D68096: Add Linux signal support to ProcessMinidump

2019-09-27 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet updated this revision to Diff 18.
JosephTremoulet added a comment.

- Move artificial SIGSTOP injection to RefreshStateAfterStop


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68096

Files:
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp


Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -215,6 +215,10 @@
 
   m_thread_list = m_minidump_parser->GetThreads();
   m_active_exception = m_minidump_parser->GetExceptionStream();
+
+  if (arch.GetTriple().isOSLinux())
+SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
   ReadModuleList();
 
   llvm::Optional pid = m_minidump_parser->GetPid();
@@ -234,6 +238,7 @@
 Status ProcessMinidump::DoDestroy() { return Status(); }
 
 void ProcessMinidump::RefreshStateAfterStop() {
+
   if (!m_active_exception)
 return;
 
@@ -250,8 +255,16 @@
   ArchSpec arch = GetArchitecture();
 
   if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
+uint32_t signo = m_active_exception->exception_record.exception_code;
+
+if (signo == 0) {
+  // Artifically inject a SIGSTOP so that we'll find a stop reason
+  // when we process the stop event.
+  signo = m_unix_signals_sp->GetSignalNumberFromName("SIGSTOP");
+}
+
 stop_info = StopInfo::CreateStopReasonWithSignal(
-*stop_thread, m_active_exception->exception_record.exception_code);
+*stop_thread, signo);
   } else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
 stop_info = StopInfoMachException::CreateStopReasonWithMachException(
 *stop_thread, m_active_exception->exception_record.exception_code, 2,


Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -215,6 +215,10 @@
 
   m_thread_list = m_minidump_parser->GetThreads();
   m_active_exception = m_minidump_parser->GetExceptionStream();
+
+  if (arch.GetTriple().isOSLinux())
+SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
   ReadModuleList();
 
   llvm::Optional pid = m_minidump_parser->GetPid();
@@ -234,6 +238,7 @@
 Status ProcessMinidump::DoDestroy() { return Status(); }
 
 void ProcessMinidump::RefreshStateAfterStop() {
+
   if (!m_active_exception)
 return;
 
@@ -250,8 +255,16 @@
   ArchSpec arch = GetArchitecture();
 
   if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
+uint32_t signo = m_active_exception->exception_record.exception_code;
+
+if (signo == 0) {
+  // Artifically inject a SIGSTOP so that we'll find a stop reason
+  // when we process the stop event.
+  signo = m_unix_signals_sp->GetSignalNumberFromName("SIGSTOP");
+}
+
 stop_info = StopInfo::CreateStopReasonWithSignal(
-*stop_thread, m_active_exception->exception_record.exception_code);
+*stop_thread, signo);
   } else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
 stop_info = StopInfoMachException::CreateStopReasonWithMachException(
 *stop_thread, m_active_exception->exception_record.exception_code, 2,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

2019-09-27 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked an inline comment as done.
jankratochvil added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/api/command-return-object/Makefile:1
+MAKE_DSYM := NO
+

jankratochvil wrote:
> labath wrote:
> > I'm pretty sure this line is not needed.
> Removed in current testsuite: rL373061
So I do not understand how `MAKE_DSYM` works but global removal of `MAKE_DSYM 
:= NO` in rL373061 broke OSX so I have reverted it by rL373110. Keeping 
`MAKE_DSYM := NO` stays omitted for this testcase.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67589



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


[Lldb-commits] [lldb] r373112 - [CMake] Depend on clang-tablegen-targets

2019-09-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 27 12:07:06 2019
New Revision: 373112

URL: http://llvm.org/viewvc/llvm-project?rev=373112&view=rev
Log:
[CMake] Depend on clang-tablegen-targets

The ClangDriverOptions target is not available for standalone builds.

Thanks Alex for pointing this out!

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

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=373112&r1=373111&r2=373112&view=diff
==
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Fri Sep 27 12:07:06 2019
@@ -66,7 +66,7 @@ add_lldb_library(lldbCore
   ValueObjectVariable.cpp
 
   DEPENDS
-ClangDriverOptions
+clang-tablegen-targets
 
   LINK_LIBS
 clangAST


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


[Lldb-commits] [PATCH] D68096: ProcessMinidump: inject SIGSTOP on Linux if no thread has a signal

2019-09-27 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet marked 2 inline comments as done.
JosephTremoulet added inline comments.



Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:219-237
+
+  if (arch.GetTriple().isOSLinux()) {
+
+SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
+if (!m_thread_list.empty() &&
+(!m_active_exception ||

JosephTremoulet wrote:
> labath wrote:
> > Would it be possible to move this code (except maybe the SetUnixSignals 
> > bit) into the `RefreshStateAfterStop` function? Would be less confusing and 
> > it would avoid the need for extra member variables...
> Yeah, happy to.  I wasn't sure what the implications of doing so would be, 
> but I guess for a dump file there will only ever be one stop?
I've moved it.  In doing so I left the early-out for `!m_active_exception`, 
which is a behavioral difference from my previous iteration, but this covers my 
use-case so I think better to keep the change focused like this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68096



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


[Lldb-commits] [PATCH] D68096: ProcessMinidump: inject SIGSTOP on Linux if no thread has a signal

2019-09-27 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet updated this revision to Diff 25.
JosephTremoulet added a comment.

- Use accessor for m_unix_signals_sp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68096

Files:
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp


Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -215,6 +215,10 @@
 
   m_thread_list = m_minidump_parser->GetThreads();
   m_active_exception = m_minidump_parser->GetExceptionStream();
+
+  if (arch.GetTriple().isOSLinux())
+SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
   ReadModuleList();
 
   llvm::Optional pid = m_minidump_parser->GetPid();
@@ -234,6 +238,7 @@
 Status ProcessMinidump::DoDestroy() { return Status(); }
 
 void ProcessMinidump::RefreshStateAfterStop() {
+
   if (!m_active_exception)
 return;
 
@@ -250,8 +255,16 @@
   ArchSpec arch = GetArchitecture();
 
   if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
+uint32_t signo = m_active_exception->exception_record.exception_code;
+
+if (signo == 0) {
+  // Artifically inject a SIGSTOP so that we'll find a stop reason
+  // when we process the stop event.
+  signo = GetUnixSignals()->GetSignalNumberFromName("SIGSTOP");
+}
+
 stop_info = StopInfo::CreateStopReasonWithSignal(
-*stop_thread, m_active_exception->exception_record.exception_code);
+*stop_thread, signo);
   } else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
 stop_info = StopInfoMachException::CreateStopReasonWithMachException(
 *stop_thread, m_active_exception->exception_record.exception_code, 2,


Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -215,6 +215,10 @@
 
   m_thread_list = m_minidump_parser->GetThreads();
   m_active_exception = m_minidump_parser->GetExceptionStream();
+
+  if (arch.GetTriple().isOSLinux())
+SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
   ReadModuleList();
 
   llvm::Optional pid = m_minidump_parser->GetPid();
@@ -234,6 +238,7 @@
 Status ProcessMinidump::DoDestroy() { return Status(); }
 
 void ProcessMinidump::RefreshStateAfterStop() {
+
   if (!m_active_exception)
 return;
 
@@ -250,8 +255,16 @@
   ArchSpec arch = GetArchitecture();
 
   if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
+uint32_t signo = m_active_exception->exception_record.exception_code;
+
+if (signo == 0) {
+  // Artifically inject a SIGSTOP so that we'll find a stop reason
+  // when we process the stop event.
+  signo = GetUnixSignals()->GetSignalNumberFromName("SIGSTOP");
+}
+
 stop_info = StopInfo::CreateStopReasonWithSignal(
-*stop_thread, m_active_exception->exception_record.exception_code);
+*stop_thread, signo);
   } else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
 stop_info = StopInfoMachException::CreateStopReasonWithMachException(
 *stop_thread, m_active_exception->exception_record.exception_code, 2,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r373114 - [Reproducer] Update the unit tests to specify the path style.

2019-09-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 27 12:12:18 2019
New Revision: 373114

URL: http://llvm.org/viewvc/llvm-project?rev=373114&view=rev
Log:
[Reproducer] Update the unit tests to specify the path style.

The unit tests started failing on Windows after my recent patch that
ensured we always deal with absolute paths. This should fix that.

Modified:
lldb/trunk/unittests/Utility/ReproducerTest.cpp

Modified: lldb/trunk/unittests/Utility/ReproducerTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ReproducerTest.cpp?rev=373114&r1=373113&r2=373114&view=diff
==
--- lldb/trunk/unittests/Utility/ReproducerTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ReproducerTest.cpp Fri Sep 27 12:12:18 2019
@@ -52,14 +52,19 @@ TEST(ReproducerTest, SetCapture) {
   EXPECT_EQ(nullptr, reproducer.GetLoader());
 
   // Enable capture and check that means we have a generator.
-  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
-Succeeded());
+  EXPECT_THAT_ERROR(
+  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  Succeeded());
   EXPECT_NE(nullptr, reproducer.GetGenerator());
-  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetGenerator()->GetRoot());
-  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetReproducerPath());
+  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+reproducer.GetGenerator()->GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+reproducer.GetReproducerPath());
 
   // Ensure that we cannot enable replay.
-  EXPECT_THAT_ERROR(reproducer.SetReplay(FileSpec("/bogus/path")), Failed());
+  EXPECT_THAT_ERROR(
+  reproducer.SetReplay(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  Failed());
   EXPECT_EQ(nullptr, reproducer.GetLoader());
 
   // Ensure we can disable the generator again.
@@ -76,36 +81,45 @@ TEST(ReproducerTest, SetReplay) {
   EXPECT_EQ(nullptr, reproducer.GetLoader());
 
   // Expected to fail because we can't load the index.
-  EXPECT_THAT_ERROR(reproducer.SetReplay(FileSpec("/bogus/path")), Failed());
+  EXPECT_THAT_ERROR(
+  reproducer.SetReplay(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  Failed());
   // However the loader should still be set, which we check here.
   EXPECT_NE(nullptr, reproducer.GetLoader());
 
   // Make sure the bogus path is correctly set.
-  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetLoader()->GetRoot());
-  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetReproducerPath());
+  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+reproducer.GetLoader()->GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+reproducer.GetReproducerPath());
 
   // Ensure that we cannot enable replay.
-  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")), Failed());
+  EXPECT_THAT_ERROR(
+  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  Failed());
   EXPECT_EQ(nullptr, reproducer.GetGenerator());
 }
 
 TEST(GeneratorTest, Create) {
   DummyReproducer reproducer;
 
-  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
-Succeeded());
+  EXPECT_THAT_ERROR(
+  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  Succeeded());
   auto &generator = *reproducer.GetGenerator();
 
   auto *provider = generator.Create();
   EXPECT_NE(nullptr, provider);
-  EXPECT_EQ(FileSpec("/bogus/path"), provider->GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+provider->GetRoot());
 }
 
 TEST(GeneratorTest, Get) {
   DummyReproducer reproducer;
 
-  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
-Succeeded());
+  EXPECT_THAT_ERROR(
+  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  Succeeded());
   auto &generator = *reproducer.GetGenerator();
 
   auto *provider = generator.Create();
@@ -118,12 +132,14 @@ TEST(GeneratorTest, Get) {
 TEST(GeneratorTest, GetOrCreate) {
   DummyReproducer reproducer;
 
-  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
-Succeeded());
+  EXPECT_THAT_ERROR(
+  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  Succeeded());
   auto &generator = *reproducer.GetGenerator();
 
   auto &provider = generator.GetOrCreate();
-  EXPECT_EQ(FileSpec("/bogus/path"), provider.GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+provider.GetRoot());
 
   auto &provider_alt = generator.GetOrCreate();
   EXPECT_EQ(&provider, &provider_alt);


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


[Lldb-commits] [PATCH] D68156: [debugserver] Don't use RNBLog for printing the version

2019-09-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: jasonmolenda.
Herald added a project: LLDB.

When not running under a TTY the output is buffered and not flushed
before debugserver exits.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68156

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


Index: lldb/tools/debugserver/source/debugserver.cpp
===
--- lldb/tools/debugserver/source/debugserver.cpp
+++ lldb/tools/debugserver/source/debugserver.cpp
@@ -1305,8 +1305,8 @@
   // as long as we're dropping remotenub in as a replacement for gdbserver,
   // explicitly note that this is not gdbserver.
 
-  RNBLogSTDOUT("%s-%s %sfor %s.\n", DEBUGSERVER_PROGRAM_NAME,
-   DEBUGSERVER_VERSION_STR, compile_options.c_str(), RNB_ARCH);
+  fprintf(stderr, "%s-%s %sfor %s.\n", DEBUGSERVER_PROGRAM_NAME,
+  DEBUGSERVER_VERSION_STR, compile_options.c_str(), RNB_ARCH);
 
   std::string host;
   int port = INT32_MAX;


Index: lldb/tools/debugserver/source/debugserver.cpp
===
--- lldb/tools/debugserver/source/debugserver.cpp
+++ lldb/tools/debugserver/source/debugserver.cpp
@@ -1305,8 +1305,8 @@
   // as long as we're dropping remotenub in as a replacement for gdbserver,
   // explicitly note that this is not gdbserver.
 
-  RNBLogSTDOUT("%s-%s %sfor %s.\n", DEBUGSERVER_PROGRAM_NAME,
-   DEBUGSERVER_VERSION_STR, compile_options.c_str(), RNB_ARCH);
+  fprintf(stderr, "%s-%s %sfor %s.\n", DEBUGSERVER_PROGRAM_NAME,
+  DEBUGSERVER_VERSION_STR, compile_options.c_str(), RNB_ARCH);
 
   std::string host;
   int port = INT32_MAX;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68156: [debugserver] Don't use RNBLog for printing the version

2019-09-27 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Hm, if the goal is to get -version (an unrecognized cmd line option) to 
explicitly print to stderr, don't we want to change the lines in 
show_usage_and_exit?  I think this change would result in us not getting the 
version string in console logs for normal debug sessions, where we want to keep 
it.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D68156



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


[Lldb-commits] [lldb] r373124 - [Reproducer] Use // in the unit tests

2019-09-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 27 13:35:55 2019
New Revision: 373124

URL: http://llvm.org/viewvc/llvm-project?rev=373124&view=rev
Log:
[Reproducer] Use // in the unit tests

This should be a valid absolute path on both POSIX and Windows.

Modified:
lldb/trunk/unittests/Utility/ReproducerTest.cpp

Modified: lldb/trunk/unittests/Utility/ReproducerTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ReproducerTest.cpp?rev=373124&r1=373123&r2=373124&view=diff
==
--- lldb/trunk/unittests/Utility/ReproducerTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ReproducerTest.cpp Fri Sep 27 13:35:55 2019
@@ -53,17 +53,17 @@ TEST(ReproducerTest, SetCapture) {
 
   // Enable capture and check that means we have a generator.
   EXPECT_THAT_ERROR(
-  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  reproducer.SetCapture(FileSpec("//bogus/path", FileSpec::Style::posix)),
   Succeeded());
   EXPECT_NE(nullptr, reproducer.GetGenerator());
-  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+  EXPECT_EQ(FileSpec("//bogus/path", FileSpec::Style::posix),
 reproducer.GetGenerator()->GetRoot());
-  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+  EXPECT_EQ(FileSpec("//bogus/path", FileSpec::Style::posix),
 reproducer.GetReproducerPath());
 
   // Ensure that we cannot enable replay.
   EXPECT_THAT_ERROR(
-  reproducer.SetReplay(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  reproducer.SetReplay(FileSpec("//bogus/path", FileSpec::Style::posix)),
   Failed());
   EXPECT_EQ(nullptr, reproducer.GetLoader());
 
@@ -82,20 +82,20 @@ TEST(ReproducerTest, SetReplay) {
 
   // Expected to fail because we can't load the index.
   EXPECT_THAT_ERROR(
-  reproducer.SetReplay(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  reproducer.SetReplay(FileSpec("//bogus/path", FileSpec::Style::posix)),
   Failed());
   // However the loader should still be set, which we check here.
   EXPECT_NE(nullptr, reproducer.GetLoader());
 
   // Make sure the bogus path is correctly set.
-  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+  EXPECT_EQ(FileSpec("//bogus/path", FileSpec::Style::posix),
 reproducer.GetLoader()->GetRoot());
-  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+  EXPECT_EQ(FileSpec("//bogus/path", FileSpec::Style::posix),
 reproducer.GetReproducerPath());
 
   // Ensure that we cannot enable replay.
   EXPECT_THAT_ERROR(
-  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  reproducer.SetCapture(FileSpec("//bogus/path", FileSpec::Style::posix)),
   Failed());
   EXPECT_EQ(nullptr, reproducer.GetGenerator());
 }
@@ -104,13 +104,13 @@ TEST(GeneratorTest, Create) {
   DummyReproducer reproducer;
 
   EXPECT_THAT_ERROR(
-  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  reproducer.SetCapture(FileSpec("//bogus/path", FileSpec::Style::posix)),
   Succeeded());
   auto &generator = *reproducer.GetGenerator();
 
   auto *provider = generator.Create();
   EXPECT_NE(nullptr, provider);
-  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+  EXPECT_EQ(FileSpec("//bogus/path", FileSpec::Style::posix),
 provider->GetRoot());
 }
 
@@ -118,7 +118,7 @@ TEST(GeneratorTest, Get) {
   DummyReproducer reproducer;
 
   EXPECT_THAT_ERROR(
-  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  reproducer.SetCapture(FileSpec("//bogus/path", FileSpec::Style::posix)),
   Succeeded());
   auto &generator = *reproducer.GetGenerator();
 
@@ -133,12 +133,12 @@ TEST(GeneratorTest, GetOrCreate) {
   DummyReproducer reproducer;
 
   EXPECT_THAT_ERROR(
-  reproducer.SetCapture(FileSpec("/bogus/path", FileSpec::Style::posix)),
+  reproducer.SetCapture(FileSpec("//bogus/path", FileSpec::Style::posix)),
   Succeeded());
   auto &generator = *reproducer.GetGenerator();
 
   auto &provider = generator.GetOrCreate();
-  EXPECT_EQ(FileSpec("/bogus/path", FileSpec::Style::posix),
+  EXPECT_EQ(FileSpec("//bogus/path", FileSpec::Style::posix),
 provider.GetRoot());
 
   auto &provider_alt = generator.GetOrCreate();


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


[Lldb-commits] [lldb] r373126 - refactor: move IOObject::m_should_close_fd into subclasses

2019-09-27 Thread Lawrence D'Anna via lldb-commits
Author: lawrence_danna
Date: Fri Sep 27 13:43:50 2019
New Revision: 373126

URL: http://llvm.org/viewvc/llvm-project?rev=373126&view=rev
Log:
refactor: move IOObject::m_should_close_fd into subclasses

Summary:
m_should_close_fd doesn't need to be in IOObject.   It will be useful
for my next change to move it down into File and Socket.

Reviewers: labath, JDevlieghere, jasonmolenda

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/include/lldb/Host/File.h
lldb/trunk/include/lldb/Host/Socket.h
lldb/trunk/include/lldb/Utility/IOObject.h
lldb/trunk/source/Host/common/File.cpp
lldb/trunk/source/Host/common/Socket.cpp

Modified: lldb/trunk/include/lldb/Host/File.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=373126&r1=373125&r2=373126&view=diff
==
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Fri Sep 27 13:43:50 2019
@@ -51,22 +51,23 @@ public:
   static mode_t ConvertOpenOptionsForPOSIXOpen(uint32_t open_options);
 
   File()
-  : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
-m_stream(kInvalidStream), m_options(0), m_own_stream(false),
-m_is_interactive(eLazyBoolCalculate),
+  : IOObject(eFDTypeFile), m_descriptor(kInvalidDescriptor),
+m_own_descriptor(false), m_stream(kInvalidStream), m_options(0),
+m_own_stream(false), m_is_interactive(eLazyBoolCalculate),
 m_is_real_terminal(eLazyBoolCalculate),
 m_supports_colors(eLazyBoolCalculate) {}
 
   File(FILE *fh, bool transfer_ownership)
-  : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
-m_stream(fh), m_options(0), m_own_stream(transfer_ownership),
-m_is_interactive(eLazyBoolCalculate),
+  : IOObject(eFDTypeFile), m_descriptor(kInvalidDescriptor),
+m_own_descriptor(false), m_stream(fh), m_options(0),
+m_own_stream(transfer_ownership), m_is_interactive(eLazyBoolCalculate),
 m_is_real_terminal(eLazyBoolCalculate),
 m_supports_colors(eLazyBoolCalculate) {}
 
   File(int fd, uint32_t options, bool transfer_ownership)
-  : IOObject(eFDTypeFile, transfer_ownership), m_descriptor(fd),
-m_stream(kInvalidStream), m_options(options), m_own_stream(false),
+  : IOObject(eFDTypeFile), m_descriptor(fd),
+m_own_descriptor(transfer_ownership), m_stream(kInvalidStream),
+m_options(options), m_own_stream(false),
 m_is_interactive(eLazyBoolCalculate),
 m_is_real_terminal(eLazyBoolCalculate) {}
 
@@ -339,6 +340,7 @@ protected:
 
   // Member variables
   int m_descriptor;
+  bool m_own_descriptor;
   FILE *m_stream;
   uint32_t m_options;
   bool m_own_stream;

Modified: lldb/trunk/include/lldb/Host/Socket.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Socket.h?rev=373126&r1=373125&r2=373126&view=diff
==
--- lldb/trunk/include/lldb/Host/Socket.h (original)
+++ lldb/trunk/include/lldb/Host/Socket.h Fri Sep 27 13:43:50 2019
@@ -122,6 +122,7 @@ protected:
   SocketProtocol m_protocol;
   NativeSocket m_socket;
   bool m_child_processes_inherit;
+  bool m_should_close_fd;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Utility/IOObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/IOObject.h?rev=373126&r1=373125&r2=373126&view=diff
==
--- lldb/trunk/include/lldb/Utility/IOObject.h (original)
+++ lldb/trunk/include/lldb/Utility/IOObject.h Fri Sep 27 13:43:50 2019
@@ -29,8 +29,7 @@ public:
   typedef int WaitableHandle;
   static const WaitableHandle kInvalidHandleValue;
 
-  IOObject(FDType type, bool should_close)
-  : m_fd_type(type), m_should_close_fd(should_close) {}
+  IOObject(FDType type) : m_fd_type(type) {}
   virtual ~IOObject();
 
   virtual Status Read(void *buf, size_t &num_bytes) = 0;
@@ -44,8 +43,6 @@ public:
 
 protected:
   FDType m_fd_type;
-  bool m_should_close_fd; // True if this class should close the file 
descriptor
-  // when it goes away.
 
 private:
   DISALLOW_COPY_AND_ASSIGN(IOObject);

Modified: lldb/trunk/source/Host/common/File.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=373126&r1=373125&r2=373126&view=diff
==
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Fri Sep 27 13:43:50 2019
@@ -98,7 +98,7 @@ FILE *File::GetStream() {
 if (DescriptorIsValid()) {
   const char *mode = GetStreamOpenModeFromOptions(m_options);
   if (mode) {
-if (!m_should_close_fd) {

[Lldb-commits] [PATCH] D68152: refactor: move IOObject::m_should_close_fd into subclasses

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG117512715d66: refactor: move IOObject::m_should_close_fd 
into subclasses (authored by lawrence_danna).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68152

Files:
  lldb/include/lldb/Host/File.h
  lldb/include/lldb/Host/Socket.h
  lldb/include/lldb/Utility/IOObject.h
  lldb/source/Host/common/File.cpp
  lldb/source/Host/common/Socket.cpp

Index: lldb/source/Host/common/Socket.cpp
===
--- lldb/source/Host/common/Socket.cpp
+++ lldb/source/Host/common/Socket.cpp
@@ -74,9 +74,10 @@
 
 Socket::Socket(SocketProtocol protocol, bool should_close,
bool child_processes_inherit)
-: IOObject(eFDTypeSocket, should_close), m_protocol(protocol),
+: IOObject(eFDTypeSocket), m_protocol(protocol),
   m_socket(kInvalidSocketValue),
-  m_child_processes_inherit(child_processes_inherit) {}
+  m_child_processes_inherit(child_processes_inherit),
+  m_should_close_fd(should_close) {}
 
 Socket::~Socket() { Close(); }
 
Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -98,7 +98,7 @@
 if (DescriptorIsValid()) {
   const char *mode = GetStreamOpenModeFromOptions(m_options);
   if (mode) {
-if (!m_should_close_fd) {
+if (!m_own_descriptor) {
 // We must duplicate the file descriptor if we don't own it because when you
 // call fdopen, the stream will own the fd
 #ifdef _WIN32
@@ -106,7 +106,7 @@
 #else
   m_descriptor = dup(GetDescriptor());
 #endif
-  m_should_close_fd = true;
+  m_own_descriptor = true;
 }
 
 m_stream =
@@ -117,7 +117,7 @@
 
 if (m_stream) {
   m_own_stream = true;
-  m_should_close_fd = false;
+  m_own_descriptor = false;
 }
   }
 }
@@ -148,7 +148,7 @@
   error.SetErrorToErrno();
   }
 
-  if (DescriptorIsValid() && m_should_close_fd) {
+  if (DescriptorIsValid() && m_own_descriptor) {
 if (::close(m_descriptor) != 0)
   error.SetErrorToErrno();
   }
@@ -156,7 +156,7 @@
   m_stream = kInvalidStream;
   m_options = 0;
   m_own_stream = false;
-  m_should_close_fd = false;
+  m_own_descriptor = false;
   m_is_interactive = eLazyBoolCalculate;
   m_is_real_terminal = eLazyBoolCalculate;
   return error;
Index: lldb/include/lldb/Utility/IOObject.h
===
--- lldb/include/lldb/Utility/IOObject.h
+++ lldb/include/lldb/Utility/IOObject.h
@@ -29,8 +29,7 @@
   typedef int WaitableHandle;
   static const WaitableHandle kInvalidHandleValue;
 
-  IOObject(FDType type, bool should_close)
-  : m_fd_type(type), m_should_close_fd(should_close) {}
+  IOObject(FDType type) : m_fd_type(type) {}
   virtual ~IOObject();
 
   virtual Status Read(void *buf, size_t &num_bytes) = 0;
@@ -44,8 +43,6 @@
 
 protected:
   FDType m_fd_type;
-  bool m_should_close_fd; // True if this class should close the file descriptor
-  // when it goes away.
 
 private:
   DISALLOW_COPY_AND_ASSIGN(IOObject);
Index: lldb/include/lldb/Host/Socket.h
===
--- lldb/include/lldb/Host/Socket.h
+++ lldb/include/lldb/Host/Socket.h
@@ -122,6 +122,7 @@
   SocketProtocol m_protocol;
   NativeSocket m_socket;
   bool m_child_processes_inherit;
+  bool m_should_close_fd;
 };
 
 } // namespace lldb_private
Index: lldb/include/lldb/Host/File.h
===
--- lldb/include/lldb/Host/File.h
+++ lldb/include/lldb/Host/File.h
@@ -51,22 +51,23 @@
   static mode_t ConvertOpenOptionsForPOSIXOpen(uint32_t open_options);
 
   File()
-  : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
-m_stream(kInvalidStream), m_options(0), m_own_stream(false),
-m_is_interactive(eLazyBoolCalculate),
+  : IOObject(eFDTypeFile), m_descriptor(kInvalidDescriptor),
+m_own_descriptor(false), m_stream(kInvalidStream), m_options(0),
+m_own_stream(false), m_is_interactive(eLazyBoolCalculate),
 m_is_real_terminal(eLazyBoolCalculate),
 m_supports_colors(eLazyBoolCalculate) {}
 
   File(FILE *fh, bool transfer_ownership)
-  : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
-m_stream(fh), m_options(0), m_own_stream(transfer_ownership),
-m_is_interactive(eLazyBoolCalculate),
+  : IOObject(eFDTypeFile), m_descriptor(kInvalidDescriptor),
+m_own_descriptor(false), m_stream(fh), m_options(0),
+m_own_stream(transfer_ownership), m_is_interactive(eLazyBoolCalculate),
 m_is_real_terminal(eLazyBoolCalculate),
 m_supports_colors(eLazyBoo

[Lldb-commits] [PATCH] D68156: [debugserver] Add --version/-V command line option to debugserver.

2019-09-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 46.
JDevlieghere retitled this revision from "[debugserver] Don't use RNBLog for 
printing the version" to "[debugserver] Add --version/-V command line option to 
debugserver.".
JDevlieghere edited the summary of this revision.

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

https://reviews.llvm.org/D68156

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


Index: lldb/tools/debugserver/source/debugserver.cpp
===
--- lldb/tools/debugserver/source/debugserver.cpp
+++ lldb/tools/debugserver/source/debugserver.cpp
@@ -789,6 +789,12 @@
   ::fflush((FILE *)baton);
 }
 
+void show_version_and_exit(int exit_code) {
+  printf("%s-%s for %s.\n", DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR,
+ RNB_ARCH);
+  exit(exit_code);
+}
+
 void show_usage_and_exit(int exit_code) {
   RNBLogSTDERR(
   "Usage:\n  %s host:port [program-name program-arg1 program-arg2 ...]\n",
@@ -811,6 +817,7 @@
 {"debug", no_argument, NULL, 'g'},
 {"kill-on-error", no_argument, NULL, 'K'},
 {"verbose", no_argument, NULL, 'v'},
+{"version", no_argument, NULL, 'V'},
 {"lockdown", no_argument, &g_lockdown_opt, 1}, // short option "-k"
 {"applist", no_argument, &g_applist_opt, 1},   // short option "-t"
 {"log-file", required_argument, NULL, 'l'},
@@ -1173,6 +1180,10 @@
   DNBLogSetVerbose(1);
   break;
 
+case 'V':
+  show_version_and_exit(0);
+  break;
+
 case 's':
   ctx.GetSTDIN().assign(optarg);
   ctx.GetSTDOUT().assign(optarg);


Index: lldb/tools/debugserver/source/debugserver.cpp
===
--- lldb/tools/debugserver/source/debugserver.cpp
+++ lldb/tools/debugserver/source/debugserver.cpp
@@ -789,6 +789,12 @@
   ::fflush((FILE *)baton);
 }
 
+void show_version_and_exit(int exit_code) {
+  printf("%s-%s for %s.\n", DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR,
+ RNB_ARCH);
+  exit(exit_code);
+}
+
 void show_usage_and_exit(int exit_code) {
   RNBLogSTDERR(
   "Usage:\n  %s host:port [program-name program-arg1 program-arg2 ...]\n",
@@ -811,6 +817,7 @@
 {"debug", no_argument, NULL, 'g'},
 {"kill-on-error", no_argument, NULL, 'K'},
 {"verbose", no_argument, NULL, 'v'},
+{"version", no_argument, NULL, 'V'},
 {"lockdown", no_argument, &g_lockdown_opt, 1}, // short option "-k"
 {"applist", no_argument, &g_applist_opt, 1},   // short option "-t"
 {"log-file", required_argument, NULL, 'l'},
@@ -1173,6 +1180,10 @@
   DNBLogSetVerbose(1);
   break;
 
+case 'V':
+  show_version_and_exit(0);
+  break;
+
 case 's':
   ctx.GetSTDIN().assign(optarg);
   ctx.GetSTDOUT().assign(optarg);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68130: [lldb] Don't emit artificial constructor declarations as global functions

2019-09-27 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

So if I look at `ClangASTContext::AddMethodToCXXRecordType(...)` it has the 
following:

  if (is_artificial)
return nullptr; // skip everything artificial

but why? if I look at the godbolt w/ an AST dump  
it is not creating as a global function and it would seem that we would want 
this behavior as well.


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

https://reviews.llvm.org/D68130



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


[Lldb-commits] [PATCH] D68156: [debugserver] Add --version/-V command line option to debugserver.

2019-09-27 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

Awesome.


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

https://reviews.llvm.org/D68156



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


[Lldb-commits] [lldb] r373127 - [debugserver] Add --version/-V command line option to debugserver.

2019-09-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 27 14:26:44 2019
New Revision: 373127

URL: http://llvm.org/viewvc/llvm-project?rev=373127&view=rev
Log:
[debugserver] Add --version/-V command line option to debugserver.

When not running under a TTY the output is buffered and not flushed
before debugserver exits which makes it impossible to parse the version
string. This adds a -V/--version command that just prints the version to
stdout and exits with an exit code zero.

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

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

Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=373127&r1=373126&r2=373127&view=diff
==
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Fri Sep 27 14:26:44 2019
@@ -789,6 +789,12 @@ void FileLogCallback(void *baton, uint32
   ::fflush((FILE *)baton);
 }
 
+void show_version_and_exit(int exit_code) {
+  printf("%s-%s for %s.\n", DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR,
+ RNB_ARCH);
+  exit(exit_code);
+}
+
 void show_usage_and_exit(int exit_code) {
   RNBLogSTDERR(
   "Usage:\n  %s host:port [program-name program-arg1 program-arg2 ...]\n",
@@ -811,6 +817,7 @@ static struct option g_long_options[] =
 {"debug", no_argument, NULL, 'g'},
 {"kill-on-error", no_argument, NULL, 'K'},
 {"verbose", no_argument, NULL, 'v'},
+{"version", no_argument, NULL, 'V'},
 {"lockdown", no_argument, &g_lockdown_opt, 1}, // short option "-k"
 {"applist", no_argument, &g_applist_opt, 1},   // short option "-t"
 {"log-file", required_argument, NULL, 'l'},
@@ -1173,6 +1180,10 @@ int main(int argc, char *argv[]) {
   DNBLogSetVerbose(1);
   break;
 
+case 'V':
+  show_version_and_exit(0);
+  break;
+
 case 's':
   ctx.GetSTDIN().assign(optarg);
   ctx.GetSTDOUT().assign(optarg);


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


[Lldb-commits] [PATCH] D68156: [debugserver] Add --version/-V command line option to debugserver.

2019-09-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL373127: [debugserver] Add --version/-V command line option 
to debugserver. (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D68156?vs=46&id=48#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D68156

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


Index: lldb/trunk/tools/debugserver/source/debugserver.cpp
===
--- lldb/trunk/tools/debugserver/source/debugserver.cpp
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp
@@ -789,6 +789,12 @@
   ::fflush((FILE *)baton);
 }
 
+void show_version_and_exit(int exit_code) {
+  printf("%s-%s for %s.\n", DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR,
+ RNB_ARCH);
+  exit(exit_code);
+}
+
 void show_usage_and_exit(int exit_code) {
   RNBLogSTDERR(
   "Usage:\n  %s host:port [program-name program-arg1 program-arg2 ...]\n",
@@ -811,6 +817,7 @@
 {"debug", no_argument, NULL, 'g'},
 {"kill-on-error", no_argument, NULL, 'K'},
 {"verbose", no_argument, NULL, 'v'},
+{"version", no_argument, NULL, 'V'},
 {"lockdown", no_argument, &g_lockdown_opt, 1}, // short option "-k"
 {"applist", no_argument, &g_applist_opt, 1},   // short option "-t"
 {"log-file", required_argument, NULL, 'l'},
@@ -1173,6 +1180,10 @@
   DNBLogSetVerbose(1);
   break;
 
+case 'V':
+  show_version_and_exit(0);
+  break;
+
 case 's':
   ctx.GetSTDIN().assign(optarg);
   ctx.GetSTDOUT().assign(optarg);


Index: lldb/trunk/tools/debugserver/source/debugserver.cpp
===
--- lldb/trunk/tools/debugserver/source/debugserver.cpp
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp
@@ -789,6 +789,12 @@
   ::fflush((FILE *)baton);
 }
 
+void show_version_and_exit(int exit_code) {
+  printf("%s-%s for %s.\n", DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR,
+ RNB_ARCH);
+  exit(exit_code);
+}
+
 void show_usage_and_exit(int exit_code) {
   RNBLogSTDERR(
   "Usage:\n  %s host:port [program-name program-arg1 program-arg2 ...]\n",
@@ -811,6 +817,7 @@
 {"debug", no_argument, NULL, 'g'},
 {"kill-on-error", no_argument, NULL, 'K'},
 {"verbose", no_argument, NULL, 'v'},
+{"version", no_argument, NULL, 'V'},
 {"lockdown", no_argument, &g_lockdown_opt, 1}, // short option "-k"
 {"applist", no_argument, &g_applist_opt, 1},   // short option "-t"
 {"log-file", required_argument, NULL, 'l'},
@@ -1173,6 +1180,10 @@
   DNBLogSetVerbose(1);
   break;
 
+case 'V':
+  show_version_and_exit(0);
+  break;
+
 case 's':
   ctx.GetSTDIN().assign(optarg);
   ctx.GetSTDOUT().assign(optarg);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68160: File::Clear() -> File::TakeStreamAndClear()

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda, labath.
Herald added a project: LLDB.

File::Clear() is an ugly function.  It's only used in one place,
which is the swig typemaps for FILE*.   This patch refactors and
renames that function to make it clear what it's really for and
why nobody else should use it.

Both File::TakeStreamAndClear() and the FILE* typemaps will be
removed in later patches after a suitable replacement is in place.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68160

Files:
  lldb/include/lldb/Host/File.h
  lldb/scripts/Python/python-typemaps.swig
  lldb/source/Host/common/File.cpp


Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -162,13 +162,17 @@
   return error;
 }
 
-void File::Clear() {
-  m_stream = nullptr;
+FILE *File::TakeStreamAndClear() {
+  GetStream();
+  FILE *stream = m_stream;
+  m_stream = NULL;
   m_descriptor = kInvalidDescriptor;
   m_options = 0;
   m_own_stream = false;
+  m_own_descriptor = false;
   m_is_interactive = m_supports_colors = m_is_real_terminal =
   eLazyBoolCalculate;
+  return stream;
 }
 
 Status File::GetFileSpec(FileSpec &file_spec) const {
Index: lldb/scripts/Python/python-typemaps.swig
===
--- lldb/scripts/Python/python-typemaps.swig
+++ lldb/scripts/Python/python-typemaps.swig
@@ -372,6 +372,9 @@
   $1 = $1 || PyCallable_Check(reinterpret_cast($input));
 }
 
+// FIXME both of these paths wind up calling fdopen() with no provision for 
ever calling
+// fclose() on the result.  SB interfaces that use FILE* should be deprecated 
for scripting
+// use and this typemap should eventually be removed.
 %typemap(in) FILE * {
using namespace lldb_private;
if ($input == Py_None)
@@ -398,9 +401,7 @@
   lldb::FileUP file = py_file.GetUnderlyingFile();
   if (!file)
  return nullptr;
-  $1 = file->GetStream();
-  if ($1)
- file->Clear();
+  $1 = file->TakeStreamAndClear();
 }
 }
 
Index: lldb/include/lldb/Host/File.h
===
--- lldb/include/lldb/Host/File.h
+++ lldb/include/lldb/Host/File.h
@@ -120,7 +120,19 @@
 
   Status Close() override;
 
-  void Clear();
+  /// DEPRECATED! Extract the underlying FILE* and reset this File without 
closing it.
+  ///
+  /// This is only here to support legacy SB interfaces that need to convert 
scripting
+  /// language objects into FILE* streams.   That conversion is inherently 
sketchy and
+  /// doing so may cause the stream to be leaked.
+  ///
+  /// After calling this the File will be reset to its original state.  It 
will be
+  /// invalid and it will not hold on to any resources.
+  ///
+  /// \return
+  /// The underlying FILE* stream from this File, if one exists and can be 
extracted,
+  /// nullptr otherwise.
+  FILE *TakeStreamAndClear();
 
   int GetDescriptor() const;
 


Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -162,13 +162,17 @@
   return error;
 }
 
-void File::Clear() {
-  m_stream = nullptr;
+FILE *File::TakeStreamAndClear() {
+  GetStream();
+  FILE *stream = m_stream;
+  m_stream = NULL;
   m_descriptor = kInvalidDescriptor;
   m_options = 0;
   m_own_stream = false;
+  m_own_descriptor = false;
   m_is_interactive = m_supports_colors = m_is_real_terminal =
   eLazyBoolCalculate;
+  return stream;
 }
 
 Status File::GetFileSpec(FileSpec &file_spec) const {
Index: lldb/scripts/Python/python-typemaps.swig
===
--- lldb/scripts/Python/python-typemaps.swig
+++ lldb/scripts/Python/python-typemaps.swig
@@ -372,6 +372,9 @@
   $1 = $1 || PyCallable_Check(reinterpret_cast($input));
 }
 
+// FIXME both of these paths wind up calling fdopen() with no provision for ever calling
+// fclose() on the result.  SB interfaces that use FILE* should be deprecated for scripting
+// use and this typemap should eventually be removed.
 %typemap(in) FILE * {
using namespace lldb_private;
if ($input == Py_None)
@@ -398,9 +401,7 @@
   lldb::FileUP file = py_file.GetUnderlyingFile();
   if (!file)
  return nullptr;
-  $1 = file->GetStream();
-  if ($1)
- file->Clear();
+  $1 = file->TakeStreamAndClear();
 }
 }
 
Index: lldb/include/lldb/Host/File.h
===
--- lldb/include/lldb/Host/File.h
+++ lldb/include/lldb/Host/File.h
@@ -120,7 +120,19 @@
 
   Status Close() override;
 
-  void Clear();
+  /// DEPRECATED! Extract the underlying FILE* and reset this File without closing it.
+  ///
+  /// This is only here to support leg

[Lldb-commits] [PATCH] D68130: [lldb] Don't emit artificial constructor declarations as global functions

2019-09-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D68130#1686530 , @shafik wrote:

> So if I look at `ClangASTContext::AddMethodToCXXRecordType(...)` it has the 
> following:
>
>   if (is_artificial)
> return nullptr; // skip everything artificial
>   
>
> but why? if I look at the godbolt w/ an AST dump 
>  it is not creating as a global function and it 
> would seem that we would want this behavior as well.


IIRC, it is because we can't count on which artificial functions get generated 
in the debug information in any given CU.  It depends on what gets used.  If we 
write artificial functions into the AST it makes it harder to unique instances 
of the class.  And it doesn't matter whether we do or not because the compiler 
will generate them into the Scratch Context when it needs them.


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

https://reviews.llvm.org/D68130



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


[Lldb-commits] [PATCH] D68156: [debugserver] Add --version/-V command line option to debugserver.

2019-09-27 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Good catch!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D68156



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


[Lldb-commits] [PATCH] D68130: [lldb] Don't emit artificial constructor declarations as global functions

2019-09-27 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

In D68130#1686549 , @jingham wrote:

> 
>  IIRC, it is because we can't count on which artificial functions get 
> generated in the debug information in any given CU.  It depends on what gets 
> used.  If we write artificial functions into the AST it makes it harder to 
> unique instances of the class.  And it doesn't matter whether we do or not 
> because the compiler will generate them into the Scratch Context when it 
> needs them.


That makes sense and it holds up to some basic experiments.

@teemperor you should add a detailed comment to note that is why we skip 
artificial memebers.

This is a quick examples where it does not generate the constructor:

  struct Foo {
// Triggers that we emit an artificial constructor for Foo.
virtual ~Foo() = default;
  };
  
  void f( Foo &f) {
  }


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

https://reviews.llvm.org/D68130



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


[Lldb-commits] [PATCH] D68140: [lldb][clang][modern-type-lookup] Use ASTImporterSharedState in ExternalASTMerger

2019-09-27 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: clang/include/clang/AST/ExternalASTMerger.h:92
   ImporterTarget Target;
+  std::shared_ptr SharedState;
 

Can you add a comment explaining what this is and why we need it and how it 
relates to the `ASTImpoter`.

It is not obvious just looking the local changes what effect adding this has.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D68140



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


[Lldb-commits] [PATCH] D67793: new api class: SBFile

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 64.
lawrence_danna added a comment.

rebased, removed duplicate test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67793

Files:
  lldb/include/lldb/API/LLDB.h
  lldb/include/lldb/API/SBDefines.h
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBFile.h
  lldb/include/lldb/Host/File.h
  lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py
  lldb/scripts/interface/SBFile.i
  lldb/scripts/lldb.swig
  lldb/source/API/CMakeLists.txt
  lldb/source/API/SBFile.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -466,8 +466,6 @@
   void Reset(PyRefType type, PyObject *py_obj) override;
   void Reset(File &file, const char *mode);
 
-  static uint32_t GetOptionsFromMode(llvm::StringRef mode);
-
   lldb::FileUP GetUnderlyingFile() const;
 };
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -949,7 +949,6 @@
 
 PythonFile::PythonFile(File &file, const char *mode) { Reset(file, mode); }
 
-
 PythonFile::PythonFile(PyRefType type, PyObject *o) { Reset(type, o); }
 
 PythonFile::~PythonFile() {}
@@ -1014,22 +1013,6 @@
 #endif
 }
 
-uint32_t PythonFile::GetOptionsFromMode(llvm::StringRef mode) {
-  if (mode.empty())
-return 0;
-
-  return llvm::StringSwitch(mode.str())
-  .Case("r", File::eOpenOptionRead)
-  .Case("w", File::eOpenOptionWrite)
-  .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |
- File::eOpenOptionCanCreate)
-  .Case("r+", File::eOpenOptionRead | File::eOpenOptionWrite)
-  .Case("w+", File::eOpenOptionRead | File::eOpenOptionWrite |
-  File::eOpenOptionCanCreate | File::eOpenOptionTruncate)
-  .Case("a+", File::eOpenOptionRead | File::eOpenOptionWrite |
-  File::eOpenOptionAppend | File::eOpenOptionCanCreate)
-  .Default(0);
-}
 
 FileUP PythonFile::GetUnderlyingFile() const {
   if (!IsValid())
@@ -1038,7 +1021,7 @@
   // We don't own the file descriptor returned by this function, make sure the
   // File object knows about that.
   PythonString py_mode = GetAttributeValue("mode").AsType();
-  auto options = PythonFile::GetOptionsFromMode(py_mode.GetString());
+  auto options = File::GetOptionsFromMode(py_mode.GetString());
   auto file = std::make_unique(PyObject_AsFileDescriptor(m_py_obj),
  options, false);
   if (!file->IsValid())
Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -68,6 +68,22 @@
   return nullptr;
 }
 
+uint32_t File::GetOptionsFromMode(llvm::StringRef mode) {
+  if (mode.empty())
+return 0;
+  return llvm::StringSwitch(mode.str())
+  .Case("r", File::eOpenOptionRead)
+  .Case("w", File::eOpenOptionWrite)
+  .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |
+ File::eOpenOptionCanCreate)
+  .Case("r+", File::eOpenOptionRead | File::eOpenOptionWrite)
+  .Case("w+", File::eOpenOptionRead | File::eOpenOptionWrite |
+  File::eOpenOptionCanCreate | File::eOpenOptionTruncate)
+  .Case("a+", File::eOpenOptionRead | File::eOpenOptionWrite |
+  File::eOpenOptionAppend | File::eOpenOptionCanCreate)
+  .Default(0);
+}
+
 int File::kInvalidDescriptor = -1;
 FILE *File::kInvalidStream = nullptr;
 
@@ -143,9 +159,14 @@
 
 Status File::Close() {
   Status error;
-  if (StreamIsValid() && m_own_stream) {
-if (::fclose(m_stream) == EOF)
-  error.SetErrorToErrno();
+  if (StreamIsValid()) {
+if (m_own_stream) {
+  if (::fclose(m_stream) == EOF)
+error.SetErrorToErrno();
+} else {
+  if (::fflush(m_stream) == EOF)
+error.SetErrorToErrno();
+}
   }
 
   if (DescriptorIsValid() && m_own_descriptor) {
Index: lldb/source/API/SBFile.cpp
===
--- /dev/null
+++ lldb/source/API/SBFile.cpp
@@ -0,0 +1,76 @@
+//===-- SBFile.cpp --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-L

[Lldb-commits] [PATCH] D68169: Fix a regression in FindTypes

2019-09-27 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: friss, JDevlieghere, jasonmolenda.
Herald added a project: LLDB.

In r368345 I accidentally introduced a regression that would over-report the 
number of matches found by FIndTypes if the DeclContext Filter was hit. This 
patch fixes this issue and adds test coverage for it in the form of an 
assertion in lldb-test (which does trigger this code).

rdar://problem/55500457


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68169

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -518,11 +518,12 @@
   
   DenseSet SearchedFiles;
   TypeMap Map;
-  if (!Name.empty())
-Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
-  SearchedFiles, Map);
-  else
-Module.FindTypes(parseCompilerContext(), languages, true, Map);
+  unsigned num_matches =
+  !Name.empty()
+  ? Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
+  SearchedFiles, Map)
+  : Module.FindTypes(parseCompilerContext(), languages, true, Map);
+  assert(num_matches == Map.GetSize());
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
   StreamString Stream;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2427,46 +2427,25 @@
   DIEArray die_offsets;
   m_index->GetTypes(name, die_offsets);
   const size_t num_die_matches = die_offsets.size();
+  const uint32_t initial_types_size = types.GetSize();
 
-  if (num_die_matches) {
-const uint32_t initial_types_size = types.GetSize();
-for (size_t i = 0; i < num_die_matches; ++i) {
-  const DIERef &die_ref = die_offsets[i];
-  DWARFDIE die = GetDIE(die_ref);
+  for (size_t i = 0; i < num_die_matches; ++i) {
+const DIERef &die_ref = die_offsets[i];
+DWARFDIE die = GetDIE(die_ref);
+if (die) {
+  if (!DIEInDeclContext(parent_decl_ctx, die))
+continue; // The containing decl contexts don't match
 
-  if (die) {
-if (!DIEInDeclContext(parent_decl_ctx, die))
-  continue; // The containing decl contexts don't match
-
-Type *matching_type = ResolveType(die, true, true);
-if (matching_type) {
-  // We found a type pointer, now find the shared pointer form our type
-  // list
-  types.InsertUnique(matching_type->shared_from_this());
-  if (types.GetSize() >= max_matches)
-break;
-}
-  } else {
-m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
-  }
-}
-const uint32_t num_matches = types.GetSize() - initial_types_size;
-if (log && num_matches) {
-  if (parent_decl_ctx) {
-GetObjectFile()->GetModule()->LogMessage(
-log,
-"SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx "
-"= %p (\"%s\"), append=%u, max_matches=%u, type_list) => %u",
-name.GetCString(), static_cast(parent_decl_ctx),
-parent_decl_ctx->GetName().AsCString(""), append, max_matches,
-num_matches);
-  } else {
-GetObjectFile()->GetModule()->LogMessage(
-log,
-"SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx "
-"= NULL, append=%u, max_matches=%u, type_list) => %u",
-name.GetCString(), append, max_matches, num_matches);
+  Type *matching_type = ResolveType(die, true, true);
+  if (matching_type) {
+// We found a type pointer, now find the shared pointer form our type
+// list
+types.InsertUnique(matching_type->shared_from_this());
+if (types.GetSize() >= max_matches)
+  break;
   }
+} else {
+  m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
 }
   }
 
@@ -2476,22 +2455,33 @@
   if (num_die_matches < max_matches) {
 UpdateExternalModuleListIfNeeded();
 
-for (const auto &pair : m_external_type_modules) {
-  ModuleSP external_module_sp = pair.second;
-  if (external_module_sp) {
-SymbolFile *sym_file = external_module_sp->GetSymbolFile();
-if (sym_file) {
-  const uint32_t num_external_matches =
-  sym_file->FindTypes(name, parent_decl_ctx, append, max_matches,
-  searched_symbol_files, types);
-  if (num_external_matches)
-return num_external_matches;
-}
-  }
+for (const auto &pair : m_external_type_modules)
+  if (ModuleSP external_module_sp = pair.second) 
+if (SymbolFile *sym_file = external_mod

[Lldb-commits] [PATCH] D68069: Explicitly set entry point arch when it's thumb

2019-09-27 Thread António Afonso via Phabricator via lldb-commits
aadsm added a comment.

>   (substituting llvm-mc for as and ld.lld for linker).

I was not able to figure out how to generate the object file with llvm-mc 
correctly. I've tried a few variations of the triple (e.g.: `armv7-eabi`) but I 
never end up with the same code that I have in the assembly: `# RUN: llvm-mc 
-triple=thumbv7 %s -filetype=obj -o %t.o`. Any idea here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68069



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


[Lldb-commits] [PATCH] D68171: Remove unused "append" parameter from FindTypes API

2019-09-27 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: labath, friss, JDevlieghere, jasonmolenda.

I noticed that SymbolFileDWARFDebugMap::FindTypes was implementing it 
incorrectly (passing append=false in a for-loop to recursive calls to FindTypes 
would yield only the very last set of results), but instead of fixing it, 
removing it seemed like an even better option.

rdar://problem/54412692


https://reviews.llvm.org/D68171

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Symbol/SymbolFile.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -519,10 +519,9 @@
   DenseSet SearchedFiles;
   TypeMap Map;
   unsigned num_matches =
-  !Name.empty()
-  ? Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
-  SearchedFiles, Map)
-  : Module.FindTypes(parseCompilerContext(), languages, true, Map);
+  !Name.empty() ? Symfile.FindTypes(ConstString(Name), ContextPtr,
+UINT32_MAX, SearchedFiles, Map)
+: Module.FindTypes(parseCompilerContext(), languages, Map);
   assert(num_matches == Map.GetSize());
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
Index: lldb/source/Symbol/SymbolFile.cpp
===
--- lldb/source/Symbol/SymbolFile.cpp
+++ lldb/source/Symbol/SymbolFile.cpp
@@ -141,19 +141,14 @@
 
 uint32_t SymbolFile::FindTypes(
 ConstString name, const CompilerDeclContext *parent_decl_ctx,
-bool append, uint32_t max_matches,
+uint32_t max_matches,
 llvm::DenseSet &searched_symbol_files,
 TypeMap &types) {
-  if (!append)
-types.Clear();
   return 0;
 }
 
 size_t SymbolFile::FindTypes(llvm::ArrayRef pattern,
- LanguageSet languages, bool append,
- TypeMap &types) {
-  if (!append)
-types.Clear();
+ LanguageSet languages, TypeMap &types) {
   return 0;
 }
 
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -128,12 +128,12 @@
   uint32_t
   FindTypes(lldb_private::ConstString name,
 const lldb_private::CompilerDeclContext *parent_decl_ctx,
-bool append, uint32_t max_matches,
+uint32_t max_matches,
 llvm::DenseSet &searched_symbol_files,
 lldb_private::TypeMap &types) override;
 
   size_t FindTypes(llvm::ArrayRef pattern,
-   lldb_private::LanguageSet languages, bool append,
+   lldb_private::LanguageSet languages,
lldb_private::TypeMap &types) override;
 
   void FindTypesByRegex(const lldb_private::RegularExpression ®ex,
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1443,13 +1443,11 @@
 
 uint32_t SymbolFilePDB::FindTypes(
 lldb_private::ConstString name,
-const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append,
+const lldb_private::CompilerDeclContext *parent_decl_ctx,
 uint32_t max_matches,
 llvm::DenseSet &searched_symbol_files,
 lldb_private::TypeMap &types) {
   std::lock_guard guard(GetModuleMutex());
-  if (!append)
-types.Clear();
   if (!name)
 return 0;
   if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
@@ -1585,10 +1583,8 @@
 }
 
 size_t SymbolFilePDB::FindTypes(llvm::ArrayRef pattern,
-LanguageSet languages, bool append,
+LanguageSet languages,
 lldb_private::TypeMap &types) {
-  if (!append)
-types.Clear();
   return 0;
 }
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

[Lldb-commits] [lldb] r373134 - [Core] Remove unused dependency on clangAST

2019-09-27 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri Sep 27 17:27:24 2019
New Revision: 373134

URL: http://llvm.org/viewvc/llvm-project?rev=373134&view=rev
Log:
[Core] Remove unused dependency on clangAST

Modified:
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/Core/DumpDataExtractor.cpp

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=373134&r1=373133&r2=373134&view=diff
==
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Fri Sep 27 17:27:24 2019
@@ -69,7 +69,6 @@ add_lldb_library(lldbCore
 clang-tablegen-targets
 
   LINK_LIBS
-clangAST
 clangDriver
 lldbBreakpoint
 lldbDataFormatters

Modified: lldb/trunk/source/Core/DumpDataExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DumpDataExtractor.cpp?rev=373134&r1=373133&r2=373134&view=diff
==
--- lldb/trunk/source/Core/DumpDataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DumpDataExtractor.cpp Fri Sep 27 17:27:24 2019
@@ -22,9 +22,6 @@
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Stream.h"
 
-#include "clang/AST/ASTContext.h"
-#include "clang/AST/CanonicalType.h"
-
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"


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


[Lldb-commits] [PATCH] D68173: Report a useful error when a the user mistypes a class name in making a script ThreadPlan

2019-09-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham created this revision.
Herald added subscribers: lldb-commits, JDevlieghere, abidh.
Herald added a project: LLDB.

Before this patch if you used SBThread.StepUsingScriptedThreadPlan but mistyped 
the Python ThreadPlan class name, you wouldn't get any error, and a bogus 
ThreadPlan would get executed.  This patch adds an error string and plumbs it 
through to where we look up the Python class, so now you get a decent error 
string.  We also tell ourselves the plan has failed (by returning an empty 
StructuredObject) so that the plan will fail the IsValid check and so not get 
pushed.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68173

Files:
  lldb/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/include/lldb/Target/ThreadPlanPython.h
  
lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
  lldb/scripts/Python/python-wrapper.swig
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
  lldb/source/Target/ThreadPlanPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -95,6 +95,7 @@
 
 extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
 const char *python_class_name, const char *session_dictionary_name,
+std::string &error_string,
 const lldb::ThreadPlanSP &thread_plan_sp) {
   return nullptr;
 }
Index: lldb/source/Target/ThreadPlanPython.cpp
===
--- lldb/source/Target/ThreadPlanPython.cpp
+++ lldb/source/Target/ThreadPlanPython.cpp
@@ -45,7 +45,9 @@
 
   if (!m_implementation_sp) {
 if (error)
-  error->Printf("Python thread plan does not have an implementation");
+  error->Printf("Error constructing Python ThreadPlan: %s",
+  m_error_str.empty() ? ""
+: m_error_str.c_str());
 return false;
   }
 
@@ -63,7 +65,7 @@
.GetScriptInterpreter();
 if (script_interp) {
   m_implementation_sp = script_interp->CreateScriptedThreadPlan(
-  m_class_name.c_str(), this->shared_from_this());
+  m_class_name.c_str(), m_error_str, this->shared_from_this());
 }
   }
 }
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -78,6 +78,7 @@
 
   StructuredData::ObjectSP
   CreateScriptedThreadPlan(const char *class_name,
+   std::string &error_str,
lldb::ThreadPlanSP thread_plan) override;
 
   bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp,
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -97,6 +97,7 @@
 
 extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
 const char *python_class_name, const char *session_dictionary_name,
+std::string &error_string,
 const lldb::ThreadPlanSP &thread_plan_sp);
 
 extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
@@ -1844,7 +1845,8 @@
 }
 
 StructuredData::ObjectSP ScriptInterpreterPythonImpl::CreateScriptedThreadPlan(
-const char *class_name, lldb::ThreadPlanSP thread_plan_sp) {
+const char *class_name, std::string &error_str, 
+lldb::ThreadPlanSP thread_plan_sp) {
   if (class_name == nullptr || class_name[0] == '\0')
 return StructuredData::ObjectSP();
 
@@ -1864,10 +1866,11 @@
   {
 Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-
 ret_val = LLDBSwigPythonCreateScriptedThreadPlan(
 class_name, python_interpreter->m_dictionary_name.c_str(),
-thread_plan_sp);
+error_str, thread_plan_sp);
+if (!ret_val)
+  return {};
   }
 
   return StructuredData::ObjectSP(new StructuredPythonObject(ret_val));
Index: lldb/scripts/Python/python-wrapper.swig
===
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -250,6 +250,7 @@
 (
 const char *python_class_name,
 const char *session_dictionary_name,
+std::string &error_string,
 const lldb::ThreadPlanSP& thread_plan_sp
 )
 {
@@ -267,8 +268,11 @@
 auto dict = PythonModule::MainModu

[Lldb-commits] [lldb] r373135 - Give an error when StepUsingScriptedThreadPlan is passed a bad classname.

2019-09-27 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Sep 27 17:53:45 2019
New Revision: 373135

URL: http://llvm.org/viewvc/llvm-project?rev=373135&view=rev
Log:
Give an error when StepUsingScriptedThreadPlan is passed a bad classname.

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

Modified:
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Target/ThreadPlanPython.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
lldb/trunk/scripts/Python/python-wrapper.swig

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

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
lldb/trunk/source/Target/ThreadPlanPython.cpp
lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=373135&r1=373134&r2=373135&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Fri Sep 27 17:53:45 
2019
@@ -208,6 +208,7 @@ public:
 
   virtual StructuredData::ObjectSP
   CreateScriptedThreadPlan(const char *class_name,
+   std::string &error_str,
lldb::ThreadPlanSP thread_plan_sp) {
 return StructuredData::ObjectSP();
   }

Modified: lldb/trunk/include/lldb/Target/ThreadPlanPython.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanPython.h?rev=373135&r1=373134&r2=373135&view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanPython.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanPython.h Fri Sep 27 17:53:45 2019
@@ -55,6 +55,7 @@ protected:
 
 private:
   std::string m_class_name;
+  std::string m_error_str;
   StructuredData::ObjectSP m_implementation_sp;
   bool m_did_push;
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py?rev=373135&r1=373134&r2=373135&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
 Fri Sep 27 17:53:45 2019
@@ -26,10 +26,13 @@ class StepScriptedTestCase(TestBase):
 
 def setUp(self):
 TestBase.setUp(self)
+self.main_source_file = lldb.SBFileSpec("main.c")
 self.runCmd("command script import Steps.py")
 
 def step_out_with_scripted_plan(self, name):
-(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", 
self.main_source_file)
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+
"Set a breakpoint here",
+
self.main_source_file)
 
 frame = thread.GetFrameAtIndex(0)
 self.assertEqual("foo", frame.GetFunctionName())
@@ -39,3 +42,21 @@ class StepScriptedTestCase(TestBase):
 
 frame = thread.GetFrameAtIndex(0)
 self.assertEqual("main", frame.GetFunctionName())
+
+def test_misspelled_plan_name(self):
+"""Test that we get a useful error if we misspell the plan class 
name"""
+self.build()
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+
"Set a breakpoint here",
+
self.main_source_file)
+stop_id = process.GetStopID()
+# Pass a non-existent class for the plan class:
+err = thread.StepUsingScriptedThreadPlan("NoSuchModule.NoSuchPlan")
+
+# Make sure we got a good error:
+self.assertTrue(err.Fail(), "We got a failure state")
+msg = err.GetCString()
+self.assertTrue("NoSuchModule.NoSuchPlan" in msg, "Mentioned missing 
class")
+
+# Make sure we didn't let the process run:
+self.assertEqual(stop_id, process.GetStopID(), "Process didn't run")

Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=373135&r1=373134&r2=373135&view=diff
==
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+

[Lldb-commits] [PATCH] D68173: Report a useful error when a the user mistypes a class name in making a script ThreadPlan

2019-09-27 Thread Jim Ingham 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 rL373135: Give an error when StepUsingScriptedThreadPlan is 
passed a bad classname. (authored by jingham, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D68173?vs=71&id=73#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D68173

Files:
  lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/trunk/include/lldb/Target/ThreadPlanPython.h
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
  lldb/trunk/scripts/Python/python-wrapper.swig
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
  lldb/trunk/source/Target/ThreadPlanPython.cpp
  lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
@@ -26,10 +26,13 @@
 
 def setUp(self):
 TestBase.setUp(self)
+self.main_source_file = lldb.SBFileSpec("main.c")
 self.runCmd("command script import Steps.py")
 
 def step_out_with_scripted_plan(self, name):
-(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", self.main_source_file)
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+"Set a breakpoint here",
+self.main_source_file)
 
 frame = thread.GetFrameAtIndex(0)
 self.assertEqual("foo", frame.GetFunctionName())
@@ -39,3 +42,21 @@
 
 frame = thread.GetFrameAtIndex(0)
 self.assertEqual("main", frame.GetFunctionName())
+
+def test_misspelled_plan_name(self):
+"""Test that we get a useful error if we misspell the plan class name"""
+self.build()
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+"Set a breakpoint here",
+self.main_source_file)
+stop_id = process.GetStopID()
+# Pass a non-existent class for the plan class:
+err = thread.StepUsingScriptedThreadPlan("NoSuchModule.NoSuchPlan")
+
+# Make sure we got a good error:
+self.assertTrue(err.Fail(), "We got a failure state")
+msg = err.GetCString()
+self.assertTrue("NoSuchModule.NoSuchPlan" in msg, "Mentioned missing class")
+
+# Make sure we didn't let the process run:
+self.assertEqual(stop_id, process.GetStopID(), "Process didn't run")
Index: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -95,6 +95,7 @@
 
 extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
 const char *python_class_name, const char *session_dictionary_name,
+std::string &error_string,
 const lldb::ThreadPlanSP &thread_plan_sp) {
   return nullptr;
 }
Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
===
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -78,6 +78,7 @@
 
   StructuredData::ObjectSP
   CreateScriptedThreadPlan(const char *class_name,
+   std::string &error_str,
lldb::ThreadPlanSP thread_plan) override;
 
   bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp,
Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -97,6 +97,7 @@
 
 extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
 const char *python_class_name, const char *session_dictionary_name,
+std::string &error_st

[Lldb-commits] [PATCH] D68174: Allow private-state-thread to call SB API's that take the TargetAPI mutex

2019-09-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham created this revision.
jingham added a reviewer: clayborg.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.

When we do synchronous process execution in lldb, the call that restarted the 
target will generally have acquired first the TargetAPI lock, and then the 
Process RunLock.  If in the process of handling that continue we need to run 
Python code in the private-state-thread (e.g. for an OS plugin or scripted 
ThreadPlan) if that Python code calls another API that takes the Target API 
mutex, we will deadlock.  However, the private state thread is always doing 
work on behalf of whatever thread initiated the continue.  So the private state 
thread should always formally be allowed to pass the lock check.

We already handled this in the case of the Process RunLock by passing out 
separate locks depending on whether you were running code in the private state 
thread or anywhere else.  This patch just does the same thing for the Target 
API mutex.

I also added a test using a scripted ThreadPlan that calls various SBFrame and 
SBValue API's which take the API lock in the should_stop method of the plan 
(which is always run on the private state thread).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68174

Files:
  lldb/include/lldb/Target/Process.h
  lldb/include/lldb/Target/Target.h
  lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/Steps.py
  
lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
  lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/main.c
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -4129,3 +4129,10 @@
 module_list = event_data->m_module_list;
   return module_list;
 }
+
+std::recursive_mutex &Target::GetAPIMutex() { 
+  if (GetProcessSP() && GetProcessSP()->CurrentThreadIsPrivateStateThread())
+return m_private_mutex;
+  else
+return m_mutex;
+}
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5538,6 +5538,12 @@
 return m_public_run_lock;
 }
 
+bool Process::CurrentThreadIsPrivateStateThread()
+{
+  return m_private_state_thread.EqualsThread(Host::GetCurrentThread());
+}
+
+
 void Process::Flush() {
   m_thread_list.Flush();
   m_extended_thread_list.Flush();
Index: lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/main.c
===
--- lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/main.c
+++ lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/main.c
@@ -1,7 +1,10 @@
 #include 
 
 void foo() {
-  printf("Set a breakpoint here.\n");
+  int foo = 10; 
+  printf("%d\n", foo); // Set a breakpoint here. 
+  foo = 20;
+  printf("%d\n", foo);
 }
 
 int main() {
Index: lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
@@ -12,23 +12,23 @@
 
 NO_DEBUG_INFO_TESTCASE = True
 
+def setUp(self):
+TestBase.setUp(self)
+self.main_source_file = lldb.SBFileSpec("main.c")
+self.runCmd("command script import Steps.py")
+
 def test_standard_step_out(self):
-"""Tests stepping with the scripted thread plan laying over a standard thread plan for stepping out."""
+"""Tests stepping with the scripted thread plan laying over a standard 
+thread plan for stepping out."""
 self.build()
-self.main_source_file = lldb.SBFileSpec("main.c")
 self.step_out_with_scripted_plan("Steps.StepOut")
 
 def test_scripted_step_out(self):
-"""Tests stepping with the scripted thread plan laying over an another scripted thread plan for stepping out."""
+"""Tests stepping with the scripted thread plan laying over an another 
+scripted thread plan for stepping out."""
 self.build()
-self.main_source_file = lldb.SBFileSpec("main.c")
 self.step_out_with_scripted_plan("Steps.StepScripted")
 
-def setUp(self):
-TestBase.setUp(self)
-self.main_source_file = lldb.SBFileSpec("main.c")
-self.runCmd("command script import Steps.py")
-
 def step_out_with_scripted_plan(self, name):
 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
 "Set a breakpoint here",
@@ -43,6 +43,7 @@
 frame = thread.GetFrameAtIndex(0)
 self.assertEqual

[Lldb-commits] [PATCH] D68174: Allow private-state-thread to call SB API's that take the TargetAPI mutex

2019-09-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Note, a better way to do this would be to have some kind of "API/Runlock baton" 
that could get handed off from the thread that initiated the continue to the 
private state thread, then handed back when the process stops and returns 
control to the SB API that initiated the run.  But I don't have time to design 
such a thing right now, and this was blocking writing tests for some work I am 
doing to handle the case where OS Plugins don't report all threads at each 
stop.  So I'd prefer this more straightforward solution for now - especially 
since it's just a copy of the way we handled the same problem for the runlock.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D68174



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


[Lldb-commits] [PATCH] D68179: [lldb] Fix JSON parser to allow empty arrays

2019-09-27 Thread Alex Cameron via Phabricator via lldb-commits
tetsuo-cpp created this revision.
tetsuo-cpp added a reviewer: xbolva00.
tetsuo-cpp added projects: LLVM, LLDB.
Herald added subscribers: lldb-commits, JDevlieghere.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=39405

  alexc@kitty:~/work/wiredtiger/build_posix$ cat breakpoint.json
  [{"Breakpoint" : {"BKPTOptions" : {"AutoContinue" : false,"ConditionText" : 
"","EnabledState" : true,"IgnoreCount" : 0,"OneShotState" : 
false},"BKPTResolver" : {"Options" : {"NameMask" : [56],"Offset" : 
0,"SkipPrologue" : true,"SymbolNames" : ["__wt_btcur_search"]},"Type" : 
"SymbolName"},"Hardware" : false,"SearchFilter" : {"Options" : {},"Type" : 
"Unconstrained","Foo" : []}}}]

**Before**

  (lldb) breakpoint read --file breakpoint.json
  error: Invalid JSON from input file: 
/home/alexc/work/wiredtiger/build_posix/breakpoint.json.

**After**

  (lldb) breakpoint read --file breakpoint.json
  New breakpoints:
  Breakpoint 1: where = libwiredtiger-3.2.2.so`__wt_btcur_search + 15 at 
bt_cursor.c:522:5, address = 0x7576ab2f


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68179

Files:
  lldb/include/lldb/Utility/JSON.h
  lldb/source/Utility/JSON.cpp
  lldb/source/Utility/StructuredData.cpp
  lldb/tools/debugserver/source/JSON.cpp
  lldb/tools/debugserver/source/JSON.h

Index: lldb/tools/debugserver/source/JSON.h
===
--- lldb/tools/debugserver/source/JSON.h
+++ lldb/tools/debugserver/source/JSON.h
@@ -292,6 +292,8 @@
   JSONValue::SP ParseJSONValue();
 
 protected:
+  JSONValue::SP ParseJSONValue(const std::string &value, const Token &token);
+
   JSONValue::SP ParseJSONObject();
 
   JSONValue::SP ParseJSONArray();
Index: lldb/tools/debugserver/source/JSON.cpp
===
--- lldb/tools/debugserver/source/JSON.cpp
+++ lldb/tools/debugserver/source/JSON.cpp
@@ -516,13 +516,16 @@
   std::string value;
   std::string key;
   while (true) {
-JSONValue::SP value_sp = ParseJSONValue();
+JSONParser::Token token = GetToken(value);
+if (token == JSONParser::Token::ArrayEnd)
+  return JSONValue::SP(array_up.release());
+JSONValue::SP value_sp = ParseJSONValue(value, token);
 if (value_sp)
   array_up->AppendObject(value_sp);
 else
   break;
 
-JSONParser::Token token = GetToken(value);
+token = GetToken(value);
 if (token == JSONParser::Token::Comma) {
   continue;
 } else if (token == JSONParser::Token::ArrayEnd) {
@@ -537,6 +540,13 @@
 JSONValue::SP JSONParser::ParseJSONValue() {
   std::string value;
   const JSONParser::Token token = GetToken(value);
+  return ParseJSONValue(value, token);
+}
+
+JSONValue::SP JSONParser::ParseJSONValue(const std::string &value,
+ const Token &token) {
+  std::string value;
+  const JSONParser::Token token = GetToken(value);
   switch (token) {
   case JSONParser::Token::ObjectStart:
 return ParseJSONObject();
Index: lldb/source/Utility/StructuredData.cpp
===
--- lldb/source/Utility/StructuredData.cpp
+++ lldb/source/Utility/StructuredData.cpp
@@ -24,6 +24,9 @@
 
 // Functions that use a JSONParser to parse JSON into StructuredData
 static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser);
+static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser,
+   const std::string &value,
+   const JSONParser::Token &token);
 static StructuredData::ObjectSP ParseJSONObject(JSONParser &json_parser);
 static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser);
 
@@ -83,13 +86,17 @@
   std::string value;
   std::string key;
   while (true) {
-StructuredData::ObjectSP value_sp = ParseJSONValue(json_parser);
+JSONParser::Token token = json_parser.GetToken(value);
+if (token == JSONParser::Token::ArrayEnd)
+  return StructuredData::ObjectSP(array_up.release());
+StructuredData::ObjectSP value_sp =
+ParseJSONValue(json_parser, value, token);
 if (value_sp)
   array_up->AddItem(value_sp);
 else
   break;
 
-JSONParser::Token token = json_parser.GetToken(value);
+token = json_parser.GetToken(value);
 if (token == JSONParser::Token::Comma) {
   continue;
 } else if (token == JSONParser::Token::ArrayEnd) {
@@ -104,6 +111,12 @@
 static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser) {
   std::string value;
   const JSONParser::Token token = json_parser.GetToken(value);
+  return ParseJSONValue(json_parser, value, token);
+}
+
+static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser,
+   const std::string &value,
+   const JSONParser::Token &token) {
   switch (token) {
   case JSONParser::Token::ObjectStart:
 ret

[Lldb-commits] [PATCH] D68179: [lldb] Fix JSON parser to allow empty arrays

2019-09-27 Thread Alex Cameron via Phabricator via lldb-commits
tetsuo-cpp updated this revision to Diff 81.

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

https://reviews.llvm.org/D68179

Files:
  lldb/include/lldb/Utility/JSON.h
  lldb/source/Utility/JSON.cpp
  lldb/source/Utility/StructuredData.cpp
  lldb/tools/debugserver/source/JSON.cpp
  lldb/tools/debugserver/source/JSON.h

Index: lldb/tools/debugserver/source/JSON.h
===
--- lldb/tools/debugserver/source/JSON.h
+++ lldb/tools/debugserver/source/JSON.h
@@ -292,6 +292,8 @@
   JSONValue::SP ParseJSONValue();
 
 protected:
+  JSONValue::SP ParseJSONValue(const std::string &value, const Token &token);
+
   JSONValue::SP ParseJSONObject();
 
   JSONValue::SP ParseJSONArray();
Index: lldb/tools/debugserver/source/JSON.cpp
===
--- lldb/tools/debugserver/source/JSON.cpp
+++ lldb/tools/debugserver/source/JSON.cpp
@@ -516,13 +516,16 @@
   std::string value;
   std::string key;
   while (true) {
-JSONValue::SP value_sp = ParseJSONValue();
+JSONParser::Token token = GetToken(value);
+if (token == JSONParser::Token::ArrayEnd)
+  return JSONValue::SP(array_up.release());
+JSONValue::SP value_sp = ParseJSONValue(value, token);
 if (value_sp)
   array_up->AppendObject(value_sp);
 else
   break;
 
-JSONParser::Token token = GetToken(value);
+token = GetToken(value);
 if (token == JSONParser::Token::Comma) {
   continue;
 } else if (token == JSONParser::Token::ArrayEnd) {
@@ -537,6 +540,11 @@
 JSONValue::SP JSONParser::ParseJSONValue() {
   std::string value;
   const JSONParser::Token token = GetToken(value);
+  return ParseJSONValue(value, token);
+}
+
+JSONValue::SP JSONParser::ParseJSONValue(const std::string &value,
+ const Token &token) {
   switch (token) {
   case JSONParser::Token::ObjectStart:
 return ParseJSONObject();
Index: lldb/source/Utility/StructuredData.cpp
===
--- lldb/source/Utility/StructuredData.cpp
+++ lldb/source/Utility/StructuredData.cpp
@@ -24,6 +24,9 @@
 
 // Functions that use a JSONParser to parse JSON into StructuredData
 static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser);
+static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser,
+   const std::string &value,
+   const JSONParser::Token &token);
 static StructuredData::ObjectSP ParseJSONObject(JSONParser &json_parser);
 static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser);
 
@@ -83,13 +86,17 @@
   std::string value;
   std::string key;
   while (true) {
-StructuredData::ObjectSP value_sp = ParseJSONValue(json_parser);
+JSONParser::Token token = json_parser.GetToken(value);
+if (token == JSONParser::Token::ArrayEnd)
+  return StructuredData::ObjectSP(array_up.release());
+StructuredData::ObjectSP value_sp =
+ParseJSONValue(json_parser, value, token);
 if (value_sp)
   array_up->AddItem(value_sp);
 else
   break;
 
-JSONParser::Token token = json_parser.GetToken(value);
+token = json_parser.GetToken(value);
 if (token == JSONParser::Token::Comma) {
   continue;
 } else if (token == JSONParser::Token::ArrayEnd) {
@@ -104,6 +111,12 @@
 static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser) {
   std::string value;
   const JSONParser::Token token = json_parser.GetToken(value);
+  return ParseJSONValue(json_parser, value, token);
+}
+
+static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser,
+   const std::string &value,
+   const JSONParser::Token &token) {
   switch (token) {
   case JSONParser::Token::ObjectStart:
 return ParseJSONObject(json_parser);
Index: lldb/source/Utility/JSON.cpp
===
--- lldb/source/Utility/JSON.cpp
+++ lldb/source/Utility/JSON.cpp
@@ -485,13 +485,16 @@
   std::string value;
   std::string key;
   while (true) {
-JSONValue::SP value_sp = ParseJSONValue();
+JSONParser::Token token = GetToken(value);
+if (token == JSONParser::Token::ArrayEnd)
+  return JSONValue::SP(array_up.release());
+JSONValue::SP value_sp = ParseJSONValue(value, token);
 if (value_sp)
   array_up->AppendObject(value_sp);
 else
   break;
 
-JSONParser::Token token = GetToken(value);
+token = GetToken(value);
 if (token == JSONParser::Token::Comma) {
   continue;
 } else if (token == JSONParser::Token::ArrayEnd) {
@@ -506,6 +509,11 @@
 JSONValue::SP JSONParser::ParseJSONValue() {
   std::string value;
   const JSONParser::Token token = GetToken(value);
+  return ParseJSONValue(value, token);
+}
+
+JSONValue::S

[Lldb-commits] [PATCH] D68179: [lldb] Fix JSON parser to allow empty arrays

2019-09-27 Thread Davide Italiano via Phabricator via lldb-commits
davide requested changes to this revision.
davide added a comment.
This revision now requires changes to proceed.

This needs a test. You can either write a python one as the ones in 
`test/testcases` or a lit-style based as the ones in `lit/`.


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

https://reviews.llvm.org/D68179



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


[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This looks good to me, but please do give a chance for other to look this over 
too. Thanks for cleaning this up.

In D67589#1684847 , @jankratochvil 
wrote:

> | `m_opaque_up` type | ABI compatible |
> | `llvm::PointerIntPair` | yes (size 8)   |
> |


This is true, but it also inflicts the SB stability requirements onto the 
`PointerIntPair` class. While I don't imagine the `sizeof(PointerIntPair)` will 
ever change, I don't think this is a good thing to do, just on principle.




Comment at: 
lldb/packages/Python/lldbsuite/test/api/command-return-object/Makefile:1
+MAKE_DSYM := NO
+

I'm pretty sure this line is not needed.



Comment at: lldb/source/API/SBCommandReturnObject.cpp:142
 
-  m_opaque_up->Clear();
+  (*this)->Clear();
 }

I think `get()->Clear()` or `ref().Clear()` would be easier on the eye.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67589



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


[Lldb-commits] [PATCH] D68106: Fix a crasher due to an assert when two files have the same UUID but different paths.

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks good, modulo the comment about shadowing.




Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:115
 
+  lldb::addr_t GetBaseAddress() const { return m_base; }
 private:

This implements something very similar to the GetBaseAddress function on line 
81 (it is equivalent to `const_cast(this)->GetBaseAddress().GetFileAddress()`). In fact, the only reason you 
could define this function is because it is const, while the other method is 
not. Having two methods with the same name returning different types is very 
confusing. I think you should just drop this and replace the call on line 417 
with `objfile->GetBaseAddress().GetFileAddress()`. That way, you don't even 
need to cast anything.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68106



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


[Lldb-commits] [PATCH] D68069: Explicitly set entry point arch when it's thumb

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D68069#1685146 , @aadsm wrote:

> > For the test, what would you say to writing that as a lit test instead 
> > (testing the address class deduction via the disassemble command you 
> > mentioned)?
>
> I was actually keen on this since lit is the only type of test I haven't used 
> yet but then thought that it wouldn't really test my change directly (just 
> indirectly). I know I put that as a test in my summary but it was more like a 
> sanity check. The real test here is checking the address class (which is what 
> is changed in the code). There are different things in lldb that uses that 
> like setting a breakpoint or disassembling instructions, that's why I don't 
> feel that testing the consequence is the ideal test. What do you think?


Yeah, lit tests are often indirect to some degree. I think that's one of their 
main drawbacks (the lack of interactivity being the other). This needs to be 
balanced with their advantages. In this particular, case I think using the lit 
approach would be fine (though I haven't looked at the code to see how exactly 
this information is plumbed), as both disassembly and breakpoint should use the 
same source for determining the instruction set, but I am fine also fine with 
keeping the test like this.

> 
> 
>> The yaml is actually fairly readable as is, but given that you felt the need 
>> to include the commands used to produce that input, it might be better to 
>> actually produce that file via the commands as a part of the test 
>> (substituting llvm-mc for as and ld.lld for linker).
> 
> I just put it there for completion sake, I always like to have the source of 
> things when I didn't do it by hand. In this case I prefer to have the yaml 
> because I'm not sure if in all scenarios that we run the test we'll be able 
> to assemble arm assembly into an object?

The things you need are the arm target being built, and having lld checked out 
(so the test would need an annotation like `REQUIRES: lld, arm`). Not everyone 
has both of these things enabled (particularly having lld is less common), but 
they are things that one _can_ enable no matter what is his host or target 
architecture, so I am not worried by that. And as tests like these become more 
common, I expect more people will start having these enabled by default.




Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2737-2738
+  0,  // Offset in section or symbol value.
+  2,  // Size.
+  true,   // Size is valid.
+  false,  // Contains linker annotations?

aadsm wrote:
> labath wrote:
> > This is pretty arbitrary. Would it be possible to just set 
> > size_is_valid=false, and let the usual symbol size deduction logic figure 
> > out something reasonable here?
> To be honest I'm not sure how the size_is_valid = false is used as I've only 
> seen it being used when going through the EH frame FDE entries.
> 
> Setting the size to 0 is problematic though, when the symbol is added to the 
> symtab its size will automatically span to the next function symbol boundary. 
> I think this can be dangerous because the symtab for the object file might 
> not have all function boundaries defined and in the event that we have mixed 
> arm/thumb code in it, it will incorrectly mark arm code as thumb. This is why 
> I wanted to be conservative here.
That's true, but in the case we don't have all function symbols, we're down to 
guessing anyway. For all you know, treating the rest of code as thumb might 
actually be the right thing to do. (In fact it will almost certainly be correct 
at least for the next few instructions, since the entry point function is 
unlikely to be just one instruction long.)

The FDE parsing code actually does exactly the same thing you do here. It 
searches for possible function entry points, and creates symbols for those 
locations, if we don't have them already. Since it doesn't know the size of the 
those symbols it just sets `size_is_valid=false`, and lets it be auto-computed.

That's why I'm pushing to make this consistent with the FDE code, as adding 
this additional symbol actually improves the accuracy of the sizes computed for 
the FDE symbols. Likewise, if you set `size_is_valid=false` here, then any 
additional symbol-searching heuristics we introduce will improve the accuracy 
of the entry symbol size.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68069



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


[Lldb-commits] [lldb] r373050 - [lldb][NFC] Test CommandObjectMultiword functionality

2019-09-27 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Sep 27 01:18:38 2019
New Revision: 373050

URL: http://llvm.org/viewvc/llvm-project?rev=373050&view=rev
Log:
[lldb][NFC] Test CommandObjectMultiword functionality

A lot of commands are made up of CommandObjectMultiword with
subcommands. CommandObjectMultiword actually has some functionality
on its own that wasn't tested before.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py?rev=373050&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
 Fri Sep 27 01:18:38 2019
@@ -0,0 +1,34 @@
+"""
+Test multiword commands ('platform' in this case).
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class MultiwordCommandsTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+def test_ambiguous_subcommand(self):
+self.expect("platform s", error=True,
+substrs=["ambiguous command 'platform s'. Possible 
completions:",
+ "\tselect\n",
+ "\tshell\n",
+ "\tsettings\n"])
+
+@no_debug_info_test
+def test_empty_subcommand(self):
+# FIXME: This has no error message.
+self.expect("platform \"\"", error=True)
+
+@no_debug_info_test
+def test_help(self):
+#  help brings up help.
+self.expect("platform help",
+substrs=["Commands to manage and create platforms.",
+ "Syntax: platform [",
+ "The following subcommands are supported:",
+ "connect",
+ "Select the current platform"])


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


[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

looks good to me




Comment at: lldb/source/Commands/CommandObjectGUI.cpp:32-33
+File &input = debugger.GetInputFile();
+if (input.GetIsRealTerminal() &&
+input.GetIsInteractive()) {
   IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));

This looks like it would fit on one line. Did you run clang-format?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891



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


[Lldb-commits] [lldb] r373051 - [lldb][NFC] Actually test which method we call in TestCallOverriddenMethod

2019-09-27 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Sep 27 01:21:08 2019
New Revision: 373051

URL: http://llvm.org/viewvc/llvm-project?rev=373051&view=rev
Log:
[lldb][NFC] Actually test which method we call in TestCallOverriddenMethod

Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py?rev=373051&r1=373050&r2=373051&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
 Fri Sep 27 01:21:08 2019
@@ -40,9 +40,12 @@ class ExprCommandCallOverriddenMethod(Te
 
 # Test call to method in base class (this should always work as the 
base
 # class method is never an override).
-self.expect("expr b->foo()")
+self.expect("expr b->foo()", substrs=["2"])
 
 # Test call to overridden method in derived class (this will fail if 
the
 # overrides table is not correctly set up, as Derived::foo will be 
assigned
 # a vtable entry that does not exist in the compiled program).
-self.expect("expr d.foo()")
+self.expect("expr d.foo()", substrs=["2"])
+
+# Test calling the base class.
+self.expect("expr realbase.foo()", substrs=["1"])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp?rev=373051&r1=373050&r2=373051&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
 Fri Sep 27 01:21:08 2019
@@ -1,15 +1,16 @@
 class Base {
 public:
   virtual ~Base() {}
-  virtual void foo() {}
+  virtual int foo() { return 1; }
 };
 
 class Derived : public Base {
 public:
-  virtual void foo() {}
+  virtual int foo() { return 2; }
 };
 
 int main() {
+  Base realbase;
   Derived d;
   Base *b = &d;
   return 0; // Set breakpoint here


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


[Lldb-commits] [lldb] r373053 - [lldb] Print an error message for an empty subcommand

2019-09-27 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Sep 27 01:49:41 2019
New Revision: 373053

URL: http://llvm.org/viewvc/llvm-project?rev=373053&view=rev
Log:
[lldb] Print an error message for an empty subcommand

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
lldb/trunk/source/Commands/CommandObjectMultiword.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py?rev=373053&r1=373052&r2=373053&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
 Fri Sep 27 01:49:41 2019
@@ -20,8 +20,7 @@ class MultiwordCommandsTestCase(TestBase
 
 @no_debug_info_test
 def test_empty_subcommand(self):
-# FIXME: This has no error message.
-self.expect("platform \"\"", error=True)
+self.expect("platform \"\"", error=True, substrs=["Need to specify a 
non-empty subcommand."])
 
 @no_debug_info_test
 def test_help(self):

Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=373053&r1=373052&r2=373053&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Fri Sep 27 01:49:41 
2019
@@ -94,8 +94,10 @@ bool CommandObjectMultiword::Execute(con
   }
 
   auto sub_command = args[0].ref();
-  if (sub_command.empty())
+  if (sub_command.empty()) {
+result.AppendError("Need to specify a non-empty subcommand.");
 return result.Succeeded();
+  }
 
   if (sub_command.equals_lower("help")) {
 this->CommandObject::GenerateHelpText(result);


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


[Lldb-commits] [PATCH] D67390: [LLDB][ELF] Load both, .symtab and .dynsym sections

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks fairly ok to me, but it could use a more explicit test of the symbol 
uniqueing code. Right, now I believe the two tests you added check that the 
symbols are _not_ uniqued. (They're also a bit hard to follow due to the whole 
 objcopy business). Could you create a test with a yaml file which will contain 
various edge cases relevant to this code. I'm thinking of stuff like "a dynsym 
and a symtab symbol at the same address, but a different name", "a dynsym and 
symtab symbols with identical names, but different addresses", etc. Then just 
run "image dump symtab" on that file to check what we have parsed?

I am also surprised that you weren't able to just use a Section* (instead of 
the name) for the uniqueing. I'd expect that all symbols (even those from the 
separate object file) should be resolved to the sections in the main object. I 
see that this isn't the case, but I am surprised that this isn't causing any 
problems. Anyway, as things seem to be working as they are now, we can leave 
that for another day.

In D67390#1685313 , @kwk wrote:

> Before I used the bare symbol name with stripped `@VERSION` suffix. Now I've 
> changed the implementation of `NamedELFSymbol` to include the `@VERSION` 
> suffix and the tests pass.


Interesting. I'm pretty sure that the symbol count is irrelevant for that test 
(it just wants to know if it is there), so we can change that if needed. 
However, having the uniqueing include the `@VERSION` sounds right to me, so if 
that makes the test happy too then, great.




Comment at: lldb/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c:1
+// This function will be embedded within the .dynsym section of the main 
binary.
+int functionInDynsym(int num) { return num * 3; }

It looks like you could inline these test inputs into the test files. You'd 
just need to change all the comments to `//` and add `.c` to the list of valid 
suffixes in lit.local.cfg.



Comment at: lldb/lit/Modules/ELF/load-from-dynsym-alone.test:16
+# have it put the default .symtab section.
+# RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
+# RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary 
%p/Inputs/load-from-dynsym-alone.c

s/dynmic/dynamic/



Comment at: lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp:371-373
+  r.st_name = st_name;
+  return elf::ELFSymbol::operator==(r) &&
+ st_name_string == rhs.st_name_string;

kwk wrote:
> clayborg wrote:
> > I would almost just manually compare only the things we care about here. 
> > Again, what about st_shndx when comparing a symbol from the main symbol 
> > table and one from the .gnu_debugdata symbol table. Are those section 
> > indexes guaranteed to match? I would think not. 
> @clayborg I explicitly only compare what we care about and therefore always 
> set the name index to  be the same.
I'll echo @clayborg here. This business with copying the ELFSymbol and clearing 
some fields is confusing. Do you even need the ELFSymbol::operator== for 
anything? If not I'd just delete that, and have the derived version compare all 
fields.

Also, it would be nice if the operator== and hash function definitions were 
next to each other. Can you just forward declare the std::hash stuff in the 
header, and have the implementation be next to this?



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2202-2204
+needle.st_name_string = ConstString(symbol_ref);
+if (symbol_section_sp)
+needle.st_section_name_string = 
ConstString(symbol_section_sp->GetName());

Move this into the NamedELFSymbol constructor?



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2205
+needle.st_section_name_string = 
ConstString(symbol_section_sp->GetName());
+if (unique_elf_symbols.find(needle) == unique_elf_symbols.end()) {
+  symtab->AddSymbol(dc_symbol);

something like `if (unique_elf_symbols.insert(needle).second)` would be more 
efficient, as you don't need to mess with the map twice.



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2650
+// A unique set of ELF symbols added to the symtab
+UniqueElfSymbolColl unique_elf_symbols({});
 SectionList *section_list = module_sp->GetSectionList();

what's wrong with the old-fashioned `UniqueElfSymbolColl unique_elf_symbols;` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67390



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


[Lldb-commits] [PATCH] D68096: Add Linux signal support to ProcessMinidump

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The functionality is fine, though I'd hope it can be cleaned up a bit.

As for testing, yes, yaml2obj has some problems roundtripping complex minidumps 
(and elf files). Fortunately, for the functionality you're testing, I don't 
think you really need the executable file, so you can just ignore the elf bit 
and test with a plain `lldb -c foo.dmp` (obviously, you won't get the backtrace 
that way, but you don't really need that here. Round-tripping minidumps is also 
WIP -- I've only implemented the bits I have needed so far (I am adding 
MemoryInfoList stream as we speak). For some streams that just means, they're 
not getting pretty-printed, while for others (those that contain pointers to 
other parts of the file) it means the reconstituted file ends up containing 
garbage. The exception stream is one of those cases, but here it looks like you 
actually want to test the case where the exception stream is not present (?), 
so that might be fine. Or it might be fine if you manually remove the 
ExceptionStream from the yaml? If you can send me the minidump you have 
generated I can try to play around with it to see if I can make a reasonable 
yaml out of it.

As for the "lldb/lit/Minidump or 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new" part, 
the main difference there is how the test is written. Which one is better 
depends on what you want to test and to some extent, also on personal 
preference. The python tests are better when you want to programatically drive 
lldb and have complex interactions with it. the lit tests are good for simply 
executing a bunch of known commands, and verifying static output. For this 
case, I think a lit test is definitely the easier route.




Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:219-237
+
+  if (arch.GetTriple().isOSLinux()) {
+
+SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
+if (!m_thread_list.empty() &&
+(!m_active_exception ||

Would it be possible to move this code (except maybe the SetUnixSignals bit) 
into the `RefreshStateAfterStop` function? Would be less confusing and it would 
avoid the need for extra member variables...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68096



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


[Lldb-commits] [PATCH] D68048: [WIP][RFC] Improve fetching the process list on the android platform

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I think that being able to debug an android device without needing to first 
copy&run an lldb-server there would be a great feature, and it's something I've 
wished for many times. Whether that also means ditching the lldb-server 
platform process is a more complicated question.

While some of the things that we use lldb-server platform for (copying files) 
can be easily done with adb, this is not generally true. I am afraid that if we 
try to do that, then we'll end up simply not being able to access some data, or 
needing to do complicated text scraping (which can be flaky). While it is not 
_that_ bad, this patch demonstrates both problems -- fetching the process 
architecture in this manner is pretty easy for lldb-server, but very hard over 
adb, and it also needs to account for differences in the "ps" output format on 
different devices.

Whether that means this approach should be scrapped? I don't know... If I were 
doing this, I'd probably try to keep it. But that's kind of not my business 
now...

What I do want to suggest is to think about a solid regression testing strategy 
early on. One of the ideas that come to mind is to create a mock adb server in 
python (similar to the mock gdb server in 
test/testcases/functionalities/gdb_client). This would allow you to simulate a 
variety of android devices and their responses to different commands (e.g. 
`ps`), and it would not require a real android device present at least for the 
most basic tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68048



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


[Lldb-commits] [lldb] r373061 - [lldb] [testsuite] Remove redundant MAKE_DSYM := NO

2019-09-27 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Fri Sep 27 02:59:53 2019
New Revision: 373061

URL: http://llvm.org/viewvc/llvm-project?rev=373061&view=rev
Log:
[lldb] [testsuite] Remove redundant MAKE_DSYM := NO

According to a comment by Pavel Labath:
https://reviews.llvm.org/D67589#inline-612375

Modified:
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/Makefile
lldb/trunk/packages/Python/lldbsuite/test/macosx/function-starts/Makefile

lldb/trunk/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/Makefile

lldb/trunk/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/create-empty-corefile.mk
lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/frame/Makefile
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/Makefile

lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/Makefile
lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/Makefile
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/Makefile

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/Makefile

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile?rev=373061&r1=373060&r2=373061&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile 
Fri Sep 27 02:59:53 2019
@@ -1,5 +1,3 @@
-MAKE_DSYM := NO
-
 ENABLE_THREADS := YES
 CXX_SOURCES := multi-process-driver.cpp testprog.cpp
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile?rev=373061&r1=373060&r2=373061&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/Makefile Fri 
Sep 27 02:59:53 2019
@@ -1,5 +1,3 @@
-MAKE_DSYM := NO
-
 ENABLE_THREADS := YES
 CXX_SOURCES := main.cpp
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile?rev=373061&r1=373060&r2=373061&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile 
Fri Sep 27 02:59:53 2019
@@ -1,7 +1,6 @@
 OBJC_SOURCES := main.m
 
 CFLAGS_EXTRAS := -g0 # No debug info.
-MAKE_DSYM := NO
 
 
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile?rev=373061&r1=373060&r2=373061&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/archives/Makefile 
Fri Sep 27 02:59:53 2019
@@ -1,6 +1,5 @@
 C_SOURCES := main.c
 
-MAKE_DSYM := NO
 ARCHIVE_NAME := libfoo.a
 ARCHIVE_C_SOURCES := a.c b.c
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile?rev=373061&r1=373060&r2=373061&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile 
Fri Sep 27 02:59:53 2019
@@ -11,6 +11,4 @@ else
 LDFLAGS = $(CFLAGS) -Wl,--gc-sections
 endif
 
-MAKE_DSYM := NO
-
 include Makefile.rules

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trun

[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

2019-09-27 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked 2 inline comments as done.
jankratochvil added a comment.

std:




Comment at: 
lldb/packages/Python/lldbsuite/test/api/command-return-object/Makefile:1
+MAKE_DSYM := NO
+

labath wrote:
> I'm pretty sure this line is not needed.
Removed in current testsuite: rL373061


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67589



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


[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

2019-09-27 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 222114.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67589

Files:
  lldb/include/lldb/API/SBCommandReturnObject.h
  lldb/packages/Python/lldbsuite/test/api/command-return-object/Makefile
  
lldb/packages/Python/lldbsuite/test/api/command-return-object/TestSBCommandReturnObject.py
  lldb/packages/Python/lldbsuite/test/api/command-return-object/main.cpp
  lldb/scripts/Python/python-wrapper.swig
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/API/SBCommandReturnObject.cpp

Index: lldb/source/API/SBCommandReturnObject.cpp
===
--- lldb/source/API/SBCommandReturnObject.cpp
+++ lldb/source/API/SBCommandReturnObject.cpp
@@ -18,11 +18,43 @@
 using namespace lldb;
 using namespace lldb_private;
 
+class lldb_private::SBCommandReturnObjectImpl {
+public:
+  SBCommandReturnObjectImpl()
+  : m_ptr(new CommandReturnObject()), m_owned(true) {}
+  SBCommandReturnObjectImpl(CommandReturnObject &ref)
+  : m_ptr(&ref), m_owned(false) {}
+  SBCommandReturnObjectImpl(const SBCommandReturnObjectImpl &rhs)
+  : m_ptr(new CommandReturnObject(*rhs.m_ptr)), m_owned(rhs.m_owned) {}
+  SBCommandReturnObjectImpl &operator=(const SBCommandReturnObjectImpl &rhs) {
+SBCommandReturnObjectImpl copy(rhs);
+std::swap(*this, copy);
+return *this;
+  }
+  // rvalue ctor+assignment are not used by SBCommandReturnObject.
+  ~SBCommandReturnObjectImpl() {
+if (m_owned)
+  delete m_ptr;
+  }
+
+  CommandReturnObject &operator*() const { return *m_ptr; }
+
+private:
+  CommandReturnObject *m_ptr;
+  bool m_owned;
+};
+
 SBCommandReturnObject::SBCommandReturnObject()
-: m_opaque_up(new CommandReturnObject()) {
+: m_opaque_up(new SBCommandReturnObjectImpl()) {
   LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommandReturnObject);
 }
 
+SBCommandReturnObject::SBCommandReturnObject(CommandReturnObject &ref)
+: m_opaque_up(new SBCommandReturnObjectImpl(ref)) {
+  LLDB_RECORD_CONSTRUCTOR(SBCommandReturnObject,
+  (lldb_private::CommandReturnObject &), ref);
+}
+
 SBCommandReturnObject::SBCommandReturnObject(const SBCommandReturnObject &rhs)
 : m_opaque_up() {
   LLDB_RECORD_CONSTRUCTOR(SBCommandReturnObject,
@@ -31,26 +63,10 @@
   m_opaque_up = clone(rhs.m_opaque_up);
 }
 
-SBCommandReturnObject::SBCommandReturnObject(CommandReturnObject *ptr)
-: m_opaque_up(ptr) {
-  LLDB_RECORD_CONSTRUCTOR(SBCommandReturnObject,
-  (lldb_private::CommandReturnObject *), ptr);
-  assert(ptr != nullptr);
-}
-
-SBCommandReturnObject::~SBCommandReturnObject() = default;
-
-CommandReturnObject *SBCommandReturnObject::Release() {
-  LLDB_RECORD_METHOD_NO_ARGS(lldb_private::CommandReturnObject *,
- SBCommandReturnObject, Release);
-
-  return LLDB_RECORD_RESULT(m_opaque_up.release());
-}
-
-const SBCommandReturnObject &SBCommandReturnObject::
+SBCommandReturnObject &SBCommandReturnObject::
 operator=(const SBCommandReturnObject &rhs) {
   LLDB_RECORD_METHOD(
-  const lldb::SBCommandReturnObject &,
+  lldb::SBCommandReturnObject &,
   SBCommandReturnObject, operator=,(const lldb::SBCommandReturnObject &),
   rhs);
 
@@ -59,6 +75,8 @@
   return LLDB_RECORD_RESULT(*this);
 }
 
+SBCommandReturnObject::~SBCommandReturnObject() = default;
+
 bool SBCommandReturnObject::IsValid() const {
   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandReturnObject, IsValid);
   return this->operator bool();
@@ -73,27 +91,27 @@
 const char *SBCommandReturnObject::GetOutput() {
   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBCommandReturnObject, GetOutput);
 
-  ConstString output(m_opaque_up->GetOutputData());
+  ConstString output(ref().GetOutputData());
   return output.AsCString(/*value_if_empty*/ "");
 }
 
 const char *SBCommandReturnObject::GetError() {
   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBCommandReturnObject, GetError);
 
-  ConstString output(m_opaque_up->GetErrorData());
+  ConstString output(ref().GetErrorData());
   return output.AsCString(/*value_if_empty*/ "");
 }
 
 size_t SBCommandReturnObject::GetOutputSize() {
   LLDB_RECORD_METHOD_NO_ARGS(size_t, SBCommandReturnObject, GetOutputSize);
 
-  return m_opaque_up->GetOutputData().size();
+  return ref().GetOutputData().size();
 }
 
 size_t SBCommandReturnObject::GetErrorSize() {
   LLDB_RECORD_METHOD_NO_ARGS(size_t, SBCommandReturnObject, GetErrorSize);
 
-  return m_opaque_up->GetErrorData().size();
+  return ref().GetErrorData().size();
 }
 
 size_t SBCommandReturnObject::PutOutput(FILE *fh) {
@@ -121,65 +139,63 @@
 void SBCommandReturnObject::Clear() {
   LLDB_RECORD_METHOD_NO_ARGS(void, SBCommandReturnObject, Clear);
 
-  m_opaque_up->Clear();
+  ref().Clear();
 }
 
 lldb::ReturnStatus SBCommandReturnObject::GetStatus() {
   LLDB_RECORD_METHOD_NO_ARGS(lldb::ReturnStatus, SBCommandReturnObject,
 

[Lldb-commits] [lldb] r373069 - Fix some swig warnings

2019-09-27 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Sep 27 04:30:16 2019
New Revision: 373069

URL: http://llvm.org/viewvc/llvm-project?rev=373069&view=rev
Log:
Fix some swig warnings

Previously, these were unseen because the wrapper script would swallow
them. This fixes the following types of warnings:
- methods being declared more than once
- swig complained about ignoring operator=, so I just removed it

Modified:
lldb/trunk/scripts/interface/SBBreakpoint.i
lldb/trunk/scripts/interface/SBBreakpointName.i
lldb/trunk/scripts/interface/SBModule.i
lldb/trunk/scripts/interface/SBStructuredData.i
lldb/trunk/scripts/interface/SBThreadPlan.i

Modified: lldb/trunk/scripts/interface/SBBreakpoint.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBBreakpoint.i?rev=373069&r1=373068&r2=373069&view=diff
==
--- lldb/trunk/scripts/interface/SBBreakpoint.i (original)
+++ lldb/trunk/scripts/interface/SBBreakpoint.i Fri Sep 27 04:30:16 2019
@@ -223,12 +223,6 @@ public:
 SBError
 AddLocation(SBAddress &address);
 
-bool
-operator == (const lldb::SBBreakpoint& rhs);
-
-bool
-operator != (const lldb::SBBreakpoint& rhs);
-
 static bool
 EventIsBreakpointEvent (const lldb::SBEvent &event);
 

Modified: lldb/trunk/scripts/interface/SBBreakpointName.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBBreakpointName.i?rev=373069&r1=373068&r2=373069&view=diff
==
--- lldb/trunk/scripts/interface/SBBreakpointName.i (original)
+++ lldb/trunk/scripts/interface/SBBreakpointName.i Fri Sep 27 04:30:16 2019
@@ -34,8 +34,6 @@ public:
 
   ~SBBreakpointName();
 
-  const lldb::SBBreakpointName &operator=(const lldb::SBBreakpointName &rhs);
-
   // Tests to see if the opaque breakpoint object in this object matches the
   // opaque breakpoint object in "rhs".
   bool operator==(const lldb::SBBreakpointName &rhs);

Modified: lldb/trunk/scripts/interface/SBModule.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBModule.i?rev=373069&r1=373068&r2=373069&view=diff
==
--- lldb/trunk/scripts/interface/SBModule.i (original)
+++ lldb/trunk/scripts/interface/SBModule.i Fri Sep 27 04:30:16 2019
@@ -342,12 +342,6 @@ public:
 lldb::SBAddress
 GetObjectFileEntryPointAddress() const;
 
-bool
-operator == (const lldb::SBModule &rhs) const;
-
-bool
-operator != (const lldb::SBModule &rhs) const;
-
 %pythoncode %{
 def __len__(self):
 '''Return the number of symbols in a lldb.SBModule object.'''

Modified: lldb/trunk/scripts/interface/SBStructuredData.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBStructuredData.i?rev=373069&r1=373068&r2=373069&view=diff
==
--- lldb/trunk/scripts/interface/SBStructuredData.i (original)
+++ lldb/trunk/scripts/interface/SBStructuredData.i Fri Sep 27 04:30:16 2019
@@ -33,8 +33,6 @@ namespace lldb {
 void
 Clear();
 
-lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
-
 lldb::StructuredDataType GetType() const;
 
 size_t GetSize() const;

Modified: lldb/trunk/scripts/interface/SBThreadPlan.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBThreadPlan.i?rev=373069&r1=373068&r2=373069&view=diff
==
--- lldb/trunk/scripts/interface/SBThreadPlan.i (original)
+++ lldb/trunk/scripts/interface/SBThreadPlan.i Fri Sep 27 04:30:16 2019
@@ -38,6 +38,9 @@ public:
~SBThreadPlan ();
 
 bool
+IsValid();
+
+bool
 IsValid() const;
 
 explicit operator bool() const;
@@ -89,11 +92,6 @@ public:
 bool
 IsPlanStale();
 
-bool
-IsValid();
-
-explicit operator bool() const;
-
 SBThreadPlan
 QueueThreadPlanForStepOverRange (SBAddress &start_address,
  lldb::addr_t range_size);


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


[Lldb-commits] [lldb] r373071 - Disable the empty string check in TestDataFormatterStdString

2019-09-27 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Sep 27 04:39:27 2019
New Revision: 373071

URL: http://llvm.org/viewvc/llvm-project?rev=373071&view=rev
Log:
Disable the empty string check in TestDataFormatterStdString

This check was failing since it was added in r372837. It should be
possible to re-enable it once D68010 lands.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py?rev=373071&r1=373070&r2=373071&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
 Fri Sep 27 04:39:27 2019
@@ -60,7 +60,8 @@ class StdStringDataFormatterTestCase(Tes
 var_q = self.frame().FindVariable('q')
 var_Q = self.frame().FindVariable('Q')
 
-self.assertTrue(var_wempty.GetSummary() == 'L""', "wempty summary 
wrong")
+# TODO: This is currently broken
+# self.assertTrue(var_wempty.GetSummary() == 'L""', "wempty summary 
wrong")
 self.assertTrue(
 var_s.GetSummary() == 'L"hello world! מזל טוב!"',
 "s summary wrong")


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


[Lldb-commits] [PATCH] D67390: [LLDB][ELF] Load both, .symtab and .dynsym sections

2019-09-27 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added inline comments.



Comment at: lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h:446
+std::size_t h2 = std::hash()(s.st_name_string.AsCString());
+std::size_t h3 = std::hash()(s.st_section_name_string.AsCString());
+return llvm::hash_combine(h1, h2, h3);

I find better to rather define `std::hash` (or provide 
`ConstString::Hasher` which I do in my DWZ patchset).



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2205
+needle.st_section_name_string = 
ConstString(symbol_section_sp->GetName());
+if (unique_elf_symbols.find(needle) == unique_elf_symbols.end()) {
+  symtab->AddSymbol(dc_symbol);

labath wrote:
> something like `if (unique_elf_symbols.insert(needle).second)` would be more 
> efficient, as you don't need to mess with the map twice.
I would unconditionally add all the symbols to `std::vector 
unique_elf_symbols` (with `unique_elf_symbols.reserve` in advance for the sym 
of `.symtab`+`.dynsym` sizes) and then after processing both `.symtab` and 
`.dynsym` and can `llvm::sort(unique_elf_symbols)` and add to `symtab` only 
those which are unique. I believe it will be much faster, one could benchmark 
it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67390



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


[Lldb-commits] [PATCH] D67390: [LLDB][ELF] Load both, .symtab and .dynsym sections

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2205
+needle.st_section_name_string = 
ConstString(symbol_section_sp->GetName());
+if (unique_elf_symbols.find(needle) == unique_elf_symbols.end()) {
+  symtab->AddSymbol(dc_symbol);

jankratochvil wrote:
> labath wrote:
> > something like `if (unique_elf_symbols.insert(needle).second)` would be 
> > more efficient, as you don't need to mess with the map twice.
> I would unconditionally add all the symbols to `std::vector 
> unique_elf_symbols` (with `unique_elf_symbols.reserve` in advance for the sym 
> of `.symtab`+`.dynsym` sizes) and then after processing both `.symtab` and 
> `.dynsym` and can `llvm::sort(unique_elf_symbols)` and add to `symtab` only 
> those which are unique. I believe it will be much faster, one could benchmark 
> it.
sounds like a good idea.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67390



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


[Lldb-commits] [PATCH] D66638: Unwind: Add a stack scanning mechanism to support win32 unwinding

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 222129.
labath added a comment.

Offline, @markmentovai pointed out that crashpad does actually produce the
MemoryInfoList stream, which means there is a fairly large class of use cases
where checking the memory permissions will work correctly. Therefore, I am
updating this code to work with GetLoadAddressPermissions (and adding a
MemoryInfoList stream to the test case), as suggested by @clayborg. I'll create
a separate patch for handling the case of Windows-generated
non-full-memory-dumps which do not include the permissions.


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

https://reviews.llvm.org/D66638

Files:
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/UnwindPlan.h
  lit/SymbolFile/Breakpad/Inputs/unwind-via-raSearch.syms
  lit/SymbolFile/Breakpad/Inputs/unwind-via-stack-win.yaml
  lit/SymbolFile/Breakpad/unwind-via-raSearch.test
  source/Plugins/Process/Utility/RegisterContextLLDB.cpp
  source/Plugins/Process/Utility/RegisterContextLLDB.h
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  source/Symbol/UnwindPlan.cpp

Index: source/Symbol/UnwindPlan.cpp
===
--- source/Symbol/UnwindPlan.cpp
+++ source/Symbol/UnwindPlan.cpp
@@ -170,7 +170,8 @@
   if (m_type == rhs.m_type) {
 switch (m_type) {
 case unspecified:
-  return true;
+case isRaSearch:
+  return m_value.ra_search_offset == rhs.m_value.ra_search_offset;
 
 case isRegisterPlusOffset:
   return m_value.reg.offset == rhs.m_value.reg.offset;
@@ -205,9 +206,12 @@
   llvm::makeArrayRef(m_value.expr.opcodes, m_value.expr.length),
   thread);
 break;
-  default:
+  case unspecified:
 s.PutCString("unspecified");
 break;
+  case isRaSearch:
+s.Printf("RaSearch@SP%+d", m_value.ra_search_offset);
+break;
   }
 }
 
Index: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
===
--- source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
+++ source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
@@ -135,6 +135,8 @@
 
   void AddSymbols(Symtab &symtab) override;
 
+  llvm::Expected GetParameterStackSize(Symbol &symbol) override;
+
   lldb::UnwindPlanSP
   GetUnwindPlan(const Address &address,
 const RegisterInfoResolver &resolver) override;
Index: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -374,6 +374,20 @@
   symtab.CalculateSymbolSizes();
 }
 
+llvm::Expected
+SymbolFileBreakpad::GetParameterStackSize(Symbol &symbol) {
+  ParseUnwindData();
+  if (auto *entry = m_unwind_data->win.FindEntryThatContains(
+  symbol.GetAddress().GetFileAddress())) {
+auto record = StackWinRecord::parse(
+*LineIterator(*m_objfile_sp, Record::StackWin, entry->data));
+assert(record.hasValue());
+return record->ParameterSize;
+  }
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Parameter size unknown.");
+}
+
 static llvm::Optional>
 GetRule(llvm::StringRef &unwind_rules) {
   // Unwind rules are of the form
@@ -585,12 +599,19 @@
 
   // We assume the first value will be the CFA. It is usually called T0, but
   // clang will use T1, if it needs to realign the stack.
-  if (!postfix::ResolveSymbols(it->second, symbol_resolver)) {
-LLDB_LOG(log, "Resolving symbols in `{0}` failed.", record->ProgramString);
-return nullptr;
+  auto *symbol = llvm::dyn_cast(it->second);
+  if (symbol && symbol->GetName() == ".raSearch") {
+row_sp->GetCFAValue().SetRaSearch(record->LocalSize +
+  record->SavedRegisterSize);
+  } else {
+if (!postfix::ResolveSymbols(it->second, symbol_resolver)) {
+  LLDB_LOG(log, "Resolving symbols in `{0}` failed.",
+   record->ProgramString);
+  return nullptr;
+}
+llvm::ArrayRef saved  = SaveAsDWARF(*it->second);
+row_sp->GetCFAValue().SetIsDWARFExpression(saved.data(), saved.size());
   }
-  llvm::ArrayRef saved = SaveAsDWARF(*it->second);
-  row_sp->GetCFAValue().SetIsDWARFExpression(saved.data(), saved.size());
 
   // Replace the node value with InitialValueNode, so that subsequent
   // expressions refer to the CFA value instead of recomputing the whole
Index: source/Plugins/Process/Utility/RegisterContextLLDB.h
===
--- source/Plugins/Process/Utility/RegisterContextLLDB.h
+++ source/Plugins/Process/Utility/RegisterContextLLDB.h
@@ -201,6 +201,8 @@
   bool IsUnwindPlanValidForCurrentPC(lldb::UnwindPlanSP unwind_plan_sp,
  int &valid_pc_

[Lldb-commits] [PATCH] D68130: [lldb] Don't emit artificial constructor declarations as global functions

2019-09-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: aprantl, vsk.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.

When we have a artificial constructor DIE, we currently create from that a 
global function with the name of that class.
That ends up causing a bunch of funny errors such as "must use 'struct' tag to 
refer to type 'Foo' in this scope" when
doing `Foo f`. Also causes that constructing a class via `Foo()` actually just 
calls that global function.

The fix is that when we have an artificial method decl, we always treat it as 
handled even if we don't create a CXXMethodDecl
for it (which we never do for artificial methods at the moment).

Fixes rdar://55757491 and probably some other radars.

Note that on non-macOS systems, calling functions etc. on temporary constructed 
objects like `Foo()` doesn't seem to work,
so that's why that one test only runs on Darwin. The generic test works on all 
platforms, so we still test this patch there.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68130

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
  
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
  
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1398,8 +1398,11 @@
   is_attr_used, attrs.is_artificial);
 
   type_handled = cxx_method_decl != NULL;
+  // Artificial methods are always handled even when don't
+  // create a new declaration for them.
+  type_handled |= attrs.is_artificial;
 
-  if (type_handled) {
+  if (cxx_method_decl) {
 LinkDeclContextToDIE(
 ClangASTContext::GetAsDeclContext(cxx_method_decl),
 die);
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
@@ -0,0 +1,8 @@
+struct Foo {
+  virtual ~Foo() = default;
+};
+
+int main() {
+  Foo f;
+  return 0; //%self.expect("expr Foo()", substrs=["(Foo) $0 = {}"])
+}
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), None)
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
@@ -11,6 +11,7 @@
 
 int main() {
   Base realbase;
+  realbase.foo();
   Derived d;
   Base *b = &d;
   return 0; // Set breakpoint here
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
@@ -49,3 +49,19 @@
 
 # Test calling the base class.
 self.expect("expr realbase.foo()", substrs=["1"])
+
+
+@skipUnlessDarwin
+def test_calling_temporaries(self):
+"""Test calls to overridden methods on locals"""
+self.build()
+
+# Set breakpoint in main and run exe
+self.runCmd("file " + self.getBuildArtifact("a.out"),
+CURRENT_EXECUTABLE_SET)
+lldbutil.run_break_set_by_file_and_line(
+self, "main.cpp", self.line, num_expected_locations=-1, 
loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+self.expect("expr Base().foo()", substrs=["1"])
+self.expect("expr Derived().foo()", substrs=["2"])


[Lldb-commits] [lldb] r373073 - [lldb/cmake] add lldbCore -> clangDriver dependency

2019-09-27 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Sep 27 05:10:12 2019
New Revision: 373073

URL: http://llvm.org/viewvc/llvm-project?rev=373073&view=rev
Log:
[lldb/cmake] add lldbCore -> clangDriver dependency

ModuleList.cpp includes clang/Driver/Driver.h. Reflect that in the build
system. Not having this can cause build failures if ModuleList.cpp is
built before Driver.inc is generated.

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

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=373073&r1=373072&r2=373073&view=diff
==
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Fri Sep 27 05:10:12 2019
@@ -67,6 +67,7 @@ add_lldb_library(lldbCore
 
   LINK_LIBS
 clangAST
+clangDriver
 lldbBreakpoint
 lldbDataFormatters
 lldbExpression


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


[Lldb-commits] [lldb] r373072 - Unwind: Add a stack scanning mechanism to support win32 unwinding

2019-09-27 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Sep 27 05:10:06 2019
New Revision: 373072

URL: http://llvm.org/viewvc/llvm-project?rev=373072&view=rev
Log:
Unwind: Add a stack scanning mechanism to support win32 unwinding

Summary:
Windows unwinding is weird. The unwind rules do not (always) describe
the precise layout of the stack, but rather expect the debugger to scan
the stack for something which looks like a plausible return address, and
the unwind based on that. The reason this works somewhat reliably is
because the the unwinder also has access to the frame sizes of the
functions on the stack. This allows it (in most cases) to skip function
pointers in local variables or function arguments, which could otherwise
be mistaken for return addresses.

Implementing this kind of unwind mechanism in lldb was a bit challenging
because we expect to be able to statically describe (in the UnwindPlan)
structure, the layout of the stack for any given instruction. Giving a
precise desription of this is not possible, because it requires
correlating information from two functions -- the pushed arguments to a
function are considered a part of the callers stack frame, and their
size needs to be considered when unwinding the caller, but they are only
present in the unwind entry of the callee. The callee may end up being
in a completely different module, or it may not even be possible to
determine it statically (indirect calls).

This patch implements this functionality by introducing a couple of new
APIs:
SymbolFile::GetParameterStackSize - return the amount of stack space
  taken up by parameters of this function.
SymbolFile::GetOwnFrameSize - the size of this function's frame. This
  excludes the parameters, but includes stuff like local variables and
  spilled registers.

These functions are then used by the unwinder to compute the estimated
location of the return address. This address is not always exact,
because the stack may contain some additional values -- for instance, if
we're getting ready to call a function then the stack will also contain
partially set up arguments, but we will not know their size because we
haven't called the function yet. For this reason the unwinder will crawl
up the stack from the return address position, and look for something
that looks like a possible return address. Currently, we assume that
something is a valid return address if it ends up pointing to an
executable section.

All of this logic kicks in when the UnwindPlan sets the value of CFA as
"isHeuristicallyDetected", which is also the final new API here. Right
now, only SymbolFileBreakpad implements these APIs, but in the future
SymbolFilePDB will use them too.

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

Added:
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/unwind-via-raSearch.syms
lldb/trunk/lit/SymbolFile/Breakpad/unwind-via-raSearch.test
Modified:
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/UnwindPlan.h
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/unwind-via-stack-win.yaml
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/trunk/source/Symbol/UnwindPlan.cpp

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=373072&r1=373071&r2=373072&view=diff
==
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Fri Sep 27 05:10:06 2019
@@ -19,8 +19,8 @@
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/TypeSystem.h"
 #include "lldb/lldb-private.h"
-
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/Support/Errc.h"
 
 #include 
 
@@ -245,6 +245,13 @@ public:
 return nullptr;
   }
 
+  /// Return the number of stack bytes taken up by the parameters to this
+  /// function.
+  virtual llvm::Expected GetParameterStackSize(Symbol &symbol) {
+return llvm::createStringError(make_error_code(llvm::errc::not_supported),
+   "Operation not supported.");
+  }
+
   virtual void Dump(Stream &s);
 
 protected:

Modified: lldb/trunk/include/lldb/Symbol/UnwindPlan.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindPlan.h?rev=373072&r1=373071&r2=373072&view=diff
==
--- lldb/trunk/include/lldb/Symbol/UnwindPlan.h (original)
+++ lldb/trunk/include/lldb/Symbol/UnwindPlan.h Fri Sep 27 05:10:06 2019
@@ -201,7 +201,8 @@ public:
 unspecified,// not specified
 isRegisterPlusOffset,   // FA = register + offset
 isRegisterDereferenced, // FA = [reg]
-isDWARFExpression   // FA = e

[Lldb-commits] [PATCH] D66638: Unwind: Add a stack scanning mechanism to support win32 unwinding

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL373072: Unwind: Add a stack scanning mechanism to support 
win32 unwinding (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66638

Files:
  lldb/trunk/include/lldb/Symbol/SymbolFile.h
  lldb/trunk/include/lldb/Symbol/UnwindPlan.h
  lldb/trunk/lit/SymbolFile/Breakpad/Inputs/unwind-via-raSearch.syms
  lldb/trunk/lit/SymbolFile/Breakpad/Inputs/unwind-via-stack-win.yaml
  lldb/trunk/lit/SymbolFile/Breakpad/unwind-via-raSearch.test
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/trunk/source/Symbol/UnwindPlan.cpp

Index: lldb/trunk/source/Symbol/UnwindPlan.cpp
===
--- lldb/trunk/source/Symbol/UnwindPlan.cpp
+++ lldb/trunk/source/Symbol/UnwindPlan.cpp
@@ -170,7 +170,8 @@
   if (m_type == rhs.m_type) {
 switch (m_type) {
 case unspecified:
-  return true;
+case isRaSearch:
+  return m_value.ra_search_offset == rhs.m_value.ra_search_offset;
 
 case isRegisterPlusOffset:
   return m_value.reg.offset == rhs.m_value.reg.offset;
@@ -205,9 +206,12 @@
   llvm::makeArrayRef(m_value.expr.opcodes, m_value.expr.length),
   thread);
 break;
-  default:
+  case unspecified:
 s.PutCString("unspecified");
 break;
+  case isRaSearch:
+s.Printf("RaSearch@SP%+d", m_value.ra_search_offset);
+break;
   }
 }
 
Index: lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
===
--- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
+++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
@@ -135,6 +135,8 @@
 
   void AddSymbols(Symtab &symtab) override;
 
+  llvm::Expected GetParameterStackSize(Symbol &symbol) override;
+
   lldb::UnwindPlanSP
   GetUnwindPlan(const Address &address,
 const RegisterInfoResolver &resolver) override;
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
@@ -374,6 +374,20 @@
   symtab.CalculateSymbolSizes();
 }
 
+llvm::Expected
+SymbolFileBreakpad::GetParameterStackSize(Symbol &symbol) {
+  ParseUnwindData();
+  if (auto *entry = m_unwind_data->win.FindEntryThatContains(
+  symbol.GetAddress().GetFileAddress())) {
+auto record = StackWinRecord::parse(
+*LineIterator(*m_objfile_sp, Record::StackWin, entry->data));
+assert(record.hasValue());
+return record->ParameterSize;
+  }
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Parameter size unknown.");
+}
+
 static llvm::Optional>
 GetRule(llvm::StringRef &unwind_rules) {
   // Unwind rules are of the form
@@ -585,12 +599,19 @@
 
   // We assume the first value will be the CFA. It is usually called T0, but
   // clang will use T1, if it needs to realign the stack.
-  if (!postfix::ResolveSymbols(it->second, symbol_resolver)) {
-LLDB_LOG(log, "Resolving symbols in `{0}` failed.", record->ProgramString);
-return nullptr;
+  auto *symbol = llvm::dyn_cast(it->second);
+  if (symbol && symbol->GetName() == ".raSearch") {
+row_sp->GetCFAValue().SetRaSearch(record->LocalSize +
+  record->SavedRegisterSize);
+  } else {
+if (!postfix::ResolveSymbols(it->second, symbol_resolver)) {
+  LLDB_LOG(log, "Resolving symbols in `{0}` failed.",
+   record->ProgramString);
+  return nullptr;
+}
+llvm::ArrayRef saved  = SaveAsDWARF(*it->second);
+row_sp->GetCFAValue().SetIsDWARFExpression(saved.data(), saved.size());
   }
-  llvm::ArrayRef saved = SaveAsDWARF(*it->second);
-  row_sp->GetCFAValue().SetIsDWARFExpression(saved.data(), saved.size());
 
   // Replace the node value with InitialValueNode, so that subsequent
   // expressions refer to the CFA value instead of recomputing the whole
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
@@ -201,6 +201,8 @@
   bool IsUnwindPlanValidForCurrentPC(lldb::UnwindPlanSP unwind_plan_sp,
  int &valid_pc_offset);
 
+  lldb::addr_t Get

[Lldb-commits] [PATCH] D68130: [lldb] Don't emit artificial constructor declarations as global functions

2019-09-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 222140.
teemperor edited the summary of this revision.
teemperor added a comment.

- Enabled test on Linux. That's only failing on my box (Thanks Pavel)


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

https://reviews.llvm.org/D68130

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
  
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
  
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1398,8 +1398,11 @@
   is_attr_used, attrs.is_artificial);
 
   type_handled = cxx_method_decl != NULL;
+  // Artificial methods are always handled even when don't
+  // create a new declaration for them.
+  type_handled |= attrs.is_artificial;
 
-  if (type_handled) {
+  if (cxx_method_decl) {
 LinkDeclContextToDIE(
 ClangASTContext::GetAsDeclContext(cxx_method_decl),
 die);
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
@@ -0,0 +1,8 @@
+struct Foo {
+  virtual ~Foo() = default;
+};
+
+int main() {
+  Foo f;
+  return 0; //%self.expect("expr Foo()", substrs=["(Foo) $0 = {}"])
+}
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), None)
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
@@ -11,6 +11,7 @@
 
 int main() {
   Base realbase;
+  realbase.foo();
   Derived d;
   Base *b = &d;
   return 0; // Set breakpoint here
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
@@ -49,3 +49,7 @@
 
 # Test calling the base class.
 self.expect("expr realbase.foo()", substrs=["1"])
+
+# Test with locally constructed instances.
+self.expect("expr Base().foo()", substrs=["1"])
+self.expect("expr Derived().foo()", substrs=["2"])


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1398,8 +1398,11 @@
   is_attr_used, attrs.is_artificial);
 
   type_handled = cxx_method_decl != NULL;
+  // Artificial methods are always handled even when don't
+  // create a new declaration for them.
+  type_handled |= attrs.is_artificial;
 
-  if (type_handled) {
+  if (cxx_method_decl) {
 LinkDeclContextToDIE(
 ClangASTContext::GetAsDeclContext(cxx_method_decl),
 die);
Index: lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
@@ -0,0 +1,8 @@
+struct Foo {
+  virtual ~Fo

[Lldb-commits] [PATCH] D68134: [LLDB] Use the llvm microsoft demangler instead of the windows dbghelp api

2019-09-27 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: labath, amccarth, rnk, compnerd.
Herald added subscribers: JDevlieghere, erik.pilkington.
Herald added a project: LLDB.

I'm unsure if there's any lldb testcase which exercise this directly (I didn't 
find any); such testcases could be made available for all platforms now.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68134

Files:
  lldb/source/Core/Mangled.cpp


Index: lldb/source/Core/Mangled.cpp
===
--- lldb/source/Core/Mangled.cpp
+++ lldb/source/Core/Mangled.cpp
@@ -10,9 +10,6 @@
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/windows.h"
-
-#include 
-#pragma comment(lib, "dbghelp.lib")
 #endif
 
 #include "lldb/Core/RichManglingContext.h"
@@ -39,25 +36,6 @@
 #include 
 using namespace lldb_private;
 
-#if defined(_MSC_VER) // TODO: Use this if linking to dbghelp
-static DWORD safeUndecorateName(const char *Mangled, char *Demangled,
-DWORD DemangledLength) {
-  static std::mutex M;
-  std::lock_guard Lock(M);
-  return ::UnDecorateSymbolName(
-  Mangled, Demangled, DemangledLength,
-  UNDNAME_NO_ACCESS_SPECIFIERS |   // Strip public, private, protected
-   // keywords
-  UNDNAME_NO_ALLOCATION_LANGUAGE | // Strip __thiscall, __stdcall,
-   // etc keywords
-  UNDNAME_NO_THROW_SIGNATURES |// Strip throw() specifications
-  UNDNAME_NO_MEMBER_TYPE | // Strip virtual, static, etc
-   // specifiers
-  UNDNAME_NO_MS_KEYWORDS   // Strip all MS extension keywords
-  );
-}
-#endif
-
 static inline Mangled::ManglingScheme cstring_mangling_scheme(const char *s) {
   if (s) {
 if (s[0] == '?')
@@ -218,28 +196,16 @@
 
 // Local helpers for different demangling implementations.
 static char *GetMSVCDemangledStr(const char *M) {
-#if defined(_MSC_VER)
-  const size_t demangled_length = 2048;
-  char *demangled_cstr = static_cast(::malloc(demangled_length));
-  ::ZeroMemory(demangled_cstr, demangled_length);
-  DWORD result = safeUndecorateName(M, demangled_cstr, demangled_length);
+  char *demangled_cstr = llvm::microsoftDemangle(M, nullptr, nullptr, nullptr);
 
   if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) 
{
 if (demangled_cstr && demangled_cstr[0])
   LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr);
 else
-  LLDB_LOGF(log, "demangled msvc: %s -> error: 0x%lu", M, result);
+  LLDB_LOGF(log, "demangled msvc: %s -> error", M);
   }
 
-  if (result != 0) {
-return demangled_cstr;
-  } else {
-::free(demangled_cstr);
-return nullptr;
-  }
-#else
-  return nullptr;
-#endif
+  return demangled_cstr;
 }
 
 static char *GetItaniumDemangledStr(const char *M) {


Index: lldb/source/Core/Mangled.cpp
===
--- lldb/source/Core/Mangled.cpp
+++ lldb/source/Core/Mangled.cpp
@@ -10,9 +10,6 @@
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/windows.h"
-
-#include 
-#pragma comment(lib, "dbghelp.lib")
 #endif
 
 #include "lldb/Core/RichManglingContext.h"
@@ -39,25 +36,6 @@
 #include 
 using namespace lldb_private;
 
-#if defined(_MSC_VER) // TODO: Use this if linking to dbghelp
-static DWORD safeUndecorateName(const char *Mangled, char *Demangled,
-DWORD DemangledLength) {
-  static std::mutex M;
-  std::lock_guard Lock(M);
-  return ::UnDecorateSymbolName(
-  Mangled, Demangled, DemangledLength,
-  UNDNAME_NO_ACCESS_SPECIFIERS |   // Strip public, private, protected
-   // keywords
-  UNDNAME_NO_ALLOCATION_LANGUAGE | // Strip __thiscall, __stdcall,
-   // etc keywords
-  UNDNAME_NO_THROW_SIGNATURES |// Strip throw() specifications
-  UNDNAME_NO_MEMBER_TYPE | // Strip virtual, static, etc
-   // specifiers
-  UNDNAME_NO_MS_KEYWORDS   // Strip all MS extension keywords
-  );
-}
-#endif
-
 static inline Mangled::ManglingScheme cstring_mangling_scheme(const char *s) {
   if (s) {
 if (s[0] == '?')
@@ -218,28 +196,16 @@
 
 // Local helpers for different demangling implementations.
 static char *GetMSVCDemangledStr(const char *M) {
-#if defined(_MSC_VER)
-  const size_t demangled_length = 2048;
-  char *demangled_cstr = static_cast(::malloc(demangled_length));
-  ::ZeroMemory(demangled_cstr, demangled_length);
-  DWORD result = safeUndecorateName(M, demangled_cstr, demangled_length);
+  char *demangled_cstr = llvm::microsoftDemangle(M, nullptr, nullptr, nullptr);
 
   if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) {
 if (demangled_cstr && demangled_cstr[0])
   LLDB_LOGF(log, "demang

[Lldb-commits] [PATCH] D68134: [LLDB] Use the llvm microsoft demangler instead of the windows dbghelp api

2019-09-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

yay


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D68134



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


[Lldb-commits] [PATCH] D68130: [lldb] Don't emit artificial constructor declarations as global functions

2019-09-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 222162.
teemperor added a comment.

- Document dedicated test a bit better.


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

https://reviews.llvm.org/D68130

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
  
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
  
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1398,8 +1398,11 @@
   is_attr_used, attrs.is_artificial);
 
   type_handled = cxx_method_decl != NULL;
+  // Artificial methods are always handled even when don't
+  // create a new declaration for them.
+  type_handled |= attrs.is_artificial;
 
-  if (type_handled) {
+  if (cxx_method_decl) {
 LinkDeclContextToDIE(
 ClangASTContext::GetAsDeclContext(cxx_method_decl),
 die);
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
@@ -0,0 +1,10 @@
+struct Foo {
+  // Triggers that we emit an artificial constructor for Foo.
+  virtual ~Foo() = default;
+};
+
+int main() {
+  Foo f;
+  // Try to construct foo in our expression.
+  return 0; //%self.expect("expr Foo()", substrs=["(Foo) $0 = {}"])
+}
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/TestIgnoreArtificialConstructors.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), None)
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
@@ -11,6 +11,7 @@
 
 int main() {
   Base realbase;
+  realbase.foo();
   Derived d;
   Base *b = &d;
   return 0; // Set breakpoint here
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
@@ -49,3 +49,7 @@
 
 # Test calling the base class.
 self.expect("expr realbase.foo()", substrs=["1"])
+
+# Test with locally constructed instances.
+self.expect("expr Base().foo()", substrs=["1"])
+self.expect("expr Derived().foo()", substrs=["2"])


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1398,8 +1398,11 @@
   is_attr_used, attrs.is_artificial);
 
   type_handled = cxx_method_decl != NULL;
+  // Artificial methods are always handled even when don't
+  // create a new declaration for them.
+  type_handled |= attrs.is_artificial;
 
-  if (type_handled) {
+  if (cxx_method_decl) {
 LinkDeclContextToDIE(
 ClangASTContext::GetAsDeclContext(cxx_method_decl),
 die);
Index: lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/commands/expression/ignore-artificial-constructors/main.cpp
@@ -0,0 +1,

[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 222165.
lawrence_danna added a comment.

clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Host/File.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanTracer.cpp

Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -46,7 +46,7 @@
   else {
 TargetSP target_sp(m_thread.CalculateTarget());
 if (target_sp)
-  return target_sp->GetDebugger().GetOutputFile().get();
+  return &(target_sp->GetDebugger().GetOutputStream());
   }
   return nullptr;
 }
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1358,15 +1358,15 @@
   if (module_sp && !module_sp->LoadScriptingResourceInTarget(
target, error, &feedback_stream)) {
 if (error.AsCString())
-  target->GetDebugger().GetErrorFile()->Printf(
+  target->GetDebugger().GetErrorStream().Printf(
   "unable to load scripting data for module %s - error reported was "
   "%s\n",
   module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
   error.AsCString());
   }
   if (feedback_stream.GetSize())
-target->GetDebugger().GetErrorFile()->Printf("%s\n",
- feedback_stream.GetData());
+target->GetDebugger().GetErrorStream().Printf("%s\n",
+  feedback_stream.GetData());
 }
 
 void Target::ClearModules(bool delete_locations) {
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1649,7 +1649,7 @@
   Address symbol_address = symbol->GetAddress();
   load_addr = ResolveIndirectFunction(&symbol_address, error);
   if (!error.Success() && show_error) {
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to resolve indirect function at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 symbol->GetLoadAddress(&GetTarget()),
@@ -1688,7 +1688,7 @@
 } else {
   if (show_error || use_hardware) {
 // Report error for setting breakpoint...
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to set breakpoint site at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 load_addr, owner->GetBreakpoint().GetID(), owner->GetID(),
@@ -4300,9 +4300,9 @@
   : IOHandler(process->GetTarget().GetDebugger(),
   IOHandler::Type::ProcessIO),
 m_process(process),
+m_read_file(GetInputFD(), File::eOpenOptionRead, false),
 m_write_file(write_fd, File::eOpenOptionWrite, false) {
 m_pipe.CreateNew(false);
-m_read_file.SetDescriptor(GetInputFD(), File::eOpenOptionRead, false);
   }
 
   ~IOHandlerProcessSTDIO() override = default;
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1226,8 +1226,8 @@
   if (fs::is_symlink_file(source.GetPath()))
 source_open_options |= File::eOpenOptionDontF

[Lldb-commits] [PATCH] D68140: [lldb][clang][modern-type-lookup] Use ASTImporterSharedState in ExternalASTMerger

2019-09-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: martong, shafik.
Herald added subscribers: lldb-commits, JDevlieghere, christof, rnkovacs.
Herald added a reviewer: a.sidorin.
Herald added a project: LLDB.
teemperor added a comment.

Just putting this up as I don't want to merge that before the weekend. Patch 
itself is obvious.


The ExternalASTMerger should use the ASTImporterSharedState. This allows it to
handle std::pair in LLDB (but the rest of libc++ is still work in progress).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68140

Files:
  clang/include/clang/AST/ExternalASTMerger.h
  clang/lib/AST/ExternalASTMerger.cpp
  
lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/TestLibCxxModernTypeLookup.py
  
lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/main.cpp

Index: lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/main.cpp
@@ -0,0 +1,6 @@
+#include 
+
+int main(int argc, char **argv) {
+  std::pair pair = std::make_pair(1, 2L);
+  return pair.first; // Set break point at this line.
+}
Index: lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/TestLibCxxModernTypeLookup.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/TestLibCxxModernTypeLookup.py
@@ -0,0 +1,19 @@
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class LibcxxModernTypeLookup(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+self.build()
+
+# Activate modern-type-lookup.
+self.runCmd("settings set target.experimental.use-modern-type-lookup true")
+
+lldbutil.run_to_source_breakpoint(self,
+"// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+
+# Test a few simple expressions that should still work with modern-type-lookup.
+self.expect("expr pair", substrs=["(std::", "pair SharedState)
   : ASTImporter(ToContext, ToFileManager, FromContext, FromFileManager,
-/*MinimalImport=*/true),
+/*MinimalImport=*/true, SharedState),
 Parent(_Parent), Reverse(FromContext, FromFileManager, ToContext,
- ToFileManager, /*MinimalImport=*/true), FromOrigins(_FromOrigins) {}
+ ToFileManager, /*MinimalImport=*/true),
+FromOrigins(_FromOrigins) {}
 
   /// Whenever a DeclContext is imported, ensure that ExternalASTSource's origin
   /// map is kept up to date.  Also set the appropriate flags.
@@ -314,6 +316,8 @@
 
 ExternalASTMerger::ExternalASTMerger(const ImporterTarget &Target,
  llvm::ArrayRef Sources) : LogStream(&llvm::nulls()), Target(Target) {
+  SharedState = std::make_shared(
+  *Target.AST.getTranslationUnitDecl());
   AddSources(Sources);
 }
 
@@ -321,7 +325,7 @@
   for (const ImporterSource &S : Sources) {
 assert(&S.AST != &Target.AST);
 Importers.push_back(std::make_unique(
-*this, Target.AST, Target.FM, S.AST, S.FM, S.OM));
+*this, Target.AST, Target.FM, S.AST, S.FM, S.OM, SharedState));
   }
 }
 
Index: clang/include/clang/AST/ExternalASTMerger.h
===
--- clang/include/clang/AST/ExternalASTMerger.h
+++ clang/include/clang/AST/ExternalASTMerger.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_AST_EXTERNALASTMERGER_H
 
 #include "clang/AST/ASTImporter.h"
+#include "clang/AST/ASTImporterSharedState.h"
 #include "clang/AST/ExternalASTSource.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -88,6 +89,7 @@
 private:
   /// The target for this ExtenralASTMerger.
   ImporterTarget Target;
+  std::shared_ptr SharedState;
 
 public:
   ExternalASTMerger(const ImporterTarget &Target,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 222168.
lawrence_danna marked 3 inline comments as done.
lawrence_danna added a comment.

style fixes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Host/File.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanTracer.cpp

Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -46,7 +46,7 @@
   else {
 TargetSP target_sp(m_thread.CalculateTarget());
 if (target_sp)
-  return target_sp->GetDebugger().GetOutputFile().get();
+  return &(target_sp->GetDebugger().GetOutputStream());
   }
   return nullptr;
 }
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1358,15 +1358,15 @@
   if (module_sp && !module_sp->LoadScriptingResourceInTarget(
target, error, &feedback_stream)) {
 if (error.AsCString())
-  target->GetDebugger().GetErrorFile()->Printf(
+  target->GetDebugger().GetErrorStream().Printf(
   "unable to load scripting data for module %s - error reported was "
   "%s\n",
   module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
   error.AsCString());
   }
   if (feedback_stream.GetSize())
-target->GetDebugger().GetErrorFile()->Printf("%s\n",
- feedback_stream.GetData());
+target->GetDebugger().GetErrorStream().Printf("%s\n",
+  feedback_stream.GetData());
 }
 
 void Target::ClearModules(bool delete_locations) {
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1649,7 +1649,7 @@
   Address symbol_address = symbol->GetAddress();
   load_addr = ResolveIndirectFunction(&symbol_address, error);
   if (!error.Success() && show_error) {
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to resolve indirect function at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 symbol->GetLoadAddress(&GetTarget()),
@@ -1688,7 +1688,7 @@
 } else {
   if (show_error || use_hardware) {
 // Report error for setting breakpoint...
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to set breakpoint site at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 load_addr, owner->GetBreakpoint().GetID(), owner->GetID(),
@@ -4300,9 +4300,9 @@
   : IOHandler(process->GetTarget().GetDebugger(),
   IOHandler::Type::ProcessIO),
 m_process(process),
+m_read_file(GetInputFD(), File::eOpenOptionRead, false),
 m_write_file(write_fd, File::eOpenOptionWrite, false) {
 m_pipe.CreateNew(false);
-m_read_file.SetDescriptor(GetInputFD(), File::eOpenOptionRead, false);
   }
 
   ~IOHandlerProcessSTDIO() override = default;
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1226,8 +1226,8 @@
   if (fs::is_symlink_file(source.GetPath()))
 

[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna added a comment.

fixed style issues


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891



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


[Lldb-commits] [PATCH] D68140: [lldb][clang][modern-type-lookup] Use ASTImporterSharedState in ExternalASTMerger

2019-09-27 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Just putting this up as I don't want to merge that before the weekend. Patch 
itself is obvious.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D68140



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


[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 222170.
lawrence_danna added a comment.

updated commit message


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Host/File.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanTracer.cpp

Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -46,7 +46,7 @@
   else {
 TargetSP target_sp(m_thread.CalculateTarget());
 if (target_sp)
-  return target_sp->GetDebugger().GetOutputFile().get();
+  return &(target_sp->GetDebugger().GetOutputStream());
   }
   return nullptr;
 }
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1358,15 +1358,15 @@
   if (module_sp && !module_sp->LoadScriptingResourceInTarget(
target, error, &feedback_stream)) {
 if (error.AsCString())
-  target->GetDebugger().GetErrorFile()->Printf(
+  target->GetDebugger().GetErrorStream().Printf(
   "unable to load scripting data for module %s - error reported was "
   "%s\n",
   module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
   error.AsCString());
   }
   if (feedback_stream.GetSize())
-target->GetDebugger().GetErrorFile()->Printf("%s\n",
- feedback_stream.GetData());
+target->GetDebugger().GetErrorStream().Printf("%s\n",
+  feedback_stream.GetData());
 }
 
 void Target::ClearModules(bool delete_locations) {
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1649,7 +1649,7 @@
   Address symbol_address = symbol->GetAddress();
   load_addr = ResolveIndirectFunction(&symbol_address, error);
   if (!error.Success() && show_error) {
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to resolve indirect function at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 symbol->GetLoadAddress(&GetTarget()),
@@ -1688,7 +1688,7 @@
 } else {
   if (show_error || use_hardware) {
 // Report error for setting breakpoint...
-GetTarget().GetDebugger().GetErrorFile()->Printf(
+GetTarget().GetDebugger().GetErrorStream().Printf(
 "warning: failed to set breakpoint site at 0x%" PRIx64
 " for breakpoint %i.%i: %s\n",
 load_addr, owner->GetBreakpoint().GetID(), owner->GetID(),
@@ -4300,9 +4300,9 @@
   : IOHandler(process->GetTarget().GetDebugger(),
   IOHandler::Type::ProcessIO),
 m_process(process),
+m_read_file(GetInputFD(), File::eOpenOptionRead, false),
 m_write_file(write_fd, File::eOpenOptionWrite, false) {
 m_pipe.CreateNew(false);
-m_read_file.SetDescriptor(GetInputFD(), File::eOpenOptionRead, false);
   }
 
   ~IOHandlerProcessSTDIO() override = default;
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1226,8 +1226,8 @@
   if (fs::is_symlink_file(source.GetPath()))
 source_open_options |= File::eOpenO

[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL373090: remove File::SetStream(), make new files instead. 
(authored by lawrence_danna, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67891?vs=222170&id=222172#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67891

Files:
  lldb/trunk/include/lldb/Core/Debugger.h
  lldb/trunk/include/lldb/Core/IOHandler.h
  lldb/trunk/include/lldb/Host/File.h
  lldb/trunk/source/API/SBDebugger.cpp
  lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/trunk/source/Commands/CommandObjectCommands.cpp
  lldb/trunk/source/Commands/CommandObjectExpression.cpp
  lldb/trunk/source/Commands/CommandObjectGUI.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Commands/CommandObjectType.cpp
  lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/trunk/source/Core/Debugger.cpp
  lldb/trunk/source/Core/IOHandler.cpp
  lldb/trunk/source/Expression/REPL.cpp
  lldb/trunk/source/Host/common/File.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/trunk/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/trunk/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/trunk/source/Target/Platform.cpp
  lldb/trunk/source/Target/Process.cpp
  lldb/trunk/source/Target/Target.cpp
  lldb/trunk/source/Target/ThreadPlanTracer.cpp

Index: lldb/trunk/include/lldb/Host/File.h
===
--- lldb/trunk/include/lldb/Host/File.h
+++ lldb/trunk/include/lldb/Host/File.h
@@ -125,12 +125,8 @@
 
   WaitableHandle GetWaitableHandle() override;
 
-  void SetDescriptor(int fd, uint32_t options, bool transfer_ownership);
-
   FILE *GetStream();
 
-  void SetStream(FILE *fh, bool transfer_ownership);
-
   /// Read bytes from a file from the current file position.
   ///
   /// NOTE: This function is NOT thread safe. Use the read function
Index: lldb/trunk/include/lldb/Core/IOHandler.h
===
--- lldb/trunk/include/lldb/Core/IOHandler.h
+++ lldb/trunk/include/lldb/Core/IOHandler.h
@@ -58,8 +58,7 @@
   IOHandler(Debugger &debugger, IOHandler::Type type);
 
   IOHandler(Debugger &debugger, IOHandler::Type type,
-const lldb::StreamFileSP &input_sp,
-const lldb::StreamFileSP &output_sp,
+const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp,
 const lldb::StreamFileSP &error_sp, uint32_t flags,
 repro::DataRecorder *data_recorder);
 
@@ -123,11 +122,11 @@
 
   FILE *GetErrorFILE();
 
-  lldb::StreamFileSP &GetInputStreamFile();
+  lldb::FileSP &GetInputFileSP();
 
-  lldb::StreamFileSP &GetOutputStreamFile();
+  lldb::StreamFileSP &GetOutputStreamFileSP();
 
-  lldb::StreamFileSP &GetErrorStreamFile();
+  lldb::StreamFileSP &GetErrorStreamFileSP();
 
   Debugger &GetDebugger() { return m_debugger; }
 
@@ -165,7 +164,7 @@
 
 protected:
   Debugger &m_debugger;
-  lldb::StreamFileSP m_input_sp;
+  lldb::FileSP m_input_sp;
   lldb::StreamFileSP m_output_sp;
   lldb::StreamFileSP m_error_sp;
   repro::DataRecorder *m_data_recorder;
@@ -333,7 +332,7 @@
 repro::DataRecorder *data_recorder);
 
   IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
-const lldb::StreamFileSP &input_sp,
+const lldb::FileSP &input_sp,
 const lldb::StreamFileSP &output_sp,
 const lldb::StreamFileSP &error_sp, uint32_t flags,
 const char *editline_name, // Used for saving history files
@@ -349,7 +348,7 @@
 const char *, bool, bool, uint32_t,
 IOHandlerDelegate &) = delete;
 
-  IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &,
+  IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &,
 const lldb::StreamFileSP &, const lldb::StreamFileSP &,
 uint32_t, const char *, const char *, const char *, bool,
 bool, uint32_t, IOHandlerDelegate &) = delete;
Index: lldb/trunk/include/lldb/Core/Debugger.h
===
--- lldb/trunk/include/lldb/Core/Debugger.h
+++ lldb/trunk/inclu

[Lldb-commits] [PATCH] D68096: Add Linux signal support to ProcessMinidump

2019-09-27 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet marked an inline comment as done.
JosephTremoulet added a comment.

> Fortunately, for the functionality you're testing, I don't think you really 
> need the executable file, so you can just ignore the elf bit and test with a 
> plain `lldb -c foo.dmp` (obviously, you won't get the backtrace that way, but 
> you don't really need that here.

Ah, yeah, good point.

> here it looks like you actually want to test the case where the exception 
> stream is not present (?)

If I'm reading things correctly, the exception stream is there and we get a 
non-null exception record, which has a tid, but its code and flags are both 
zero.
This makes me realize that the title I've put here is very misleading, I'll fix 
that when I update the patch.

> If you can send me the minidump you have generated I can try to play around 
> with it to see if I can make a reasonable yaml out of it.

Thanks!  Will send.




Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:219-237
+
+  if (arch.GetTriple().isOSLinux()) {
+
+SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
+if (!m_thread_list.empty() &&
+(!m_active_exception ||

labath wrote:
> Would it be possible to move this code (except maybe the SetUnixSignals bit) 
> into the `RefreshStateAfterStop` function? Would be less confusing and it 
> would avoid the need for extra member variables...
Yeah, happy to.  I wasn't sure what the implications of doing so would be, but 
I guess for a dump file there will only ever be one stop?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68096



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


[Lldb-commits] [PATCH] D67793: new api class: SBFile

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 222190.
lawrence_danna edited the summary of this revision.
lawrence_danna added a comment.

rebased, and converted Set* methods into constructors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67793

Files:
  lldb/include/lldb/API/LLDB.h
  lldb/include/lldb/API/SBDefines.h
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBFile.h
  lldb/include/lldb/Host/File.h
  lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py
  lldb/scripts/interface/SBFile.i
  lldb/scripts/lldb.swig
  lldb/source/API/CMakeLists.txt
  lldb/source/API/SBFile.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -466,8 +466,6 @@
   void Reset(PyRefType type, PyObject *py_obj) override;
   void Reset(File &file, const char *mode);
 
-  static uint32_t GetOptionsFromMode(llvm::StringRef mode);
-
   lldb::FileUP GetUnderlyingFile() const;
 };
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -949,7 +949,6 @@
 
 PythonFile::PythonFile(File &file, const char *mode) { Reset(file, mode); }
 
-
 PythonFile::PythonFile(PyRefType type, PyObject *o) { Reset(type, o); }
 
 PythonFile::~PythonFile() {}
@@ -1014,22 +1013,6 @@
 #endif
 }
 
-uint32_t PythonFile::GetOptionsFromMode(llvm::StringRef mode) {
-  if (mode.empty())
-return 0;
-
-  return llvm::StringSwitch(mode.str())
-  .Case("r", File::eOpenOptionRead)
-  .Case("w", File::eOpenOptionWrite)
-  .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |
- File::eOpenOptionCanCreate)
-  .Case("r+", File::eOpenOptionRead | File::eOpenOptionWrite)
-  .Case("w+", File::eOpenOptionRead | File::eOpenOptionWrite |
-  File::eOpenOptionCanCreate | File::eOpenOptionTruncate)
-  .Case("a+", File::eOpenOptionRead | File::eOpenOptionWrite |
-  File::eOpenOptionAppend | File::eOpenOptionCanCreate)
-  .Default(0);
-}
 
 FileUP PythonFile::GetUnderlyingFile() const {
   if (!IsValid())
@@ -1038,7 +1021,7 @@
   // We don't own the file descriptor returned by this function, make sure the
   // File object knows about that.
   PythonString py_mode = GetAttributeValue("mode").AsType();
-  auto options = PythonFile::GetOptionsFromMode(py_mode.GetString());
+  auto options = File::GetOptionsFromMode(py_mode.GetString());
   auto file = std::make_unique(PyObject_AsFileDescriptor(m_py_obj),
  options, false);
   if (!file->IsValid())
Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -68,6 +68,22 @@
   return nullptr;
 }
 
+uint32_t File::GetOptionsFromMode(llvm::StringRef mode) {
+  if (mode.empty())
+return 0;
+  return llvm::StringSwitch(mode.str())
+  .Case("r", File::eOpenOptionRead)
+  .Case("w", File::eOpenOptionWrite)
+  .Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |
+ File::eOpenOptionCanCreate)
+  .Case("r+", File::eOpenOptionRead | File::eOpenOptionWrite)
+  .Case("w+", File::eOpenOptionRead | File::eOpenOptionWrite |
+  File::eOpenOptionCanCreate | File::eOpenOptionTruncate)
+  .Case("a+", File::eOpenOptionRead | File::eOpenOptionWrite |
+  File::eOpenOptionAppend | File::eOpenOptionCanCreate)
+  .Default(0);
+}
+
 int File::kInvalidDescriptor = -1;
 FILE *File::kInvalidStream = nullptr;
 
@@ -143,9 +159,14 @@
 
 Status File::Close() {
   Status error;
-  if (StreamIsValid() && m_own_stream) {
-if (::fclose(m_stream) == EOF)
-  error.SetErrorToErrno();
+  if (StreamIsValid()) {
+if (m_own_stream) {
+  if (::fclose(m_stream) == EOF)
+error.SetErrorToErrno();
+} else {
+  if (::fflush(m_stream) == EOF)
+error.SetErrorToErrno();
+}
   }
 
   if (DescriptorIsValid() && m_should_close_fd) {
Index: lldb/source/API/SBFile.cpp
===
--- /dev/null
+++ lldb/source/API/SBFile.cpp
@@ -0,0 +1,76 @@
+//===-- SBFile.cpp --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptio

[Lldb-commits] [PATCH] D67793: new api class: SBFile

2019-09-27 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna marked 2 inline comments as done.
lawrence_danna added a comment.

@labath, OK sets are now constructors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67793



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


[Lldb-commits] [PATCH] D68048: [WIP][RFC] Improve fetching the process list on the android platform

2019-09-27 Thread walter erquinigo via Phabricator via lldb-commits
wallace abandoned this revision.
wallace added a comment.

This diff has created a good discussion and I have a better idea of what we 
should do to move forward:)

- I figured out a way to improve the existing process fetching functionality of 
the lldb-server so that it can show all the nice information that ps -A is 
showing. I'll just do some things ps is doing under the hood with /proc files.
- I'll add some more fields to ProcessInstanceInfo that are android-specific, 
like package name, which is not the same as process name.
- I'll implement a way for lldb to push an existing local lldb-server or to 
reuse one already in the device. That way lldb can start lldb-server on behalf 
of the user for two cases: the initial platform connection and the actual apk 
debugging, which requires an lldb-server started with the correct user
- I'll implement a way for lldb to debug an apk bundle


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68048



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