[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:115
   _type:   
\
   name = #_type
   switch (type) {

joerg wrote:
> krytarowski wrote:
> > brunoalr wrote:
> > > joerg wrote:
> > > > labath wrote:
> > > > > If we go about renaming them, then we should change this, as we still 
> > > > > want to display the standard name of the entries.
> > > > Or name = "AUXV_AT_???" ENTRY_NAME(type) name = #type and then return 
> > > > name + 4;
> > > Hmm that looks too "hacky", doesn't it?
> > `name + 4` looks prettier to me.
> Just using the name directly makes this searchable. The cleanup is an 
> implementation detail, even if it might waste a bit space.
I think name+4 (well, 5) is fine, but if you want to keep it this way, then I'd 
suggest you hardcode the AUXV_ prefix into the macro (`#define ENTRY_NAME(type) 
AUXV_##type: name = #type`. This is just adds redundant magic.


https://reviews.llvm.org/D35065



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


[Lldb-commits] [PATCH] D35083: [TypeSystem] Guard the global `ASTSourceMap` with a mutex

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

I would prefer the unique_lock idea also. Lamdas make the code look ugly.

Alternatively, we could start using thread safety annotations 
https://clang.llvm.org/docs/ThreadSafetyAnalysis.html, and let clang do the 
checking for us. I think a number of places could benefit from those. Not 
saying this is the best example, but since we're already discussing it...


Repository:
  rL LLVM

https://reviews.llvm.org/D35083



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


[Lldb-commits] [PATCH] D35113: Clean up lldb-types.h

2017-07-07 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
Herald added a subscriber: ki.stfu.

It defined a couple of types (condition_t) which we don't use anymore,
as we have c++11 goodies now. I remove these definitions.

Also it unnecessarily included a couple of headers which weren't
necessary for it's operation. I remove these, and place the includes in
the relevant files (usually .cpp, usually in Host code) which use them.
This allows us to reduce namespace pollution in most of the lldb files
which don't need the OS-specific definitions.


https://reviews.llvm.org/D35113

Files:
  include/lldb/Host/MainLoop.h
  include/lldb/Host/PosixApi.h
  include/lldb/lldb-types.h
  source/Host/common/File.cpp
  source/Host/common/Socket.cpp
  source/Host/common/TCPSocket.cpp
  source/Host/linux/Host.cpp
  source/Host/linux/HostInfoLinux.cpp
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  source/Host/posix/FileSystem.cpp
  source/Host/posix/HostProcessPosix.cpp
  source/Host/posix/LockFilePosix.cpp
  source/Host/posix/ProcessLauncherPosixFork.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeThreadLinux.h
  source/Plugins/Process/Linux/ProcessorTrace.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Target.cpp
  tools/driver/Driver.cpp
  tools/lldb-mi/MICmnLLDBDebugger.cpp
  tools/lldb-mi/MIDriver.cpp
  tools/lldb-mi/MIDriverMain.cpp

Index: tools/lldb-mi/MIDriverMain.cpp
===
--- tools/lldb-mi/MIDriverMain.cpp
+++ tools/lldb-mi/MIDriverMain.cpp
@@ -33,6 +33,7 @@
 
 // Third party headers:
 #include "lldb/API/SBHostOS.h"
+#include 
 #include 
 
 // In house headers:
Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ tools/lldb-mi/MIDriver.cpp
@@ -9,7 +9,9 @@
 
 // Third party headers:
 #include "lldb/API/SBError.h"
+#include 
 #include 
+#include 
 
 // In-house headers:
 #include "MICmdArgValFile.h"
Index: tools/lldb-mi/MICmnLLDBDebugger.cpp
===
--- tools/lldb-mi/MICmnLLDBDebugger.cpp
+++ tools/lldb-mi/MICmnLLDBDebugger.cpp
@@ -17,6 +17,7 @@
 #include "lldb/API/SBTypeCategory.h"
 #include "lldb/API/SBTypeNameSpecifier.h"
 #include "lldb/API/SBTypeSummary.h"
+#include 
 
 // In-house headers:
 #include "MICmnLLDBDebugSessionInfo.h"
Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -34,6 +34,7 @@
 #include "lldb/Expression/REPL.h"
 #include "lldb/Expression/UserExpression.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Host/PosixApi.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/OptionGroupWatchpoint.h"
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -16,6 +16,7 @@
 #include 
 #include  // for mmap
 #include 
+#include 
 #endif
 #include 
 #include 
@@ -40,6 +41,7 @@
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostThread.h"
+#include "lldb/Host/PosixApi.h"
 #include "lldb/Host/PseudoTerminal.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Host/Symbols.h"
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -29,6 +29,7 @@
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/PosixApi.h"
 #include "lldb/Host/common/NativeProcessProtocol.h"
 #include "lldb/Host/common/NativeRegisterContext.h"
 #include "lldb/Host/common/NativeThreadProtocol.h"
Index: source/Plugins/Process/Linux/ProcessorTrace.h
===
--- source/Plugins/Process/Linux/ProcessorTrace.h
+++ source/Plugins/Process/Linux/ProcessorTrace.h
@@ -18,6 +18,7 @@
 
 #include 
 #include 
+#include 
 
 namespace lldb_private {
 
Index: source/Plugins/Process/Linux/NativeThreadLinux.h
===
--- sou

Re: [Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-07 Thread Pavel Labath via lldb-commits
On 6 July 2017 at 18:40, Bruno Rosa via Phabricator
 wrote:
> brunoalr added a comment.
>
> In https://reviews.llvm.org/D35065#800877, @krytarowski wrote:
>
>> What are the build failures?
>
>
>
>
>   [2397/3183] Building CXX object 
> tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
>   FAILED: 
> tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
>   /usr/bin/c++   -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLIBXML2_DEFINED 
> -DLLDB_USE_BUILTIN_DEMANGLER -DLLVM_BUILD_GLOBAL_ISEL -D_DEBUG -D_GNU_SOURCE 
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIM
>   IT_MACROS -Itools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD 
> -I/home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD 
> -Itools/lldb/include -I/home/brosa/llvm/tools/lldb/include -Iinclude
>   -I/home/brosa/llvm/include -I/usr/include/python2.7 
> -I/home/brosa/llvm/tools/clang/include -Itools/lldb/../clang/include 
> -I/usr/include/libxml2 -I/home/brosa/llvm/tools/lldb/source/. -fPIC 
> -fvisibility-
>   inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter 
> -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic 
> -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virt
>   ual-dtor -Wno-comment -Wno-deprecated-declarations -Wno-unknown-pragmas 
> -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g
> -fno-exceptions -fno-rtti -MD -MT tools/lldb/source/Plugins
>   
> /DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
>  -MF 
> tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector
>   .cpp.o.d -o 
> tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeFiles/lldbPluginDynamicLoaderPosixDYLD.dir/AuxVector.cpp.o
>  -c /home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxV
>   ector.cpp
>   In file included from /usr/include/powerpc64le-linux-gnu/asm/elf.h:17:0,
>from 
> /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:13,
>from 
> /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
>from /usr/include/signal.h:306,
>from 
> /home/brosa/llvm/tools/lldb/include/lldb/lldb-types.h:17,
>from 
> /home/brosa/llvm/tools/lldb/include/lldb/lldb-private-interfaces.h:17,
>from 
> /home/brosa/llvm/tools/lldb/include/lldb/lldb-private.h:17,
>from 
> /home/brosa/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h:21,
>from 
> /home/brosa/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSite.h:22,
>from 
> /home/brosa/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSiteList.h:21,
>from 
> /home/brosa/llvm/tools/lldb/include/lldb/Target/Process.h:29,
>from 
> /home/brosa/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:17:

 might help you here, as it removes
the (completely unnecessary) signal.h include from lldb-types.h.
However, using different symbol names than those in system headers is
probably a good idea anyway.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D35113: Clean up lldb-types.h

2017-07-07 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:18
 #if defined(__linux__) || defined(__FreeBSD__)
 #include "Plugins/Process/elf-core/ProcessElfCore.h"
 #endif

Is this needed here?


https://reviews.llvm.org/D35113



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


[Lldb-commits] [PATCH] D35113: Clean up lldb-types.h

2017-07-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp:18
 #if defined(__linux__) || defined(__FreeBSD__)
 #include "Plugins/Process/elf-core/ProcessElfCore.h"
 #endif

krytarowski wrote:
> Is this needed here?
good point. I'm pretty sure it isn't.


https://reviews.llvm.org/D35113



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


[Lldb-commits] [PATCH] D35113: Clean up lldb-types.h

2017-07-07 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 105613.
labath added a comment.

Remove unused include from auxvector.h


https://reviews.llvm.org/D35113

Files:
  include/lldb/Host/MainLoop.h
  include/lldb/Host/PosixApi.h
  include/lldb/lldb-types.h
  source/Host/common/File.cpp
  source/Host/common/Socket.cpp
  source/Host/common/TCPSocket.cpp
  source/Host/linux/Host.cpp
  source/Host/linux/HostInfoLinux.cpp
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  source/Host/posix/FileSystem.cpp
  source/Host/posix/HostProcessPosix.cpp
  source/Host/posix/LockFilePosix.cpp
  source/Host/posix/ProcessLauncherPosixFork.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeThreadLinux.h
  source/Plugins/Process/Linux/ProcessorTrace.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Target.cpp
  tools/driver/Driver.cpp
  tools/lldb-mi/MICmnLLDBDebugger.cpp
  tools/lldb-mi/MIDriver.cpp
  tools/lldb-mi/MIDriverMain.cpp

Index: tools/lldb-mi/MIDriverMain.cpp
===
--- tools/lldb-mi/MIDriverMain.cpp
+++ tools/lldb-mi/MIDriverMain.cpp
@@ -33,6 +33,7 @@
 
 // Third party headers:
 #include "lldb/API/SBHostOS.h"
+#include 
 #include 
 
 // In house headers:
Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ tools/lldb-mi/MIDriver.cpp
@@ -9,7 +9,9 @@
 
 // Third party headers:
 #include "lldb/API/SBError.h"
+#include 
 #include 
+#include 
 
 // In-house headers:
 #include "MICmdArgValFile.h"
Index: tools/lldb-mi/MICmnLLDBDebugger.cpp
===
--- tools/lldb-mi/MICmnLLDBDebugger.cpp
+++ tools/lldb-mi/MICmnLLDBDebugger.cpp
@@ -17,6 +17,7 @@
 #include "lldb/API/SBTypeCategory.h"
 #include "lldb/API/SBTypeNameSpecifier.h"
 #include "lldb/API/SBTypeSummary.h"
+#include 
 
 // In-house headers:
 #include "MICmnLLDBDebugSessionInfo.h"
Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -34,6 +34,7 @@
 #include "lldb/Expression/REPL.h"
 #include "lldb/Expression/UserExpression.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Host/PosixApi.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/OptionGroupWatchpoint.h"
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -16,6 +16,7 @@
 #include 
 #include  // for mmap
 #include 
+#include 
 #endif
 #include 
 #include 
@@ -40,6 +41,7 @@
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostThread.h"
+#include "lldb/Host/PosixApi.h"
 #include "lldb/Host/PseudoTerminal.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Host/Symbols.h"
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -29,6 +29,7 @@
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/PosixApi.h"
 #include "lldb/Host/common/NativeProcessProtocol.h"
 #include "lldb/Host/common/NativeRegisterContext.h"
 #include "lldb/Host/common/NativeThreadProtocol.h"
Index: source/Plugins/Process/Linux/ProcessorTrace.h
===
--- source/Plugins/Process/Linux/ProcessorTrace.h
+++ source/Plugins/Process/Linux/ProcessorTrace.h
@@ -18,6 +18,7 @@
 
 #include 
 #include 
+#include 
 
 namespace lldb_private {
 
Index: source/Plugins/Process/Linux/NativeThreadLinux.h
===
--- source/Plugins/Process/Linux/NativeThreadLinux.h
+++ source/Plugins/Process/Linux/NativeThreadLinux.h
@@ -16,6 +16,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 namespace lldb_private {
Index: source/Plugins/Process/Linux/NativeProcessLinux.h
===
--- source/Plugins/Process/Linux/NativeProcessLinux.h
+++ source/Plugins/Process/Linux/NativeProce

[Lldb-commits] [lldb] r307390 - Add a NativeProcessProtocol Factory class

2017-07-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jul  7 04:02:19 2017
New Revision: 307390

URL: http://llvm.org/viewvc/llvm-project?rev=307390&view=rev
Log:
Add a NativeProcessProtocol Factory class

Summary:
This replaces the static functions used for creating
NativeProcessProtocol instances with a factory pattern, and modernizes
the interface of the new class in the process -- I use llvm::Expected
instead of the Status+value combo. I also move some of the common code
(like the Delegate registration into the base class). The new
arrangement has multiple benefits:
- it removes the NativeProcess*** dependency from Process/gdb-remote
  (which for example means that liblldb no longer pulls in this code).
- it enables unit testing of the GDBRemoteCommunicationServerLLGS class
  (by providing a mock Native Process).
- serves as another example on how to use the llvm::Expected class (I
  couldn't get rid of the Initialize-type functions completely here
  because of the use of shared_from_this, but that's the next thing on
  my list here)

Tests still pass on Linux and I've made sure NetBSD compiles after this.

Reviewers: zturner, eugene, krytarowski

Subscribers: srhines, lldb-commits, mgorny

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

Modified:
lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
lldb/trunk/source/Plugins/Process/gdb-remote/CMakeLists.txt

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

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

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
lldb/trunk/tools/lldb-server/CMakeLists.txt
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=307390&r1=307389&r2=307390&view=diff
==
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Fri Jul  7 
04:02:19 2017
@@ -19,6 +19,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include 
 
@@ -244,68 +245,57 @@ public:
   virtual Status GetFileLoadAddress(const llvm::StringRef &file_name,
 lldb::addr_t &load_addr) = 0;
 
-  //--
-  /// Launch a process for debugging. This method will create an concrete
-  /// instance of NativeProcessProtocol, based on the host platform.
-  /// (e.g. NativeProcessLinux on linux, etc.)
-  ///
-  /// @param[in] launch_info
-  /// Information required to launch the process.
-  ///
-  /// @param[in] native_delegate
-  /// The delegate that will receive messages regarding the
-  /// inferior.  Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[in] mainloop
-  /// The mainloop instance with which the process can register
-  /// callbacks. Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[out] process_sp
-  /// On successful return from the method, this parameter
-  /// contains the shared pointer to the
-  /// NativeProcessProtocol that can be used to manipulate
-  /// the native process.
-  ///
-  /// @return
-  /// An error object indicating if the operation succeeded,
-  /// and if not, what error occurred.
-  //--
-  static Status Launch(ProcessLaunchInfo &launch_info,
-   NativeDelegate &native_delegate, MainLoop &mainloop,
-   NativeProcessProtocolSP &process_sp);
-
-  //--
-  /// Attach to an existing process. This method will create an concrete
-  /// instance of NativeProcessProtocol, based on the host platform.
-  /// (e.g. NativeProcessLinux on linux, etc.)
-  ///
-  /// @param[in] pid
-  /// pid of the process locatable
-  ///
-  /// @param[in] native_delegate
-  /// The delegate that will receive messages regarding the
-  /// inferior.  Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[in] mainloop
-  /// The mainloop instance with which the process can register
-  /// callbacks. Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[ou

[Lldb-commits] [lldb] r307391 - Disable TestGoASTContext

2017-07-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jul  7 04:02:28 2017
New Revision: 307391

URL: http://llvm.org/viewvc/llvm-project?rev=307391&view=rev
Log:
Disable TestGoASTContext

it fails with go 1.8 and we don't seem to have a maintainer of that
functionality.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py?rev=307391&r1=307390&r2=307391&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py 
Fri Jul  7 04:02:28 2017
@@ -20,6 +20,7 @@ class TestGoASTContext(TestBase):
 @skipIfRemote  # Not remote test suit ready
 @no_debug_info_test
 @skipUnlessGoInstalled
+@expectedFailureAll(bugnumber="llvm.org/pr33643")
 def test_with_dsym_and_python_api(self):
 """Test GoASTContext dwarf parsing."""
 self.buildGo()


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


[Lldb-commits] [PATCH] D33778: Add a NativeProcessProtocol Factory class

2017-07-07 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL307390: Add a NativeProcessProtocol Factory class (authored 
by labath).

Repository:
  rL LLVM

https://reviews.llvm.org/D33778

Files:
  lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
  lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
  lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  lldb/trunk/source/Plugins/Process/gdb-remote/CMakeLists.txt
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  lldb/trunk/tools/lldb-server/CMakeLists.txt
  lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

Index: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
===
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include 
 
@@ -244,68 +245,57 @@
   virtual Status GetFileLoadAddress(const llvm::StringRef &file_name,
 lldb::addr_t &load_addr) = 0;
 
-  //--
-  /// Launch a process for debugging. This method will create an concrete
-  /// instance of NativeProcessProtocol, based on the host platform.
-  /// (e.g. NativeProcessLinux on linux, etc.)
-  ///
-  /// @param[in] launch_info
-  /// Information required to launch the process.
-  ///
-  /// @param[in] native_delegate
-  /// The delegate that will receive messages regarding the
-  /// inferior.  Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[in] mainloop
-  /// The mainloop instance with which the process can register
-  /// callbacks. Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[out] process_sp
-  /// On successful return from the method, this parameter
-  /// contains the shared pointer to the
-  /// NativeProcessProtocol that can be used to manipulate
-  /// the native process.
-  ///
-  /// @return
-  /// An error object indicating if the operation succeeded,
-  /// and if not, what error occurred.
-  //--
-  static Status Launch(ProcessLaunchInfo &launch_info,
-   NativeDelegate &native_delegate, MainLoop &mainloop,
-   NativeProcessProtocolSP &process_sp);
-
-  //--
-  /// Attach to an existing process. This method will create an concrete
-  /// instance of NativeProcessProtocol, based on the host platform.
-  /// (e.g. NativeProcessLinux on linux, etc.)
-  ///
-  /// @param[in] pid
-  /// pid of the process locatable
-  ///
-  /// @param[in] native_delegate
-  /// The delegate that will receive messages regarding the
-  /// inferior.  Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[in] mainloop
-  /// The mainloop instance with which the process can register
-  /// callbacks. Must outlive the NativeProcessProtocol
-  /// instance.
-  ///
-  /// @param[out] process_sp
-  /// On successful return from the method, this parameter
-  /// contains the shared pointer to the
-  /// NativeProcessProtocol that can be used to manipulate
-  /// the native process.
-  ///
-  /// @return
-  /// An error object indicating if the operation succeeded,
-  /// and if not, what error occurred.
-  //--
-  static Status Attach(lldb::pid_t pid, NativeDelegate &native_delegate,
-   MainLoop &mainloop, NativeProcessProtocolSP &process_sp);
+  class Factory {
+  public:
+virtual ~Factory();
+//--
+/// Launch a process for debugging.
+///
+/// @param[in] launch_info
+/// Information required to launch the process.
+///
+/// @param[in] native_delegate
+/// The delegate that will receive messages regarding the
+/// inferior.  Must outlive the NativeProcessProtocol
+/// instance.
+///
+/// @param[in] mainloop
+/// The mainloop instance with which the process can register
+/// callbacks. Must outlive the NativeProcessProtocol
+/// instance.
+//

[Lldb-commits] [PATCH] D35123: Remove shared pointer from NativeProcessProtocol

2017-07-07 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.

The usage of shared_from_this forces us to separate construction and
initialization phases, because shared_from_this() is not available in
the constructor (or destructor). The shared semantics are not necessary,
as we always have a clear owner of the native process class
(GDBRemoteCommunicationServerLLDB object). Even if we need shared
semantics in the future (which I think we should strongly avoid),
reverting this will not be necessary -- the owners can still easily
store the native process object in a shared pointer if they really want
to -- this just prevents the knowledge of that from leaking into the
class implementation.

After this a NativeThread object will hold a reference to the parent
process (instead of a weak_ptr) -- having a process instance always
available allows us to simplify some logic in this class (some of it was
already simplified because we were asserting that the process is
available, but this makes it obvious).


https://reviews.llvm.org/D35123

Files:
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/Host/common/NativeThreadProtocol.h
  include/lldb/lldb-private-forward.h
  source/Host/common/NativeRegisterContext.cpp
  source/Host/common/NativeThreadProtocol.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.h
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  tools/lldb-server/lldb-gdbserver.cpp

Index: tools/lldb-server/lldb-gdbserver.cpp
===
--- tools/lldb-server/lldb-gdbserver.cpp
+++ tools/lldb-server/lldb-gdbserver.cpp
@@ -67,13 +67,13 @@
 // Dummy implementation to make sure the code compiles
 class NativeProcessFactory : public NativeProcessProtocol::Factory {
 public:
-  llvm::Expected
+  llvm::Expected>
   Launch(ProcessLaunchInfo &launch_info,
  NativeProcessProtocol::NativeDelegate &delegate,
  MainLoop &mainloop) const override {
 llvm_unreachable("Not implemented");
   }
-  llvm::Expected
+  llvm::Expected>
   Attach(lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &delegate,
  MainLoop &mainloop) const override {
 llvm_unreachable("Not implemented");
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -114,7 +114,7 @@
   lldb::tid_t m_current_tid = LLDB_INVALID_THREAD_ID;
   lldb::tid_t m_continue_tid = LLDB_INVALID_THREAD_ID;
   std::recursive_mutex m_debugged_process_mutex;
-  NativeProcessProtocolSP m_debugged_process_sp;
+  std::unique_ptr m_debugged_process_up;
 
   Communication m_stdio_communication;
   MainLoop::ReadHandleUP m_stdio_handle_up;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -239,7 +239,7 @@
 
   {
 std::lock_guard guard(m_debugged_process_mutex);
-assert(!m_debugged_process_sp && "lldb-server creating debugged "
+assert(!m_debugged_process_up && "lldb-server creating debugged "
  "process but one already exists");
 auto process_or =
 m_process_factory.Launch(m_process_launch_info, *this, m_mainloop);
@@ -250,7 +250,7 @@
   m_process_launch_info.GetArguments().GetArgumentAtIndex(0), status);
   return status;
 }
-m_debugged_process_sp = *process_or;
+m_debugged_process_up = std::move(*process_or);
   }
 
   // Handle mirroring of inferior stdout/stderr over the gdb-remote protocol
@@ -263,14 +263,13 @@
 // nullptr means it's not redirected to file or pty (in case of LLGS local)
 // at least one of stdio will be transferred pty<->gdb-remote
 // we need to give the pty master handle to this object to read and/or write
-if (log)
-  log->Printf(
-  "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-  " setting up stdout/stderr redirection via $O gdb-remote commands",
-  __FUNCTION__, m_debugged_process_sp->GetID());
+LLDB_LOG(log,
+ "pid = {0}: setting up stdout/stderr redirection via 

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-07 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr updated this revision to Diff 105638.
brunoalr added a comment.

Applying suggestions from review


https://reviews.llvm.org/D35065

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_SYSINFO_EHDR);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
@@ -574,7 +574,7 @@
   if (m_auxv.get() == NULL)
 return LLDB_INVALID_ADDRESS;
 
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_ENTRY);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_ENTRY);
 
   if (I == m_auxv->end())
 return LLDB_INVALID_ADDRESS;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -42,41 +42,42 @@
 
   /// Constants describing the type of entry.
   /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX information.
+  /// Added AUXV prefix to avoid potential conflicts with system-defined macros
   enum EntryType {
-AT_NULL = 0,  ///< End of auxv.
-AT_IGNORE = 1,///< Ignore entry.
-AT_EXECFD = 2,///< File descriptor of program.
-AT_PHDR = 3,  ///< Program headers.
-AT_PHENT = 4, ///< Size of program header.
-AT_PHNUM = 5, ///< Number of program headers.
-AT_PAGESZ = 6,///< Page size.
-AT_BASE = 7,  ///< Interpreter base address.
-AT_FLAGS = 8, ///< Flags.
-AT_ENTRY = 9, ///< Program entry point.
-AT_NOTELF = 10,   ///< Set if program is not an ELF.
-AT_UID = 11,  ///< UID.
-AT_EUID = 12, ///< Effective UID.
-AT_GID = 13,  ///< GID.
-AT_EGID = 14, ///< Effective GID.
-AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
-AT_PLATFORM = 15, ///< String identifying platform.
-AT_HWCAP = 16,///< Machine dependent hints about processor capabilities.
-AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
-AT_SECURE = 23,///< Boolean, was exec setuid-like?
-AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
-AT_RANDOM = 25,///< Address of 16 random bytes.
-AT_EXECFN = 31,///< Filename of executable.
-AT_SYSINFO = 32, ///< Pointer to the global system page used for system
- ///calls and other nice things.
-AT_SYSINFO_EHDR = 33,
-AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
-AT_L1D_CACHESHAPE = 35,
-AT_L2_CACHESHAPE = 36,
-AT_L3_CACHESHAPE = 37,
+AUXV_AT_NULL = 0,///< End of auxv.
+AUXV_AT_IGNORE = 1,  ///< Ignore entry.
+AUXV_AT_EXECFD = 2,  ///< File descriptor of program.
+AUXV_AT_PHDR = 3,///< Program headers.
+AUXV_AT_PHENT = 4,   ///< Size of program header.
+AUXV_AT_PHNUM = 5,   ///< Number of program headers.
+AUXV_AT_PAGESZ = 6,  ///< Page size.
+AUXV_AT_BASE = 7,///< Interpreter base address.
+AUXV_AT_FLAGS = 8,   ///< Flags.
+AUXV_AT_ENTRY = 9,   ///< Program entry point.
+AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF.
+AUXV_AT_UID = 11,///< UID.
+AUXV_AT_EUID = 12,   ///< Effective UID.
+AUXV_AT_GID = 13,///< GID.
+AUXV_AT_EGID = 14,   ///< Effective GID.
+AUXV_AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)).
+AUXV_AT_PLATFORM = 15,   ///< String identifying platform.
+AUXV_AT_HWCAP = 16,  ///< Machine dependent hints about processor capabilities.
+AUXV_AT_FPUCW = 18,  ///< Used FPU control word.
+AUXV_AT_DCACHEBSIZE = 19,///< Data cache block size.
+AUXV_AT_ICACHEBSIZE = 20,///< Instruction cache block size.
+AUXV_AT_UCACHEBSIZE = 21,///< Unified cache block size.
+AUXV_AT_IGNOREPPC = 22,  ///< Entry should be ignored.
+AUXV_AT_SECURE = 23, ///< Boolean, was exec setuid-like?
+AUXV_AT_BASE_PLATFORM = 24,  ///< String identifying real platforms.
+AUXV_AT_RANDOM = 25, ///< Address of 16 random bytes.

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-07 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr updated this revision to Diff 105639.
brunoalr added a comment.

Use string+5 instead of concatenation


https://reviews.llvm.org/D35065

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_SYSINFO_EHDR);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
@@ -574,7 +574,7 @@
   if (m_auxv.get() == NULL)
 return LLDB_INVALID_ADDRESS;
 
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_ENTRY);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_ENTRY);
 
   if (I == m_auxv->end())
 return LLDB_INVALID_ADDRESS;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -42,41 +42,42 @@
 
   /// Constants describing the type of entry.
   /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX information.
+  /// Added AUXV prefix to avoid potential conflicts with system-defined macros
   enum EntryType {
-AT_NULL = 0,  ///< End of auxv.
-AT_IGNORE = 1,///< Ignore entry.
-AT_EXECFD = 2,///< File descriptor of program.
-AT_PHDR = 3,  ///< Program headers.
-AT_PHENT = 4, ///< Size of program header.
-AT_PHNUM = 5, ///< Number of program headers.
-AT_PAGESZ = 6,///< Page size.
-AT_BASE = 7,  ///< Interpreter base address.
-AT_FLAGS = 8, ///< Flags.
-AT_ENTRY = 9, ///< Program entry point.
-AT_NOTELF = 10,   ///< Set if program is not an ELF.
-AT_UID = 11,  ///< UID.
-AT_EUID = 12, ///< Effective UID.
-AT_GID = 13,  ///< GID.
-AT_EGID = 14, ///< Effective GID.
-AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
-AT_PLATFORM = 15, ///< String identifying platform.
-AT_HWCAP = 16,///< Machine dependent hints about processor capabilities.
-AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
-AT_SECURE = 23,///< Boolean, was exec setuid-like?
-AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
-AT_RANDOM = 25,///< Address of 16 random bytes.
-AT_EXECFN = 31,///< Filename of executable.
-AT_SYSINFO = 32, ///< Pointer to the global system page used for system
- ///calls and other nice things.
-AT_SYSINFO_EHDR = 33,
-AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
-AT_L1D_CACHESHAPE = 35,
-AT_L2_CACHESHAPE = 36,
-AT_L3_CACHESHAPE = 37,
+AUXV_AT_NULL = 0,///< End of auxv.
+AUXV_AT_IGNORE = 1,  ///< Ignore entry.
+AUXV_AT_EXECFD = 2,  ///< File descriptor of program.
+AUXV_AT_PHDR = 3,///< Program headers.
+AUXV_AT_PHENT = 4,   ///< Size of program header.
+AUXV_AT_PHNUM = 5,   ///< Number of program headers.
+AUXV_AT_PAGESZ = 6,  ///< Page size.
+AUXV_AT_BASE = 7,///< Interpreter base address.
+AUXV_AT_FLAGS = 8,   ///< Flags.
+AUXV_AT_ENTRY = 9,   ///< Program entry point.
+AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF.
+AUXV_AT_UID = 11,///< UID.
+AUXV_AT_EUID = 12,   ///< Effective UID.
+AUXV_AT_GID = 13,///< GID.
+AUXV_AT_EGID = 14,   ///< Effective GID.
+AUXV_AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)).
+AUXV_AT_PLATFORM = 15,   ///< String identifying platform.
+AUXV_AT_HWCAP = 16,  ///< Machine dependent hints about processor capabilities.
+AUXV_AT_FPUCW = 18,  ///< Used FPU control word.
+AUXV_AT_DCACHEBSIZE = 19,///< Data cache block size.
+AUXV_AT_ICACHEBSIZE = 20,///< Instruction cache block size.
+AUXV_AT_UCACHEBSIZE = 21,///< Unified cache block size.
+AUXV_AT_IGNOREPPC = 22,  ///< Entry should be ignored.
+AUXV_AT_SECURE = 23, ///< Boolean, was exec setuid-like?
+AUXV_AT_BASE_PLATFORM = 24,  ///< String identifying real platforms.
+AUXV_AT_RANDOM = 25, ///< Address of 16 random by

[Lldb-commits] [PATCH] D35065: [LLDB][ppc64le] Rename enums in AuxVector

2017-07-07 Thread Bruno Rosa via Phabricator via lldb-commits
brunoalr updated this revision to Diff 105640.
brunoalr added a comment.

Small fix


https://reviews.llvm.org/D35065

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -561,7 +561,7 @@
 }
 
 void DynamicLoaderPOSIXDYLD::EvalVdsoStatus() {
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_SYSINFO_EHDR);
 
   if (I != m_auxv->end())
 m_vdso_base = I->value;
@@ -574,7 +574,7 @@
   if (m_auxv.get() == NULL)
 return LLDB_INVALID_ADDRESS;
 
-  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_ENTRY);
+  AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_ENTRY);
 
   if (I == m_auxv->end())
 return LLDB_INVALID_ADDRESS;
