svn commit: r321194 - in vendor/lldb/dist: cmake/modules include/lldb include/lldb/Host include/lldb/Host/common include/lldb/Interpreter include/lldb/Utility packages/Python/lldbsuite/test/express...
Dimitry Andric
dim at FreeBSD.org
Wed Jul 19 07:03:13 UTC 2017
Author: dim
Date: Wed Jul 19 07:03:07 2017
New Revision: 321194
URL: https://svnweb.freebsd.org/changeset/base/321194
Log:
Vendor import of lldb trunk r308421:
https://llvm.org/svn/llvm-project/lldb/trunk@308421
Deleted:
vendor/lldb/dist/tools/debugserver/source/MacOSX/i386/CMakeLists.txt
vendor/lldb/dist/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt
Modified:
vendor/lldb/dist/cmake/modules/LLDBConfig.cmake
vendor/lldb/dist/cmake/modules/LLDBStandalone.cmake
vendor/lldb/dist/include/lldb/Host/MainLoop.h
vendor/lldb/dist/include/lldb/Host/PosixApi.h
vendor/lldb/dist/include/lldb/Host/SocketAddress.h
vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h
vendor/lldb/dist/include/lldb/Host/common/NativeThreadProtocol.h
vendor/lldb/dist/include/lldb/Interpreter/CommandInterpreter.h
vendor/lldb/dist/include/lldb/Utility/DataExtractor.h
vendor/lldb/dist/include/lldb/lldb-private-forward.h
vendor/lldb/dist/include/lldb/lldb-types.h
vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
vendor/lldb/dist/source/Host/CMakeLists.txt
vendor/lldb/dist/source/Host/common/File.cpp
vendor/lldb/dist/source/Host/common/Host.cpp
vendor/lldb/dist/source/Host/common/MainLoop.cpp
vendor/lldb/dist/source/Host/common/NativeRegisterContext.cpp
vendor/lldb/dist/source/Host/common/NativeThreadProtocol.cpp
vendor/lldb/dist/source/Host/common/Socket.cpp
vendor/lldb/dist/source/Host/common/SocketAddress.cpp
vendor/lldb/dist/source/Host/common/TCPSocket.cpp
vendor/lldb/dist/source/Host/linux/Host.cpp
vendor/lldb/dist/source/Host/linux/HostInfoLinux.cpp
vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp
vendor/lldb/dist/source/Host/posix/FileSystem.cpp
vendor/lldb/dist/source/Host/posix/HostProcessPosix.cpp
vendor/lldb/dist/source/Host/posix/LockFilePosix.cpp
vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp
vendor/lldb/dist/source/Interpreter/CommandInterpreter.cpp
vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
vendor/lldb/dist/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp
vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.h
vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
vendor/lldb/dist/source/Plugins/Process/Linux/NativeThreadLinux.cpp
vendor/lldb/dist/source/Plugins/Process/Linux/NativeThreadLinux.h
vendor/lldb/dist/source/Plugins/Process/Linux/ProcessorTrace.h
vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
vendor/lldb/dist/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
vendor/lldb/dist/source/Target/Target.cpp
vendor/lldb/dist/test/CMakeLists.txt
vendor/lldb/dist/tools/debugserver/CMakeLists.txt
vendor/lldb/dist/tools/debugserver/source/CMakeLists.txt
vendor/lldb/dist/tools/debugserver/source/MacOSX/CMakeLists.txt
vendor/lldb/dist/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
vendor/lldb/dist/tools/debugserver/source/RNBSocket.cpp
vendor/lldb/dist/tools/driver/Driver.cpp
vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebugger.cpp
vendor/lldb/dist/tools/lldb-mi/MIDriver.cpp
vendor/lldb/dist/tools/lldb-mi/MIDriverMain.cpp
vendor/lldb/dist/tools/lldb-server/lldb-gdbserver.cpp
vendor/lldb/dist/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
vendor/lldb/dist/unittests/debugserver/RNBSocketTest.cpp
Modified: vendor/lldb/dist/cmake/modules/LLDBConfig.cmake
==============================================================================
--- vendor/lldb/dist/cmake/modules/LLDBConfig.cmake Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/cmake/modules/LLDBConfig.cmake Wed Jul 19 07:03:07 2017 (r321194)
@@ -10,17 +10,22 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_S
set(LLDB_LINKER_SUPPORTS_GROUPS ON)
endif()
+set(LLDB_DEFAULT_DISABLE_PYTHON 0)
+set(LLDB_DEFAULT_DISABLE_CURSES 0)
+
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
- set(LLDB_DEFAULT_DISABLE_PYTHON 0)
set(LLDB_DEFAULT_DISABLE_CURSES 1)
elseif (CMAKE_SYSTEM_NAME MATCHES "Android" )
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
set(LLDB_DEFAULT_DISABLE_CURSES 1)
-else()
- set(LLDB_DEFAULT_DISABLE_PYTHON 0)
- set(LLDB_DEFAULT_DISABLE_CURSES 0)
+elseif(IOS)
+ set(LLDB_DEFAULT_DISABLE_PYTHON 1)
endif()
+if(IOS)
+ add_definitions(-DNO_XPC_SERVICES)
+endif()
+
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
"Disables the Python scripting integration.")
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
@@ -298,13 +303,15 @@ if (NOT LIBXML2_FOUND AND NOT (CMAKE_SYSTEM_NAME MATCH
endif()
# Find libraries or frameworks that may be needed
-if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
- find_library(CARBON_LIBRARY Carbon)
+if (APPLE)
+ if(NOT IOS)
+ find_library(CARBON_LIBRARY Carbon)
+ find_library(CORE_SERVICES_LIBRARY CoreServices)
+ find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
+ endif()
find_library(FOUNDATION_LIBRARY Foundation)
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
- find_library(CORE_SERVICES_LIBRARY CoreServices)
find_library(SECURITY_LIBRARY Security)
- find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output directory for LLDB.framework")
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
@@ -312,10 +319,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources)
add_definitions( -DLIBXML2_DEFINED )
- list(APPEND system_libs xml2 ${CURSES_LIBRARIES})
- list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY}
- ${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY}
- ${DEBUG_SYMBOLS_LIBRARY})
+ list(APPEND system_libs xml2
+ ${CURSES_LIBRARIES}
+ ${FOUNDATION_LIBRARY}
+ ${CORE_FOUNDATION_LIBRARY}
+ ${CORE_SERVICES_LIBRARY}
+ ${SECURITY_LIBRARY}
+ ${DEBUG_SYMBOLS_LIBRARY})
else()
if (LIBXML2_FOUND)
Modified: vendor/lldb/dist/cmake/modules/LLDBStandalone.cmake
==============================================================================
--- vendor/lldb/dist/cmake/modules/LLDBStandalone.cmake Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/cmake/modules/LLDBStandalone.cmake Wed Jul 19 07:03:07 2017 (r321194)
@@ -2,7 +2,6 @@
# standalone project, using LLVM as an external library:
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(lldb)
- cmake_minimum_required(VERSION 2.8.12.2)
if (POLICY CMP0022)
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
Modified: vendor/lldb/dist/include/lldb/Host/MainLoop.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/MainLoop.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/Host/MainLoop.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -12,8 +12,8 @@
#include "lldb/Host/Config.h"
#include "lldb/Host/MainLoopBase.h"
-
#include "llvm/ADT/DenseMap.h"
+#include <csignal>
#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H
#define SIGNAL_POLLING_UNSUPPORTED 1
Modified: vendor/lldb/dist/include/lldb/Host/PosixApi.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/PosixApi.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/Host/PosixApi.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -16,6 +16,8 @@
#if defined(_WIN32)
#include "lldb/Host/windows/PosixApi.h"
+#else
+#include <unistd.h>
#endif
#endif
Modified: vendor/lldb/dist/include/lldb/Host/SocketAddress.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/SocketAddress.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/Host/SocketAddress.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -152,6 +152,11 @@ class SocketAddress { (public)
bool IsAnyAddr() const;
//------------------------------------------------------------------
+ // Returns true if the socket is INADDR_LOOPBACK
+ //------------------------------------------------------------------
+ bool IsLocalhost() const;
+
+ //------------------------------------------------------------------
// Direct access to all of the sockaddr structures
//------------------------------------------------------------------
struct sockaddr &sockaddr() {
Modified: vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -33,8 +33,7 @@ class ResumeActionList;
//------------------------------------------------------------------
// NativeProcessProtocol
//------------------------------------------------------------------
-class NativeProcessProtocol
- : public std::enable_shared_from_this<NativeProcessProtocol> {
+class NativeProcessProtocol {
friend class SoftwareBreakpoint;
public:
@@ -268,7 +267,7 @@ class NativeProcessProtocol (public)
/// A NativeProcessProtocol shared pointer if the operation succeeded or
/// an error object if it failed.
//------------------------------------------------------------------
- virtual llvm::Expected<NativeProcessProtocolSP>
+ virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate,
MainLoop &mainloop) const = 0;
@@ -292,7 +291,7 @@ class NativeProcessProtocol (public)
/// A NativeProcessProtocol shared pointer if the operation succeeded or
/// an error object if it failed.
//------------------------------------------------------------------
- virtual llvm::Expected<NativeProcessProtocolSP>
+ virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Attach(lldb::pid_t pid, NativeDelegate &native_delegate,
MainLoop &mainloop) const = 0;
};
Modified: vendor/lldb/dist/include/lldb/Host/common/NativeThreadProtocol.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/common/NativeThreadProtocol.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/Host/common/NativeThreadProtocol.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -23,7 +23,7 @@ namespace lldb_private {
class NativeThreadProtocol
: public std::enable_shared_from_this<NativeThreadProtocol> {
public:
- NativeThreadProtocol(NativeProcessProtocol *process, lldb::tid_t tid);
+ NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid);
virtual ~NativeThreadProtocol() {}
@@ -46,7 +46,7 @@ class NativeThreadProtocol (public)
lldb::tid_t GetID() const { return m_tid; }
- NativeProcessProtocolSP GetProcess();
+ NativeProcessProtocol &GetProcess() { return m_process; }
// ---------------------------------------------------------------------
// Thread-specific watchpoints
@@ -64,7 +64,7 @@ class NativeThreadProtocol (public)
virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0;
protected:
- NativeProcessProtocolWP m_process_wp;
+ NativeProcessProtocol &m_process;
lldb::tid_t m_tid;
};
}
Modified: vendor/lldb/dist/include/lldb/Interpreter/CommandInterpreter.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Interpreter/CommandInterpreter.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/Interpreter/CommandInterpreter.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -539,7 +539,7 @@ class CommandInterpreter : public Broadcaster, (privat
std::string m_repeat_command; // Stores the command that will be executed for
// an empty command string.
lldb::ScriptInterpreterSP m_script_interpreter_sp;
- std::mutex m_script_interpreter_mutex;
+ std::recursive_mutex m_script_interpreter_mutex;
lldb::IOHandlerSP m_command_io_handler_sp;
char m_comment_char;
bool m_batch_command_mode;
Modified: vendor/lldb/dist/include/lldb/Utility/DataExtractor.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Utility/DataExtractor.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/Utility/DataExtractor.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -15,6 +15,7 @@
#include "lldb/lldb-forward.h" // for DataBufferSP
#include "lldb/lldb-types.h"
+#include <cassert>
#include <stdint.h>
#include <string.h>
Modified: vendor/lldb/dist/include/lldb/lldb-private-forward.h
==============================================================================
--- vendor/lldb/dist/include/lldb/lldb-private-forward.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/lldb-private-forward.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -30,10 +30,6 @@ class UnixSignals;
// SP/WP decls.
// ---------------------------------------------------------------
typedef std::shared_ptr<NativeBreakpoint> NativeBreakpointSP;
-typedef std::shared_ptr<lldb_private::NativeProcessProtocol>
- NativeProcessProtocolSP;
-typedef std::weak_ptr<lldb_private::NativeProcessProtocol>
- NativeProcessProtocolWP;
typedef std::shared_ptr<lldb_private::NativeRegisterContext>
NativeRegisterContextSP;
typedef std::shared_ptr<lldb_private::NativeThreadProtocol>
Modified: vendor/lldb/dist/include/lldb/lldb-types.h
==============================================================================
--- vendor/lldb/dist/include/lldb/lldb-types.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/include/lldb/lldb-types.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -13,16 +13,10 @@
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
-#include <assert.h>
-#include <signal.h>
#include <stdint.h>
//----------------------------------------------------------------------
// All host systems must define:
-// lldb::condition_t The native condition type (or a substitute class)
-// for conditions on the host system.
-// lldb::mutex_t The native mutex type for mutex objects on the host
-// system.
// lldb::thread_t The native thread type for spawned threads on the
// system
// lldb::thread_arg_t The type of the one any only thread creation
@@ -34,32 +28,22 @@
// #define LLDB_INVALID_PROCESS_ID ...
// #define LLDB_INVALID_THREAD_ID ...
// #define LLDB_INVALID_HOST_THREAD ...
-// #define IS_VALID_LLDB_HOST_THREAD ...
//----------------------------------------------------------------------
// TODO: Add a bunch of ifdefs to determine the host system and what
// things should be defined. Currently MacOSX is being assumed by default
// since that is what lldb was first developed for.
-#ifndef _MSC_VER
-#include <stdbool.h>
-#include <unistd.h>
-#endif
-
#ifdef _WIN32
#include <process.h>
namespace lldb {
-typedef void *mutex_t;
-typedef void *condition_t;
typedef void *rwlock_t;
typedef void *process_t; // Process type is HANDLE
typedef void *thread_t; // Host thread type
typedef void *file_t; // Host file type
-typedef void *pipe_t; // Host pipe type
typedef unsigned int __w64 socket_t; // Host socket type
-typedef uint32_t thread_key_t;
typedef void *thread_arg_t; // Host thread argument type
typedef unsigned thread_result_t; // Host thread result type
typedef thread_result_t (*thread_func_t)(void *); // Host thread function type
@@ -73,15 +57,11 @@ namespace lldb {
//----------------------------------------------------------------------
// MacOSX Types
//----------------------------------------------------------------------
-typedef ::pthread_mutex_t mutex_t;
-typedef pthread_cond_t condition_t;
typedef pthread_rwlock_t rwlock_t;
typedef uint64_t process_t; // Process type is just a pid.
typedef pthread_t thread_t; // Host thread type
typedef int file_t; // Host file type
-typedef int pipe_t; // Host pipe type
typedef int socket_t; // Host socket type
-typedef pthread_key_t thread_key_t;
typedef void *thread_arg_t; // Host thread argument type
typedef void *thread_result_t; // Host thread result type
typedef void *(*thread_func_t)(void *); // Host thread function type
@@ -100,10 +80,6 @@ typedef bool (*ExpressionCancelCallback)(ExpressionEva
#define LLDB_INVALID_PROCESS ((lldb::process_t)-1)
#define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL)
-#define IS_VALID_LLDB_HOST_THREAD(t) ((t) != LLDB_INVALID_HOST_THREAD)
-
-#define LLDB_INVALID_HOST_TIME \
- { 0, 0 }
namespace lldb {
typedef uint64_t addr_t;
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py Wed Jul 19 07:03:07 2017 (r321194)
@@ -23,32 +23,8 @@ class UnwindFromExpressionTest(TestBase):
def build_and_run_to_bkpt(self):
self.build()
- exe = os.path.join(os.getcwd(), "a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Create the breakpoint.
- breakpoint = target.BreakpointCreateBySourceRegex(
- "// Set a breakpoint here to get started", self.main_spec)
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple(
- None, None, self.get_process_working_directory())
-
- if not process:
- self.fail("SBTarget.LaunchProcess() failed")
-
- if process.GetState() != lldb.eStateStopped:
- self.fail("Process should be in the 'stopped' state, "
- "instead the actual state is: '%s'" %
- lldbutil.state_type_to_str(process.GetState()))
-
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
- process, breakpoint)
- self.assertIsNotNone(
- self.thread, "Expected one thread to be stopped at the breakpoint")
+ (target, process, self.thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+ "// Set a breakpoint here to get started", self.main_spec)
# Next set a breakpoint in this function, set up Expression options to stop on
# breakpoint hits, and call the function.
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py Wed Jul 19 07:03:07 2017 (r321194)
@@ -30,46 +30,13 @@ class BadAddressBreakpointTestCase(TestBase):
def address_breakpoints(self):
"""Test that breakpoints set on a bad address say they are bad."""
- exe = os.path.join(os.getcwd(), "a.out")
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
+ (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+ "Set a breakpoint here", lldb.SBFileSpec("main.c"))
- # Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateBySourceRegex(
- "Set a breakpoint here", lldb.SBFileSpec("main.c"))
- self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Get the breakpoint location from breakpoint after we verified that,
- # indeed, it has one location.
- location = breakpoint.GetLocationAtIndex(0)
- self.assertTrue(location and
- location.IsEnabled(),
- VALID_BREAKPOINT_LOCATION)
-
- launch_info = lldb.SBLaunchInfo(None)
-
- error = lldb.SBError()
-
- process = target.Launch(launch_info, error)
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # Did we hit our breakpoint?
- from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
- threads = get_threads_stopped_at_breakpoint(process, breakpoint)
- self.assertTrue(
- len(threads) == 1,
- "There should be a thread stopped at our breakpoint")
-
- # The hit count for the breakpoint should be 1.
- self.assertTrue(breakpoint.GetHitCount() == 1)
-
# Now see if we can read from 0. If I can't do that, I don't have a good way to know
# what an illegal address is...
- error.Clear()
+ error = lldb.SBError()
ptr = process.ReadPointerFromMemory(0x0, error)
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py Wed Jul 19 07:03:07 2017 (r321194)
@@ -18,29 +18,9 @@ class ConsecutiveBreakpointsTestCase(TestBase):
def prepare_test(self):
self.build()
- exe = os.path.join(os.getcwd(), "a.out")
- # Create a target by the debugger.
- self.target = self.dbg.CreateTarget(exe)
- self.assertTrue(self.target, VALID_TARGET)
-
- breakpoint1 = self.target.BreakpointCreateBySourceRegex(
- "Set breakpoint here", lldb.SBFileSpec("main.cpp"))
- self.assertTrue(
- breakpoint1 and breakpoint1.GetNumLocations() == 1,
- VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- self.process = self.target.LaunchSimple(
- None, None, self.get_process_working_directory())
- self.assertIsNotNone(self.process, PROCESS_IS_VALID)
-
- # We should be stopped at the first breakpoint
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
- self.process, breakpoint1)
- self.assertIsNotNone(
- self.thread,
- "Expected one thread to be stopped at breakpoint 1")
+ (self.target, self.process, self.thread, bkpt) = lldbutil.run_to_source_breakpoint(
+ self, "Set breakpoint here", lldb.SBFileSpec("main.cpp"))
# Set breakpoint to the next instruction
frame = self.thread.GetFrameAtIndex(0)
Modified: vendor/lldb/dist/source/Host/CMakeLists.txt
==============================================================================
--- vendor/lldb/dist/source/Host/CMakeLists.txt Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/CMakeLists.txt Wed Jul 19 07:03:07 2017 (r321194)
@@ -103,6 +103,10 @@ else()
macosx/cfcpp/CFCMutableSet.cpp
macosx/cfcpp/CFCString.cpp
)
+ if(IOS)
+ set_property(SOURCE macosx/Host.mm APPEND PROPERTY
+ COMPILE_DEFINITIONS "NO_XPC_SERVICES=1")
+ endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
Modified: vendor/lldb/dist/source/Host/common/File.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/File.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/File.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
+#include <unistd.h>
#endif
#include "llvm/Support/ConvertUTF.h"
Modified: vendor/lldb/dist/source/Host/common/Host.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/Host.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/Host.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -46,6 +46,7 @@
#endif
// C++ Includes
+#include <csignal>
// Other libraries and framework includes
// Project includes
Modified: vendor/lldb/dist/source/Host/common/MainLoop.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/MainLoop.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/MainLoop.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -10,6 +10,7 @@
#include "llvm/Config/llvm-config.h"
#include "lldb/Host/MainLoop.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Utility/Status.h"
#include <algorithm>
#include <cassert>
Modified: vendor/lldb/dist/source/Host/common/NativeRegisterContext.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/NativeRegisterContext.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/NativeRegisterContext.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -345,17 +345,12 @@ Status NativeRegisterContext::ReadRegisterValueFromMem
return error;
}
- NativeProcessProtocolSP process_sp(m_thread.GetProcess());
- if (!process_sp) {
- error.SetErrorString("invalid process");
- return error;
- }
-
+ NativeProcessProtocol &process = m_thread.GetProcess();
uint8_t src[RegisterValue::kMaxRegisterByteSize];
// Read the memory
size_t bytes_read;
- error = process_sp->ReadMemory(src_addr, src, src_len, bytes_read);
+ error = process.ReadMemory(src_addr, src, src_len, bytes_read);
if (error.Fail())
return error;
@@ -374,7 +369,7 @@ Status NativeRegisterContext::ReadRegisterValueFromMem
// order of the memory data doesn't match the process. For now we are assuming
// they are the same.
lldb::ByteOrder byte_order;
- if (!process_sp->GetByteOrder(byte_order)) {
+ if (process.GetByteOrder(byte_order)) {
error.SetErrorString("NativeProcessProtocol::GetByteOrder () failed");
return error;
}
@@ -392,41 +387,37 @@ Status NativeRegisterContext::WriteRegisterValueToMemo
Status error;
- NativeProcessProtocolSP process_sp(m_thread.GetProcess());
- if (process_sp) {
+ NativeProcessProtocol &process = m_thread.GetProcess();
- // TODO: we might need to add a parameter to this function in case the byte
- // order of the memory data doesn't match the process. For now we are
- // assuming
- // they are the same.
- lldb::ByteOrder byte_order;
- if (!process_sp->GetByteOrder(byte_order))
- return Status("NativeProcessProtocol::GetByteOrder () failed");
+ // TODO: we might need to add a parameter to this function in case the byte
+ // order of the memory data doesn't match the process. For now we are
+ // assuming
+ // they are the same.
+ lldb::ByteOrder byte_order;
+ if (!process.GetByteOrder(byte_order))
+ return Status("NativeProcessProtocol::GetByteOrder () failed");
- const size_t bytes_copied =
- reg_value.GetAsMemoryData(reg_info, dst, dst_len, byte_order, error);
+ const size_t bytes_copied =
+ reg_value.GetAsMemoryData(reg_info, dst, dst_len, byte_order, error);
- if (error.Success()) {
- if (bytes_copied == 0) {
- error.SetErrorString("byte copy failed.");
- } else {
- size_t bytes_written;
- error =
- process_sp->WriteMemory(dst_addr, dst, bytes_copied, bytes_written);
- if (error.Fail())
- return error;
+ if (error.Success()) {
+ if (bytes_copied == 0) {
+ error.SetErrorString("byte copy failed.");
+ } else {
+ size_t bytes_written;
+ error = process.WriteMemory(dst_addr, dst, bytes_copied, bytes_written);
+ if (error.Fail())
+ return error;
- if (bytes_written != bytes_copied) {
- // This might happen if we read _some_ bytes but not all
- error.SetErrorStringWithFormat("only wrote %" PRIu64 " of %" PRIu64
- " bytes",
- static_cast<uint64_t>(bytes_written),
- static_cast<uint64_t>(bytes_copied));
- }
+ if (bytes_written != bytes_copied) {
+ // This might happen if we read _some_ bytes but not all
+ error.SetErrorStringWithFormat("only wrote %" PRIu64 " of %" PRIu64
+ " bytes",
+ static_cast<uint64_t>(bytes_written),
+ static_cast<uint64_t>(bytes_copied));
}
}
- } else
- error.SetErrorString("invalid process");
+ }
return error;
}
Modified: vendor/lldb/dist/source/Host/common/NativeThreadProtocol.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/NativeThreadProtocol.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/NativeThreadProtocol.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -16,9 +16,9 @@
using namespace lldb;
using namespace lldb_private;
-NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol *process,
+NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol &process,
lldb::tid_t tid)
- : m_process_wp(process->shared_from_this()), m_tid(tid) {}
+ : m_process(process), m_tid(tid) {}
Status NativeThreadProtocol::ReadRegister(uint32_t reg,
RegisterValue ®_value) {
@@ -61,8 +61,4 @@ Status NativeThreadProtocol::RestoreAllRegisters(lldb:
if (!register_context_sp)
return Status("no register context");
return register_context_sp->ReadAllRegisterValues(data_sp);
-}
-
-NativeProcessProtocolSP NativeThreadProtocol::GetProcess() {
- return m_process_wp.lock();
}
Modified: vendor/lldb/dist/source/Host/common/Socket.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/Socket.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/Socket.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -29,6 +29,7 @@
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <unistd.h>
#endif
#ifdef __linux__
Modified: vendor/lldb/dist/source/Host/common/SocketAddress.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/SocketAddress.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/SocketAddress.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -317,6 +317,13 @@ bool SocketAddress::IsAnyAddr() const {
: 0 == memcmp(&m_socket_addr.sa_ipv6.sin6_addr, &in6addr_any, 16);
}
+bool SocketAddress::IsLocalhost() const {
+ return (GetFamily() == AF_INET)
+ ? m_socket_addr.sa_ipv4.sin_addr.s_addr == htonl(INADDR_LOOPBACK)
+ : 0 == memcmp(&m_socket_addr.sa_ipv6.sin6_addr, &in6addr_loopback,
+ 16);
+}
+
bool SocketAddress::operator==(const SocketAddress &rhs) const {
if (GetFamily() != rhs.GetFamily())
return false;
Modified: vendor/lldb/dist/source/Host/common/TCPSocket.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/TCPSocket.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/common/TCPSocket.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -34,6 +34,7 @@
#define CLOSE_SOCKET closesocket
typedef const char *set_socket_option_arg_type;
#else
+#include <unistd.h>
#define CLOSE_SOCKET ::close
typedef const void *set_socket_option_arg_type;
#endif
Modified: vendor/lldb/dist/source/Host/linux/Host.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/linux/Host.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/linux/Host.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -16,6 +16,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
+#include <unistd.h>
// C++ Includes
// Other libraries and framework includes
Modified: vendor/lldb/dist/source/Host/linux/HostInfoLinux.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/linux/HostInfoLinux.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/linux/HostInfoLinux.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
+#include <unistd.h>
#include <algorithm>
#include <mutex> // std::once
Modified: vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -30,6 +30,7 @@
#ifndef LLDB_DISABLE_POSIX
#include <termios.h>
+#include <unistd.h>
#endif
// C++ Includes
Modified: vendor/lldb/dist/source/Host/posix/FileSystem.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/posix/FileSystem.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/posix/FileSystem.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -15,6 +15,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
#ifdef __linux__
#include <linux/magic.h>
#include <sys/mount.h>
Modified: vendor/lldb/dist/source/Host/posix/HostProcessPosix.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/posix/HostProcessPosix.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/posix/HostProcessPosix.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -13,7 +13,9 @@
#include "llvm/ADT/STLExtras.h"
+#include <csignal>
#include <limits.h>
+#include <unistd.h>
using namespace lldb_private;
Modified: vendor/lldb/dist/source/Host/posix/LockFilePosix.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/posix/LockFilePosix.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/posix/LockFilePosix.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -10,6 +10,7 @@
#include "lldb/Host/posix/LockFilePosix.h"
#include <fcntl.h>
+#include <unistd.h>
using namespace lldb;
using namespace lldb_private;
Modified: vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -19,8 +19,10 @@
#include <limits.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
+#include <unistd.h>
#include <sstream>
+#include <csignal>
#ifdef __ANDROID__
#include <android/api-level.h>
Modified: vendor/lldb/dist/source/Interpreter/CommandInterpreter.cpp
==============================================================================
--- vendor/lldb/dist/source/Interpreter/CommandInterpreter.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Interpreter/CommandInterpreter.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -2475,7 +2475,7 @@ void CommandInterpreter::HandleCommandsFromFile(
}
ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create) {
- std::lock_guard<std::mutex> locker(m_script_interpreter_mutex);
+ std::lock_guard<std::recursive_mutex> locker(m_script_interpreter_mutex);
if (!m_script_interpreter_sp) {
if (!can_create)
return nullptr;
Modified: vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -7,23 +7,11 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-// C++ Includes
-// Other libraries and framework includes
+#include "AuxVector.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
-
-#if defined(__linux__) || defined(__FreeBSD__)
-#include "Plugins/Process/elf-core/ProcessElfCore.h"
-#endif
-
-#include "AuxVector.h"
using namespace lldb;
using namespace lldb_private;
Modified: vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -451,16 +451,16 @@ void ClangModulesDeclVendorImpl::ForEachMacro(
bool first_arg = true;
- for (clang::MacroInfo::arg_iterator ai = macro_info->arg_begin(),
- ae = macro_info->arg_end();
- ai != ae; ++ai) {
+ for (auto pi = macro_info->param_begin(),
+ pe = macro_info->param_end();
+ pi != pe; ++pi) {
if (!first_arg) {
macro_expansion.append(", ");
} else {
first_arg = false;
}
- macro_expansion.append((*ai)->getName().str());
+ macro_expansion.append((*pi)->getName().str());
}
if (macro_info->isC99Varargs()) {
Modified: vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -274,6 +274,28 @@ bool CPlusPlusNameParser::ConsumeAnonymousNamespace()
return true;
}
+bool CPlusPlusNameParser::ConsumeLambda() {
+ Bookmark start_position = SetBookmark();
+ if (!ConsumeToken(tok::l_brace)) {
+ return false;
+ }
+ constexpr llvm::StringLiteral g_lambda("lambda");
+ if (HasMoreTokens() && Peek().is(tok::raw_identifier) &&
+ Peek().getRawIdentifier() == g_lambda) {
+ // Put the matched brace back so we can use ConsumeBrackets
+ TakeBack();
+ } else {
+ return false;
+ }
+
+ if (!ConsumeBrackets(tok::l_brace, tok::r_brace)) {
+ return false;
+ }
+
+ start_position.Remove();
+ return true;
+}
+
bool CPlusPlusNameParser::ConsumeBrackets(tok::TokenKind left,
tok::TokenKind right) {
Bookmark start_position = SetBookmark();
@@ -502,6 +524,15 @@ CPlusPlusNameParser::ParseFullNameImpl() {
state = State::AfterTwoColons;
break;
}
+ case tok::l_brace:
+ if (state == State::Beginning || state == State::AfterTwoColons) {
+ if (ConsumeLambda()) {
+ state = State::AfterIdentifier;
+ break;
+ }
+ }
+ continue_parsing = false;
+ break;
case tok::coloncolon: // Type nesting delimiter.
if (state != State::Beginning && state != State::AfterIdentifier &&
state != State::AfterTemplate) {
Modified: vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
==============================================================================
--- vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -143,6 +143,9 @@ class CPlusPlusNameParser { (private)
// Consumes '(anonymous namespace)'
bool ConsumeAnonymousNamespace();
+ // Consumes '{lambda ...}'
+ bool ConsumeLambda();
+
// Consumes operator declaration like 'operator *' or 'operator delete []'
bool ConsumeOperator();
Modified: vendor/lldb/dist/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -23,6 +23,7 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/FileSpec.h"
Modified: vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -214,7 +214,7 @@ static Status EnsureFDFlags(int fd, int flags) {
// Public Static Methods
// -----------------------------------------------------------------------------
-llvm::Expected<NativeProcessProtocolSP>
+llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
NativeProcessLinux::Factory::Launch(ProcessLaunchInfo &launch_info,
NativeDelegate &native_delegate,
MainLoop &mainloop) const {
@@ -259,14 +259,13 @@ NativeProcessLinux::Factory::Launch(ProcessLaunchInfo
return status.ToError();
}
- std::shared_ptr<NativeProcessLinux> process_sp(new NativeProcessLinux(
+ return std::unique_ptr<NativeProcessLinux>(new NativeProcessLinux(
pid, launch_info.GetPTY().ReleaseMasterFileDescriptor(), native_delegate,
- arch, mainloop));
- process_sp->InitializeThreads({pid});
- return process_sp;
+ arch, mainloop, {pid}));
}
-llvm::Expected<NativeProcessProtocolSP> NativeProcessLinux::Factory::Attach(
+llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
+NativeProcessLinux::Factory::Attach(
lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
MainLoop &mainloop) const {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
@@ -282,10 +281,8 @@ llvm::Expected<NativeProcessProtocolSP> NativeProcessL
if (!tids_or)
return tids_or.takeError();
- std::shared_ptr<NativeProcessLinux> process_sp(
- new NativeProcessLinux(pid, -1, native_delegate, arch, mainloop));
- process_sp->InitializeThreads(*tids_or);
- return process_sp;
+ return std::unique_ptr<NativeProcessLinux>(new NativeProcessLinux(
+ pid, -1, native_delegate, arch, mainloop, *tids_or));
}
// -----------------------------------------------------------------------------
@@ -294,7 +291,8 @@ llvm::Expected<NativeProcessProtocolSP> NativeProcessL
NativeProcessLinux::NativeProcessLinux(::pid_t pid, int terminal_fd,
NativeDelegate &delegate,
- const ArchSpec &arch, MainLoop &mainloop)
+ const ArchSpec &arch, MainLoop &mainloop,
+ llvm::ArrayRef<::pid_t> tids)
: NativeProcessProtocol(pid, terminal_fd, delegate), m_arch(arch) {
if (m_terminal_fd != -1) {
Status status = EnsureFDFlags(m_terminal_fd, O_NONBLOCK);
@@ -305,9 +303,7 @@ NativeProcessLinux::NativeProcessLinux(::pid_t pid, in
m_sigchld_handle = mainloop.RegisterSignal(
SIGCHLD, [this](MainLoopBase &) { SigchldHandler(); }, status);
assert(m_sigchld_handle && status.Success());
-}
-void NativeProcessLinux::InitializeThreads(llvm::ArrayRef<::pid_t> tids) {
for (const auto &tid : tids) {
NativeThreadLinuxSP thread_sp = AddThread(tid);
assert(thread_sp && "AddThread() returned a nullptr thread");
@@ -2009,7 +2005,7 @@ NativeThreadLinuxSP NativeProcessLinux::AddThread(lldb
if (m_threads.empty())
SetCurrentThreadID(thread_id);
- auto thread_sp = std::make_shared<NativeThreadLinux>(this, thread_id);
+ auto thread_sp = std::make_shared<NativeThreadLinux>(*this, thread_id);
m_threads.push_back(thread_sp);
if (m_pt_proces_trace_id != LLDB_INVALID_UID) {
Modified: vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.h
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.h Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.h Wed Jul 19 07:03:07 2017 (r321194)
@@ -10,7 +10,7 @@
#ifndef liblldb_NativeProcessLinux_H_
#define liblldb_NativeProcessLinux_H_
-// C++ Includes
+#include <csignal>
#include <unordered_set>
// Other libraries and framework includes
@@ -42,11 +42,11 @@ class NativeProcessLinux : public NativeProcessProtoco
public:
class Factory : public NativeProcessProtocol::Factory {
public:
- llvm::Expected<NativeProcessProtocolSP>
+ llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate,
MainLoop &mainloop) const override;
- llvm::Expected<NativeProcessProtocolSP>
+ llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Attach(lldb::pid_t pid, NativeDelegate &native_delegate,
MainLoop &mainloop) const override;
};
@@ -160,14 +160,13 @@ class NativeProcessLinux : public NativeProcessProtoco
// Private Instance Methods
// ---------------------------------------------------------------------
NativeProcessLinux(::pid_t pid, int terminal_fd, NativeDelegate &delegate,
- const ArchSpec &arch, MainLoop &mainloop);
+ const ArchSpec &arch, MainLoop &mainloop,
+ llvm::ArrayRef<::pid_t> tids);
// Returns a list of process threads that we have attached to.
static llvm::Expected<std::vector<::pid_t>> Attach(::pid_t pid);
static Status SetDefaultPtraceOpts(const lldb::pid_t);
-
- void InitializeThreads(llvm::ArrayRef<::pid_t> tids);
void MonitorCallback(lldb::pid_t pid, bool exited, WaitStatus status);
Modified: vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -30,11 +30,7 @@ lldb::ByteOrder NativeRegisterContextLinux::GetByteOrd
// read.
lldb::ByteOrder byte_order = lldb::eByteOrderInvalid;
- NativeProcessProtocolSP process_sp(m_thread.GetProcess());
- if (!process_sp)
- return byte_order;
-
- if (!process_sp->GetByteOrder(byte_order)) {
+ if (!m_thread.GetProcess().GetByteOrder(byte_order)) {
// FIXME log here
}
Modified: vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -873,7 +873,7 @@ Status NativeRegisterContextLinux_arm64::DoReadRegiste
PTRACE_GETREGSET, m_thread.GetID(), ®set, &ioVec, sizeof regs);
if (error.Success()) {
ArchSpec arch;
- if (m_thread.GetProcess()->GetArchitecture(arch))
+ if (m_thread.GetProcess().GetArchitecture(arch))
value.SetBytes((void *)(((unsigned char *)(®s)) + offset), 16,
arch.GetByteOrder());
else
@@ -890,7 +890,7 @@ Status NativeRegisterContextLinux_arm64::DoReadRegiste
PTRACE_GETREGSET, m_thread.GetID(), ®set, &ioVec, sizeof regs);
if (error.Success()) {
ArchSpec arch;
- if (m_thread.GetProcess()->GetArchitecture(arch))
+ if (m_thread.GetProcess().GetArchitecture(arch))
value.SetBytes((void *)(((unsigned char *)(regs)) + offset), 8,
arch.GetByteOrder());
else
Modified: vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -953,7 +953,7 @@ NativeRegisterContextLinux_mips64::GetWatchpointHitAdd
return LLDB_INVALID_ADDRESS;
EmulatorBaton baton(
- static_cast<NativeProcessLinux *>(m_thread.GetProcess().get()), this);
+ static_cast<NativeProcessLinux *>(&m_thread.GetProcess()), this);
emulator_ap->SetBaton(&baton);
emulator_ap->SetReadMemCallback(&ReadMemoryCallback);
emulator_ap->SetReadRegCallback(&ReadRegisterCallback);
@@ -1034,7 +1034,7 @@ Status NativeRegisterContextLinux_mips64::Read_SR_Conf
PTRACE_GETREGS, m_thread.GetID(), NULL, ®s, sizeof regs);
if (error.Success()) {
lldb_private::ArchSpec arch;
- if (m_thread.GetProcess()->GetArchitecture(arch)) {
+ if (m_thread.GetProcess().GetArchitecture(arch)) {
void *target_address = ((uint8_t *)®s) + offset +
4 * (arch.GetMachine() == llvm::Triple::mips);
value.SetUInt(*(uint32_t *)target_address, size);
Modified: vendor/lldb/dist/source/Plugins/Process/Linux/NativeThreadLinux.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/Linux/NativeThreadLinux.cpp Wed Jul 19 07:03:04 2017 (r321193)
+++ vendor/lldb/dist/source/Plugins/Process/Linux/NativeThreadLinux.cpp Wed Jul 19 07:03:07 2017 (r321194)
@@ -85,7 +85,7 @@ void LogThreadStopInfo(Log &log, const ThreadStopInfo
}
}
-NativeThreadLinux::NativeThreadLinux(NativeProcessLinux *process,
+NativeThreadLinux::NativeThreadLinux(NativeProcessLinux &process,
lldb::tid_t tid)
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
m_stop_info(), m_reg_context_sp(), m_stop_description() {}
@@ -144,12 +144,8 @@ NativeRegisterContextSP NativeThreadLinux::GetRegister
if (m_reg_context_sp)
return m_reg_context_sp;
- NativeProcessProtocolSP m_process_sp = m_process_wp.lock();
- if (!m_process_sp)
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-vendor
mailing list