summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-19 07:03:07 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-19 07:03:07 +0000
commita884e649599e13d58ce6d2b2a0ce8091ceb48dac (patch)
treef527514e113dd4f771eef3d39e5a5d2da36b8552
parente75e363cb71a7339552b9d943e78ac62b737379b (diff)
downloadsrc-test2-a884e649599e13d58ce6d2b2a0ce8091ceb48dac.tar.gz
src-test2-a884e649599e13d58ce6d2b2a0ce8091ceb48dac.zip
Notes
-rw-r--r--cmake/modules/LLDBConfig.cmake34
-rw-r--r--cmake/modules/LLDBStandalone.cmake1
-rw-r--r--include/lldb/Host/MainLoop.h2
-rw-r--r--include/lldb/Host/PosixApi.h2
-rw-r--r--include/lldb/Host/SocketAddress.h5
-rw-r--r--include/lldb/Host/common/NativeProcessProtocol.h7
-rw-r--r--include/lldb/Host/common/NativeThreadProtocol.h6
-rw-r--r--include/lldb/Interpreter/CommandInterpreter.h2
-rw-r--r--include/lldb/Utility/DataExtractor.h1
-rw-r--r--include/lldb/lldb-private-forward.h4
-rw-r--r--include/lldb/lldb-types.h24
-rw-r--r--packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py28
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py39
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py24
-rw-r--r--source/Host/CMakeLists.txt4
-rw-r--r--source/Host/common/File.cpp1
-rw-r--r--source/Host/common/Host.cpp1
-rw-r--r--source/Host/common/MainLoop.cpp1
-rw-r--r--source/Host/common/NativeRegisterContext.cpp67
-rw-r--r--source/Host/common/NativeThreadProtocol.cpp8
-rw-r--r--source/Host/common/Socket.cpp1
-rw-r--r--source/Host/common/SocketAddress.cpp7
-rw-r--r--source/Host/common/TCPSocket.cpp1
-rw-r--r--source/Host/linux/Host.cpp1
-rw-r--r--source/Host/linux/HostInfoLinux.cpp1
-rw-r--r--source/Host/posix/ConnectionFileDescriptorPosix.cpp1
-rw-r--r--source/Host/posix/FileSystem.cpp1
-rw-r--r--source/Host/posix/HostProcessPosix.cpp2
-rw-r--r--source/Host/posix/LockFilePosix.cpp1
-rw-r--r--source/Host/posix/ProcessLauncherPosixFork.cpp2
-rw-r--r--source/Interpreter/CommandInterpreter.cpp2
-rw-r--r--source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp14
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp8
-rw-r--r--source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp31
-rw-r--r--source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h3
-rw-r--r--source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp1
-rw-r--r--source/Plugins/Process/Linux/NativeProcessLinux.cpp24
-rw-r--r--source/Plugins/Process/Linux/NativeProcessLinux.h11
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp6
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp4
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp4
-rw-r--r--source/Plugins/Process/Linux/NativeThreadLinux.cpp24
-rw-r--r--source/Plugins/Process/Linux/NativeThreadLinux.h3
-rw-r--r--source/Plugins/Process/Linux/ProcessorTrace.h1
-rw-r--r--source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp23
-rw-r--r--source/Plugins/Process/NetBSD/NativeProcessNetBSD.h4
-rw-r--r--source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp10
-rw-r--r--source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp8
-rw-r--r--source/Plugins/Process/NetBSD/NativeThreadNetBSD.h3
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp560
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h2
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp2
-rw-r--r--source/Target/Target.cpp1
-rw-r--r--test/CMakeLists.txt14
-rw-r--r--tools/debugserver/CMakeLists.txt19
-rw-r--r--tools/debugserver/source/CMakeLists.txt20
-rw-r--r--tools/debugserver/source/MacOSX/CMakeLists.txt25
-rw-r--r--tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt2
-rw-r--r--tools/debugserver/source/MacOSX/i386/CMakeLists.txt4
-rw-r--r--tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt8
-rw-r--r--tools/debugserver/source/RNBSocket.cpp21
-rw-r--r--tools/driver/Driver.cpp1
-rw-r--r--tools/lldb-mi/MICmnLLDBDebugger.cpp1
-rw-r--r--tools/lldb-mi/MIDriver.cpp2
-rw-r--r--tools/lldb-mi/MIDriverMain.cpp1
-rw-r--r--tools/lldb-server/lldb-gdbserver.cpp4
-rw-r--r--unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp5
-rw-r--r--unittests/debugserver/RNBSocketTest.cpp2
68 files changed, 509 insertions, 648 deletions
diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
index bbf7a0838d26..726552675f47 100644
--- a/cmake/modules/LLDBConfig.cmake
+++ b/cmake/modules/LLDBConfig.cmake
@@ -10,15 +10,20 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darw
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
@@ -298,13 +303,15 @@ if (NOT LIBXML2_FOUND AND NOT (CMAKE_SYSTEM_NAME MATCHES "Windows"))
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)
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index 67e207e59edb..2f959c91fdd7 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -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
diff --git a/include/lldb/Host/MainLoop.h b/include/lldb/Host/MainLoop.h
index a722348b8843..5ac145ff865b 100644
--- a/include/lldb/Host/MainLoop.h
+++ b/include/lldb/Host/MainLoop.h
@@ -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
diff --git a/include/lldb/Host/PosixApi.h b/include/lldb/Host/PosixApi.h
index 02324307dc9e..d5c48dd6d170 100644
--- a/include/lldb/Host/PosixApi.h
+++ b/include/lldb/Host/PosixApi.h
@@ -16,6 +16,8 @@
#if defined(_WIN32)
#include "lldb/Host/windows/PosixApi.h"
+#else
+#include <unistd.h>
#endif
#endif
diff --git a/include/lldb/Host/SocketAddress.h b/include/lldb/Host/SocketAddress.h
index 8e9026ba962c..ebc6f4e57ee8 100644
--- a/include/lldb/Host/SocketAddress.h
+++ b/include/lldb/Host/SocketAddress.h
@@ -152,6 +152,11 @@ 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() {
diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h
index 5f2157510c0a..9671d710fc02 100644
--- a/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/include/lldb/Host/common/NativeProcessProtocol.h
@@ -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 @@ 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 @@ 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;
};
diff --git a/include/lldb/Host/common/NativeThreadProtocol.h b/include/lldb/Host/common/NativeThreadProtocol.h
index 2e6c96a34cf5..d96f71311185 100644
--- a/include/lldb/Host/common/NativeThreadProtocol.h
+++ b/include/lldb/Host/common/NativeThreadProtocol.h
@@ -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 @@ public:
lldb::tid_t GetID() const { return m_tid; }
- NativeProcessProtocolSP GetProcess();
+ NativeProcessProtocol &GetProcess() { return m_process; }
// ---------------------------------------------------------------------
// Thread-specific watchpoints
@@ -64,7 +64,7 @@ public:
virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0;
protected:
- NativeProcessProtocolWP m_process_wp;
+ NativeProcessProtocol &m_process;
lldb::tid_t m_tid;
};
}
diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h
index f47411079a3a..73bd7d6e6220 100644
--- a/include/lldb/Interpreter/CommandInterpreter.h
+++ b/include/lldb/Interpreter/CommandInterpreter.h
@@ -539,7 +539,7 @@ private:
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;
diff --git a/include/lldb/Utility/DataExtractor.h b/include/lldb/Utility/DataExtractor.h
index 58240d9a5268..4ef78c1af492 100644
--- a/include/lldb/Utility/DataExtractor.h
+++ b/include/lldb/Utility/DataExtractor.h
@@ -15,6 +15,7 @@
#include "lldb/lldb-forward.h" // for DataBufferSP
#include "lldb/lldb-types.h"
+#include <cassert>
#include <stdint.h>
#include <string.h>
diff --git a/include/lldb/lldb-private-forward.h b/include/lldb/lldb-private-forward.h
index 69a231132982..296facb1a0bd 100644
--- a/include/lldb/lldb-private-forward.h
+++ b/include/lldb/lldb-private-forward.h
@@ -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>
diff --git a/include/lldb/lldb-types.h b/include/lldb/lldb-types.h
index 07e9f5ac7161..fc445f55a9e5 100644
--- a/include/lldb/lldb-types.h
+++ b/include/lldb/lldb-types.h
@@ -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)(ExpressionEvaluationPhase phase,
#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;
diff --git a/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py b/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
index 9cc585b75aa1..3b01d4470de6 100644
--- a/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
+++ b/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
@@ -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.
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
index ca05356f9696..6f06ca7770c8 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
@@ -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)
-
- # 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)
+ (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+ "Set a breakpoint here", lldb.SBFileSpec("main.c"))
# 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)
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
index 312f2944102e..6afde150d8d7 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
@@ -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)
diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt
index 73d030e198af..2ee599cf43a2 100644
--- a/source/Host/CMakeLists.txt
+++ b/source/Host/CMakeLists.txt
@@ -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")
diff --git a/source/Host/common/File.cpp b/source/Host/common/File.cpp
index 90a4462c6ca9..6ee4e894756b 100644
--- a/source/Host/common/File.cpp
+++ b/source/Host/common/File.cpp
@@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
+#include <unistd.h>
#endif
#include "llvm/Support/ConvertUTF.h"
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 29e5991d31aa..8248aa3c5118 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -46,6 +46,7 @@
#endif
// C++ Includes
+#include <csignal>
// Other libraries and framework includes
// Project includes
diff --git a/source/Host/common/MainLoop.cpp b/source/Host/common/MainLoop.cpp
index c0c4471e735f..d0e0d00a3151 100644
--- a/source/Host/common/MainLoop.cpp
+++ b/source/Host/common/MainLoop.cpp
@@ -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>
diff --git a/source/Host/common/NativeRegisterContext.cpp b/source/Host/common/NativeRegisterContext.cpp
index 2ca95d707963..629b0247422d 100644
--- a/source/Host/common/NativeRegisterContext.cpp
+++ b/source/Host/common/NativeRegisterContext.cpp
@@ -345,17 +345,12 @@ Status NativeRegisterContext::ReadRegisterValueFromMemory(
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::ReadRegisterValueFromMemory(
// 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::WriteRegisterValueToMemory(
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 (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 (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));
}
}
- } else
- error.SetErrorString("invalid process");
+ }
return error;
}
diff --git a/source/Host/common/NativeThreadProtocol.cpp b/source/Host/common/NativeThreadProtocol.cpp
index 29e25bbc5692..54ac96dd3c6f 100644
--- a/source/Host/common/NativeThreadProtocol.cpp
+++ b/source/Host/common/NativeThreadProtocol.cpp
@@ -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 &reg_value) {
@@ -62,7 +62,3 @@ Status NativeThreadProtocol::RestoreAllRegisters(lldb::DataBufferSP &data_sp) {
return Status("no register context");
return register_context_sp->ReadAllRegisterValues(data_sp);
}
-
-NativeProcessProtocolSP NativeThreadProtocol::GetProcess() {
- return m_process_wp.lock();
-}
diff --git a/source/Host/common/Socket.cpp b/source/Host/common/Socket.cpp
index 0df9dc02c70f..5490e9b30bda 100644
--- a/source/Host/common/Socket.cpp
+++ b/source/Host/common/Socket.cpp
@@ -29,6 +29,7 @@
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <unistd.h>
#endif
#ifdef __linux__
diff --git a/source/Host/common/SocketAddress.cpp b/source/Host/common/SocketAddress.cpp
index 41150fa7fd74..def3e0359f01 100644
--- a/source/Host/common/SocketAddress.cpp
+++ b/source/Host/common/SocketAddress.cpp
@@ -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;
diff --git a/source/Host/common/TCPSocket.cpp b/source/Host/common/TCPSocket.cpp
index c013334ce23a..a7af93f10a7f 100644
--- a/source/Host/common/TCPSocket.cpp
+++ b/source/Host/common/TCPSocket.cpp
@@ -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
diff --git a/source/Host/linux/Host.cpp b/source/Host/linux/Host.cpp
index 486d4e3f0b81..f43090eadf81 100644
--- a/source/Host/linux/Host.cpp
+++ b/source/Host/linux/Host.cpp
@@ -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
diff --git a/source/Host/linux/HostInfoLinux.cpp b/source/Host/linux/HostInfoLinux.cpp
index 3ff722d5c109..8d59cda249e8 100644
--- a/source/Host/linux/HostInfoLinux.cpp
+++ b/source/Host/linux/HostInfoLinux.cpp
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
+#include <unistd.h>
#include <algorithm>
#include <mutex> // std::once
diff --git a/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index 105ef0f23d46..3797650105ce 100644
--- a/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -30,6 +30,7 @@
#ifndef LLDB_DISABLE_POSIX
#include <termios.h>
+#include <unistd.h>
#endif
// C++ Includes
diff --git a/source/Host/posix/FileSystem.cpp b/source/Host/posix/FileSystem.cpp
index e5a99e1aa754..3ece0677f991 100644
--- a/source/Host/posix/FileSystem.cpp
+++ b/source/Host/posix/FileSystem.cpp
@@ -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>
diff --git a/source/Host/posix/HostProcessPosix.cpp b/source/Host/posix/HostProcessPosix.cpp
index b5505dbec65b..3c5273f4bd3f 100644
--- a/source/Host/posix/HostProcessPosix.cpp
+++ b/source/Host/posix/HostProcessPosix.cpp
@@ -13,7 +13,9 @@
#include "llvm/ADT/STLExtras.h"
+#include <csignal>
#include <limits.h>
+#include <unistd.h>
using namespace lldb_private;
diff --git a/source/Host/posix/LockFilePosix.cpp b/source/Host/posix/LockFilePosix.cpp
index 2b7d548a021c..05423062bd44 100644
--- a/source/Host/posix/LockFilePosix.cpp
+++ b/source/Host/posix/LockFilePosix.cpp
@@ -10,6 +10,7 @@
#include "lldb/Host/posix/LockFilePosix.h"
#include <fcntl.h>
+#include <unistd.h>
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Host/posix/ProcessLauncherPosixFork.cpp b/source/Host/posix/ProcessLauncherPosixFork.cpp
index 0b40c24256ef..66c0229e0dab 100644
--- a/source/Host/posix/ProcessLauncherPosixFork.cpp
+++ b/source/Host/posix/ProcessLauncherPosixFork.cpp
@@ -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>
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 075f2e7b7bd1..986be7ffbf89 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -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;
diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
index 5dbb3bb4ef7e..7dd2b57da0cb 100644
--- a/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
+++ b/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
@@ -7,24 +7,12 @@
//
//===----------------------------------------------------------------------===//
-// 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;
diff --git a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 696bdf7e030d..bce0eaf6d57e 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -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()) {
diff --git a/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp b/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
index 5f0596cc9ad2..88bdd68ff301 100644
--- a/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
+++ b/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
@@ -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) {
diff --git a/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h b/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
index f936fb787c94..fe1d46f32c17 100644
--- a/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
+++ b/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
@@ -143,6 +143,9 @@ private:
// Consumes '(anonymous namespace)'
bool ConsumeAnonymousNamespace();
+ // Consumes '{lambda ...}'
+ bool ConsumeLambda();
+
// Consumes operator declaration like 'operator *' or 'operator delete []'
bool ConsumeOperator();
diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 645bfdfa770d..759ec7fd1d29 100644
--- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -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"
diff --git a/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index d988ee93a2bc..170d3b100064 100644
--- a/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -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 &launch_info,
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> NativeProcessLinux::Factory::Attach(
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> NativeProcessLinux::Factory::Attach(
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, int terminal_fd,
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::tid_t thread_id) {
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) {
diff --git a/source/Plugins/Process/Linux/NativeProcessLinux.h b/source/Plugins/Process/Linux/NativeProcessLinux.h
index 9584713d3654..c9ec002760f8 100644
--- a/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -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 NativeProcessProtocol {
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,15 +160,14 @@ private:
// 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);
void WaitForNewThread(::pid_t tid);
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
index 43253f388019..30f09f0c3a3f 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
@@ -30,11 +30,7 @@ lldb::ByteOrder NativeRegisterContextLinux::GetByteOrder() const {
// 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
}
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 1a5b304ac697..7aad062e3f93 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -873,7 +873,7 @@ Status NativeRegisterContextLinux_arm64::DoReadRegisterValue(
PTRACE_GETREGSET, m_thread.GetID(), &regset, &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), 16,
arch.GetByteOrder());
else
@@ -890,7 +890,7 @@ Status NativeRegisterContextLinux_arm64::DoReadRegisterValue(
PTRACE_GETREGSET, m_thread.GetID(), &regset, &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
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
index dee2c064a346..f35ff2be0d94 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
@@ -953,7 +953,7 @@ NativeRegisterContextLinux_mips64::GetWatchpointHitAddress(uint32_t wp_index) {
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_Config(uint32_t offset,
PTRACE_GETREGS, m_thread.GetID(), NULL, &regs, 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 *)&regs) + offset +
4 * (arch.GetMachine() == llvm::Triple::mips);
value.SetUInt(*(uint32_t *)target_address, size);
diff --git a/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index b1d13668f327..5cd40941dcf8 100644
--- a/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -85,7 +85,7 @@ void LogThreadStopInfo(Log &log, const ThreadStopInfo &stop_info,
}
}
-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::GetRegisterContext() {
if (m_reg_context_sp)
return m_reg_context_sp;
- NativeProcessProtocolSP m_process_sp = m_process_wp.lock();
- if (!m_process_sp)
- return NativeRegisterContextSP();
-
ArchSpec target_arch;
- if (!m_process_sp->GetArchitecture(target_arch))
+ if (!m_process.GetArchitecture(target_arch))
return NativeRegisterContextSP();
const uint32_t concrete_frame_idx = 0;
@@ -460,20 +456,10 @@ void NativeThreadLinux::MaybeLogStateChange(lldb::StateType new_state) {
if (new_state == old_state)
return;
- NativeProcessProtocolSP m_process_sp = m_process_wp.lock();
- lldb::pid_t pid =
- m_process_sp ? m_process_sp->GetID() : LLDB_INVALID_PROCESS_ID;
-
- // Log it.
- log->Printf("NativeThreadLinux: thread (pid=%" PRIu64 ", tid=%" PRIu64
- ") changing from state %s to %s",
- pid, GetID(), StateAsCString(old_state),
- StateAsCString(new_state));
+ LLDB_LOG(log, "pid={0}, tid={1}: changing from state {2} to {3}",
+ m_process.GetID(), GetID(), old_state, new_state);
}
NativeProcessLinux &NativeThreadLinux::GetProcess() {
- auto process_sp = std::static_pointer_cast<NativeProcessLinux>(
- NativeThreadProtocol::GetProcess());
- assert(process_sp);
- return *process_sp;
+ return static_cast<NativeProcessLinux &>(m_process);
}
diff --git a/source/Plugins/Process/Linux/NativeThreadLinux.h b/source/Plugins/Process/Linux/NativeThreadLinux.h
index b9126b3752a0..6ae87feffcda 100644
--- a/source/Plugins/Process/Linux/NativeThreadLinux.h
+++ b/source/Plugins/Process/Linux/NativeThreadLinux.h
@@ -14,6 +14,7 @@
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/lldb-private-forward.h"
+#include <csignal>
#include <map>
#include <memory>
#include <string>
@@ -27,7 +28,7 @@ class NativeThreadLinux : public NativeThreadProtocol {
friend class NativeProcessLinux;
public:
- NativeThreadLinux(NativeProcessLinux *process, lldb::tid_t tid);
+ NativeThreadLinux(NativeProcessLinux &process, lldb::tid_t tid);
// ---------------------------------------------------------------------
// NativeThreadProtocol Interface
diff --git a/source/Plugins/Process/Linux/ProcessorTrace.h b/source/Plugins/Process/Linux/ProcessorTrace.h
index ddcaf0f842b5..6603c7d60478 100644
--- a/source/Plugins/Process/Linux/ProcessorTrace.h
+++ b/source/Plugins/Process/Linux/ProcessorTrace.h
@@ -18,6 +18,7 @@
#include <linux/perf_event.h>
#include <sys/mman.h>
+#include <unistd.h>
namespace lldb_private {
diff --git a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
index b9ef02efa65d..388989a21f76 100644
--- a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -64,7 +64,7 @@ static Status EnsureFDFlags(int fd, int flags) {
// Public Static Methods
// -----------------------------------------------------------------------------
-llvm::Expected<NativeProcessProtocolSP>
+llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
NativeProcessNetBSD::Factory::Launch(ProcessLaunchInfo &launch_info,
NativeDelegate &native_delegate,
MainLoop &mainloop) const {
@@ -101,24 +101,25 @@ NativeProcessNetBSD::Factory::Launch(ProcessLaunchInfo &launch_info,
LLDB_LOG(log, "pid = {0:x}, detected architecture {1}", pid,
arch.GetArchitectureName());
- std::shared_ptr<NativeProcessNetBSD> process_sp(new NativeProcessNetBSD(
+ std::unique_ptr<NativeProcessNetBSD> process_up(new NativeProcessNetBSD(
pid, launch_info.GetPTY().ReleaseMasterFileDescriptor(), native_delegate,
arch, mainloop));
- status = process_sp->ReinitializeThreads();
+ status = process_up->ReinitializeThreads();
if (status.Fail())
return status.ToError();
- for (const auto &thread_sp : process_sp->m_threads) {
+ for (const auto &thread_sp : process_up->m_threads) {
static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
SIGSTOP);
}
- process_sp->SetState(StateType::eStateStopped);
+ process_up->SetState(StateType::eStateStopped);
- return process_sp;
+ return std::move(process_up);
}
-llvm::Expected<NativeProcessProtocolSP> NativeProcessNetBSD::Factory::Attach(
+llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
+NativeProcessNetBSD::Factory::Attach(
lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
MainLoop &mainloop) const {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
@@ -130,14 +131,14 @@ llvm::Expected<NativeProcessProtocolSP> NativeProcessNetBSD::Factory::Attach(
if (!status.Success())
return status.ToError();
- std::shared_ptr<NativeProcessNetBSD> process_sp(
+ std::unique_ptr<NativeProcessNetBSD> process_up(
new NativeProcessNetBSD(pid, -1, native_delegate, arch, mainloop));
- status = process_sp->Attach();
+ status = process_up->Attach();
if (!status.Success())
return status.ToError();
- return process_sp;
+ return std::move(process_up);
}
// -----------------------------------------------------------------------------
@@ -787,7 +788,7 @@ NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) {
if (m_threads.empty())
SetCurrentThreadID(thread_id);
- auto thread_sp = std::make_shared<NativeThreadNetBSD>(this, thread_id);
+ auto thread_sp = std::make_shared<NativeThreadNetBSD>(*this, thread_id);
m_threads.push_back(thread_sp);
return thread_sp;
}
diff --git a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
index 34b892f1fc88..2cbd5e30ab23 100644
--- a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+++ b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
@@ -34,11 +34,11 @@ class NativeProcessNetBSD : public NativeProcessProtocol {
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;
};
diff --git a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
index b442fc3462cc..dde86880c41a 100644
--- a/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
+++ b/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
@@ -104,15 +104,9 @@ Status NativeRegisterContextNetBSD::DoWriteDBR(void *buf) {
}
NativeProcessNetBSD &NativeRegisterContextNetBSD::GetProcess() {
- auto process_sp =
- std::static_pointer_cast<NativeProcessNetBSD>(m_thread.GetProcess());
- assert(process_sp);
- return *process_sp;
+ return static_cast<NativeProcessNetBSD &>(m_thread.GetProcess());
}
::pid_t NativeRegisterContextNetBSD::GetProcessPid() {
- NativeProcessNetBSD &process = GetProcess();
- lldb::pid_t pid = process.GetID();
-
- return pid;
+ return GetProcess().GetID();
}
diff --git a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
index 8a16431b016d..1fd7400bf800 100644
--- a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -24,7 +24,7 @@ using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::process_netbsd;
-NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
+NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD &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 NativeThreadNetBSD::GetRegisterContext() {
if (m_reg_context_sp)
return m_reg_context_sp;
- NativeProcessProtocolSP m_process_sp = m_process_wp.lock();
- if (!m_process_sp)
- return NativeRegisterContextSP();
-
ArchSpec target_arch;
- if (!m_process_sp->GetArchitecture(target_arch))
+ if (!m_process.GetArchitecture(target_arch))
return NativeRegisterContextSP();
const uint32_t concrete_frame_idx = 0;
diff --git a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
index dcd360cdd310..1e3f587be5f5 100644
--- a/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+++ b/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -12,6 +12,7 @@
#include "lldb/Host/common/NativeThreadProtocol.h"
+#include <csignal>
#include <map>
#include <string>
@@ -24,7 +25,7 @@ class NativeThreadNetBSD : public NativeThreadProtocol {
friend class NativeProcessNetBSD;
public:
- NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
+ NativeThreadNetBSD(NativeProcessNetBSD &process, lldb::tid_t tid);
// ---------------------------------------------------------------------
// NativeThreadProtocol Interface
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index a7fe4ee3b147..9294359dbef1 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/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"
@@ -239,7 +240,7 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
{
std::lock_guard<std::recursive_mutex> 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 +251,7 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
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 +264,13 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
// 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 $O "
+ "gdb-remote commands",
+ m_debugged_process_up->GetID());
// Setup stdout/stderr mapping from inferior to $O
- auto terminal_fd = m_debugged_process_sp->GetTerminalFileDescriptor();
+ auto terminal_fd = m_debugged_process_up->GetTerminalFileDescriptor();
if (terminal_fd >= 0) {
if (log)
log->Printf("ProcessGDBRemoteCommunicationServerLLGS::%s setting "
@@ -286,16 +286,15 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
__FUNCTION__, terminal_fd);
}
} else {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " skipping stdout/stderr redirection via $O: inferior will "
- "communicate over client-provided file descriptors",
- __FUNCTION__, m_debugged_process_sp->GetID());
+ LLDB_LOG(log,
+ "pid = {0} skipping stdout/stderr redirection via $O: inferior "
+ "will communicate over client-provided file descriptors",
+ m_debugged_process_up->GetID());
}
printf("Launched '%s' as process %" PRIu64 "...\n",
m_process_launch_info.GetArguments().GetArgumentAtIndex(0),
- m_debugged_process_sp->GetID());
+ m_debugged_process_up->GetID());
return Status();
}
@@ -308,12 +307,12 @@ Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) {
// Before we try to attach, make sure we aren't already monitoring something
// else.
- if (m_debugged_process_sp &&
- m_debugged_process_sp->GetID() != LLDB_INVALID_PROCESS_ID)
+ if (m_debugged_process_up &&
+ m_debugged_process_up->GetID() != LLDB_INVALID_PROCESS_ID)
return Status("cannot attach to a process %" PRIu64
" when another process with pid %" PRIu64
" is being debugged.",
- pid, m_debugged_process_sp->GetID());
+ pid, m_debugged_process_up->GetID());
// Try to attach.
auto process_or = m_process_factory.Attach(pid, *this, m_mainloop);
@@ -323,10 +322,10 @@ Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) {
status);
return status;
}
- m_debugged_process_sp = *process_or;
+ m_debugged_process_up = std::move(*process_or);
// Setup stdout/stderr mapping from inferior.
- auto terminal_fd = m_debugged_process_sp->GetTerminalFileDescriptor();
+ auto terminal_fd = m_debugged_process_up->GetTerminalFileDescriptor();
if (terminal_fd >= 0) {
if (log)
log->Printf("ProcessGDBRemoteCommunicationServerLLGS::%s setting "
@@ -597,18 +596,15 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
// Ensure we have a debugged process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(50);
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s preparing packet for pid %" PRIu64
- " tid %" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID(), tid);
+ LLDB_LOG(log, "preparing packet for pid {0} tid {1}",
+ m_debugged_process_up->GetID(), tid);
// Ensure we can get info on the given thread.
- NativeThreadProtocolSP thread_sp(m_debugged_process_sp->GetThreadByID(tid));
+ NativeThreadProtocolSP thread_sp(m_debugged_process_up->GetThreadByID(tid));
if (!thread_sp)
return SendErrorResponse(51);
@@ -629,13 +625,11 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
// Output the T packet with the thread
response.PutChar('T');
int signum = tid_stop_info.details.signal.signo;
- if (log) {
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " tid %" PRIu64
- " got signal signo = %d, reason = %d, exc_type = %" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID(), tid, signum,
- tid_stop_info.reason, tid_stop_info.details.exception.type);
- }
+ LLDB_LOG(
+ log,
+ "pid {0}, tid {1}, got signal signo = {2}, reason = {3}, exc_type = {4}",
+ m_debugged_process_up->GetID(), tid, signum, int(tid_stop_info.reason),
+ tid_stop_info.details.exception.type);
// Print the signal number.
response.PutHex8(signum & 0xff);
@@ -673,9 +667,9 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
uint32_t thread_index = 0;
NativeThreadProtocolSP listed_thread_sp;
for (listed_thread_sp =
- m_debugged_process_sp->GetThreadAtIndex(thread_index);
+ m_debugged_process_up->GetThreadAtIndex(thread_index);
listed_thread_sp; ++thread_index,
- listed_thread_sp = m_debugged_process_sp->GetThreadAtIndex(
+ listed_thread_sp = m_debugged_process_up->GetThreadAtIndex(
thread_index)) {
if (thread_index > 0)
response.PutChar(',');
@@ -692,24 +686,23 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
if (thread_index > 0) {
const bool threads_with_valid_stop_info_only = true;
JSONArray::SP threads_info_sp = GetJSONThreadsInfo(
- *m_debugged_process_sp, threads_with_valid_stop_info_only);
+ *m_debugged_process_up, threads_with_valid_stop_info_only);
if (threads_info_sp) {
response.PutCString("jstopinfo:");
StreamString unescaped_response;
threads_info_sp->Write(unescaped_response);
response.PutCStringAsRawHex8(unescaped_response.GetData());
response.PutChar(';');
- } else if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to prepare a "
- "jstopinfo field for pid %" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID());
+ } else
+ LLDB_LOG(log, "failed to prepare a jstopinfo field for pid {0}",
+ m_debugged_process_up->GetID());
}
uint32_t i = 0;
response.PutCString("thread-pcs");
char delimiter = ':';
for (NativeThreadProtocolSP thread_sp;
- (thread_sp = m_debugged_process_sp->GetThreadAtIndex(i)) != nullptr;
+ (thread_sp = m_debugged_process_up->GetThreadAtIndex(i)) != nullptr;
++i) {
NativeRegisterContextSP reg_ctx_sp = thread_sp->GetRegisterContext();
if (!reg_ctx_sp)
@@ -1069,8 +1062,8 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceStart(
StringExtractorGDBRemote &packet) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(68);
if (!packet.ConsumeFront("jTraceStart:"))
@@ -1120,7 +1113,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceStart(
Status error;
lldb::user_id_t uid = LLDB_INVALID_UID;
- uid = m_debugged_process_sp->StartTrace(options, error);
+ uid = m_debugged_process_up->StartTrace(options, error);
LLDB_LOG(log, "uid is {0} , error is {1}", uid, error.GetError());
if (error.Fail())
return SendErrorResponse(error);
@@ -1134,8 +1127,8 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_jTraceStop(
StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(68);
if (!packet.ConsumeFront("jTraceStop:"))
@@ -1157,7 +1150,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceStop(
json_dict->GetValueForKeyAsInteger("threadid", tid);
- Status error = m_debugged_process_sp->StopTrace(uid, tid);
+ Status error = m_debugged_process_up->StopTrace(uid, tid);
if (error.Fail())
return SendErrorResponse(error);
@@ -1170,8 +1163,8 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceConfigRead(
StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(68);
if (!packet.ConsumeFront("jTraceConfigRead:"))
@@ -1200,7 +1193,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceConfigRead(
StreamGDBRemote response;
options.setThreadID(threadid);
- Status error = m_debugged_process_sp->GetTraceConfig(uid, options);
+ Status error = m_debugged_process_up->GetTraceConfig(uid, options);
if (error.Fail())
return SendErrorResponse(error);
@@ -1228,8 +1221,8 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceRead(
StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(68);
enum PacketType { MetaData, BufferData };
@@ -1274,9 +1267,9 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceRead(
llvm::MutableArrayRef<uint8_t> buf(buffer.get(), byte_count);
if (tracetype == BufferData)
- error = m_debugged_process_sp->GetData(uid, tid, buf, offset);
+ error = m_debugged_process_up->GetData(uid, tid, buf, offset);
else if (tracetype == MetaData)
- error = m_debugged_process_sp->GetMetaData(uid, tid, buf, offset);
+ error = m_debugged_process_up->GetMetaData(uid, tid, buf, offset);
if (error.Fail())
return SendErrorResponse(error);
@@ -1293,11 +1286,11 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_qProcessInfo(
StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(68);
- lldb::pid_t pid = m_debugged_process_sp->GetID();
+ lldb::pid_t pid = m_debugged_process_up->GetID();
if (pid == LLDB_INVALID_PROCESS_ID)
return SendErrorResponse(1);
@@ -1314,16 +1307,16 @@ GDBRemoteCommunicationServerLLGS::Handle_qProcessInfo(
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_qC(StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(68);
// Make sure we set the current thread so g and p packets return
// the data the gdb will expect.
- lldb::tid_t tid = m_debugged_process_sp->GetCurrentThreadID();
+ lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID();
SetCurrentThreadID(tid);
- NativeThreadProtocolSP thread_sp = m_debugged_process_sp->GetCurrentThread();
+ NativeThreadProtocolSP thread_sp = m_debugged_process_up->GetCurrentThread();
if (!thread_sp)
return SendErrorResponse(69);
@@ -1339,20 +1332,15 @@ GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote &packet) {
StopSTDIOForwarding();
- if (!m_debugged_process_sp) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s No debugged process found.",
- __FUNCTION__);
+ if (!m_debugged_process_up) {
+ LLDB_LOG(log, "No debugged process found.");
return PacketResult::Success;
}
- Status error = m_debugged_process_sp->Kill();
- if (error.Fail() && log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s Failed to kill debugged "
- "process %" PRIu64 ": %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ Status error = m_debugged_process_up->Kill();
+ if (error.Fail())
+ LLDB_LOG(log, "Failed to kill debugged process {0}: {1}",
+ m_debugged_process_up->GetID(), error);
// No OK response for kill packet.
// return SendOKResponse ();
@@ -1400,7 +1388,7 @@ GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) {
log->Printf("GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
// Ensure we have a native process.
- if (!m_debugged_process_sp) {
+ if (!m_debugged_process_up) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s no debugged process "
"shared pointer",
@@ -1453,26 +1441,20 @@ GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) {
} else {
// Send the signal to the process since we weren't targeting a specific
// continue thread with the signal.
- error = m_debugged_process_sp->Signal(signo);
+ error = m_debugged_process_up->Signal(signo);
if (error.Fail()) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to send "
- "signal for process %" PRIu64 ": %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "failed to send signal for process {0}: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x52);
}
}
// Resume the threads.
- error = m_debugged_process_sp->Resume(resume_actions);
+ error = m_debugged_process_up->Resume(resume_actions);
if (error.Fail()) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to resume "
- "threads for process %" PRIu64 ": %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "failed to resume threads for process {0}: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x38);
}
@@ -1492,15 +1474,13 @@ GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) {
// For now just support all continue.
const bool has_continue_address = (packet.GetBytesLeft() > 0);
if (has_continue_address) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s not implemented for "
- "c{address} variant [%s remains]",
- __FUNCTION__, packet.Peek());
+ LLDB_LOG(log, "not implemented for c[address] variant [{0} remains]",
+ packet.Peek());
return SendUnimplementedResponse(packet.GetStringRef().c_str());
}
// Ensure we have a native process.
- if (!m_debugged_process_sp) {
+ if (!m_debugged_process_up) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s no debugged process "
"shared pointer",
@@ -1511,22 +1491,14 @@ GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) {
// Build the ResumeActionList
ResumeActionList actions(StateType::eStateRunning, 0);
- Status error = m_debugged_process_sp->Resume(actions);
+ Status error = m_debugged_process_up->Resume(actions);
if (error.Fail()) {
- if (log) {
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s c failed for process %" PRIu64
- ": %s",
- __FUNCTION__, m_debugged_process_sp->GetID(), error.AsCString());
- }
+ LLDB_LOG(log, "c failed for process {0}: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(GDBRemoteServerError::eErrorResume);
}
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s continued process %" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID());
-
+ LLDB_LOG(log, "continued process {0}", m_debugged_process_up->GetID());
// No response required from continue.
return PacketResult::Success;
}
@@ -1570,11 +1542,8 @@ GDBRemoteCommunicationServerLLGS::Handle_vCont(
}
// Ensure we have a native process.
- if (!m_debugged_process_sp) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s no debugged process "
- "shared pointer",
- __FUNCTION__);
+ if (!m_debugged_process_up) {
+ LLDB_LOG(log, "no debugged process");
return SendErrorResponse(0x36);
}
@@ -1635,44 +1604,30 @@ GDBRemoteCommunicationServerLLGS::Handle_vCont(
thread_actions.Append(thread_action);
}
- Status error = m_debugged_process_sp->Resume(thread_actions);
+ Status error = m_debugged_process_up->Resume(thread_actions);
if (error.Fail()) {
- if (log) {
- log->Printf("GDBRemoteCommunicationServerLLGS::%s vCont failed for "
- "process %" PRIu64 ": %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
- }
+ LLDB_LOG(log, "vCont failed for process {0}: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(GDBRemoteServerError::eErrorResume);
}
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s continued process %" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID());
-
+ LLDB_LOG(log, "continued process {0}", m_debugged_process_up->GetID());
// No response required from vCont.
return PacketResult::Success;
}
void GDBRemoteCommunicationServerLLGS::SetCurrentThreadID(lldb::tid_t tid) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s setting current thread "
- "id to %" PRIu64,
- __FUNCTION__, tid);
+ LLDB_LOG(log, "setting current thread id to {0}", tid);
m_current_tid = tid;
- if (m_debugged_process_sp)
- m_debugged_process_sp->SetCurrentThreadID(m_current_tid);
+ if (m_debugged_process_up)
+ m_debugged_process_up->SetCurrentThreadID(m_current_tid);
}
void GDBRemoteCommunicationServerLLGS::SetContinueThreadID(lldb::tid_t tid) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s setting continue thread "
- "id to %" PRIu64,
- __FUNCTION__, tid);
+ LLDB_LOG(log, "setting continue thread id to {0}", tid);
m_continue_tid = tid;
}
@@ -1683,10 +1638,10 @@ GDBRemoteCommunicationServerLLGS::Handle_stop_reason(
// Handle the $? gdbremote command.
// If no process, indicate error
- if (!m_debugged_process_sp)
+ if (!m_debugged_process_up)
return SendErrorResponse(02);
- return SendStopReasonForState(m_debugged_process_sp->GetState());
+ return SendStopReasonForState(m_debugged_process_up->GetState());
}
GDBRemoteCommunication::PacketResult
@@ -1707,7 +1662,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReasonForState(
case eStateSuspended:
case eStateStopped:
case eStateCrashed: {
- lldb::tid_t tid = m_debugged_process_sp->GetCurrentThreadID();
+ lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID();
// Make sure we set the current thread so g and p packets return
// the data the gdb will expect.
SetCurrentThreadID(tid);
@@ -1717,15 +1672,11 @@ GDBRemoteCommunicationServerLLGS::SendStopReasonForState(
case eStateInvalid:
case eStateUnloaded:
case eStateExited:
- return SendWResponse(m_debugged_process_sp.get());
+ return SendWResponse(m_debugged_process_up.get());
default:
- if (log) {
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- ", current state reporting not handled: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- StateAsCString(process_state));
- }
+ LLDB_LOG(log, "pid {0}, current state reporting not handled: {1}",
+ m_debugged_process_up->GetID(), process_state);
break;
}
@@ -1736,12 +1687,12 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo(
StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(68);
// Ensure we have a thread.
- NativeThreadProtocolSP thread_sp(m_debugged_process_sp->GetThreadAtIndex(0));
+ NativeThreadProtocolSP thread_sp(m_debugged_process_up->GetThreadAtIndex(0));
if (!thread_sp)
return SendErrorResponse(69);
@@ -1945,47 +1896,33 @@ GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo(
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s() no process (%s), "
- "returning OK",
- __FUNCTION__,
- m_debugged_process_sp ? "invalid process id"
- : "null m_debugged_process_sp");
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ LLDB_LOG(log, "no process ({0}), returning OK",
+ m_debugged_process_up ? "invalid process id"
+ : "null m_debugged_process_up");
return SendOKResponse();
}
StreamGDBRemote response;
response.PutChar('m');
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s() starting thread iteration",
- __FUNCTION__);
-
+ LLDB_LOG(log, "starting thread iteration");
NativeThreadProtocolSP thread_sp;
uint32_t thread_index;
for (thread_index = 0,
- thread_sp = m_debugged_process_sp->GetThreadAtIndex(thread_index);
+ thread_sp = m_debugged_process_up->GetThreadAtIndex(thread_index);
thread_sp; ++thread_index,
- thread_sp = m_debugged_process_sp->GetThreadAtIndex(thread_index)) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s() iterated thread %" PRIu32
- "(%s, tid=0x%" PRIx64 ")",
- __FUNCTION__, thread_index, thread_sp ? "is not null" : "null",
- thread_sp ? thread_sp->GetID() : LLDB_INVALID_THREAD_ID);
+ thread_sp = m_debugged_process_up->GetThreadAtIndex(thread_index)) {
+ LLDB_LOG(log, "iterated thread {0}({1}, tid={2})", thread_index,
+ thread_sp ? "is not null" : "null",
+ thread_sp ? thread_sp->GetID() : LLDB_INVALID_THREAD_ID);
if (thread_index > 0)
response.PutChar(',');
response.Printf("%" PRIx64, thread_sp->GetID());
}
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s() finished thread iteration",
- __FUNCTION__);
-
+ LLDB_LOG(log, "finished thread iteration");
return SendPacketNoLock(response.GetString());
}
@@ -2026,11 +1963,10 @@ GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) {
// Get the thread's register context.
NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
if (!reg_context_sp) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 " tid %" PRIu64
- " failed, no register context available for the thread",
- __FUNCTION__, m_debugged_process_sp->GetID(), thread_sp->GetID());
+ LLDB_LOG(
+ log,
+ "pid {0} tid {1} failed, no register context available for the thread",
+ m_debugged_process_up->GetID(), thread_sp->GetID());
return SendErrorResponse(0x15);
}
@@ -2113,8 +2049,8 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
// Get process architecture.
ArchSpec process_arch;
- if (!m_debugged_process_sp ||
- !m_debugged_process_sp->GetArchitecture(process_arch)) {
+ if (!m_debugged_process_up ||
+ !m_debugged_process_up->GetArchitecture(process_arch)) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to retrieve "
"inferior architecture",
@@ -2143,7 +2079,7 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 " tid %" PRIu64
" failed, no register context available for the thread",
- __FUNCTION__, m_debugged_process_sp->GetID(), thread_sp->GetID());
+ __FUNCTION__, m_debugged_process_up->GetID(), thread_sp->GetID());
return SendErrorResponse(0x15);
}
@@ -2197,8 +2133,8 @@ GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2241,7 +2177,7 @@ GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) {
// Ensure we have the given thread when not specifying -1 (all threads) or 0
// (any thread).
if (tid != LLDB_INVALID_THREAD_ID && tid != 0) {
- NativeThreadProtocolSP thread_sp(m_debugged_process_sp->GetThreadByID(tid));
+ NativeThreadProtocolSP thread_sp(m_debugged_process_up->GetThreadByID(tid));
if (!thread_sp) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, tid %" PRIu64
@@ -2275,8 +2211,8 @@ GDBRemoteCommunicationServerLLGS::Handle_I(StringExtractorGDBRemote &packet) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2311,30 +2247,21 @@ GDBRemoteCommunicationServerLLGS::Handle_interrupt(
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
- __FUNCTION__);
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ LLDB_LOG(log, "failed, no process available");
return SendErrorResponse(0x15);
}
// Interrupt the process.
- Status error = m_debugged_process_sp->Interrupt();
+ Status error = m_debugged_process_up->Interrupt();
if (error.Fail()) {
- if (log) {
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s failed for process %" PRIu64
- ": %s",
- __FUNCTION__, m_debugged_process_sp->GetID(), error.AsCString());
- }
+ LLDB_LOG(log, "failed for process {0}: {1}", m_debugged_process_up->GetID(),
+ error);
return SendErrorResponse(GDBRemoteServerError::eErrorResume);
}
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s stopped process %" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID());
+ LLDB_LOG(log, "stopped process {0}", m_debugged_process_up->GetID());
// No response required from stop all.
return PacketResult::Success;
@@ -2345,8 +2272,8 @@ GDBRemoteCommunicationServerLLGS::Handle_memory_read(
StringExtractorGDBRemote &packet) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2388,13 +2315,13 @@ GDBRemoteCommunicationServerLLGS::Handle_memory_read(
// Retrieve the process memory.
size_t bytes_read = 0;
- Status error = m_debugged_process_sp->ReadMemoryWithoutTrap(
+ Status error = m_debugged_process_up->ReadMemoryWithoutTrap(
read_addr, &buf[0], byte_count, bytes_read);
if (error.Fail()) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
" mem 0x%" PRIx64 ": failed to read. Error: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(), read_addr,
+ __FUNCTION__, m_debugged_process_up->GetID(), read_addr,
error.AsCString());
return SendErrorResponse(0x08);
}
@@ -2403,7 +2330,7 @@ GDBRemoteCommunicationServerLLGS::Handle_memory_read(
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
" mem 0x%" PRIx64 ": read 0 of %" PRIu64 " requested bytes",
- __FUNCTION__, m_debugged_process_sp->GetID(), read_addr,
+ __FUNCTION__, m_debugged_process_up->GetID(), read_addr,
byte_count);
return SendErrorResponse(0x08);
}
@@ -2426,8 +2353,8 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2455,10 +2382,7 @@ GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) {
const uint64_t byte_count = packet.GetHexMaxU64(false, 0);
if (byte_count == 0) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s nothing to write: "
- "zero-length packet",
- __FUNCTION__);
+ LLDB_LOG(log, "nothing to write: zero-length packet");
return PacketResult::Success;
}
@@ -2476,12 +2400,11 @@ GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) {
StreamGDBRemote response;
const uint64_t convert_count = packet.GetHexBytes(buf, 0);
if (convert_count != byte_count) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " mem 0x%" PRIx64 ": asked to write %" PRIu64
- " bytes, but only found %" PRIu64 " to convert.",
- __FUNCTION__, m_debugged_process_sp->GetID(), write_addr,
- byte_count, convert_count);
+ LLDB_LOG(log,
+ "pid {0} mem {1:x}: asked to write {2} bytes, but only found {3} "
+ "to convert.",
+ m_debugged_process_up->GetID(), write_addr, byte_count,
+ convert_count);
return SendIllFormedResponse(packet, "M content byte length specified did "
"not match hex-encoded content "
"length");
@@ -2489,23 +2412,17 @@ GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) {
// Write the process memory.
size_t bytes_written = 0;
- Status error = m_debugged_process_sp->WriteMemory(write_addr, &buf[0],
+ Status error = m_debugged_process_up->WriteMemory(write_addr, &buf[0],
byte_count, bytes_written);
if (error.Fail()) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " mem 0x%" PRIx64 ": failed to write. Error: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(), write_addr,
- error.AsCString());
+ LLDB_LOG(log, "pid {0} mem {1:x}: failed to write. Error: {2}",
+ m_debugged_process_up->GetID(), write_addr, error);
return SendErrorResponse(0x09);
}
if (bytes_written == 0) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " mem 0x%" PRIx64 ": wrote 0 of %" PRIu64 " requested bytes",
- __FUNCTION__, m_debugged_process_sp->GetID(), write_addr,
- byte_count);
+ LLDB_LOG(log, "pid {0} mem {1:x}: wrote 0 of {2} requested bytes",
+ m_debugged_process_up->GetID(), write_addr, byte_count);
return SendErrorResponse(0x09);
}
@@ -2525,8 +2442,8 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfoSupported(
// Ensure we have a process running; otherwise, we can't figure this out
// since we won't have a NativeProcessProtocol.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2537,7 +2454,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfoSupported(
// Test if we can get any region back when asking for the region around NULL.
MemoryRegionInfo region_info;
const Status error =
- m_debugged_process_sp->GetMemoryRegionInfo(0, region_info);
+ m_debugged_process_up->GetMemoryRegionInfo(0, region_info);
if (error.Fail()) {
// We don't support memory region info collection for this
// NativeProcessProtocol.
@@ -2553,8 +2470,8 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
// Ensure we have a process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2575,7 +2492,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(
// Get the memory region info for the target address.
MemoryRegionInfo region_info;
const Status error =
- m_debugged_process_sp->GetMemoryRegionInfo(read_addr, region_info);
+ m_debugged_process_up->GetMemoryRegionInfo(read_addr, region_info);
if (error.Fail()) {
// Return the error message.
@@ -2619,13 +2536,10 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) {
// Ensure we have a process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
- __FUNCTION__);
+ LLDB_LOG(log, "failed, no process available");
return SendErrorResponse(0x15);
}
@@ -2693,28 +2607,22 @@ GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) {
if (want_breakpoint) {
// Try to set the breakpoint.
const Status error =
- m_debugged_process_sp->SetBreakpoint(addr, size, want_hardware);
+ m_debugged_process_up->SetBreakpoint(addr, size, want_hardware);
if (error.Success())
return SendOKResponse();
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " failed to set breakpoint: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "pid {0} failed to set breakpoint: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x09);
} else {
// Try to set the watchpoint.
- const Status error = m_debugged_process_sp->SetWatchpoint(
+ const Status error = m_debugged_process_up->SetWatchpoint(
addr, size, watch_flags, want_hardware);
if (error.Success())
return SendOKResponse();
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " failed to set watchpoint: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "pid {0} failed to set watchpoint: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x09);
}
}
@@ -2722,13 +2630,10 @@ GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) {
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) {
// Ensure we have a process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
- __FUNCTION__);
+ LLDB_LOG(log, "failed, no process available");
return SendErrorResponse(0x15);
}
@@ -2790,27 +2695,21 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) {
if (want_breakpoint) {
// Try to clear the breakpoint.
const Status error =
- m_debugged_process_sp->RemoveBreakpoint(addr, want_hardware);
+ m_debugged_process_up->RemoveBreakpoint(addr, want_hardware);
if (error.Success())
return SendOKResponse();
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " failed to remove breakpoint: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "pid {0} failed to remove breakpoint: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x09);
} else {
// Try to clear the watchpoint.
- const Status error = m_debugged_process_sp->RemoveWatchpoint(addr);
+ const Status error = m_debugged_process_up->RemoveWatchpoint(addr);
if (error.Success())
return SendOKResponse();
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " failed to remove watchpoint: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "pid {0} failed to remove watchpoint: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x09);
}
}
@@ -2820,8 +2719,8 @@ GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
// Ensure we have a process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2840,7 +2739,7 @@ GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) {
// Double check that we have such a thread.
// TODO investigate: on MacOSX we might need to do an UpdateThreads () here.
- NativeThreadProtocolSP thread_sp = m_debugged_process_sp->GetThreadByID(tid);
+ NativeThreadProtocolSP thread_sp = m_debugged_process_up->GetThreadByID(tid);
if (!thread_sp || thread_sp->GetID() != tid)
return SendErrorResponse(0x33);
@@ -2853,12 +2752,12 @@ GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) {
// All other threads stop while we're single stepping a thread.
actions.SetDefaultThreadActionIfNeeded(eStateStopped, 0);
- Status error = m_debugged_process_sp->Resume(actions);
+ Status error = m_debugged_process_up->Resume(actions);
if (error.Fail()) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
" tid %" PRIu64 " Resume() failed with error: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(), tid,
+ __FUNCTION__, m_debugged_process_up->GetID(), tid,
error.AsCString());
return SendErrorResponse(0x49);
}
@@ -2901,8 +2800,8 @@ GDBRemoteCommunicationServerLLGS::Handle_qXfer_auxv_read(
// Grab the auxv data if we need it.
if (!m_active_auxv_buffer_up) {
// Make sure we have a valid process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -2911,7 +2810,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qXfer_auxv_read(
}
// Grab the auxv data.
- auto buffer_or_error = m_debugged_process_sp->GetAuxvData();
+ auto buffer_or_error = m_debugged_process_up->GetAuxvData();
if (!buffer_or_error) {
std::error_code ec = buffer_or_error.getError();
LLDB_LOG(log, "no auxv data retrieved: {0}", ec.message());
@@ -2979,11 +2878,10 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState(
// Grab the register context for the thread.
NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
if (!reg_context_sp) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 " tid %" PRIu64
- " failed, no register context available for the thread",
- __FUNCTION__, m_debugged_process_sp->GetID(), thread_sp->GetID());
+ LLDB_LOG(
+ log,
+ "pid {0} tid {1} failed, no register context available for the thread",
+ m_debugged_process_up->GetID(), thread_sp->GetID());
return SendErrorResponse(0x15);
}
@@ -2991,11 +2889,8 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState(
DataBufferSP register_data_sp;
Status error = reg_context_sp->ReadAllRegisterValues(register_data_sp);
if (error.Fail()) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " failed to save all register values: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "pid {0} failed to save all register values: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x75);
}
@@ -3029,10 +2924,8 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(
const uint32_t save_id = packet.GetU32(0);
if (save_id == 0) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s QRestoreRegisterState "
- "packet has malformed save id, expecting decimal uint32_t",
- __FUNCTION__);
+ LLDB_LOG(log, "QRestoreRegisterState packet has malformed save id, "
+ "expecting decimal uint32_t");
return SendErrorResponse(0x76);
}
@@ -3050,11 +2943,10 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(
// Grab the register context for the thread.
NativeRegisterContextSP reg_context_sp(thread_sp->GetRegisterContext());
if (!reg_context_sp) {
- if (log)
- log->Printf(
- "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64 " tid %" PRIu64
- " failed, no register context available for the thread",
- __FUNCTION__, m_debugged_process_sp->GetID(), thread_sp->GetID());
+ LLDB_LOG(
+ log,
+ "pid {0} tid {1} failed, no register context available for the thread",
+ m_debugged_process_up->GetID(), thread_sp->GetID());
return SendErrorResponse(0x15);
}
@@ -3066,10 +2958,9 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(
// Find the register set buffer for the given save id.
auto it = m_saved_registers_map.find(save_id);
if (it == m_saved_registers_map.end()) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " does not have a register set save buffer for id %" PRIu32,
- __FUNCTION__, m_debugged_process_sp->GetID(), save_id);
+ LLDB_LOG(log,
+ "pid {0} does not have a register set save buffer for id {1}",
+ m_debugged_process_up->GetID(), save_id);
return SendErrorResponse(0x77);
}
register_data_sp = it->second;
@@ -3080,11 +2971,8 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(
Status error = reg_context_sp->WriteAllRegisterValues(register_data_sp);
if (error.Fail()) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
- " failed to restore all register values: %s",
- __FUNCTION__, m_debugged_process_sp->GetID(),
- error.AsCString());
+ LLDB_LOG(log, "pid {0} failed to restore all register values: {1}",
+ m_debugged_process_up->GetID(), error);
return SendErrorResponse(0x77);
}
@@ -3124,7 +3012,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vAttach(
}
// Notify we attached by sending a stop packet.
- return SendStopReasonForState(m_debugged_process_sp->GetState());
+ return SendStopReasonForState(m_debugged_process_up->GetState());
}
GDBRemoteCommunication::PacketResult
@@ -3134,8 +3022,8 @@ GDBRemoteCommunicationServerLLGS::Handle_D(StringExtractorGDBRemote &packet) {
StopSTDIOForwarding();
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)) {
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
if (log)
log->Printf(
"GDBRemoteCommunicationServerLLGS::%s failed, no process available",
@@ -3157,16 +3045,16 @@ GDBRemoteCommunicationServerLLGS::Handle_D(StringExtractorGDBRemote &packet) {
return SendIllFormedResponse(packet, "D failed to parse the process id");
}
- if (pid != LLDB_INVALID_PROCESS_ID && m_debugged_process_sp->GetID() != pid) {
+ if (pid != LLDB_INVALID_PROCESS_ID && m_debugged_process_up->GetID() != pid) {
return SendIllFormedResponse(packet, "Invalid pid");
}
- const Status error = m_debugged_process_sp->Detach();
+ const Status error = m_debugged_process_up->Detach();
if (error.Fail()) {
if (log)
log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to detach from "
"pid %" PRIu64 ": %s\n",
- __FUNCTION__, m_debugged_process_sp->GetID(),
+ __FUNCTION__, m_debugged_process_up->GetID(),
error.AsCString());
return SendErrorResponse(0x01);
}
@@ -3197,24 +3085,18 @@ GDBRemoteCommunicationServerLLGS::Handle_jThreadsInfo(
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
// Ensure we have a debugged process.
- if (!m_debugged_process_sp ||
- (m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID))
+ if (!m_debugged_process_up ||
+ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID))
return SendErrorResponse(50);
-
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s preparing packet for pid "
- "%" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID());
+ LLDB_LOG(log, "preparing packet for pid {0}", m_debugged_process_up->GetID());
StreamString response;
const bool threads_with_valid_stop_info_only = false;
JSONArray::SP threads_array_sp = GetJSONThreadsInfo(
- *m_debugged_process_sp, threads_with_valid_stop_info_only);
+ *m_debugged_process_up, threads_with_valid_stop_info_only);
if (!threads_array_sp) {
- if (log)
- log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to prepare a "
- "packet for pid %" PRIu64,
- __FUNCTION__, m_debugged_process_sp->GetID());
+ LLDB_LOG(log, "failed to prepare a packet for pid {0}",
+ m_debugged_process_up->GetID());
return SendErrorResponse(52);
}
@@ -3228,8 +3110,8 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_qWatchpointSupportInfo(
StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)
+ if (!m_debugged_process_up ||
+ m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)
return SendErrorResponse(68);
packet.SetFilePos(strlen("qWatchpointSupportInfo"));
@@ -3238,7 +3120,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qWatchpointSupportInfo(
if (packet.GetChar() != ':')
return SendErrorResponse(67);
- auto hw_debug_cap = m_debugged_process_sp->GetHardwareDebugSupportInfo();
+ auto hw_debug_cap = m_debugged_process_up->GetHardwareDebugSupportInfo();
StreamGDBRemote response;
if (hw_debug_cap == llvm::None)
@@ -3253,8 +3135,8 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_qFileLoadAddress(
StringExtractorGDBRemote &packet) {
// Fail if we don't have a current process.
- if (!m_debugged_process_sp ||
- m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)
+ if (!m_debugged_process_up ||
+ m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)
return SendErrorResponse(67);
packet.SetFilePos(strlen("qFileLoadAddress:"));
@@ -3266,7 +3148,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qFileLoadAddress(
lldb::addr_t file_load_address = LLDB_INVALID_ADDRESS;
Status error =
- m_debugged_process_sp->GetFileLoadAddress(file_name, file_load_address);
+ m_debugged_process_up->GetFileLoadAddress(file_name, file_load_address);
if (error.Fail())
return SendErrorResponse(69);
@@ -3302,10 +3184,10 @@ GDBRemoteCommunicationServerLLGS::Handle_QPassSignals(
}
// Fail if we don't have a current process.
- if (!m_debugged_process_sp)
+ if (!m_debugged_process_up)
return SendErrorResponse(68);
- Status error = m_debugged_process_sp->IgnoreSignals(signals);
+ Status error = m_debugged_process_up->IgnoreSignals(signals);
if (error.Fail())
return SendErrorResponse(69);
@@ -3342,8 +3224,8 @@ NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
NativeThreadProtocolSP thread_sp;
// We have no thread if we don't have a process.
- if (!m_debugged_process_sp ||
- m_debugged_process_sp->GetID() == LLDB_INVALID_PROCESS_ID)
+ if (!m_debugged_process_up ||
+ m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)
return thread_sp;
// If the client hasn't asked for thread suffix support, there will not be a
@@ -3355,9 +3237,9 @@ NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
return thread_sp;
else if (current_tid == 0) {
// Pick a thread.
- return m_debugged_process_sp->GetThreadAtIndex(0);
+ return m_debugged_process_up->GetThreadAtIndex(0);
} else
- return m_debugged_process_sp->GetThreadByID(current_tid);
+ return m_debugged_process_up->GetThreadByID(current_tid);
}
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
@@ -3387,7 +3269,7 @@ NativeThreadProtocolSP GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
packet.SetFilePos(packet.GetFilePos() + strlen("thread:"));
const lldb::tid_t tid = packet.GetHexMaxU64(false, 0);
if (tid != 0)
- return m_debugged_process_sp->GetThreadByID(tid);
+ return m_debugged_process_up->GetThreadByID(tid);
return thread_sp;
}
@@ -3397,9 +3279,9 @@ lldb::tid_t GDBRemoteCommunicationServerLLGS::GetCurrentThreadID() const {
// Use whatever the debug process says is the current thread id
// since the protocol either didn't specify or specified we want
// any/all threads marked as the current thread.
- if (!m_debugged_process_sp)
+ if (!m_debugged_process_up)
return LLDB_INVALID_THREAD_ID;
- return m_debugged_process_sp->GetCurrentThreadID();
+ return m_debugged_process_up->GetCurrentThreadID();
}
// Use the specific current thread id set by the gdb remote protocol.
return m_current_tid;
@@ -3420,9 +3302,9 @@ void GDBRemoteCommunicationServerLLGS::ClearProcessSpecificData() {
FileSpec
GDBRemoteCommunicationServerLLGS::FindModuleFile(const std::string &module_path,
const ArchSpec &arch) {
- if (m_debugged_process_sp) {
+ if (m_debugged_process_up) {
FileSpec file_spec;
- if (m_debugged_process_sp
+ if (m_debugged_process_up
->GetLoadedModuleFileSpec(module_path.c_str(), file_spec)
.Success()) {
if (file_spec.Exists())
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
index b065642d4aed..71199473bb8e 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -114,7 +114,7 @@ protected:
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<NativeProcessProtocol> m_debugged_process_up;
Communication m_stdio_communication;
MainLoop::ReadHandleUP m_stdio_handle_up;
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 8a66f3865ebc..be11dd9bc7ec 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -16,6 +16,7 @@
#include <netinet/in.h>
#include <sys/mman.h> // for mmap
#include <sys/socket.h>
+#include <unistd.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
@@ -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"
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 4632ada26ed3..d97f651ca08b 100644
--- a/source/Target/Target.cpp
+++ b/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"
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0cb744760a58..824dff51865d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -49,8 +49,8 @@ endif()
# Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script
set(LLDB_TEST_USER_ARGS
- "${LLDB_TEST_USER_ARGS_New}"
- CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'" FORCE)
+ ""
+ CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'")
set(LLDB_TEST_COMMON_ARGS
--arch=${LLDB_TEST_ARCH}
@@ -101,19 +101,19 @@ if(CMAKE_HOST_APPLE)
list(APPEND LLDB_TEST_COMMON_ARGS --server $<TARGET_FILE:debugserver>)
endif()
+set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
+
add_python_test_target(check-lldb-single
${LLDB_SOURCE_DIR}/test/dotest.py
- "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
- "Testing LLDB with args: ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
+ "--no-multiprocess;${LLDB_DOTEST_ARGS}"
+ "Testing LLDB with args: ${LLDB_DOTEST_ARGS}"
)
-set(LLDB_DOTEST_ARGS -q;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
-
# If tests crash cause LLDB to crash, or things are otherwise unstable, or if machine-parsable
# output is desired (i.e. in continuous integration contexts) check-lldb-single is a better target.
add_python_test_target(check-lldb
${LLDB_SOURCE_DIR}/test/dotest.py
- "${LLDB_DOTEST_ARGS}"
+ "-q;${LLDB_DOTEST_ARGS}"
"Testing LLDB (parallel execution, with a separate subprocess per test)"
)
diff --git a/tools/debugserver/CMakeLists.txt b/tools/debugserver/CMakeLists.txt
index d8414e5a2fe0..ae436b8f07c3 100644
--- a/tools/debugserver/CMakeLists.txt
+++ b/tools/debugserver/CMakeLists.txt
@@ -1,2 +1,19 @@
-project(C CXX ASM-ATT)
+cmake_minimum_required(VERSION 3.4.3)
+
+project(Debugserver LANGUAGES C CXX ASM-ATT)
+
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_MODULE_PATH
+ ${CMAKE_MODULE_PATH}
+ "${CMAKE_SOURCE_DIR}/../../cmake"
+ "${CMAKE_SOURCE_DIR}/../../cmake/modules"
+ )
+
+ include(LLDBStandalone)
+ include(AddLLDB)
+
+ set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
+ include_directories(${LLDB_SOURCE_DIR}/include)
+endif()
+
add_subdirectory(source)
diff --git a/tools/debugserver/source/CMakeLists.txt b/tools/debugserver/source/CMakeLists.txt
index 775a1a127b6f..bdca1602f4a8 100644
--- a/tools/debugserver/source/CMakeLists.txt
+++ b/tools/debugserver/source/CMakeLists.txt
@@ -1,3 +1,4 @@
+include(CheckCXXCompilerFlag)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
include_directories(${LLDB_SOURCE_DIR}/source)
include_directories(MacOSX/DarwinLog)
@@ -25,7 +26,6 @@ if (CXX_SUPPORTS_NO_EXTENDED_OFFSETOF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof")
endif ()
-find_library(COCOA_LIBRARY Cocoa)
add_subdirectory(MacOSX)
set(generated_mach_interfaces
@@ -91,11 +91,23 @@ set(lldbDebugserverCommonSources
add_library(lldbDebugserverCommon ${lldbDebugserverCommonSources})
+
+if (APPLE)
+ if(IOS)
+ find_library(COCOA_LIBRARY UIKit)
+ target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY} ${CORE_FOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY})
+ else()
+ find_library(COCOA_LIBRARY Cocoa)
+ target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY})
+ endif()
+endif()
+
target_link_libraries(lldbDebugserverCommon
INTERFACE ${COCOA_LIBRARY}
- lldbDebugserverMacOSX_I386
- lldbDebugserverMacOSX_X86_64
- lldbDebugserverMacOSX_DarwinLog)
+ ${CORE_FOUNDATION_LIBRARY}
+ ${FOUNDATION_LIBRARY}
+ lldbDebugserverArchSupport
+ lldbDebugserverDarwin_DarwinLog)
set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
diff --git a/tools/debugserver/source/MacOSX/CMakeLists.txt b/tools/debugserver/source/MacOSX/CMakeLists.txt
index 59b39a1bff63..28877d122d94 100644
--- a/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ b/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -1,8 +1,23 @@
-#add_subdirectory(arm64)
-#add_subdirectory(arm)
-add_subdirectory(i386)
-#add_subdirectory(ppc)
-add_subdirectory(x86_64)
+if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*arm.*")
+ list(APPEND SOURCES arm/DNBArchImpl.cpp arm64/DNBArchImplARM64.cpp)
+ include_directories(${CURRENT_SOURCE_DIR}/arm ${CURRENT_SOURCE_DIR}/arm64)
+endif()
+
+if(NOT CMAKE_OSX_ARCHITECTURES OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*86.*")
+ list(APPEND SOURCES i386/DNBArchImplI386.cpp x86_64/DNBArchImplX86_64.cpp)
+ include_directories(${CURRENT_SOURCE_DIR}/i386 ${CURRENT_SOURCE_DIR}/x86_64)
+endif()
+
+if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*ppc.*")
+ list(APPEND SOURCES ppc/DNBArchImpl.cpp)
+ include_directories(${CURRENT_SOURCE_DIR}/ppc)
+endif()
+
add_subdirectory(DarwinLog)
include_directories(..)
+
+include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
+add_library(lldbDebugserverArchSupport
+ ${SOURCES}
+ )
diff --git a/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt b/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
index 47e7362f0d5e..dffa357f1e68 100644
--- a/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
+++ b/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
@@ -3,7 +3,7 @@
# we must include the grandparent directory...
include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
-add_library(lldbDebugserverMacOSX_DarwinLog
+add_library(lldbDebugserverDarwin_DarwinLog
ActivityStore.cpp
DarwinLogCollector.cpp
LogFilter.cpp
diff --git a/tools/debugserver/source/MacOSX/i386/CMakeLists.txt b/tools/debugserver/source/MacOSX/i386/CMakeLists.txt
deleted file mode 100644
index dee2c1ea96b0..000000000000
--- a/tools/debugserver/source/MacOSX/i386/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
-add_library(lldbDebugserverMacOSX_I386
- DNBArchImplI386.cpp
- )
diff --git a/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt b/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt
deleted file mode 100644
index bb41b04d9d9e..000000000000
--- a/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Due to sources including headers like:
-# #include "MacOSX/i386/DNBArchImplI386.h"
-# we must include the grandparent directory...
-include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
-
-add_library(lldbDebugserverMacOSX_X86_64
- DNBArchImplX86_64.cpp
- )
diff --git a/tools/debugserver/source/RNBSocket.cpp b/tools/debugserver/source/RNBSocket.cpp
index 62a3e4f9adf5..f1db5e419ff2 100644
--- a/tools/debugserver/source/RNBSocket.cpp
+++ b/tools/debugserver/source/RNBSocket.cpp
@@ -79,9 +79,17 @@ rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
return rnb_err;
}
+ bool any_addr = (strcmp(listen_host, "*") == 0);
+
+ // If the user wants to allow connections from any address we should create
+ // sockets on all families that can resolve localhost. This will allow us to
+ // listen for IPv6 and IPv4 connections from all addresses if those interfaces
+ // are available.
+ const char *local_addr = any_addr ? "localhost" : listen_host;
+
std::map<int, lldb_private::SocketAddress> sockets;
auto addresses = lldb_private::SocketAddress::GetAddressInfo(
- listen_host, NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
+ local_addr, NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
for (auto address : addresses) {
int sock_fd = ::socket(address.GetFamily(), SOCK_STREAM, IPPROTO_TCP);
@@ -90,9 +98,15 @@ rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
SetSocketOption(sock_fd, SOL_SOCKET, SO_REUSEADDR, 1);
- address.SetPort(port);
+ lldb_private::SocketAddress bind_address = address;
+
+ if(any_addr || !bind_address.IsLocalhost())
+ bind_address.SetToAnyAddress(bind_address.GetFamily(), port);
+ else
+ bind_address.SetPort(port);
- int error = ::bind(sock_fd, &address.sockaddr(), address.GetLength());
+ int error =
+ ::bind(sock_fd, &bind_address.sockaddr(), bind_address.GetLength());
if (error == -1) {
ClosePort(sock_fd, false);
continue;
@@ -179,6 +193,7 @@ rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
DNBLogThreaded("error: rejecting connection from %s (expecting %s)\n",
accept_addr.GetIPAddress().c_str(),
addr_in.GetIPAddress().c_str());
+ err.Clear();
}
}
}
diff --git a/tools/driver/Driver.cpp b/tools/driver/Driver.cpp
index 8e226a97af35..102ba775da91 100644
--- a/tools/driver/Driver.cpp
+++ b/tools/driver/Driver.cpp
@@ -9,6 +9,7 @@
#include "Driver.h"
+#include <csignal>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
diff --git a/tools/lldb-mi/MICmnLLDBDebugger.cpp b/tools/lldb-mi/MICmnLLDBDebugger.cpp
index a676ecc92602..b102cab9f93a 100644
--- a/tools/lldb-mi/MICmnLLDBDebugger.cpp
+++ b/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 <cassert>
// In-house headers:
#include "MICmnLLDBDebugSessionInfo.h"
diff --git a/tools/lldb-mi/MIDriver.cpp b/tools/lldb-mi/MIDriver.cpp
index 49e8588bf732..7bd6b7b2e166 100644
--- a/tools/lldb-mi/MIDriver.cpp
+++ b/tools/lldb-mi/MIDriver.cpp
@@ -9,6 +9,8 @@
// Third party headers:
#include "lldb/API/SBError.h"
+#include <cassert>
+#include <csignal>
#include <fstream>
// In-house headers:
diff --git a/tools/lldb-mi/MIDriverMain.cpp b/tools/lldb-mi/MIDriverMain.cpp
index fdced8dd4ea2..be01f1d97790 100644
--- a/tools/lldb-mi/MIDriverMain.cpp
+++ b/tools/lldb-mi/MIDriverMain.cpp
@@ -33,6 +33,7 @@
// Third party headers:
#include "lldb/API/SBHostOS.h"
+#include <csignal>
#include <stdio.h>
// In house headers:
diff --git a/tools/lldb-server/lldb-gdbserver.cpp b/tools/lldb-server/lldb-gdbserver.cpp
index 337f244c2c2d..f1a9b113c8ee 100644
--- a/tools/lldb-server/lldb-gdbserver.cpp
+++ b/tools/lldb-server/lldb-gdbserver.cpp
@@ -67,13 +67,13 @@ typedef process_netbsd::NativeProcessNetBSD::Factory NativeProcessFactory;
// Dummy implementation to make sure the code compiles
class NativeProcessFactory : public NativeProcessProtocol::Factory {
public:
- llvm::Expected<NativeProcessProtocolSP>
+ llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Launch(ProcessLaunchInfo &launch_info,
NativeProcessProtocol::NativeDelegate &delegate,
MainLoop &mainloop) const override {
llvm_unreachable("Not implemented");
}
- llvm::Expected<NativeProcessProtocolSP>
+ llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Attach(lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &delegate,
MainLoop &mainloop) const override {
llvm_unreachable("Not implemented");
diff --git a/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp b/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
index 8c7fade83759..1e7dd77c4dee 100644
--- a/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ b/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -62,6 +62,11 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
"XX::(anonymous namespace)::anon_class", "anon_func", "()", "const",
"XX::(anonymous namespace)::anon_class::anon_func"},
+ // Lambda
+ {"main::{lambda()#1}::operator()() const::{lambda()#1}::operator()() const",
+ "main::{lambda()#1}::operator()() const::{lambda()#1}", "operator()", "()", "const",
+ "main::{lambda()#1}::operator()() const::{lambda()#1}::operator()"},
+
// Function pointers
{"string (*f(vector<int>&&))(float)", "", "f", "(vector<int>&&)", "",
"f"},
diff --git a/unittests/debugserver/RNBSocketTest.cpp b/unittests/debugserver/RNBSocketTest.cpp
index 163e12bfcac8..37169a53de5a 100644
--- a/unittests/debugserver/RNBSocketTest.cpp
+++ b/unittests/debugserver/RNBSocketTest.cpp
@@ -85,6 +85,8 @@ TEST(RNBSocket, LoopBackListenIPv4) { TestSocketListen("127.0.0.1"); }
TEST(RNBSocket, LoopBackListenIPv6) { TestSocketListen("::1"); }
+TEST(RNBSocket, AnyListen) { TestSocketListen("*"); }
+
void TestSocketConnect(const char *addr) {
// Skip IPv6 tests if there isn't a valid interafce
auto addresses = lldb_private::SocketAddress::GetAddressInfo(