Index: source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.h
@@ -42,41 +42,42 @@
 
   /// Constants describing the type of entry.
   /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX information.
+  /// Added AUXV prefix to avoid potential conflicts with system-defined macros
   enum EntryType {
-AT_NULL = 0,  ///< End of auxv.
-AT_IGNORE = 1,///< Ignore entry.
-AT_EXECFD = 2,///< File descriptor of program.
-AT_PHDR = 3,  ///< Program headers.
-AT_PHENT = 4, ///< Size of program header.
-AT_PHNUM = 5, ///< Number of program headers.
-AT_PAGESZ = 6,///< Page size.
-AT_BASE = 7,  ///< Interpreter base address.
-AT_FLAGS = 8, ///< Flags.
-AT_ENTRY = 9, ///< Program entry point.
-AT_NOTELF = 10,   ///< Set if program is not an ELF.
-AT_UID = 11,  ///< UID.
-AT_EUID = 12, ///< Effective UID.
-AT_GID = 13,  ///< GID.
-AT_EGID = 14, ///< Effective GID.
-AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
-AT_PLATFORM = 15, ///< String identifying platform.
-AT_HWCAP = 16,///< Machine dependent hints about processor capabilities.
-AT_FPUCW = 18,///< Used FPU control word.
-AT_DCACHEBSIZE = 19,   ///< Data cache block size.
-AT_ICACHEBSIZE = 20,   ///< Instruction cache block size.
-AT_UCACHEBSIZE = 21,   ///< Unified cache block size.
-AT_IGNOREPPC = 22, ///< Entry should be ignored.
-AT_SECURE = 23,///< Boolean, was exec setuid-like?
-AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
-AT_RANDOM = 25,///< Address of 16 random bytes.
-AT_EXECFN = 31,///< Filename of executable.
-AT_SYSINFO = 32, ///< Pointer to the global system page used for system
- ///calls and other nice things.
-AT_SYSINFO_EHDR = 33,
-AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches.
-AT_L1D_CACHESHAPE = 35,
-AT_L2_CACHESHAPE = 36,
-AT_L3_CACHESHAPE = 37,
+AUXV_AT_NULL = 0,///< End of auxv.
+AUXV_AT_IGNORE = 1,  ///< Ignore entry.
+AUXV_AT_EXECFD = 2,  ///< File descriptor of program.
+AUXV_AT_PHDR = 3,///< Program headers.
+AUXV_AT_PHENT = 4,   ///< Size of program header.
+AUXV_AT_PHNUM = 5,   ///< Number of program headers.
+AUXV_AT_PAGESZ = 6,  ///< Page size.
+AUXV_AT_BASE = 7,///< Interpreter base address.
+AUXV_AT_FLAGS = 8,   ///< Flags.
+AUXV_AT_ENTRY = 9,   ///< Program entry point.
+AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF.
+AUXV_AT_UID = 11,///< UID.
+AUXV_AT_EUID = 12,   ///< Effective UID.
+AUXV_AT_GID = 13,///< GID.
+AUXV_AT_EGID = 14,   ///< Effective GID.
+AUXV_AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)).
+AUXV_AT_PLATFORM = 15,   ///< String identifying platform.
+AUXV_AT_HWCAP = 16,  ///< Machine dependent hints about processor capabilities.
+AUXV_AT_FPUCW = 18,  ///< Used FPU control word.
+AUXV_AT_DCACHEBSIZE = 19,///< Data cache block size.
+AUXV_AT_ICACHEBSIZE = 20,///< Instruction cache block size.
+AUXV_AT_UCACHEBSIZE = 21,///< Unified cache block size.
+AUXV_AT_IGNOREPPC = 22,  ///< Entry should be ignored.
+AUXV_AT_SECURE = 23, ///< Boolean, was exec setuid-like?
+AUXV_AT_BASE_PLATFORM = 24,  ///< String identifying real platforms.
+AUXV_AT_RANDOM = 25, ///< Address of 16 random bytes.
+AUXV_AT_EXECFN = 3

