[Lldb-commits] [lldb] r237078 - Get lldb-server building on android-9
Vince Harron
vince at nethacker.com
Mon May 11 18:10:56 PDT 2015
Author: vharron
Date: Mon May 11 20:10:56 2015
New Revision: 237078
URL: http://llvm.org/viewvc/llvm-project?rev=237078&view=rev
Log:
Get lldb-server building on android-9
Build lldb-server with an android-9 sysroot.
Added:
lldb/trunk/include/lldb/Host/Time.h
lldb/trunk/include/lldb/Host/linux/Personality.h
lldb/trunk/include/lldb/Host/linux/Ptrace.h
lldb/trunk/include/lldb/Host/linux/Signalfd.h
lldb/trunk/include/lldb/Host/posix/Fcntl.h
lldb/trunk/source/Host/android/LibcGlue.cpp
Modified:
lldb/trunk/cmake/platforms/Android.cmake
lldb/trunk/include/lldb/Host/android/Android.h
lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Host/posix/HostInfoPosix.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Utility/PseudoTerminal.cpp
Modified: lldb/trunk/cmake/platforms/Android.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/platforms/Android.cmake?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/cmake/platforms/Android.cmake (original)
+++ lldb/trunk/cmake/platforms/Android.cmake Mon May 11 20:10:56 2015
@@ -85,12 +85,21 @@ if( NOT CMAKE_C_COMPILER )
set( CMAKE_RANLIB "${ANDROID_TOOLCHAIN_DIR}/bin/${ANDROID_TOOLCHAIN_NAME}-ranlib${EXECUTABLE_SUFFIX}" CACHE PATH "ranlib" )
endif()
-set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT} -pie -fPIE -funwind-tables -fsigned-char -no-canonical-prefixes" )
+set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT} -funwind-tables -fsigned-char -no-canonical-prefixes" )
# TODO: different ARM abi have different flags such as neon, vfpv etc
if( X86 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
+elseif( ANDROID_ABI STREQUAL "armeabi" )
+ # 64 bit atomic operations used in c++ libraries require armv7-a instructions
+ # armv5te and armv6 were tried but do not work.
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a" )
endif()
+# PIE is required for API 21+ so we enable it
+# unfortunately, it is not supported before API 14 so we need to do something else there
+# see http://llvm.org/pr23457
+set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -pie -fPIE" )
+
# linker flags
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fdata-sections -ffunction-sections" )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--gc-sections" )
Added: lldb/trunk/include/lldb/Host/Time.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Time.h?rev=237078&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/Time.h (added)
+++ lldb/trunk/include/lldb/Host/Time.h Mon May 11 20:10:56 2015
@@ -0,0 +1,26 @@
+//===-- Time.h --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Include system time headers, adding missing functions as necessary
+
+#ifndef liblldb_Host_Time_h_
+#define liblldb_Host_Time_h_
+
+#ifdef __ANDROID_NDK__
+#include <android/api-level.h>
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#include <time64.h>
+static time_t timegm(struct tm* t);
+#else
+#include <time.h>
+#endif
+
+#endif // liblldb_Host_Time_h_
Modified: lldb/trunk/include/lldb/Host/android/Android.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/android/Android.h?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/android/Android.h (original)
+++ lldb/trunk/include/lldb/Host/android/Android.h Mon May 11 20:10:56 2015
@@ -16,9 +16,6 @@
#define _isatty isatty
#define SYS_tgkill __NR_tgkill
-#define PT_DETACH PTRACE_DETACH
-
-typedef int __ptrace_request;
namespace std
{
Added: lldb/trunk/include/lldb/Host/linux/Personality.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Personality.h?rev=237078&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Personality.h (added)
+++ lldb/trunk/include/lldb/Host/linux/Personality.h Mon May 11 20:10:56 2015
@@ -0,0 +1,25 @@
+//===-- Personality.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines personality functions & structures
+
+#ifndef liblldb_Host_linux_Personality_h_
+#define liblldb_Host_linux_Personality_h_
+
+#ifdef __ANDROID_NDK__
+#include <android/api-level.h>
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#include <linux/personality.h>
+#else
+#include <sys/personality.h>
+#endif
+
+#endif // liblldb_Host_linux_Personality_h_
Added: lldb/trunk/include/lldb/Host/linux/Ptrace.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Ptrace.h?rev=237078&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Ptrace.h (added)
+++ lldb/trunk/include/lldb/Host/linux/Ptrace.h Mon May 11 20:10:56 2015
@@ -0,0 +1,66 @@
+//===-- Ptrace.h ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines ptrace functions & structures
+
+#ifndef liblldb_Host_linux_Ptrace_h_
+#define liblldb_Host_linux_Ptrace_h_
+
+#include <sys/ptrace.h>
+
+#ifdef __ANDROID_NDK__
+#define PT_DETACH PTRACE_DETACH
+typedef int __ptrace_request;
+#endif
+
+#define DEBUG_PTRACE_MAXBYTES 20
+
+// Support ptrace extensions even when compiled without required kernel support
+#ifndef PT_GETREGS
+ #ifndef PTRACE_GETREGS
+ #define PTRACE_GETREGS 12
+ #endif
+#endif
+#ifndef PT_SETREGS
+ #ifndef PTRACE_SETREGS
+ #define PTRACE_SETREGS 13
+ #endif
+#endif
+#ifndef PT_GETFPREGS
+ #ifndef PTRACE_GETFPREGS
+ #define PTRACE_GETFPREGS 14
+ #endif
+#endif
+#ifndef PT_SETFPREGS
+ #ifndef PTRACE_SETFPREGS
+ #define PTRACE_SETFPREGS 15
+ #endif
+#endif
+#ifndef PTRACE_GETREGSET
+ #define PTRACE_GETREGSET 0x4204
+#endif
+#ifndef PTRACE_SETREGSET
+ #define PTRACE_SETREGSET 0x4205
+#endif
+#ifndef PTRACE_GET_THREAD_AREA
+ #define PTRACE_GET_THREAD_AREA 25
+#endif
+#ifndef PTRACE_ARCH_PRCTL
+ #define PTRACE_ARCH_PRCTL 30
+#endif
+#ifndef ARCH_GET_FS
+ #define ARCH_SET_GS 0x1001
+ #define ARCH_SET_FS 0x1002
+ #define ARCH_GET_FS 0x1003
+ #define ARCH_GET_GS 0x1004
+#endif
+
+#define LLDB_PTRACE_NT_ARM_TLS 0x401 // ARM TLS register
+
+#endif // liblldb_Host_linux_Ptrace_h_
Added: lldb/trunk/include/lldb/Host/linux/Signalfd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Signalfd.h?rev=237078&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Signalfd.h (added)
+++ lldb/trunk/include/lldb/Host/linux/Signalfd.h Mon May 11 20:10:56 2015
@@ -0,0 +1,54 @@
+//===-- Signalfd.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines signalfd functions & structures
+
+#ifndef liblldb_Host_linux_Signalfd_h_
+#define liblldb_Host_linux_Signalfd_h_
+
+#ifdef __ANDROID_NDK__
+#include <android/api-level.h>
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+
+#include <linux/types.h>
+#include <linux/fcntl.h>
+
+#define SFD_CLOEXEC O_CLOEXEC
+#define SFD_NONBLOCK O_NONBLOCK
+
+struct signalfd_siginfo {
+ __u32 ssi_signo;
+ __s32 ssi_errno;
+ __s32 ssi_code;
+ __u32 ssi_pid;
+ __u32 ssi_uid;
+ __s32 ssi_fd;
+ __u32 ssi_tid;
+ __u32 ssi_band;
+ __u32 ssi_overrun;
+ __u32 ssi_trapno;
+ __s32 ssi_status;
+ __s32 ssi_int;
+ __u64 ssi_ptr;
+ __u64 ssi_utime;
+ __u64 ssi_stime;
+ __u64 ssi_addr;
+ __u16 ssi_addr_lsb;
+ __u8 __pad[46];
+};
+
+int signalfd (int fd, const sigset_t *mask, int flags);
+
+#else
+#include <sys/signalfd.h>
+#endif
+
+#endif // liblldb_Host_linux_Signalfd_h_
Added: lldb/trunk/include/lldb/Host/posix/Fcntl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/Fcntl.h?rev=237078&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/Fcntl.h (added)
+++ lldb/trunk/include/lldb/Host/posix/Fcntl.h Mon May 11 20:10:56 2015
@@ -0,0 +1,25 @@
+//===-- Fcntl.h -------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines fcntl functions & structures
+
+#ifndef liblldb_Host_posix_Fcntl_h_
+#define liblldb_Host_posix_Fcntl_h_
+
+#ifdef __ANDROID_NDK__
+#include <android/api-level.h>
+#endif
+
+#include <fcntl.h>
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
+#endif
+
+#endif // liblldb_Host_posix_Fcntl_h_
Modified: lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp Mon May 11 20:10:56 2015
@@ -29,10 +29,13 @@
#include "lldb/Utility/ProcessStructReader.h"
#include <algorithm>
+
#if __ANDROID_NDK__
#include <sys/types.h>
#endif
+#include "lldb/Host/Time.h"
+
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::formatters;
Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Mon May 11 20:10:56 2015
@@ -104,6 +104,7 @@ else()
if (__ANDROID_NDK__)
add_host_subdirectory(android
android/HostInfoAndroid.cpp
+ android/LibcGlue.cpp
android/ProcessLauncherAndroid.cpp
linux/Host.cpp
linux/HostInfoLinux.cpp
Added: lldb/trunk/source/Host/android/LibcGlue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/LibcGlue.cpp?rev=237078&view=auto
==============================================================================
--- lldb/trunk/source/Host/android/LibcGlue.cpp (added)
+++ lldb/trunk/source/Host/android/LibcGlue.cpp Mon May 11 20:10:56 2015
@@ -0,0 +1,39 @@
+//===-- LibcGlue.cpp --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This files adds functions missing from libc on earlier versions of Android
+
+#include <android/api-level.h>
+
+#if __ANDROID_API__ < 21
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/syscall.h>
+#include <signal.h>
+
+#include "lldb/Host/Time.h"
+
+time_t timegm(struct tm* t)
+{
+ return (time_t) timegm64(t);
+}
+
+int signalfd (int fd, const sigset_t *mask, int flags)
+{
+ return syscall(__NR_signalfd4, fd, mask, _NSIG / 8, flags);
+}
+
+int posix_openpt(int flags)
+{
+ return open("/dev/ptmx", flags);
+}
+
+#endif
Modified: lldb/trunk/source/Host/posix/HostInfoPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostInfoPosix.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/HostInfoPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/HostInfoPosix.cpp Mon May 11 20:10:56 2015
@@ -17,6 +17,7 @@
#include <grp.h>
#include <limits.h>
+#include <mutex>
#include <netdb.h>
#include <pwd.h>
#include <sys/types.h>
@@ -47,9 +48,31 @@ HostInfoPosix::GetHostname(std::string &
return false;
}
+#ifdef __ANDROID_NDK__
+#include <android/api-level.h>
+#endif
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#define USE_GETPWUID
+#endif
+
+#ifdef USE_GETPWUID
+static std::mutex s_getpwuid_lock;
+#endif
+
const char *
HostInfoPosix::LookupUserName(uint32_t uid, std::string &user_name)
{
+#ifdef USE_GETPWUID
+ // getpwuid_r is missing from android-9
+ // make getpwuid thread safe with a mutex
+ std::lock_guard<std::mutex> lock(s_getpwuid_lock);
+ struct passwd *user_info_ptr = ::getpwuid(uid);
+ if (user_info_ptr)
+ {
+ user_name.assign(user_info_ptr->pw_name);
+ return user_name.c_str();
+ }
+#else
struct passwd user_info;
struct passwd *user_info_ptr = &user_info;
char user_buffer[PATH_MAX];
@@ -62,8 +85,9 @@ HostInfoPosix::LookupUserName(uint32_t u
return user_name.c_str();
}
}
+#endif
user_name.clear();
- return NULL;
+ return nullptr;
}
const char *
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Mon May 11 20:10:56 2015
@@ -54,10 +54,8 @@
// System includes - They have to be included after framework includes because they define some
// macros which collide with variable names in other modules
#include <linux/unistd.h>
-#include <sys/personality.h>
-#include <sys/ptrace.h>
#include <sys/socket.h>
-#include <sys/signalfd.h>
+
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/user.h>
@@ -68,52 +66,10 @@
#include <elf.h>
#endif
-#ifdef __ANDROID__
-#define __ptrace_request int
-#define PT_DETACH PTRACE_DETACH
-#endif
-
-#define DEBUG_PTRACE_MAXBYTES 20
-
-// Support ptrace extensions even when compiled without required kernel support
-#ifndef PT_GETREGS
-#ifndef PTRACE_GETREGS
- #define PTRACE_GETREGS 12
-#endif
-#endif
-#ifndef PT_SETREGS
-#ifndef PTRACE_SETREGS
- #define PTRACE_SETREGS 13
-#endif
-#endif
-#ifndef PT_GETFPREGS
-#ifndef PTRACE_GETFPREGS
- #define PTRACE_GETFPREGS 14
-#endif
-#endif
-#ifndef PT_SETFPREGS
-#ifndef PTRACE_SETFPREGS
- #define PTRACE_SETFPREGS 15
-#endif
-#endif
-#ifndef PTRACE_GETREGSET
- #define PTRACE_GETREGSET 0x4204
-#endif
-#ifndef PTRACE_SETREGSET
- #define PTRACE_SETREGSET 0x4205
-#endif
-#ifndef PTRACE_GET_THREAD_AREA
- #define PTRACE_GET_THREAD_AREA 25
-#endif
-#ifndef PTRACE_ARCH_PRCTL
- #define PTRACE_ARCH_PRCTL 30
-#endif
-#ifndef ARCH_GET_FS
- #define ARCH_SET_GS 0x1001
- #define ARCH_SET_FS 0x1002
- #define ARCH_GET_FS 0x1003
- #define ARCH_GET_GS 0x1004
-#endif
+#include "lldb/Host/linux/Personality.h"
+#include "lldb/Host/linux/Ptrace.h"
+#include "lldb/Host/linux/Signalfd.h"
+#include "lldb/Host/android/Android.h"
#define LLDB_PERSONALITY_GET_CURRENT_SETTINGS 0xffffffff
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Mon May 11 20:10:56 2015
@@ -41,8 +41,12 @@
// System includes - They have to be included after framework includes because they define some
// macros which collide with variable names in other modules
-#include <sys/personality.h>
-#include <sys/ptrace.h>
+
+#include "lldb/Host/linux/Personality.h"
+#include "lldb/Host/linux/Ptrace.h"
+#include "lldb/Host/linux/Signalfd.h"
+#include "lldb/Host/android/Android.h"
+
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/types.h>
@@ -50,37 +54,8 @@
#include <sys/user.h>
#include <sys/wait.h>
-#ifdef __ANDROID__
-#define __ptrace_request int
-#define PT_DETACH PTRACE_DETACH
-#endif
-
-#define DEBUG_PTRACE_MAXBYTES 20
-
-// Support ptrace extensions even when compiled without required kernel support
-#ifndef PTRACE_GETREGSET
- #define PTRACE_GETREGSET 0x4204
-#endif
-#ifndef PTRACE_SETREGSET
- #define PTRACE_SETREGSET 0x4205
-#endif
-#ifndef PTRACE_GET_THREAD_AREA
- #define PTRACE_GET_THREAD_AREA 25
-#endif
-#ifndef PTRACE_ARCH_PRCTL
- #define PTRACE_ARCH_PRCTL 30
-#endif
-#ifndef ARCH_GET_FS
- #define ARCH_SET_GS 0x1001
- #define ARCH_SET_FS 0x1002
- #define ARCH_GET_FS 0x1003
- #define ARCH_GET_GS 0x1004
-#endif
-
#define LLDB_PERSONALITY_GET_CURRENT_SETTINGS 0xffffffff
-#define LLDB_PTRACE_NT_ARM_TLS 0x401 // ARM TLS register
-
// Support hardware breakpoints in case it has not been defined
#ifndef TRAP_HWBKPT
#define TRAP_HWBKPT 4
Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Mon May 11 20:10:56 2015
@@ -33,6 +33,8 @@
#include "Plugins/Process/Linux/ProcessMonitor.h"
#include "POSIXThread.h"
+#include "lldb/Host/posix/Fcntl.h"
+
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon May 11 20:10:56 2015
@@ -259,7 +259,7 @@ GDBRemoteCommunication::SendPacketNoLock
strm.Printf("<%4" PRIu64 "> send packet: %.*s", (uint64_t)bytes_written, (int)binary_start_offset, packet_data);
const uint8_t *p;
// Print binary data exactly as sent
- for (p = (uint8_t*)packet_data + binary_start_offset; *p != '#'; ++p)
+ for (p = (const uint8_t*)packet_data + binary_start_offset; *p != '#'; ++p)
strm.Printf("\\x%2.2x", *p);
// Print the checksum
strm.Printf("%*s", (int)3, p);
@@ -822,7 +822,11 @@ GDBRemoteCommunication::StartDebugserver
// connect to us..
error = StartListenThread ("127.0.0.1", 0);
if (error.Fail())
+ {
+ if (log)
+ log->Printf ("GDBRemoteCommunication::%s() unable to start listen thread: %s", __FUNCTION__, error.AsCString());
return error;
+ }
ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)GetConnection ();
// Wait for 10 seconds to resolve the bound port
@@ -839,6 +843,8 @@ GDBRemoteCommunication::StartDebugserver
else
{
error.SetErrorString ("failed to bind to port 0 on 127.0.0.1");
+ if (log)
+ log->Printf ("GDBRemoteCommunication::%s() failed: %s", __FUNCTION__, error.AsCString());
return error;
}
}
@@ -957,6 +963,13 @@ GDBRemoteCommunication::StartDebugserver
{
error.SetErrorStringWithFormat ("unable to locate " DEBUGSERVER_BASENAME );
}
+
+ if (error.Fail())
+ {
+ if (log)
+ log->Printf ("GDBRemoteCommunication::%s() failed: %s", __FUNCTION__, error.AsCString());
+ }
+
return error;
}
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Mon May 11 20:10:56 2015
@@ -396,6 +396,10 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_qUserName (StringExtractorGDBRemote &packet)
{
#if !defined(LLDB_DISABLE_POSIX)
+ Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf("GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__);
+
// Packet format: "qUserName:%i" where %i is the uid
packet.SetFilePos(::strlen ("qUserName:"));
uint32_t uid = packet.GetU32 (UINT32_MAX);
@@ -409,6 +413,8 @@ GDBRemoteCommunicationServerCommon::Hand
return SendPacketNoLock (response.GetData(), response.GetSize());
}
}
+ if (log)
+ log->Printf("GDBRemoteCommunicationServerCommon::%s end", __FUNCTION__);
#endif
return SendErrorResponse (5);
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Mon May 11 20:10:56 2015
@@ -117,7 +117,7 @@ GDBRemoteCommunicationServerPlatform::Ha
if (hostname.empty())
hostname = "127.0.0.1";
if (log)
- log->Printf("Launching debugserver with: %s:%u...\n", hostname.c_str(), port);
+ log->Printf("Launching debugserver with: %s:%u...", hostname.c_str(), port);
// Do not run in a new session so that it can not linger after the
// platform closes.
Modified: lldb/trunk/source/Utility/PseudoTerminal.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/PseudoTerminal.cpp?rev=237078&r1=237077&r2=237078&view=diff
==============================================================================
--- lldb/trunk/source/Utility/PseudoTerminal.cpp (original)
+++ lldb/trunk/source/Utility/PseudoTerminal.cpp Mon May 11 20:10:56 2015
@@ -34,6 +34,7 @@ pid_t fork(void) { return 0; }
pid_t setsid(void) { return 0; }
#elif defined(__ANDROID_NDK__)
#include "lldb/Host/android/Android.h"
+int posix_openpt(int flags);
#endif
using namespace lldb_utility;
More information about the lldb-commits
mailing list