diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-07-17 03:23:13 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-07-17 03:23:13 +0000 |
| commit | 23f59509a8790b04c691ec063c55724a3bfee7eb (patch) | |
| tree | 9bd1537b53423b7a43ccd4b9bceb178960bbbb02 /lldb/tools/debugserver/source/MacOSX | |
| parent | 24a8378c4f5ab46f9156e8c271500a6e051c2fd4 (diff) | |
| download | bcm5719-llvm-23f59509a8790b04c691ec063c55724a3bfee7eb.tar.gz bcm5719-llvm-23f59509a8790b04c691ec063c55724a3bfee7eb.zip | |
Ran the static analyzer on the codebase and found a few things.
llvm-svn: 160338
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX')
| -rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachException.cpp | 7 | ||||
| -rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachProcess.cpp | 23 | ||||
| -rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp | 5 |
3 files changed, 17 insertions, 18 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.cpp b/lldb/tools/debugserver/source/MacOSX/MachException.cpp index ead512ea148..9856867d11e 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachException.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachException.cpp @@ -122,7 +122,6 @@ catch_mach_exception_raise_state_identity mach_msg_type_number_t *new_stateCnt ) { - kern_return_t kret; if (DNBLogCheckLogBit(LOG_EXCEPTIONS)) { DNBLogThreaded("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { 0x%llx, 0x%llx })", @@ -135,8 +134,8 @@ catch_mach_exception_raise_state_identity (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD), (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD)); } - kret = mach_port_deallocate (mach_task_self (), task_port); - kret = mach_port_deallocate (mach_task_self (), thread_port); + mach_port_deallocate (mach_task_self (), task_port); + mach_port_deallocate (mach_task_self (), thread_port); return KERN_FAILURE; } @@ -229,7 +228,7 @@ MachException::Data::GetStopInfo(struct DNBThreadStopInfo *stop_info) const if (desc < end_desc) { const char *sig_str = SysSignal::Name(soft_signal); - desc += snprintf(desc, end_desc - desc, " EXC_SOFT_SIGNAL( %i ( %s ))", soft_signal, sig_str ? sig_str : "unknown signal"); + snprintf(desc, end_desc - desc, " EXC_SOFT_SIGNAL( %i ( %s ))", soft_signal, sig_str ? sig_str : "unknown signal"); } } else diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp index 4d787782c60..2dcbb6727cd 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp @@ -421,8 +421,7 @@ MachProcess::DoSIGSTOP (bool clear_bps_and_wps, bool allow_running, uint32_t *th { DisableAllBreakpoints (true); DisableAllWatchpoints (true); - // The static analyzer complains about this, but just leave the following line in. - clear_bps_and_wps = false; + //clear_bps_and_wps = false; } uint32_t thread_idx = m_thread_list.GetThreadIndexForThreadStoppedWithSignal (SIGSTOP); if (thread_idx_ptr) @@ -1865,18 +1864,20 @@ MachProcess::ForkChildForPTraceDebugging // If our parent is setgid, lets make sure we don't inherit those // extra powers due to nepotism. - ::setgid (getgid ()); + if (::setgid (getgid ()) == 0) + { - // Let the child have its own process group. We need to execute - // this call in both the child and parent to avoid a race condition - // between the two processes. - ::setpgid (0, 0); // Set the child process group to match its pid + // Let the child have its own process group. We need to execute + // this call in both the child and parent to avoid a race condition + // between the two processes. + ::setpgid (0, 0); // Set the child process group to match its pid - // Sleep a bit to before the exec call - ::sleep (1); + // Sleep a bit to before the exec call + ::sleep (1); - // Turn this process into - ::execv (path, (char * const *)argv); + // Turn this process into + ::execv (path, (char * const *)argv); + } // Exit with error code. Child process should have taken // over in above exec call and if the exec fails it will // exit the child process below. diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp index b8044fe6c7f..8e35069fd8a 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp @@ -470,9 +470,9 @@ MachThreadList::DisableHardwareBreakpoint (const DNBBreakpoint* bp) const uint32_t MachThreadList::EnableHardwareWatchpoint (const DNBBreakpoint* wp) const { + uint32_t hw_index = INVALID_NUB_HW_INDEX; if (wp != NULL) { - uint32_t hw_index; PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex); const uint32_t num_threads = m_threads.size(); for (uint32_t idx = 0; idx < num_threads; ++idx) @@ -492,9 +492,8 @@ MachThreadList::EnableHardwareWatchpoint (const DNBBreakpoint* wp) const // Use an arbitrary thread to signal the completion of our transaction. if (num_threads) m_threads[0]->HardwareWatchpointStateChanged(); - return hw_index; } - return INVALID_NUB_HW_INDEX; + return hw_index; } bool |