[Lldb-commits] [PATCH] D35083: [TypeSystem] Guard the global `ASTSourceMap` with a mutex

2017-07-07 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The ThreadSafety analysis stuff looks interesting, but just to be sure I 
understand:  You said "alternatively we could..." but from what I could tell 
the thread safety is markup on already extant mechanisms.  It didn't look like 
it provided any locking on it's on, it only enforces the discipline for your 
current locking strategy.  Did I miss something?


Repository:
  rL LLVM

https://reviews.llvm.org/D35083



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


[Lldb-commits] [lldb] r307454 - The x86 instruction unwinder can be asked to disassemble non-instruction

2017-07-07 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Jul  7 17:12:15 2017
New Revision: 307454

URL: http://llvm.org/viewvc/llvm-project?rev=307454&view=rev
Log:
The x86 instruction unwinder can be asked to disassemble non-instruction 
blocks of memory, and if the final bytes of that block look like a long
x86 instruction, it can cause the llvm disassembler to read past the end
of the buffer.  Use the maximum allowed instruction length that we pass
to the llvm disassembler as a way to limit this to the size of the buffer.

An example of how to trigger this is when lldb does a function call, it
puts a breakpoint on the beginning of main() and uses that as the return
address from the function call.  When we stop at that location, lldb may
try to find the first frame up the stack.  Because this is on the first
instruction of a function, it will get the word-size value at the stack
pointer and assume that this was the caller's pc value.  But this is random
stack memory and could point to anything - an object in memory, something
in the data section, whatever.  And if we have a symbol for that thing,
we'll try to disassemble it.

