summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools/debugserver/source')
-rw-r--r--lldb/tools/debugserver/source/DNB.cpp54
-rw-r--r--lldb/tools/debugserver/source/DNB.h16
-rw-r--r--lldb/tools/debugserver/source/DNBDataRef.cpp30
-rw-r--r--lldb/tools/debugserver/source/DNBDefs.h10
-rw-r--r--lldb/tools/debugserver/source/DNBLog.cpp18
-rw-r--r--lldb/tools/debugserver/source/DNBTimer.h10
-rw-r--r--lldb/tools/debugserver/source/JSON.h2
-rw-r--r--lldb/tools/debugserver/source/JSONGenerator.h2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/CFBundle.cpp10
-rw-r--r--lldb/tools/debugserver/source/MacOSX/CFBundle.h2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/CFString.cpp8
-rw-r--r--lldb/tools/debugserver/source/MacOSX/CFString.h2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/CFUtils.h2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.h6
-rw-r--r--lldb/tools/debugserver/source/MacOSX/DarwinLog/LogFilterRegex.cpp2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/DarwinLog/LogMessageOsLog.h2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/Genealogy.cpp2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachProcess.h16
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachTask.h3
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/OsLogger.cpp2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp4
-rw-r--r--lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp4
-rw-r--r--lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp4
-rw-r--r--lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp4
-rw-r--r--lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp4
-rw-r--r--lldb/tools/debugserver/source/PThreadEvent.cpp4
-rw-r--r--lldb/tools/debugserver/source/PThreadEvent.h2
-rw-r--r--lldb/tools/debugserver/source/PseudoTerminal.cpp16
-rw-r--r--lldb/tools/debugserver/source/PseudoTerminal.h6
-rw-r--r--lldb/tools/debugserver/source/RNBContext.cpp6
-rw-r--r--lldb/tools/debugserver/source/RNBContext.h6
-rw-r--r--lldb/tools/debugserver/source/RNBRemote.cpp20
-rw-r--r--lldb/tools/debugserver/source/StdStringExtractor.cpp14
-rw-r--r--lldb/tools/debugserver/source/StdStringExtractor.h6
-rw-r--r--lldb/tools/debugserver/source/debugserver.cpp22
-rw-r--r--lldb/tools/debugserver/source/libdebugserver.cpp8
37 files changed, 0 insertions, 331 deletions
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index 6b57d488b2f..cb02ee06807 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -62,12 +62,10 @@ static size_t
GetAllInfosMatchingName(const char *process_name,
std::vector<struct kinfo_proc> &matching_proc_infos);
-//----------------------------------------------------------------------
// A Thread safe singleton to get a process map pointer.
//
// Returns a pointer to the existing process map, or a pointer to a
// newly created process map if CAN_CREATE is non-zero.
-//----------------------------------------------------------------------
static ProcessMap *GetProcessMap(bool can_create) {
static ProcessMap *g_process_map_ptr = NULL;
@@ -80,13 +78,11 @@ static ProcessMap *GetProcessMap(bool can_create) {
return g_process_map_ptr;
}
-//----------------------------------------------------------------------
// Add PID to the shared process pointer map.
//
// Return non-zero value if we succeed in adding the process to the map.
// The only time this should fail is if we run out of memory and can't
// allocate a ProcessMap.
-//----------------------------------------------------------------------
static nub_bool_t AddProcessToMap(nub_process_t pid, MachProcessSP &procSP) {
ProcessMap *process_map = GetProcessMap(true);
if (process_map) {
@@ -96,11 +92,9 @@ static nub_bool_t AddProcessToMap(nub_process_t pid, MachProcessSP &procSP) {
return false;
}
-//----------------------------------------------------------------------
// Remove the shared pointer for PID from the process map.
//
// Returns the number of items removed from the process map.
-//----------------------------------------------------------------------
// static size_t
// RemoveProcessFromMap (nub_process_t pid)
//{
@@ -112,12 +106,10 @@ static nub_bool_t AddProcessToMap(nub_process_t pid, MachProcessSP &procSP) {
// return 0;
//}
-//----------------------------------------------------------------------
// Get the shared pointer for PID from the existing process map.
//
// Returns true if we successfully find a shared pointer to a
// MachProcess object.
-//----------------------------------------------------------------------
static nub_bool_t GetProcessSP(nub_process_t pid, MachProcessSP &procSP) {
ProcessMap *process_map = GetProcessMap(false);
if (process_map != NULL) {
@@ -811,9 +803,7 @@ nub_bool_t DNBProcessIsAlive(nub_process_t pid) {
return eStateInvalid;
}
-//----------------------------------------------------------------------
// Process and Thread state information
-//----------------------------------------------------------------------
nub_state_t DNBProcessGetState(nub_process_t pid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP)) {
@@ -822,9 +812,7 @@ nub_state_t DNBProcessGetState(nub_process_t pid) {
return eStateInvalid;
}
-//----------------------------------------------------------------------
// Process and Thread state information
-//----------------------------------------------------------------------
nub_bool_t DNBProcessGetExitStatus(nub_process_t pid, int *status) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP)) {
@@ -1031,9 +1019,7 @@ const char *DNBProcessGetArgumentAtIndex(nub_process_t pid, nub_size_t idx) {
return NULL;
}
-//----------------------------------------------------------------------
// Execution control
-//----------------------------------------------------------------------
nub_bool_t DNBProcessResume(nub_process_t pid,
const DNBThreadResumeAction *actions,
size_t num_actions) {
@@ -1128,9 +1114,7 @@ nub_bool_t DNBBreakpointClear(nub_process_t pid, nub_addr_t addr) {
return false; // Failed
}
-//----------------------------------------------------------------------
// Watchpoints
-//----------------------------------------------------------------------
nub_bool_t DNBWatchpointSet(nub_process_t pid, nub_addr_t addr, nub_size_t size,
uint32_t watch_flags, nub_bool_t hardware) {
MachProcessSP procSP;
@@ -1146,9 +1130,7 @@ nub_bool_t DNBWatchpointClear(nub_process_t pid, nub_addr_t addr) {
return false; // Failed
}
-//----------------------------------------------------------------------
// Return the number of supported hardware watchpoints.
-//----------------------------------------------------------------------
uint32_t DNBWatchpointGetNumSupportedHWP(nub_process_t pid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1156,13 +1138,11 @@ uint32_t DNBWatchpointGetNumSupportedHWP(nub_process_t pid) {
return 0;
}
-//----------------------------------------------------------------------
// Read memory in the address space of process PID. This call will take
// care of setting and restoring permissions and breaking up the memory
// read into multiple chunks as required.
//
// RETURNS: number of bytes actually read
-//----------------------------------------------------------------------
nub_size_t DNBProcessMemoryRead(nub_process_t pid, nub_addr_t addr,
nub_size_t size, void *buf) {
MachProcessSP procSP;
@@ -1246,13 +1226,11 @@ std::string DNBProcessMemoryReadCStringFixed(nub_process_t pid, nub_addr_t addr,
return cstr;
}
-//----------------------------------------------------------------------
// Write memory to the address space of process PID. This call will take
// care of setting and restoring permissions and breaking up the memory
// write into multiple chunks as required.
//
// RETURNS: number of bytes actually written
-//----------------------------------------------------------------------
nub_size_t DNBProcessMemoryWrite(nub_process_t pid, nub_addr_t addr,
nub_size_t size, const void *buf) {
MachProcessSP procSP;
@@ -1276,7 +1254,6 @@ nub_bool_t DNBProcessMemoryDeallocate(nub_process_t pid, nub_addr_t addr) {
return 0;
}
-//----------------------------------------------------------------------
// Find attributes of the memory region that contains ADDR for process PID,
// if possible, and return a string describing those attributes.
//
@@ -1289,7 +1266,6 @@ nub_bool_t DNBProcessMemoryDeallocate(nub_process_t pid, nub_addr_t addr) {
// Returns -1 if this platform cannot look up information about memory regions
// or if we do not yet have a valid launched process.
//
-//----------------------------------------------------------------------
int DNBProcessMemoryRegionInfo(nub_process_t pid, nub_addr_t addr,
DNBRegionInfo *region_info) {
MachProcessSP procSP;
@@ -1321,9 +1297,7 @@ nub_bool_t DNBProcessSetEnableAsyncProfiling(nub_process_t pid,
return false;
}
-//----------------------------------------------------------------------
// Get the number of threads for the specified process.
-//----------------------------------------------------------------------
nub_size_t DNBProcessGetNumThreads(nub_process_t pid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1331,9 +1305,7 @@ nub_size_t DNBProcessGetNumThreads(nub_process_t pid) {
return 0;
}
-//----------------------------------------------------------------------
// Get the thread ID of the current thread.
-//----------------------------------------------------------------------
nub_thread_t DNBProcessGetCurrentThread(nub_process_t pid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1341,9 +1313,7 @@ nub_thread_t DNBProcessGetCurrentThread(nub_process_t pid) {
return 0;
}
-//----------------------------------------------------------------------
// Get the mach port number of the current thread.
-//----------------------------------------------------------------------
nub_thread_t DNBProcessGetCurrentThreadMachPort(nub_process_t pid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1351,9 +1321,7 @@ nub_thread_t DNBProcessGetCurrentThreadMachPort(nub_process_t pid) {
return 0;
}
-//----------------------------------------------------------------------
// Change the current thread.
-//----------------------------------------------------------------------
nub_thread_t DNBProcessSetCurrentThread(nub_process_t pid, nub_thread_t tid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1361,10 +1329,8 @@ nub_thread_t DNBProcessSetCurrentThread(nub_process_t pid, nub_thread_t tid) {
return INVALID_NUB_THREAD;
}
-//----------------------------------------------------------------------
// Dump a string describing a thread's stop reason to the specified file
// handle
-//----------------------------------------------------------------------
nub_bool_t DNBThreadGetStopReason(nub_process_t pid, nub_thread_t tid,
struct DNBThreadStopInfo *stop_info) {
MachProcessSP procSP;
@@ -1373,13 +1339,11 @@ nub_bool_t DNBThreadGetStopReason(nub_process_t pid, nub_thread_t tid,
return false;
}
-//----------------------------------------------------------------------
// Return string description for the specified thread.
//
// RETURNS: NULL if the thread isn't valid, else a NULL terminated C
// string from a static buffer that must be copied prior to subsequent
// calls.
-//----------------------------------------------------------------------
const char *DNBThreadGetInfo(nub_process_t pid, nub_thread_t tid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1387,9 +1351,7 @@ const char *DNBThreadGetInfo(nub_process_t pid, nub_thread_t tid) {
return NULL;
}
-//----------------------------------------------------------------------
// Get the thread ID given a thread index.
-//----------------------------------------------------------------------
nub_thread_t DNBProcessGetThreadAtIndex(nub_process_t pid, size_t thread_idx) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1397,10 +1359,8 @@ nub_thread_t DNBProcessGetThreadAtIndex(nub_process_t pid, size_t thread_idx) {
return INVALID_NUB_THREAD;
}
-//----------------------------------------------------------------------
// Do whatever is needed to sync the thread's register state with it's kernel
// values.
-//----------------------------------------------------------------------
nub_bool_t DNBProcessSyncThreadState(nub_process_t pid, nub_thread_t tid) {
MachProcessSP procSP;
if (GetProcessSP(pid, procSP))
@@ -1440,11 +1400,9 @@ const char *DNBGetDeploymentInfo(nub_process_t pid,
}
-//----------------------------------------------------------------------
// Get the current shared library information for a process. Only return
// the shared libraries that have changed since the last shared library
// state changed event if only_changed is non-zero.
-//----------------------------------------------------------------------
nub_size_t
DNBProcessGetSharedLibraryInfo(nub_process_t pid, nub_bool_t only_changed,
struct DNBExecutableImageInfo **image_infos) {
@@ -1461,16 +1419,12 @@ DNBProcessGetSharedLibraryInfo(nub_process_t pid, nub_bool_t only_changed,
uint32_t DNBGetRegisterCPUType() {
return DNBArchProtocol::GetRegisterCPUType();
}
-//----------------------------------------------------------------------
// Get the register set information for a specific thread.
-//----------------------------------------------------------------------
const DNBRegisterSetInfo *DNBGetRegisterSetInfo(nub_size_t *num_reg_sets) {
return DNBArchProtocol::GetRegisterSetInfo(num_reg_sets);
}
-//----------------------------------------------------------------------
// Read a register value by register set and register index.
-//----------------------------------------------------------------------
nub_bool_t DNBThreadGetRegisterValueByID(nub_process_t pid, nub_thread_t tid,
uint32_t set, uint32_t reg,
DNBRegisterValue *value) {
@@ -1533,9 +1487,7 @@ nub_bool_t DNBThreadRestoreRegisterState(nub_process_t pid, nub_thread_t tid,
return false;
}
-//----------------------------------------------------------------------
// Read a register value by name.
-//----------------------------------------------------------------------
nub_bool_t DNBThreadGetRegisterValueByName(nub_process_t pid, nub_thread_t tid,
uint32_t reg_set,
const char *reg_name,
@@ -1567,9 +1519,7 @@ nub_bool_t DNBThreadGetRegisterValueByName(nub_process_t pid, nub_thread_t tid,
return false;
}
-//----------------------------------------------------------------------
// Read a register set and register number from the register name.
-//----------------------------------------------------------------------
nub_bool_t DNBGetRegisterInfoByName(const char *reg_name,
DNBRegisterInfo *info) {
const struct DNBRegisterSetInfo *set_info;
@@ -1604,10 +1554,8 @@ nub_bool_t DNBGetRegisterInfoByName(const char *reg_name,
return false;
}
-//----------------------------------------------------------------------
// Set the name to address callback function that this nub can use
// for any name to address lookups that are needed.
-//----------------------------------------------------------------------
nub_bool_t DNBProcessSetNameToAddressCallback(nub_process_t pid,
DNBCallbackNameToAddress callback,
void *baton) {
@@ -1619,10 +1567,8 @@ nub_bool_t DNBProcessSetNameToAddressCallback(nub_process_t pid,
return false;
}
-//----------------------------------------------------------------------
// Set the name to address callback function that this nub can use
// for any name to address lookups that are needed.
-//----------------------------------------------------------------------
nub_bool_t DNBProcessSetSharedLibraryInfoCallback(
nub_process_t pid, DNBCallbackCopyExecutableImageInfos callback,
void *baton) {
diff --git a/lldb/tools/debugserver/source/DNB.h b/lldb/tools/debugserver/source/DNB.h
index d32040b4111..074d0aa53f4 100644
--- a/lldb/tools/debugserver/source/DNB.h
+++ b/lldb/tools/debugserver/source/DNB.h
@@ -34,9 +34,7 @@ void DNBTerminate();
nub_bool_t DNBSetArchitecture(const char *arch);
-//----------------------------------------------------------------------
// Process control
-//----------------------------------------------------------------------
nub_process_t DNBProcessLaunch(
const char *path, char const *argv[], const char *envp[],
const char *working_directory, // NULL => don't change, non-NULL => set
@@ -102,9 +100,7 @@ DNBProcessSetEnableAsyncProfiling(nub_process_t pid, nub_bool_t enable,
DNBProfileDataScanType scan_type) DNB_EXPORT;
DarwinLogEventVector DNBProcessGetAvailableDarwinLogEvents(nub_process_t pid);
-//----------------------------------------------------------------------
// Process status
-//----------------------------------------------------------------------
nub_bool_t DNBProcessIsAlive(nub_process_t pid) DNB_EXPORT;
nub_state_t DNBProcessGetState(nub_process_t pid) DNB_EXPORT;
nub_bool_t DNBProcessGetExitStatus(nub_process_t pid, int *status) DNB_EXPORT;
@@ -149,24 +145,18 @@ nub_size_t DNBProcessGetAvailableProfileData(nub_process_t pid, char *buf,
nub_size_t DNBProcessGetStopCount(nub_process_t pid) DNB_EXPORT;
uint32_t DNBProcessGetCPUType(nub_process_t pid) DNB_EXPORT;
-//----------------------------------------------------------------------
// Process executable and arguments
-//----------------------------------------------------------------------
const char *DNBProcessGetExecutablePath(nub_process_t pid);
const char *DNBProcessGetArgumentAtIndex(nub_process_t pid, nub_size_t idx);
nub_size_t DNBProcessGetArgumentCount(nub_process_t pid);
-//----------------------------------------------------------------------
// Process events
-//----------------------------------------------------------------------
nub_event_t DNBProcessWaitForEvents(nub_process_t pid, nub_event_t event_mask,
bool wait_for_set,
struct timespec *timeout);
void DNBProcessResetEvents(nub_process_t pid, nub_event_t event_mask);
-//----------------------------------------------------------------------
// Thread functions
-//----------------------------------------------------------------------
const char *DNBThreadGetName(nub_process_t pid, nub_thread_t tid);
nub_bool_t
DNBThreadGetIdentifierInfo(nub_process_t pid, nub_thread_t tid,
@@ -215,16 +205,12 @@ DNBGetLibrariesInfoForAddresses(nub_process_t pid,
JSONGenerator::ObjectSP DNBGetSharedCacheInfo(nub_process_t pid);
//
-//----------------------------------------------------------------------
// Breakpoint functions
-//----------------------------------------------------------------------
nub_bool_t DNBBreakpointSet(nub_process_t pid, nub_addr_t addr, nub_size_t size,
nub_bool_t hardware);
nub_bool_t DNBBreakpointClear(nub_process_t pid, nub_addr_t addr);
-//----------------------------------------------------------------------
// Watchpoint functions
-//----------------------------------------------------------------------
nub_bool_t DNBWatchpointSet(nub_process_t pid, nub_addr_t addr, nub_size_t size,
uint32_t watch_flags, nub_bool_t hardware);
nub_bool_t DNBWatchpointClear(nub_process_t pid, nub_addr_t addr);
@@ -235,9 +221,7 @@ const DNBRegisterSetInfo *DNBGetRegisterSetInfo(nub_size_t *num_reg_sets);
nub_bool_t DNBGetRegisterInfoByName(const char *reg_name,
DNBRegisterInfo *info);
-//----------------------------------------------------------------------
// Other static nub information calls.
-//----------------------------------------------------------------------
const char *DNBStateAsString(nub_state_t state);
nub_bool_t DNBResolveExecutablePath(const char *path, char *resolved_path,
size_t resolved_path_size);
diff --git a/lldb/tools/debugserver/source/DNBDataRef.cpp b/lldb/tools/debugserver/source/DNBDataRef.cpp
index 073591c8afe..f19c913f65d 100644
--- a/lldb/tools/debugserver/source/DNBDataRef.cpp
+++ b/lldb/tools/debugserver/source/DNBDataRef.cpp
@@ -16,33 +16,25 @@
#include <ctype.h>
#include <libkern/OSByteOrder.h>
-//----------------------------------------------------------------------
// Constructor
-//----------------------------------------------------------------------
DNBDataRef::DNBDataRef()
: m_start(NULL), m_end(NULL), m_swap(false), m_ptrSize(0),
m_addrPCRelative(INVALID_NUB_ADDRESS), m_addrTEXT(INVALID_NUB_ADDRESS),
m_addrDATA(INVALID_NUB_ADDRESS) {}
-//----------------------------------------------------------------------
// Constructor
-//----------------------------------------------------------------------
DNBDataRef::DNBDataRef(const uint8_t *start, size_t size, bool swap)
: m_start(start), m_end(start + size), m_swap(swap), m_ptrSize(0),
m_addrPCRelative(INVALID_NUB_ADDRESS), m_addrTEXT(INVALID_NUB_ADDRESS),
m_addrDATA(INVALID_NUB_ADDRESS) {}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
DNBDataRef::~DNBDataRef() {}
-//----------------------------------------------------------------------
// Get8
-//----------------------------------------------------------------------
uint8_t DNBDataRef::Get8(offset_t *offset_ptr) const {
uint8_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -52,9 +44,7 @@ uint8_t DNBDataRef::Get8(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// Get16
-//----------------------------------------------------------------------
uint16_t DNBDataRef::Get16(offset_t *offset_ptr) const {
uint16_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -70,9 +60,7 @@ uint16_t DNBDataRef::Get16(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// Get32
-//----------------------------------------------------------------------
uint32_t DNBDataRef::Get32(offset_t *offset_ptr) const {
uint32_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -87,9 +75,7 @@ uint32_t DNBDataRef::Get32(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// Get64
-//----------------------------------------------------------------------
uint64_t DNBDataRef::Get64(offset_t *offset_ptr) const {
uint64_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -104,12 +90,10 @@ uint64_t DNBDataRef::Get64(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// GetMax32
//
// Used for calls when the size can vary. Fill in extra cases if they
// are ever needed.
-//----------------------------------------------------------------------
uint32_t DNBDataRef::GetMax32(offset_t *offset_ptr, uint32_t byte_size) const {
switch (byte_size) {
case 1:
@@ -128,12 +112,10 @@ uint32_t DNBDataRef::GetMax32(offset_t *offset_ptr, uint32_t byte_size) const {
return 0;
}
-//----------------------------------------------------------------------
// GetMax64
//
// Used for calls when the size can vary. Fill in extra cases if they
// are ever needed.
-//----------------------------------------------------------------------
uint64_t DNBDataRef::GetMax64(offset_t *offset_ptr, uint32_t size) const {
switch (size) {
case 1:
@@ -155,20 +137,16 @@ uint64_t DNBDataRef::GetMax64(offset_t *offset_ptr, uint32_t size) const {
return 0;
}
-//----------------------------------------------------------------------
// GetPointer
//
// Extract a pointer value from the buffer. The pointer size must be
// set prior to using this using one of the SetPointerSize functions.
-//----------------------------------------------------------------------
uint64_t DNBDataRef::GetPointer(offset_t *offset_ptr) const {
// Must set pointer size prior to using this call
assert(m_ptrSize != 0);
return GetMax64(offset_ptr, m_ptrSize);
}
-//----------------------------------------------------------------------
// GetCStr
-//----------------------------------------------------------------------
const char *DNBDataRef::GetCStr(offset_t *offset_ptr,
uint32_t fixed_length) const {
const char *s = NULL;
@@ -184,9 +162,7 @@ const char *DNBDataRef::GetCStr(offset_t *offset_ptr,
return s;
}
-//----------------------------------------------------------------------
// GetData
-//----------------------------------------------------------------------
const uint8_t *DNBDataRef::GetData(offset_t *offset_ptr,
uint32_t length) const {
const uint8_t *data = NULL;
@@ -197,9 +173,7 @@ const uint8_t *DNBDataRef::GetData(offset_t *offset_ptr,
return data;
}
-//----------------------------------------------------------------------
// Get_ULEB128
-//----------------------------------------------------------------------
uint64_t DNBDataRef::Get_ULEB128(offset_t *offset_ptr) const {
uint64_t result = 0;
if (m_start < m_end) {
@@ -222,9 +196,7 @@ uint64_t DNBDataRef::Get_ULEB128(offset_t *offset_ptr) const {
return result;
}
-//----------------------------------------------------------------------
// Get_SLEB128
-//----------------------------------------------------------------------
int64_t DNBDataRef::Get_SLEB128(offset_t *offset_ptr) const {
int64_t result = 0;
@@ -254,11 +226,9 @@ int64_t DNBDataRef::Get_SLEB128(offset_t *offset_ptr) const {
return result;
}
-//----------------------------------------------------------------------
// Skip_LEB128
//
// Skips past ULEB128 and SLEB128 numbers (just updates the offset)
-//----------------------------------------------------------------------
void DNBDataRef::Skip_LEB128(offset_t *offset_ptr) const {
if (m_start < m_end) {
const uint8_t *start = m_start + *offset_ptr;
diff --git a/lldb/tools/debugserver/source/DNBDefs.h b/lldb/tools/debugserver/source/DNBDefs.h
index 278caadd79d..3ff60d313aa 100644
--- a/lldb/tools/debugserver/source/DNBDefs.h
+++ b/lldb/tools/debugserver/source/DNBDefs.h
@@ -19,33 +19,25 @@
#include <sys/syslimits.h>
#include <unistd.h>
-//----------------------------------------------------------------------
// Define nub_addr_t and the invalid address value from the architecture
-//----------------------------------------------------------------------
#if defined(__x86_64__) || defined(__ppc64__) || defined(__arm64__) || \
defined(__aarch64__)
-//----------------------------------------------------------------------
// 64 bit address architectures
-//----------------------------------------------------------------------
typedef uint64_t nub_addr_t;
#define INVALID_NUB_ADDRESS ((nub_addr_t)~0ull)
#elif defined(__i386__) || defined(__powerpc__) || defined(__ppc__) || \
defined(__arm__)
-//----------------------------------------------------------------------
// 32 bit address architectures
-//----------------------------------------------------------------------
typedef uint32_t nub_addr_t;
#define INVALID_NUB_ADDRESS ((nub_addr_t)~0ul)
#else
-//----------------------------------------------------------------------
// Default to 64 bit address for unrecognized architectures.
-//----------------------------------------------------------------------
#warning undefined architecture, defaulting to 8 byte addresses
typedef uint64_t nub_addr_t;
@@ -253,11 +245,9 @@ enum DNBMemoryPermissions {
#define DNB_THREAD_STOP_INFO_MAX_DESC_LENGTH 256
#define DNB_THREAD_STOP_INFO_MAX_EXC_DATA 8
-//----------------------------------------------------------------------
// DNBThreadStopInfo
//
// Describes the reason a thread stopped.
-//----------------------------------------------------------------------
struct DNBThreadStopInfo {
DNBThreadStopType reason;
char description[DNB_THREAD_STOP_INFO_MAX_DESC_LENGTH];
diff --git a/lldb/tools/debugserver/source/DNBLog.cpp b/lldb/tools/debugserver/source/DNBLog.cpp
index 3d60b59cc99..11b2d0a04b7 100644
--- a/lldb/tools/debugserver/source/DNBLog.cpp
+++ b/lldb/tools/debugserver/source/DNBLog.cpp
@@ -78,10 +78,8 @@ void _DNBLog(uint32_t flags, const char *format, ...) {
va_end(args);
}
-//----------------------------------------------------------------------
// Print debug strings if and only if the global g_debug is set to
// a non-zero value.
-//----------------------------------------------------------------------
void _DNBLogDebug(const char *format, ...) {
if (DNBLogEnabled() && g_debug) {
va_list args;
@@ -91,10 +89,8 @@ void _DNBLogDebug(const char *format, ...) {
}
}
-//----------------------------------------------------------------------
// Print debug strings if and only if the global g_debug is set to
// a non-zero value.
-//----------------------------------------------------------------------
void _DNBLogDebugVerbose(const char *format, ...) {
if (DNBLogEnabled() && g_debug && g_verbose) {
va_list args;
@@ -106,10 +102,8 @@ void _DNBLogDebugVerbose(const char *format, ...) {
static uint32_t g_message_id = 0;
-//----------------------------------------------------------------------
// Prefix the formatted log string with process and thread IDs and
// suffix it with a newline.
-//----------------------------------------------------------------------
void _DNBLogThreaded(const char *format, ...) {
if (DNBLogEnabled()) {
// PTHREAD_MUTEX_LOCKER(locker, GetLogThreadedMutex());
@@ -150,10 +144,8 @@ void _DNBLogThreaded(const char *format, ...) {
}
}
-//----------------------------------------------------------------------
// Prefix the formatted log string with process and thread IDs and
// suffix it with a newline.
-//----------------------------------------------------------------------
void _DNBLogThreadedIf(uint32_t log_bit, const char *format, ...) {
if (DNBLogEnabled() && (log_bit & g_log_bits) == log_bit) {
// PTHREAD_MUTEX_LOCKER(locker, GetLogThreadedMutex());
@@ -195,9 +187,7 @@ void _DNBLogThreadedIf(uint32_t log_bit, const char *format, ...) {
}
}
-//----------------------------------------------------------------------
// Printing of errors that are not fatal.
-//----------------------------------------------------------------------
void _DNBLogError(const char *format, ...) {
if (DNBLogEnabled()) {
char *arg_msg = NULL;
@@ -213,10 +203,8 @@ void _DNBLogError(const char *format, ...) {
}
}
-//----------------------------------------------------------------------
// Printing of errors that ARE fatal. Exit with ERR exit code
// immediately.
-//----------------------------------------------------------------------
void _DNBLogFatalError(int err, const char *format, ...) {
if (DNBLogEnabled()) {
char *arg_msg = NULL;
@@ -233,10 +221,8 @@ void _DNBLogFatalError(int err, const char *format, ...) {
}
}
-//----------------------------------------------------------------------
// Printing of warnings that are not fatal only if verbose mode is
// enabled.
-//----------------------------------------------------------------------
void _DNBLogVerbose(const char *format, ...) {
if (DNBLogEnabled() && g_verbose) {
va_list args;
@@ -246,10 +232,8 @@ void _DNBLogVerbose(const char *format, ...) {
}
}
-//----------------------------------------------------------------------
// Printing of warnings that are not fatal only if verbose mode is
// enabled.
-//----------------------------------------------------------------------
void _DNBLogWarningVerbose(const char *format, ...) {
if (DNBLogEnabled() && g_verbose) {
char *arg_msg = NULL;
@@ -265,9 +249,7 @@ void _DNBLogWarningVerbose(const char *format, ...) {
}
}
}
-//----------------------------------------------------------------------
// Printing of warnings that are not fatal.
-//----------------------------------------------------------------------
void _DNBLogWarning(const char *format, ...) {
if (DNBLogEnabled()) {
char *arg_msg = NULL;
diff --git a/lldb/tools/debugserver/source/DNBTimer.h b/lldb/tools/debugserver/source/DNBTimer.h
index 9792c9b79ab..21ee2351d69 100644
--- a/lldb/tools/debugserver/source/DNBTimer.h
+++ b/lldb/tools/debugserver/source/DNBTimer.h
@@ -21,9 +21,7 @@
class DNBTimer {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
DNBTimer(bool threadSafe) : m_mutexAP() {
if (threadSafe)
m_mutexAP.reset(new PThreadMutex(PTHREAD_MUTEX_RECURSIVE));
@@ -50,16 +48,12 @@ public:
~DNBTimer() {}
bool IsThreadSafe() const { return m_mutexAP.get() != NULL; }
- //------------------------------------------------------------------
// Reset the time value to now
- //------------------------------------------------------------------
void Reset() {
PTHREAD_MUTEX_LOCKER(locker, m_mutexAP.get());
gettimeofday(&m_timeval, NULL);
}
- //------------------------------------------------------------------
// Get the total mircoseconds since Jan 1, 1970
- //------------------------------------------------------------------
uint64_t TotalMicroSeconds() const {
PTHREAD_MUTEX_LOCKER(locker, m_mutexAP.get());
return (uint64_t)(m_timeval.tv_sec) * 1000000ull +
@@ -71,10 +65,8 @@ public:
sec = m_timeval.tv_sec;
usec = m_timeval.tv_usec;
}
- //------------------------------------------------------------------
// Return the number of microseconds elapsed between now and the
// m_timeval
- //------------------------------------------------------------------
uint64_t ElapsedMicroSeconds(bool update) {
PTHREAD_MUTEX_LOCKER(locker, m_mutexAP.get());
struct timeval now;
@@ -134,9 +126,7 @@ public:
}
protected:
- //------------------------------------------------------------------
// Classes that inherit from DNBTimer can see and modify these
- //------------------------------------------------------------------
std::unique_ptr<PThreadMutex> m_mutexAP;
struct timeval m_timeval;
};
diff --git a/lldb/tools/debugserver/source/JSON.h b/lldb/tools/debugserver/source/JSON.h
index e7ffcfb5712..b1c4a4c9db8 100644
--- a/lldb/tools/debugserver/source/JSON.h
+++ b/lldb/tools/debugserver/source/JSON.h
@@ -203,7 +203,6 @@ public:
JSONValue::SP GetObject(const std::string &key) const;
- // -------------------------------------------------------------------------
/// Return keyed value as bool
///
/// \param[in] key
@@ -217,7 +216,6 @@ public:
/// true if the key existed as was a bool value; false otherwise.
/// Note the return value is *not* the value of the bool, use
/// \b value for that.
- // -------------------------------------------------------------------------
bool GetObjectAsBool(const std::string &key, bool &value) const;
bool GetObjectAsString(const std::string &key, std::string &value) const;
diff --git a/lldb/tools/debugserver/source/JSONGenerator.h b/lldb/tools/debugserver/source/JSONGenerator.h
index efd8a6c3d35..70708f9a5ac 100644
--- a/lldb/tools/debugserver/source/JSONGenerator.h
+++ b/lldb/tools/debugserver/source/JSONGenerator.h
@@ -16,7 +16,6 @@
#include <utility>
#include <vector>
-//----------------------------------------------------------------------
/// \class JSONGenerator JSONGenerator.h
/// A class which can construct structured data for the sole purpose
/// of printing it in JSON format.
@@ -24,7 +23,6 @@
/// A stripped down version of lldb's StructuredData objects which are much
/// general purpose. This variant is intended only for assembling information
/// and printing it as a JSON string.
-//----------------------------------------------------------------------
class JSONGenerator {
public:
diff --git a/lldb/tools/debugserver/source/MacOSX/CFBundle.cpp b/lldb/tools/debugserver/source/MacOSX/CFBundle.cpp
index 6825fb374da..6971c1f4c32 100644
--- a/lldb/tools/debugserver/source/MacOSX/CFBundle.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/CFBundle.cpp
@@ -13,38 +13,28 @@
#include "CFBundle.h"
#include "CFString.h"
-//----------------------------------------------------------------------
// CFBundle constructor
-//----------------------------------------------------------------------
CFBundle::CFBundle(const char *path)
: CFReleaser<CFBundleRef>(), m_bundle_url() {
if (path && path[0])
SetPath(path);
}
-//----------------------------------------------------------------------
// CFBundle copy constructor
-//----------------------------------------------------------------------
CFBundle::CFBundle(const CFBundle &rhs)
: CFReleaser<CFBundleRef>(rhs), m_bundle_url(rhs.m_bundle_url) {}
-//----------------------------------------------------------------------
// CFBundle copy constructor
-//----------------------------------------------------------------------
CFBundle &CFBundle::operator=(const CFBundle &rhs) {
if (this != &rhs)
*this = rhs;
return *this;
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
CFBundle::~CFBundle() {}
-//----------------------------------------------------------------------
// Set the path for a bundle by supplying a
-//----------------------------------------------------------------------
bool CFBundle::SetPath(const char *path) {
CFAllocatorRef alloc = kCFAllocatorDefault;
// Release our old bundle and ULR
diff --git a/lldb/tools/debugserver/source/MacOSX/CFBundle.h b/lldb/tools/debugserver/source/MacOSX/CFBundle.h
index c56edee7a03..f49dc30f1f8 100644
--- a/lldb/tools/debugserver/source/MacOSX/CFBundle.h
+++ b/lldb/tools/debugserver/source/MacOSX/CFBundle.h
@@ -17,9 +17,7 @@
class CFBundle : public CFReleaser<CFBundleRef> {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
CFBundle(const char *path = NULL);
CFBundle(const CFBundle &rhs);
CFBundle &operator=(const CFBundle &rhs);
diff --git a/lldb/tools/debugserver/source/MacOSX/CFString.cpp b/lldb/tools/debugserver/source/MacOSX/CFString.cpp
index 3061c429b9a..637ba65ae4d 100644
--- a/lldb/tools/debugserver/source/MacOSX/CFString.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/CFString.cpp
@@ -14,19 +14,13 @@
#include <glob.h>
#include <string>
-//----------------------------------------------------------------------
// CFString constructor
-//----------------------------------------------------------------------
CFString::CFString(CFStringRef s) : CFReleaser<CFStringRef>(s) {}
-//----------------------------------------------------------------------
// CFString copy constructor
-//----------------------------------------------------------------------
CFString::CFString(const CFString &rhs) : CFReleaser<CFStringRef>(rhs) {}
-//----------------------------------------------------------------------
// CFString copy constructor
-//----------------------------------------------------------------------
CFString &CFString::operator=(const CFString &rhs) {
if (this != &rhs)
*this = rhs;
@@ -41,9 +35,7 @@ CFString::CFString(const char *cstr, CFStringEncoding cstr_encoding)
}
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
CFString::~CFString() {}
const char *CFString::GetFileSystemRepresentation(std::string &s) {
diff --git a/lldb/tools/debugserver/source/MacOSX/CFString.h b/lldb/tools/debugserver/source/MacOSX/CFString.h
index 47db507ce38..d1bd5682689 100644
--- a/lldb/tools/debugserver/source/MacOSX/CFString.h
+++ b/lldb/tools/debugserver/source/MacOSX/CFString.h
@@ -18,9 +18,7 @@
class CFString : public CFReleaser<CFStringRef> {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
CFString(CFStringRef cf_str = NULL);
CFString(const char *s, CFStringEncoding encoding = kCFStringEncodingUTF8);
CFString(const CFString &rhs);
diff --git a/lldb/tools/debugserver/source/MacOSX/CFUtils.h b/lldb/tools/debugserver/source/MacOSX/CFUtils.h
index 9dae40670f3..b567524ce63 100644
--- a/lldb/tools/debugserver/source/MacOSX/CFUtils.h
+++ b/lldb/tools/debugserver/source/MacOSX/CFUtils.h
@@ -17,11 +17,9 @@
#ifdef __cplusplus
-//----------------------------------------------------------------------
// Templatized CF helper class that can own any CF pointer and will
// call CFRelease() on any valid pointer it owns unless that pointer is
// explicitly released using the release() member function.
-//----------------------------------------------------------------------
template <class T> class CFReleaser {
public:
// Type names for the avlue
diff --git a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.h b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.h
index 334953dcbaf..24ab4230e38 100644
--- a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.h
+++ b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.h
@@ -29,21 +29,17 @@ class DarwinLogCollector
: public std::enable_shared_from_this<DarwinLogCollector>,
public ActivityStore {
public:
- //------------------------------------------------------------------
/// Return whether the os_log and activity tracing SPI is available.
///
/// \return \b true if the activity stream support is available,
/// \b false otherwise.
- //------------------------------------------------------------------
static bool IsSupported();
- //------------------------------------------------------------------
/// Return a log function suitable for DNBLog to use as the internal
/// logging function.
///
/// \return a DNBLog-style logging function if IsSupported() returns
/// true; otherwise, returns nullptr.
- //------------------------------------------------------------------
static DNBCallbackLog GetLogFunction();
static bool StartCollectingForProcess(nub_process_t pid,
@@ -57,9 +53,7 @@ public:
pid_t GetProcessID() const { return m_pid; }
- //------------------------------------------------------------------
// ActivityStore API
- //------------------------------------------------------------------
const char *GetActivityForID(os_activity_id_t activity_id) const override;
std::string
diff --git a/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogFilterRegex.cpp b/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogFilterRegex.cpp
index 9a09e55edba..489c056fa81 100644
--- a/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogFilterRegex.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogFilterRegex.cpp
@@ -11,11 +11,9 @@
#include "DNBLog.h"
#include "LogMessage.h"
-//----------------------------------------------------------------------
// Enable enhanced mode if it is available. This allows for things like
// \d for digit, \s for space, and many more, but it isn't available
// everywhere.
-//----------------------------------------------------------------------
#if defined(REG_ENHANCED)
#define DEFAULT_COMPILE_FLAGS (REG_ENHANCED | REG_EXTENDED)
#else
diff --git a/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogMessageOsLog.h b/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogMessageOsLog.h
index 5f50e390aa6..39b6adccb1b 100644
--- a/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogMessageOsLog.h
+++ b/lldb/tools/debugserver/source/MacOSX/DarwinLog/LogMessageOsLog.h
@@ -16,13 +16,11 @@
using ActivityStreamEntry = struct os_activity_stream_entry_s;
-// -----------------------------------------------------------------------------
/// Provides a unified wrapper around os_log()-style log messages.
///
/// The lifetime of this class is intended to be very short. The caller
/// must ensure that the passed in ActivityStore and ActivityStreamEntry
/// outlive this LogMessageOsLog entry.
-// -----------------------------------------------------------------------------
class LogMessageOsLog : public LogMessage {
public:
diff --git a/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp b/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp
index 803eb913832..4b664be5488 100644
--- a/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp
@@ -16,9 +16,7 @@
#include "GenealogySPI.h"
#include "MachThreadList.h"
-//---------------------------
/// Constructor
-//---------------------------
Genealogy::Genealogy()
: m_os_activity_diagnostic_for_pid(nullptr),
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.h b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
index 644364be4c9..0b8e1f4d4a5 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -40,9 +40,7 @@ class DNBThreadResumeActions;
class MachProcess {
public:
- //----------------------------------------------------------------------
// Constructors and Destructors
- //----------------------------------------------------------------------
MachProcess();
~MachProcess();
@@ -79,9 +77,7 @@ public:
: filename(), load_address(INVALID_NUB_ADDRESS), mod_date(0) {}
};
- //----------------------------------------------------------------------
// Child process control
- //----------------------------------------------------------------------
pid_t AttachForDebug(pid_t pid, char *err_str, size_t err_len);
pid_t LaunchForDebug(const char *path, char const *argv[], char const *envp[],
const char *working_directory, const char *stdin_path,
@@ -160,9 +156,7 @@ public:
nub_size_t ReadMemory(nub_addr_t addr, nub_size_t size, void *buf);
nub_size_t WriteMemory(nub_addr_t addr, nub_size_t size, const void *buf);
- //----------------------------------------------------------------------
// Path and arg accessors
- //----------------------------------------------------------------------
const char *Path() const { return m_path.c_str(); }
size_t ArgumentCount() const { return m_args.size(); }
const char *ArgumentAtIndex(size_t arg_idx) const {
@@ -171,9 +165,7 @@ public:
return NULL;
}
- //----------------------------------------------------------------------
// Breakpoint functions
- //----------------------------------------------------------------------
DNBBreakpoint *CreateBreakpoint(nub_addr_t addr, nub_size_t length,
bool hardware);
bool DisableBreakpoint(nub_addr_t addr, bool remove);
@@ -182,9 +174,7 @@ public:
DNBBreakpointList &Breakpoints() { return m_breakpoints; }
const DNBBreakpointList &Breakpoints() const { return m_breakpoints; }
- //----------------------------------------------------------------------
// Watchpoint functions
- //----------------------------------------------------------------------
DNBBreakpoint *CreateWatchpoint(nub_addr_t addr, nub_size_t length,
uint32_t watch_type, bool hardware);
bool DisableWatchpoint(nub_addr_t addr, bool remove);
@@ -194,9 +184,7 @@ public:
DNBBreakpointList &Watchpoints() { return m_watchpoints; }
const DNBBreakpointList &Watchpoints() const { return m_watchpoints; }
- //----------------------------------------------------------------------
// Exception thread functions
- //----------------------------------------------------------------------
bool StartSTDIOThread();
static void *STDIOThread(void *arg);
void ExceptionMessageReceived(const MachException::Message &exceptionMessage);
@@ -205,9 +193,7 @@ public:
nub_size_t CopyImageInfos(struct DNBExecutableImageInfo **image_infos,
bool only_changed);
- //----------------------------------------------------------------------
// Profile functions
- //----------------------------------------------------------------------
void SetEnableAsyncProfiling(bool enable, uint64_t internal_usec,
DNBProfileDataScanType scan_type);
bool IsProfilingEnabled() { return m_profile_enabled; }
@@ -217,9 +203,7 @@ public:
void SignalAsyncProfileData(const char *info);
size_t GetAsyncProfileData(char *buf, size_t buf_size);
- //----------------------------------------------------------------------
// Accessors
- //----------------------------------------------------------------------
pid_t ProcessID() const { return m_pid; }
bool ProcessIDIsValid() const { return m_pid > 0; }
pid_t SetProcessID(pid_t pid);
diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.h b/lldb/tools/debugserver/source/MacOSX/MachTask.h
index ad25f0e415f..a933bffc8a0 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachTask.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachTask.h
@@ -5,7 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-//----------------------------------------------------------------------
//
// MachTask.h
// debugserver
@@ -45,9 +44,7 @@ struct MachMallocEvent {
class MachTask {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
MachTask(MachProcess *process);
virtual ~MachTask();
diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
index be59fb6a0cf..8d2165b0f24 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
@@ -451,7 +451,6 @@ uint32_t MachThreadList::ProcessDidStop(MachProcess *process) {
return num_threads;
}
-//----------------------------------------------------------------------
// Check each thread in our thread list to see if we should notify our
// client of the current halt in execution.
//
@@ -461,7 +460,6 @@ uint32_t MachThreadList::ProcessDidStop(MachProcess *process) {
// RETURNS
// true if we should stop and notify our clients
// false if we should resume our child process and skip notification
-//----------------------------------------------------------------------
bool MachThreadList::ShouldStop(bool &step_more) {
PTHREAD_MUTEX_LOCKER(locker, m_threads_mutex);
uint32_t should_stop = false;
diff --git a/lldb/tools/debugserver/source/MacOSX/OsLogger.cpp b/lldb/tools/debugserver/source/MacOSX/OsLogger.cpp
index 5e13819de87..a83afb62b36 100644
--- a/lldb/tools/debugserver/source/MacOSX/OsLogger.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/OsLogger.cpp
@@ -19,10 +19,8 @@
#define LLDB_OS_LOG_MAX_BUFFER_LENGTH 256
namespace {
-//----------------------------------------------------------------------
// Darwin os_log logging callback that can be registered with
// DNBLogSetLogCallback
-//----------------------------------------------------------------------
void DarwinLogCallback(void *baton, uint32_t flags, const char *format,
va_list args) {
if (format == nullptr)
diff --git a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
index 0d2455e123d..45d05d6e0bd 100644
--- a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
@@ -1423,9 +1423,7 @@ nub_addr_t DNBArchMachARM::GetWatchAddress(const DBG &debug_state,
return bits(debug_state.__wvr[hw_index], 31, 0);
}
-//----------------------------------------------------------------------
// Register information definitions for 32 bit ARMV7.
-//----------------------------------------------------------------------
enum gpr_regnums {
gpr_r0 = 0,
gpr_r1,
@@ -1776,11 +1774,9 @@ const size_t DNBArchMachARM::k_num_exc_registers =
const size_t DNBArchMachARM::k_num_all_registers =
k_num_gpr_registers + k_num_vfp_registers + k_num_exc_registers;
-//----------------------------------------------------------------------
// Register set definitions. The first definitions at register set index
// of zero is for all registers, followed by other registers sets. The
// register information for the all register set need not be filled in.
-//----------------------------------------------------------------------
const DNBRegisterSetInfo DNBArchMachARM::g_reg_sets[] = {
{"ARM Registers", NULL, k_num_all_registers},
{"General Purpose Registers", g_gpr_registers, k_num_gpr_registers},
diff --git a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
index 8fedb984182..911cbe6b4b3 100644
--- a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
@@ -947,9 +947,7 @@ nub_addr_t DNBArchMachARM64::GetWatchAddress(const DBG &debug_state,
return bits(debug_state.__wvr[hw_index], 63, 0);
}
-//----------------------------------------------------------------------
// Register information definitions for 64 bit ARMv8.
-//----------------------------------------------------------------------
enum gpr_regnums {
gpr_x0 = 0,
gpr_x1,
@@ -1689,11 +1687,9 @@ const size_t DNBArchMachARM64::k_num_exc_registers =
const size_t DNBArchMachARM64::k_num_all_registers =
k_num_gpr_registers + k_num_vfp_registers + k_num_exc_registers;
-//----------------------------------------------------------------------
// Register set definitions. The first definitions at register set index
// of zero is for all registers, followed by other registers sets. The
// register information for the all register set need not be filled in.
-//----------------------------------------------------------------------
const DNBRegisterSetInfo DNBArchMachARM64::g_reg_sets[] = {
{"ARM64 Registers", NULL, k_num_all_registers},
{"General Purpose Registers", g_gpr_registers, k_num_gpr_registers},
diff --git a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
index 1854a9c831e..7d2d0c2ef1b 100644
--- a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
@@ -1025,9 +1025,7 @@ kern_return_t DNBArchImplI386::EnableHardwareSingleStep(bool enable) {
return m_state.GetError(e_regSetGPR, Read);
}
-//----------------------------------------------------------------------
// Register information definitions
-//----------------------------------------------------------------------
#define DEFINE_GPR_PSEUDO_16(reg16, reg32) \
{ \
@@ -1540,11 +1538,9 @@ const size_t DNBArchImplI386::k_num_all_registers_avx =
const size_t DNBArchImplI386::k_num_all_registers_avx512f =
k_num_gpr_registers + k_num_fpu_registers_avx512f + k_num_exc_registers;
-//----------------------------------------------------------------------
// Register set definitions. The first definitions at register set index
// of zero is for all registers, followed by other registers sets. The
// register information for the all register set need not be filled in.
-//----------------------------------------------------------------------
const DNBRegisterSetInfo DNBArchImplI386::g_reg_sets_no_avx[] = {
{"i386 Registers", NULL, k_num_all_registers_no_avx},
{"General Purpose Registers", g_gpr_registers, k_num_gpr_registers},
diff --git a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp b/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp
index 141b6b72c2a..c6671b5066a 100644
--- a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp
@@ -178,9 +178,7 @@ kern_return_t DNBArchMachPPC::EnableHardwareSingleStep(bool enable) {
return m_state.GetError(e_regSetGPR, Read);
}
-//----------------------------------------------------------------------
// Register information definitions for 32 bit PowerPC.
-//----------------------------------------------------------------------
enum gpr_regnums {
e_regNumGPR_srr0,
@@ -319,11 +317,9 @@ const size_t k_num_vec_registers =
const size_t k_num_ppc_registers = k_num_gpr_registers + k_num_fpr_registers +
k_num_exc_registers + k_num_vec_registers;
-//----------------------------------------------------------------------
// Register set definitions. The first definitions at register set index
// of zero is for all registers, followed by other registers sets. The
// register information for the all register set need not be filled in.
-//----------------------------------------------------------------------
static const DNBRegisterSetInfo g_reg_sets[] = {
{"PowerPC Registers", NULL, k_num_ppc_registers},
{"General Purpose Registers", g_gpr_registers, k_num_gpr_registers},
diff --git a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
index 4f32d44e69f..319215e8a7f 100644
--- a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -980,9 +980,7 @@ kern_return_t DNBArchImplX86_64::EnableHardwareSingleStep(bool enable) {
return m_state.GetError(e_regSetGPR, Read);
}
-//----------------------------------------------------------------------
// Register information definitions
-//----------------------------------------------------------------------
enum {
gpr_rax = 0,
@@ -2062,11 +2060,9 @@ const size_t DNBArchImplX86_64::k_num_fpu_registers_avx512f =
const size_t DNBArchImplX86_64::k_num_all_registers_avx512f =
k_num_gpr_registers + k_num_fpu_registers_avx512f + k_num_exc_registers;
-//----------------------------------------------------------------------
// Register set definitions. The first definitions at register set index
// of zero is for all registers, followed by other registers sets. The
// register information for the all register set need not be filled in.
-//----------------------------------------------------------------------
const DNBRegisterSetInfo DNBArchImplX86_64::g_reg_sets_no_avx[] = {
{"x86_64 Registers", NULL, k_num_all_registers_no_avx},
{"General Purpose Registers", g_gpr_registers, k_num_gpr_registers},
diff --git a/lldb/tools/debugserver/source/PThreadEvent.cpp b/lldb/tools/debugserver/source/PThreadEvent.cpp
index 9a70b25a880..82d1d227867 100644
--- a/lldb/tools/debugserver/source/PThreadEvent.cpp
+++ b/lldb/tools/debugserver/source/PThreadEvent.cpp
@@ -105,10 +105,8 @@ void PThreadEvent::ResetEvents(const uint32_t mask) {
}
}
-//----------------------------------------------------------------------
// Wait until 'timeout_abstime' for any events that are set in
// 'mask'. If 'timeout_abstime' is NULL, then wait forever.
-//----------------------------------------------------------------------
uint32_t
PThreadEvent::WaitForSetEvents(const uint32_t mask,
const struct timespec *timeout_abstime) const {
@@ -149,10 +147,8 @@ PThreadEvent::WaitForSetEvents(const uint32_t mask,
return 0;
}
-//----------------------------------------------------------------------
// Wait until 'timeout_abstime' for any events in 'mask' to reset.
// If 'timeout_abstime' is NULL, then wait forever.
-//----------------------------------------------------------------------
uint32_t PThreadEvent::WaitForEventsToReset(
const uint32_t mask, const struct timespec *timeout_abstime) const {
// DNBLogThreadedIf(LOG_EVENTS, "%p PThreadEvent::%s (0x%8.8x, %p)", this,
diff --git a/lldb/tools/debugserver/source/PThreadEvent.h b/lldb/tools/debugserver/source/PThreadEvent.h
index 00c8316ef07..5689cbfb9ca 100644
--- a/lldb/tools/debugserver/source/PThreadEvent.h
+++ b/lldb/tools/debugserver/source/PThreadEvent.h
@@ -44,10 +44,8 @@ public:
const struct timespec *timeout_abstime = NULL) const;
protected:
- //----------------------------------------------------------------------
// pthread condition and mutex variable to control access and allow
// blocking between the main thread and the spotlight index thread.
- //----------------------------------------------------------------------
mutable PThreadMutex m_mutex;
mutable PThreadCondition m_set_condition;
mutable PThreadCondition m_reset_condition;
diff --git a/lldb/tools/debugserver/source/PseudoTerminal.cpp b/lldb/tools/debugserver/source/PseudoTerminal.cpp
index 0a75bc9741f..cac8bda6248 100644
--- a/lldb/tools/debugserver/source/PseudoTerminal.cpp
+++ b/lldb/tools/debugserver/source/PseudoTerminal.cpp
@@ -15,27 +15,21 @@
#include <sys/ioctl.h>
#include <unistd.h>
-//----------------------------------------------------------------------
// PseudoTerminal constructor
-//----------------------------------------------------------------------
PseudoTerminal::PseudoTerminal()
: m_master_fd(invalid_fd), m_slave_fd(invalid_fd) {}
-//----------------------------------------------------------------------
// Destructor
// The master and slave file descriptors will get closed if they are
// valid. Call the ReleaseMasterFD()/ReleaseSlaveFD() member functions
// to release any file descriptors that are needed beyond the lifespan
// of this object.
-//----------------------------------------------------------------------
PseudoTerminal::~PseudoTerminal() {
CloseMaster();
CloseSlave();
}
-//----------------------------------------------------------------------
// Close the master file descriptor if it is valid.
-//----------------------------------------------------------------------
void PseudoTerminal::CloseMaster() {
if (m_master_fd > 0) {
::close(m_master_fd);
@@ -43,9 +37,7 @@ void PseudoTerminal::CloseMaster() {
}
}
-//----------------------------------------------------------------------
// Close the slave file descriptor if it is valid.
-//----------------------------------------------------------------------
void PseudoTerminal::CloseSlave() {
if (m_slave_fd > 0) {
::close(m_slave_fd);
@@ -53,7 +45,6 @@ void PseudoTerminal::CloseSlave() {
}
}
-//----------------------------------------------------------------------
// Open the first available pseudo terminal with OFLAG as the
// permissions. The file descriptor is store in the m_master_fd member
// variable and can be accessed via the MasterFD() or ReleaseMasterFD()
@@ -63,7 +54,6 @@ void PseudoTerminal::CloseSlave() {
//
// RETURNS:
// Zero when successful, non-zero indicating an error occurred.
-//----------------------------------------------------------------------
PseudoTerminal::Status PseudoTerminal::OpenFirstAvailableMaster(int oflag) {
// Open the master side of a pseudo terminal
m_master_fd = ::posix_openpt(oflag);
@@ -86,7 +76,6 @@ PseudoTerminal::Status PseudoTerminal::OpenFirstAvailableMaster(int oflag) {
return success;
}
-//----------------------------------------------------------------------
// Open the slave pseudo terminal for the current master pseudo
// terminal. A master pseudo terminal should already be valid prior to
// calling this function (see PseudoTerminal::OpenFirstAvailableMaster()).
@@ -95,7 +84,6 @@ PseudoTerminal::Status PseudoTerminal::OpenFirstAvailableMaster(int oflag) {
//
// RETURNS:
// Zero when successful, non-zero indicating an error occurred.
-//----------------------------------------------------------------------
PseudoTerminal::Status PseudoTerminal::OpenSlave(int oflag) {
CloseSlave();
@@ -113,7 +101,6 @@ PseudoTerminal::Status PseudoTerminal::OpenSlave(int oflag) {
return success;
}
-//----------------------------------------------------------------------
// Get the name of the slave pseudo terminal. A master pseudo terminal
// should already be valid prior to calling this function (see
// PseudoTerminal::OpenFirstAvailableMaster()).
@@ -123,14 +110,12 @@ PseudoTerminal::Status PseudoTerminal::OpenSlave(int oflag) {
// The name of the slave pseudo terminal as a NULL terminated C string
// that comes from static memory, so a copy of the string should be
// made as subsequent calls can change this value.
-//----------------------------------------------------------------------
const char *PseudoTerminal::SlaveName() const {
if (m_master_fd < 0)
return NULL;
return ::ptsname(m_master_fd);
}
-//----------------------------------------------------------------------
// Fork a child process that and have its stdio routed to a pseudo
// terminal.
//
@@ -150,7 +135,6 @@ const char *PseudoTerminal::SlaveName() const {
// RETURNS:
// in the parent process: the pid of the child, or -1 if fork fails
// in the child process: zero
-//----------------------------------------------------------------------
pid_t PseudoTerminal::Fork(PseudoTerminal::Status &error) {
pid_t pid = invalid_pid;
diff --git a/lldb/tools/debugserver/source/PseudoTerminal.h b/lldb/tools/debugserver/source/PseudoTerminal.h
index c14042a41c4..e4093bd98e9 100644
--- a/lldb/tools/debugserver/source/PseudoTerminal.h
+++ b/lldb/tools/debugserver/source/PseudoTerminal.h
@@ -35,9 +35,7 @@ public:
err_dup2_failed_on_stdout = -11,
err_dup2_failed_on_stderr = -12
};
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
PseudoTerminal();
~PseudoTerminal();
@@ -69,16 +67,12 @@ public:
pid_t Fork(Status &error);
protected:
- //------------------------------------------------------------------
// Classes that inherit from PseudoTerminal can see and modify these
- //------------------------------------------------------------------
int m_master_fd;
int m_slave_fd;
private:
- //------------------------------------------------------------------
// Outlaw copy and assignment constructors
- //------------------------------------------------------------------
PseudoTerminal(const PseudoTerminal &rhs);
PseudoTerminal &operator=(const PseudoTerminal &rhs);
};
diff --git a/lldb/tools/debugserver/source/RNBContext.cpp b/lldb/tools/debugserver/source/RNBContext.cpp
index 87f24ccf1b9..3f1a37a1175 100644
--- a/lldb/tools/debugserver/source/RNBContext.cpp
+++ b/lldb/tools/debugserver/source/RNBContext.cpp
@@ -25,14 +25,10 @@
#include "DNBLog.h"
#include "RNBRemote.h"
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
RNBContext::~RNBContext() { SetProcessID(INVALID_NUB_PROCESS); }
-//----------------------------------------------------------------------
// RNBContext constructor
-//----------------------------------------------------------------------
const char *RNBContext::EnvironmentAtIndex(size_t index) {
if (index < m_env_vec.size())
@@ -134,10 +130,8 @@ void RNBContext::StopProcessStatusThread() {
}
}
-//----------------------------------------------------------------------
// This thread's sole purpose is to watch for any status changes in the
// child process.
-//----------------------------------------------------------------------
void *RNBContext::ThreadFunctionProcessStatus(void *arg) {
RNBRemoteSP remoteSP(g_remoteSP);
RNBRemote *remote = remoteSP.get();
diff --git a/lldb/tools/debugserver/source/RNBContext.h b/lldb/tools/debugserver/source/RNBContext.h
index c2a0d3374d7..9159057329f 100644
--- a/lldb/tools/debugserver/source/RNBContext.h
+++ b/lldb/tools/debugserver/source/RNBContext.h
@@ -42,9 +42,7 @@ public:
all_event_bits = sticky_event_bits | normal_event_bits
} event_t;
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
RNBContext()
: m_pid(INVALID_NUB_PROCESS), m_pid_stop_count(0),
m_events(0, all_event_bits), m_pid_pthread(), m_launch_status(),
@@ -127,9 +125,7 @@ public:
bool GetDetachOnError() { return m_detach_on_error; }
protected:
- //------------------------------------------------------------------
// Classes that inherit from RNBContext can see and modify these
- //------------------------------------------------------------------
nub_process_t m_pid;
std::string m_stdin;
std::string m_stdout;
@@ -153,9 +149,7 @@ protected:
static void *ThreadFunctionProcessStatus(void *arg);
private:
- //------------------------------------------------------------------
// Outlaw copy and assignment operators
- //------------------------------------------------------------------
RNBContext(const RNBContext &rhs);
RNBContext &operator=(const RNBContext &rhs);
};
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index d67f5c8d47a..16c15f64c25 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -49,18 +49,14 @@
#include <sstream>
#include <unordered_set>
-//----------------------------------------------------------------------
// constants
-//----------------------------------------------------------------------
static const std::string OS_LOG_EVENTS_KEY_NAME("events");
static const std::string JSON_ASYNC_TYPE_KEY_NAME("type");
static const DarwinLogEventVector::size_type DARWIN_LOG_MAX_EVENTS_PER_PACKET =
10;
-//----------------------------------------------------------------------
// std::iostream formatting macros
-//----------------------------------------------------------------------
#define RAW_HEXBASE std::setfill('0') << std::hex << std::right
#define HEXBASE '0' << 'x' << RAW_HEXBASE
#define RAWHEX8(x) RAW_HEXBASE << std::setw(2) << ((uint32_t)((uint8_t)x))
@@ -89,16 +85,12 @@ static const DarwinLogEventVector::size_type DARWIN_LOG_MAX_EVENTS_PER_PACKET =
std::setfill('\t') << std::setw((iword_idx)) << ""
// Class to handle communications via gdb remote protocol.
-//----------------------------------------------------------------------
// Prototypes
-//----------------------------------------------------------------------
static std::string binary_encode_string(const std::string &s);
-//----------------------------------------------------------------------
// Decode a single hex character and return the hex value as a number or
// -1 if "ch" is not a hex character.
-//----------------------------------------------------------------------
static inline int xdigit_to_sint(char ch) {
if (ch >= 'a' && ch <= 'f')
return 10 + ch - 'a';
@@ -109,10 +101,8 @@ static inline int xdigit_to_sint(char ch) {
return -1;
}
-//----------------------------------------------------------------------
// Decode a single hex ASCII byte. Return -1 on failure, a value 0-255
// on success.
-//----------------------------------------------------------------------
static inline int decoded_hex_ascii_char(const char *p) {
const int hi_nibble = xdigit_to_sint(p[0]);
if (hi_nibble == -1)
@@ -123,9 +113,7 @@ static inline int decoded_hex_ascii_char(const char *p) {
return (uint8_t)((hi_nibble << 4) + lo_nibble);
}
-//----------------------------------------------------------------------
// Decode a hex ASCII string back into a string
-//----------------------------------------------------------------------
static std::string decode_hex_ascii_string(const char *p,
uint32_t max_length = UINT32_MAX) {
std::string arg;
@@ -4414,10 +4402,8 @@ rnb_err_t RNBRemote::HandlePacket_C(const char *p) {
return rnb_success;
}
-//----------------------------------------------------------------------
// 'D' packet
// Detach from gdb.
-//----------------------------------------------------------------------
rnb_err_t RNBRemote::HandlePacket_D(const char *p) {
if (m_ctx.HasValidProcessID()) {
if (DNBProcessDetach(m_ctx.ProcessID()))
@@ -5821,13 +5807,11 @@ static nub_addr_t GetMachHeaderForMainExecutable(const nub_process_t pid,
DNBDataRef::offset_t offset = 0;
data.SetPointerSize(addr_size);
- //----------------------------------------------------------------------
// When we are sitting at __dyld_start, the kernel has placed the
// address of the mach header of the main executable on the stack. If we
// read the SP and dereference a pointer, we might find the mach header
// for the executable. We also just make sure there is only 1 thread
// since if we are at __dyld_start we shouldn't have multiple threads.
- //----------------------------------------------------------------------
if (DNBProcessGetNumThreads(pid) == 1) {
nub_thread_t tid = DNBProcessGetThreadAtIndex(pid, 0);
if (tid != INVALID_NUB_THREAD) {
@@ -5847,10 +5831,8 @@ static nub_addr_t GetMachHeaderForMainExecutable(const nub_process_t pid,
}
}
- //----------------------------------------------------------------------
// Check the dyld_all_image_info structure for a list of mach header
// since it is a very easy thing to check
- //----------------------------------------------------------------------
if (shlib_addr != INVALID_NUB_ADDRESS) {
bytes_read =
DNBProcessMemoryRead(pid, shlib_addr, sizeof(AllImageInfos), bytes);
@@ -5880,12 +5862,10 @@ static nub_addr_t GetMachHeaderForMainExecutable(const nub_process_t pid,
}
}
- //----------------------------------------------------------------------
// We failed to find the executable's mach header from the all image
// infos and by dereferencing the stack pointer. Now we fall back to
// enumerating the memory regions and looking for regions that are
// executable.
- //----------------------------------------------------------------------
DNBRegionInfo region_info;
mach_header_addr = 0;
while (DNBProcessMemoryRegionInfo(pid, mach_header_addr, &region_info)) {
diff --git a/lldb/tools/debugserver/source/StdStringExtractor.cpp b/lldb/tools/debugserver/source/StdStringExtractor.cpp
index a52e8aba5d9..cb706a8f50c 100644
--- a/lldb/tools/debugserver/source/StdStringExtractor.cpp
+++ b/lldb/tools/debugserver/source/StdStringExtractor.cpp
@@ -21,9 +21,7 @@ static inline int xdigit_to_sint(char ch) {
return -1;
}
-//----------------------------------------------------------------------
// StdStringExtractor constructor
-//----------------------------------------------------------------------
StdStringExtractor::StdStringExtractor() : m_packet(), m_index(0) {}
StdStringExtractor::StdStringExtractor(const char *packet_cstr)
@@ -32,15 +30,11 @@ StdStringExtractor::StdStringExtractor(const char *packet_cstr)
m_packet.assign(packet_cstr);
}
-//----------------------------------------------------------------------
// StdStringExtractor copy constructor
-//----------------------------------------------------------------------
StdStringExtractor::StdStringExtractor(const StdStringExtractor &rhs)
: m_packet(rhs.m_packet), m_index(rhs.m_index) {}
-//----------------------------------------------------------------------
// StdStringExtractor assignment operator
-//----------------------------------------------------------------------
const StdStringExtractor &StdStringExtractor::
operator=(const StdStringExtractor &rhs) {
if (this != &rhs) {
@@ -50,9 +44,7 @@ operator=(const StdStringExtractor &rhs) {
return *this;
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
StdStringExtractor::~StdStringExtractor() {}
char StdStringExtractor::GetChar(char fail_value) {
@@ -65,14 +57,12 @@ char StdStringExtractor::GetChar(char fail_value) {
return fail_value;
}
-//----------------------------------------------------------------------
// If a pair of valid hex digits exist at the head of the
// StdStringExtractor they are decoded into an unsigned byte and returned
// by this function
//
// If there is not a pair of valid hex digits at the head of the
// StdStringExtractor, it is left unchanged and -1 is returned
-//----------------------------------------------------------------------
int StdStringExtractor::DecodeHexU8() {
SkipSpaces();
if (GetBytesLeft() < 2) {
@@ -87,10 +77,8 @@ int StdStringExtractor::DecodeHexU8() {
return (uint8_t)((hi_nibble << 4) + lo_nibble);
}
-//----------------------------------------------------------------------
// Extract an unsigned character from two hex ASCII chars in the packet
// string, or return fail_value on failure
-//----------------------------------------------------------------------
uint8_t StdStringExtractor::GetHexU8(uint8_t fail_value, bool set_eof_on_fail) {
// On success, fail_value will be overwritten with the next
// character in the stream
@@ -290,12 +278,10 @@ size_t StdStringExtractor::GetHexBytes(void *dst_void, size_t dst_len,
return bytes_extracted;
}
-//----------------------------------------------------------------------
// Decodes all valid hex encoded bytes at the head of the
// StdStringExtractor, limited by dst_len.
//
// Returns the number of bytes successfully decoded
-//----------------------------------------------------------------------
size_t StdStringExtractor::GetHexBytesAvail(void *dst_void, size_t dst_len) {
uint8_t *dst = (uint8_t *)dst_void;
size_t bytes_extracted = 0;
diff --git a/lldb/tools/debugserver/source/StdStringExtractor.h b/lldb/tools/debugserver/source/StdStringExtractor.h
index cc256f5655f..d3edfb2f461 100644
--- a/lldb/tools/debugserver/source/StdStringExtractor.h
+++ b/lldb/tools/debugserver/source/StdStringExtractor.h
@@ -18,17 +18,13 @@
class StdStringExtractor {
public:
enum { BigEndian = 0, LittleEndian = 1 };
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
StdStringExtractor();
StdStringExtractor(const char *packet_cstr);
StdStringExtractor(const StdStringExtractor &rhs);
virtual ~StdStringExtractor();
- //------------------------------------------------------------------
// Operators
- //------------------------------------------------------------------
const StdStringExtractor &operator=(const StdStringExtractor &rhs);
// Returns true if the file position is still valid for the data
@@ -107,9 +103,7 @@ public:
}
protected:
- //------------------------------------------------------------------
// For StdStringExtractor only
- //------------------------------------------------------------------
std::string m_packet; // The string in which to extract data.
uint64_t m_index; // When extracting data from a packet, this index
// will march along as things get extracted. If set
diff --git a/lldb/tools/debugserver/source/debugserver.cpp b/lldb/tools/debugserver/source/debugserver.cpp
index c360a46aed5..1463ff906cf 100644
--- a/lldb/tools/debugserver/source/debugserver.cpp
+++ b/lldb/tools/debugserver/source/debugserver.cpp
@@ -45,9 +45,7 @@ extern "C" int proc_set_wakemon_params(pid_t, int,
// Global PID in case we get a signal and need to stop the process...
nub_process_t g_pid = INVALID_NUB_PROCESS;
-//----------------------------------------------------------------------
// Run loop modes which determine which run loop function will be called
-//----------------------------------------------------------------------
typedef enum {
eRNBRunLoopModeInvalid = 0,
eRNBRunLoopModeGetStartModeFromRemoteProtocol,
@@ -58,9 +56,7 @@ typedef enum {
eRNBRunLoopModeExit
} RNBRunLoopMode;
-//----------------------------------------------------------------------
// Global Variables
-//----------------------------------------------------------------------
RNBRemoteSP g_remoteSP;
static int g_lockdown_opt = 0;
static int g_applist_opt = 0;
@@ -87,12 +83,10 @@ bool g_detach_on_error = true;
} \
} while (0)
-//----------------------------------------------------------------------
// Get our program path and arguments from the remote connection.
// We will need to start up the remote connection without a PID, get the
// arguments, wait for the new process to finish launching and hit its
// entry point, and then return the run loop mode that should come next.
-//----------------------------------------------------------------------
RNBRunLoopMode RNBRunLoopGetStartModeFromRemote(RNBRemote *remote) {
std::string packet;
@@ -162,12 +156,10 @@ RNBRunLoopMode RNBRunLoopGetStartModeFromRemote(RNBRemote *remote) {
return eRNBRunLoopModeExit;
}
-//----------------------------------------------------------------------
// This run loop mode will wait for the process to launch and hit its
// entry point. It will currently ignore all events except for the
// process state changed event, where it watches for the process stopped
// or crash process state.
-//----------------------------------------------------------------------
RNBRunLoopMode RNBRunLoopLaunchInferior(RNBRemote *remote,
const char *stdin_path,
const char *stdout_path,
@@ -351,12 +343,10 @@ RNBRunLoopMode RNBRunLoopLaunchInferior(RNBRemote *remote,
return eRNBRunLoopModeExit;
}
-//----------------------------------------------------------------------
// This run loop mode will wait for the process to launch and hit its
// entry point. It will currently ignore all events except for the
// process state changed event, where it watches for the process stopped
// or crash process state.
-//----------------------------------------------------------------------
RNBRunLoopMode RNBRunLoopLaunchAttaching(RNBRemote *remote,
nub_process_t attach_pid,
nub_process_t &pid) {
@@ -379,11 +369,9 @@ RNBRunLoopMode RNBRunLoopLaunchAttaching(RNBRemote *remote,
}
}
-//----------------------------------------------------------------------
// Watch for signals:
// SIGINT: so we can halt our inferior. (disabled for now)
// SIGPIPE: in case our child process dies
-//----------------------------------------------------------------------
int g_sigint_received = 0;
int g_sigpipe_received = 0;
void signal_handler(int signo) {
@@ -654,10 +642,8 @@ RNBRunLoopMode RNBRunLoopPlatform(RNBRemote *remote) {
return eRNBRunLoopModeExit;
}
-//----------------------------------------------------------------------
// Convenience function to set up the remote listening port
// Returns 1 for success 0 for failure.
-//----------------------------------------------------------------------
static void PortWasBoundCallbackUnixSocket(const void *baton, in_port_t port) {
//::printf ("PortWasBoundCallbackUnixSocket (baton = %p, port = %u)\n", baton,
@@ -761,9 +747,7 @@ static int ConnectRemote(RNBRemote *remote, const char *host, int port,
return 1;
}
-//----------------------------------------------------------------------
// ASL Logging callback that can be registered with DNBLogSetLogCallback
-//----------------------------------------------------------------------
void ASLLogCallback(void *baton, uint32_t flags, const char *format,
va_list args) {
if (format == NULL)
@@ -792,10 +776,8 @@ void ASLLogCallback(void *baton, uint32_t flags, const char *format,
::asl_vlog(NULL, g_aslmsg, asl_level, format, args);
}
-//----------------------------------------------------------------------
// FILE based Logging callback that can be registered with
// DNBLogSetLogCallback
-//----------------------------------------------------------------------
void FileLogCallback(void *baton, uint32_t flags, const char *format,
va_list args) {
if (baton == NULL || format == NULL)
@@ -821,9 +803,7 @@ void show_usage_and_exit(int exit_code) {
exit(exit_code);
}
-//----------------------------------------------------------------------
// option descriptors for getopt_long_only()
-//----------------------------------------------------------------------
static struct option g_long_options[] = {
{"attach", required_argument, NULL, 'a'},
{"arch", required_argument, NULL, 'A'},
@@ -890,9 +870,7 @@ static struct option g_long_options[] = {
// -F localhost:1234 -- /bin/ls"
{NULL, 0, NULL, 0}};
-//----------------------------------------------------------------------
// main
-//----------------------------------------------------------------------
int main(int argc, char *argv[]) {
// If debugserver is launched with DYLD_INSERT_LIBRARIES, unset it so we
// don't spawn child processes with this enabled.
diff --git a/lldb/tools/debugserver/source/libdebugserver.cpp b/lldb/tools/debugserver/source/libdebugserver.cpp
index 450ce41de25..e545caf5ae8 100644
--- a/lldb/tools/debugserver/source/libdebugserver.cpp
+++ b/lldb/tools/debugserver/source/libdebugserver.cpp
@@ -26,9 +26,7 @@
#include "RNBSocket.h"
#include "SysSignal.h"
-//----------------------------------------------------------------------
// Run loop modes which determine which run loop function will be called
-//----------------------------------------------------------------------
typedef enum {
eRNBRunLoopModeInvalid = 0,
eRNBRunLoopModeGetStartModeFromRemoteProtocol,
@@ -36,9 +34,7 @@ typedef enum {
eRNBRunLoopModeExit
} RNBRunLoopMode;
-//----------------------------------------------------------------------
// Global Variables
-//----------------------------------------------------------------------
RNBRemoteSP g_remoteSP;
int g_disable_aslr = 0;
int g_isatty = 0;
@@ -60,12 +56,10 @@ int g_isatty = 0;
} \
} while (0)
-//----------------------------------------------------------------------
// Get our program path and arguments from the remote connection.
// We will need to start up the remote connection without a PID, get the
// arguments, wait for the new process to finish launching and hit its
// entry point, and then return the run loop mode that should come next.
-//----------------------------------------------------------------------
RNBRunLoopMode RNBRunLoopGetStartModeFromRemote(RNBRemoteSP &remoteSP) {
std::string packet;
@@ -125,11 +119,9 @@ RNBRunLoopMode RNBRunLoopGetStartModeFromRemote(RNBRemoteSP &remoteSP) {
return eRNBRunLoopModeExit;
}
-//----------------------------------------------------------------------
// Watch for signals:
// SIGINT: so we can halt our inferior. (disabled for now)
// SIGPIPE: in case our child process dies
-//----------------------------------------------------------------------
nub_process_t g_pid;
int g_sigpipe_received = 0;
void signal_handler(int signo) {
OpenPOWER on IntegriCloud