summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-01-07 12:13:03 +0100
committerRaphael Isemann <teemperor@gmail.com>2020-01-07 13:03:56 +0100
commit65fdb34219f33b2871a532a38814ac4ebea10abc (patch)
tree5ddc3e81290641e13302734ec37030f3013ca77d /lldb/tools/debugserver
parent14cd4a5b32478f76b9fa58825b7c92ba0dd5bc2b (diff)
downloadbcm5719-llvm-65fdb34219f33b2871a532a38814ac4ebea10abc.tar.gz
bcm5719-llvm-65fdb34219f33b2871a532a38814ac4ebea10abc.zip
[lldb][NFC] Use static_cast instead of reinterpret_cast where possible
Summary: There are a few places in LLDB where we do a `reinterpret_cast` for conversions that we could also do with `static_cast`. This patch moves all this code to `static_cast`. Reviewers: shafik, JDevlieghere, labath Reviewed By: labath Subscribers: arphaman, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72161
Diffstat (limited to 'lldb/tools/debugserver')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp7
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachProcess.mm51
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachThread.cpp2
3 files changed, 31 insertions, 29 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
index be50f04c4d8..a9f8956b8d4 100644
--- a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
@@ -690,9 +690,10 @@ void DarwinLogCollector::CancelActivityStream() {
if (!m_activity_stream)
return;
- DNBLogThreadedIf(LOG_DARWIN_LOG, "DarwinLogCollector::%s(): canceling "
- "activity stream %p",
- __FUNCTION__, reinterpret_cast<void *>(m_activity_stream));
+ DNBLogThreadedIf(LOG_DARWIN_LOG,
+ "DarwinLogCollector::%s(): canceling "
+ "activity stream %p",
+ __FUNCTION__, static_cast<void *>(m_activity_stream));
(*s_os_activity_stream_cancel)(m_activity_stream);
m_activity_stream = nullptr;
}
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index 652a531dab0..2e952d6ad0b 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -1413,29 +1413,29 @@ bool MachProcess::Interrupt() {
bool MachProcess::Signal(int signal, const struct timespec *timeout_abstime) {
DNBLogThreadedIf(LOG_PROCESS,
"MachProcess::Signal (signal = %d, timeout = %p)", signal,
- reinterpret_cast<const void *>(timeout_abstime));
+ static_cast<const void *>(timeout_abstime));
nub_state_t state = GetState();
if (::kill(ProcessID(), signal) == 0) {
// If we were running and we have a timeout, wait for the signal to stop
if (IsRunning(state) && timeout_abstime) {
- DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout "
- "= %p) waiting for signal to stop "
- "process...",
- signal, reinterpret_cast<const void *>(timeout_abstime));
+ DNBLogThreadedIf(LOG_PROCESS,
+ "MachProcess::Signal (signal = %d, timeout "
+ "= %p) waiting for signal to stop "
+ "process...",
+ signal, static_cast<const void *>(timeout_abstime));
m_private_events.WaitForSetEvents(eEventProcessStoppedStateChanged,
timeout_abstime);
state = GetState();
DNBLogThreadedIf(
LOG_PROCESS,
"MachProcess::Signal (signal = %d, timeout = %p) state = %s", signal,
- reinterpret_cast<const void *>(timeout_abstime),
- DNBStateAsString(state));
+ static_cast<const void *>(timeout_abstime), DNBStateAsString(state));
return !IsRunning(state);
}
DNBLogThreadedIf(
LOG_PROCESS,
"MachProcess::Signal (signal = %d, timeout = %p) not waiting...",
- signal, reinterpret_cast<const void *>(timeout_abstime));
+ signal, static_cast<const void *>(timeout_abstime));
return true;
}
DNBError err(errno, DNBError::POSIX);
@@ -1739,10 +1739,10 @@ DNBBreakpoint *MachProcess::CreateBreakpoint(nub_addr_t addr, nub_size_t length,
bp = m_breakpoints.Add(addr, length, hardware);
if (EnableBreakpoint(addr)) {
- DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = "
- "0x%8.8llx, length = %llu) => %p",
- (uint64_t)addr, (uint64_t)length,
- reinterpret_cast<void *>(bp));
+ DNBLogThreadedIf(LOG_BREAKPOINTS,
+ "MachProcess::CreateBreakpoint ( addr = "
+ "0x%8.8llx, length = %llu) => %p",
+ (uint64_t)addr, (uint64_t)length, static_cast<void *>(bp));
return bp;
} else if (bp->Release() == 0) {
m_breakpoints.Remove(addr);
@@ -1771,10 +1771,10 @@ DNBBreakpoint *MachProcess::CreateWatchpoint(nub_addr_t addr, nub_size_t length,
wp->SetIsWatchpoint(watch_flags);
if (EnableWatchpoint(addr)) {
- DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = "
- "0x%8.8llx, length = %llu) => %p",
- (uint64_t)addr, (uint64_t)length,
- reinterpret_cast<void *>(wp));
+ DNBLogThreadedIf(LOG_WATCHPOINTS,
+ "MachProcess::CreateWatchpoint ( addr = "
+ "0x%8.8llx, length = %llu) => %p",
+ (uint64_t)addr, (uint64_t)length, static_cast<void *>(wp));
return wp;
} else {
DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = "
@@ -2303,7 +2303,7 @@ void MachProcess::AppendSTDOUT(char *s, size_t len) {
size_t MachProcess::GetAvailableSTDOUT(char *buf, size_t buf_size) {
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", __FUNCTION__,
- reinterpret_cast<void *>(buf), (uint64_t)buf_size);
+ static_cast<void *>(buf), (uint64_t)buf_size);
PTHREAD_MUTEX_LOCKER(locker, m_stdio_mutex);
size_t bytes_available = m_stdout_data.size();
if (bytes_available > 0) {
@@ -2463,7 +2463,7 @@ void MachProcess::SignalAsyncProfileData(const char *info) {
size_t MachProcess::GetAsyncProfileData(char *buf, size_t buf_size) {
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", __FUNCTION__,
- reinterpret_cast<void *>(buf), (uint64_t)buf_size);
+ static_cast<void *>(buf), (uint64_t)buf_size);
PTHREAD_MUTEX_LOCKER(locker, m_profile_data_mutex);
if (m_profile_data.empty())
return 0;
@@ -2995,8 +2995,8 @@ pid_t MachProcess::LaunchForDebug(
DNBLogThreadedIf(LOG_PROCESS,
"%s( path = '%s', argv = %p, envp = %p, "
"launch_flavor = %u, disable_aslr = %d )",
- __FUNCTION__, path, reinterpret_cast<const void *>(argv),
- reinterpret_cast<const void *>(envp), launch_flavor,
+ __FUNCTION__, path, static_cast<const void *>(argv),
+ static_cast<const void *>(envp), launch_flavor,
disable_aslr);
// Fork a child process for debugging
@@ -3138,11 +3138,12 @@ pid_t MachProcess::PosixSpawnChildForPTraceDebugging(
MachProcess *process, int disable_aslr, DNBError &err) {
posix_spawnattr_t attr;
short flags;
- DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv=%p, envp=%p, "
- "working_dir=%s, stdin=%s, stdout=%s "
- "stderr=%s, no-stdio=%i)",
- __FUNCTION__, path, reinterpret_cast<const void *>(argv),
- reinterpret_cast<const void *>(envp), working_directory,
+ DNBLogThreadedIf(LOG_PROCESS,
+ "%s ( path='%s', argv=%p, envp=%p, "
+ "working_dir=%s, stdin=%s, stdout=%s "
+ "stderr=%s, no-stdio=%i)",
+ __FUNCTION__, path, static_cast<const void *>(argv),
+ static_cast<const void *>(envp), working_directory,
stdin_path, stdout_path, stderr_path, no_stdio);
err.SetError(::posix_spawnattr_init(&attr), DNBError::POSIX);
diff --git a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
index b51ea694922..80d6042caa5 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
@@ -49,7 +49,7 @@ MachThread::MachThread(MachProcess *process, bool is_64_bit,
DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE,
"MachThread::MachThread ( process = %p, tid = 0x%8.8" PRIx64
", seq_id = %u )",
- reinterpret_cast<void *>(&m_process), m_unique_id, m_seq_id);
+ static_cast<void *>(&m_process), m_unique_id, m_seq_id);
}
MachThread::~MachThread() {
OpenPOWER on IntegriCloud