This was leading to infrequent crashes in customer scenarios; figured out
what was happening with address sanitizer.

 


Modified:
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
lldb/trunk/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp

Modified: 
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp?rev=307454&r1=307453&r2=307454&view=diff
==
--- 
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp 
Fri Jul  7 17:12:15 2017
@@ -604,9 +604,10 @@ uint32_t x86AssemblyInspectionEngine::ex
 }
 
 bool x86AssemblyInspectionEngine::instruction_length(uint8_t *insn_p,
- int &length) {
+ int &length, 
+ uint32_t 
buffer_remaining_bytes) {
 
-  const uint32_t max_op_byte_size = m_arch.GetMaximumOpcodeByteSize();
+  uint32_t max_op_byte_size = std::min(buffer_remaining_bytes, 
m_arch.GetMaximumOpcodeByteSize());
   llvm::SmallVector opcode_data;
   opcode_data.resize(max_op_byte_size);
 
@@ -698,8 +699,9 @@ bool x86AssemblyInspectionEngine::GetNon
 bool row_updated = false; // The UnwindPlan::Row 'row' has been updated
 
 m_cur_insn = data + current_func_text_offset;
-if (!instruction_length(m_cur_insn, insn_len) || insn_len == 0 ||
-insn_len > kMaxInstructionByteSize) {
+if (!instruction_length(m_cur_insn, insn_len, size - 
current_func_text_offset)
+|| insn_len == 0 
+|| insn_len > kMaxInstructionByteSize) {
   // An unrecognized/junk instruction
   break;
 }
@@ -1002,8 +1004,9 @@ bool x86AssemblyInspectionEngine::Augmen
   while (offset < size) {
 m_cur_insn = data + offset;
 int insn_len;
-if (!instruction_length(m_cur_insn, insn_len) || insn_len == 0 ||
-insn_len > kMaxInstructionByteSize) {
+if (!instruction_length(m_cur_insn, insn_len, size - offset)
+|| insn_len == 0 
+|| insn_len > kMaxInstructionByteSize) {
   // An unrecognized/junk instruction.
   break;
 }
@@ -1214,8 +1217,9 @@ bool x86AssemblyInspectionEngine::FindFi
 int scratch;
 
 m_cur_insn = data + offset;
-if (!instruction_length(m_cur_insn, insn_len) ||
-insn_len > kMaxInstructionByteSize || insn_len == 0) {
+if (!instruction_length(m_cur_insn, insn_len, size - offset) 
+|| insn_len > kMaxInstructionByteSize 
+|| insn_len == 0) {
   // An error parsing the instruction, i.e. probably data/garbage - stop
   // scanning
   break;

Modified: 
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h?rev=307454&r1=307453&r2=307454&view=diff
==
--- lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h 
(original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h 
Fri Jul  7 17:12:15 2017
@@ -113,7 +113,7 @@ private:
   bool ret_pattern_p();
   uint32_t extract_4(uint8_t *b);
 
-  bool instruction_length(uint8_t *insn, int &length);
+  bool instruction_length(uint8_t *insn, int &length, uint32_t 
buffer_remaining_bytes);
 
   bool machine_regno_to_lldb_regno(int machine_regno, uint32_t &lldb_regno);
 

Modified: 
lldb/trunk/unittests

[Lldb-commits] [lldb] r307464 - Update message that Main Thread Checker produces.

2017-07-07 Thread Kuba Mracek via lldb-commits
Author: kuba.brecka
Date: Fri Jul  7 22:18:19 2017
New Revision: 307464

URL: http://llvm.org/viewvc/llvm-project?rev=307464&view=rev
Log:
Update message that Main Thread Checker produces.


Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py

lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py?rev=307464&r1=307463&r2=307464&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
 Fri Jul  7 22:18:19 2017
@@ -41,7 +41,7 @@ class MTCSimpleTestCase(TestBase):
 thread = process.GetSelectedThread()
 frame = thread.GetSelectedFrame()
 
-self.expect("thread info", substrs=['stop reason = -[NSView superview] 
must be called from main thread only'])
+self.expect("thread info", substrs=['stop reason = -[NSView superview] 
must be used from main thread only'])
 
 self.expect(
 "thread info -s",
@@ -54,4 +54,4 @@ class MTCSimpleTestCase(TestBase):
 self.assertEqual(data["api_name"], "-[NSView superview]")
 self.assertEqual(data["class_name"], "NSView")
 self.assertEqual(data["selector"], "superview")
-self.assertEqual(data["description"], "-[NSView superview] must be 
called from main thread only")
+self.assertEqual(data["description"], "-[NSView superview] must be 
used from main thread only")

Modified: 
lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp?rev=307464&r1=307463&r2=307464&view=diff
==
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp
 Fri Jul  7 22:18:19 2017
@@ -141,7 +141,7 @@ MainThreadCheckerRuntime::RetrieveReport
   d->AddStringItem("class_name", className);
   d->AddStringItem("selector", selector);
   d->AddStringItem("description",
-   apiName + " must be called from main thread only");
+   apiName + " must be used from main thread only");
   d->AddIntegerItem("tid", thread_sp->GetIndexID());
   d->AddItem("trace", trace_sp);
   return dict_sp;


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