diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
commit | 05097246f352eca76207c9ebb08656c88bdf751a (patch) | |
tree | bfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/Plugins/Process/FreeBSD | |
parent | add59c052dd6768fd54431e6a3bf045e7f25cb59 (diff) | |
download | bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.gz bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.zip |
Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.
FYI, the script I used was:
import textwrap
import commands
import os
import sys
import re
tmp = "%s.tmp"%sys.argv[1]
out = open(tmp, "w+")
with open(sys.argv[1], "r") as f:
header = ""
text = ""
comment = re.compile(r'^( *//) ([^ ].*)$')
special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$')
for line in f:
match = comment.match(line)
if match and not special.match(match.group(2)):
# skip intentionally short comments.
if not text and len(match.group(2)) < 40:
out.write(line)
continue
if text:
text += " " + match.group(2)
else:
header = match.group(1)
text = match.group(2)
continue
if text:
filled = textwrap.wrap(text, width=(78-len(header)),
break_long_words=False)
for l in filled:
out.write(header+" "+l+'\n')
text = ""
out.write(line)
os.rename(tmp, sys.argv[1])
Differential Revision: https://reviews.llvm.org/D46144
llvm-svn: 331197
Diffstat (limited to 'lldb/source/Plugins/Process/FreeBSD')
6 files changed, 82 insertions, 88 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp b/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp index e6557c2d58e..4b0d640c6c2 100644 --- a/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp @@ -69,15 +69,15 @@ FreeBSDThread::FreeBSDThread(Process &process, lldb::tid_t tid) for (uint32_t wp_idx = 0; wp_idx < wp_size; wp_idx++) { lldb::WatchpointSP wp = wp_list.GetByIndex(wp_idx); if (wp.get() && wp->IsEnabled()) { - // This watchpoint as been enabled; obviously this "new" thread - // has been created since that watchpoint was enabled. Since - // the POSIXBreakpointProtocol has yet to be initialized, its - // m_watchpoints_initialized member will be FALSE. Attempting to - // read the debug status register to determine if a watchpoint - // has been hit would result in the zeroing of that register. - // Since the active debug registers would have been cloned when - // this thread was created, simply force the m_watchpoints_initized - // member to TRUE and avoid resetting dr6 and dr7. + // This watchpoint as been enabled; obviously this "new" thread has been + // created since that watchpoint was enabled. Since the + // POSIXBreakpointProtocol has yet to be initialized, its + // m_watchpoints_initialized member will be FALSE. Attempting to read + // the debug status register to determine if a watchpoint has been hit + // would result in the zeroing of that register. Since the active debug + // registers would have been cloned when this thread was created, simply + // force the m_watchpoints_initized member to TRUE and avoid resetting + // dr6 and dr7. GetPOSIXBreakpointProtocol()->ForceWatchpointsInitialized(); } } @@ -98,9 +98,8 @@ void FreeBSDThread::RefreshStateAfterStop() { // context by the time this function gets called. The KDPRegisterContext // class has been made smart enough to detect when it needs to invalidate // which registers are valid by putting hooks in the register read and - // register supply functions where they check the process stop ID and do - // the right thing. - // if (StateIsStoppedState(GetState()) + // register supply functions where they check the process stop ID and do the + // right thing. if (StateIsStoppedState(GetState()) { const bool force = false; GetRegisterContext()->InvalidateIfNeeded(force); @@ -469,20 +468,17 @@ void FreeBSDThread::BreakNotify(const ProcessMessage &message) { GetProcess()->GetBreakpointSiteList().FindByAddress(pc)); // If the breakpoint is for this thread, then we'll report the hit, but if it - // is for another thread, - // we create a stop reason with should_stop=false. If there is no breakpoint - // location, then report - // an invalid stop reason. We don't need to worry about stepping over the - // breakpoint here, that will - // be taken care of when the thread resumes and notices that there's a + // is for another thread, we create a stop reason with should_stop=false. If + // there is no breakpoint location, then report an invalid stop reason. We + // don't need to worry about stepping over the breakpoint here, that will be + // taken care of when the thread resumes and notices that there's a // breakpoint under the pc. if (bp_site) { lldb::break_id_t bp_id = bp_site->GetID(); // If we have an operating system plug-in, we might have set a thread - // specific breakpoint using the - // operating system thread ID, so we can't make any assumptions about the - // thread ID so we must always - // report the breakpoint regardless of the thread. + // specific breakpoint using the operating system thread ID, so we can't + // make any assumptions about the thread ID so we must always report the + // breakpoint regardless of the thread. if (bp_site->ValidForThisThread(this) || GetProcess()->GetOperatingSystem() != NULL) SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID(*this, bp_id)); @@ -541,13 +537,12 @@ void FreeBSDThread::TraceNotify(const ProcessMessage &message) { lldb::BreakpointSiteSP bp_site( GetProcess()->GetBreakpointSiteList().FindByAddress(pc)); - // If the current pc is a breakpoint site then set the StopInfo to Breakpoint. - // Otherwise, set the StopInfo to Watchpoint or Trace. - // If we have an operating system plug-in, we might have set a thread specific - // breakpoint using the - // operating system thread ID, so we can't make any assumptions about the - // thread ID so we must always - // report the breakpoint regardless of the thread. + // If the current pc is a breakpoint site then set the StopInfo to + // Breakpoint. Otherwise, set the StopInfo to Watchpoint or Trace. If we have + // an operating system plug-in, we might have set a thread specific + // breakpoint using the operating system thread ID, so we can't make any + // assumptions about the thread ID so we must always report the breakpoint + // regardless of the thread. if (bp_site && (bp_site->ValidForThisThread(this) || GetProcess()->GetOperatingSystem() != NULL)) SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID( diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp index ec33bf903d3..aa8464e9862 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -357,10 +357,10 @@ ProcessFreeBSD::GetFileSpec(const lldb_private::FileAction *file_action, if (file_action && file_action->GetAction() == FileAction::eFileActionOpen) { file_spec = file_action->GetFileSpec(); - // By default the stdio paths passed in will be pseudo-terminal - // (/dev/pts). If so, convert to using a different default path - // instead to redirect I/O to the debugger console. This should - // also handle user overrides to /dev/null or a different file. + // By default the stdio paths passed in will be pseudo-terminal (/dev/pts). + // If so, convert to using a different default path instead to redirect I/O + // to the debugger console. This should also handle user overrides to + // /dev/null or a different file. if (!file_spec || file_spec == dbg_pts_file_spec) file_spec = default_file_spec; } @@ -655,8 +655,8 @@ ProcessFreeBSD::GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site) { break; case llvm::Triple::arm: { - // The ARM reference recommends the use of 0xe7fddefe and 0xdefe - // but the linux kernel does otherwise. + // The ARM reference recommends the use of 0xe7fddefe and 0xdefe but the + // linux kernel does otherwise. static const uint8_t g_arm_breakpoint_opcode[] = {0xf0, 0x01, 0xf0, 0xe7}; static const uint8_t g_thumb_breakpoint_opcode[] = {0x01, 0xde}; @@ -744,8 +744,8 @@ Status ProcessFreeBSD::EnableWatchpoint(Watchpoint *wp, bool notify) { wp->SetEnabled(true, notify); return error; } else { - // Watchpoint enabling failed on at least one - // of the threads so roll back all of them + // Watchpoint enabling failed on at least one of the threads so roll + // back all of them DisableWatchpoint(wp, false); error.SetErrorString("Setting hardware watchpoint failed"); } @@ -812,8 +812,8 @@ Status ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num) { Status ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num, bool &after) { Status error = GetWatchpointSupportInfo(num); - // Watchpoints trigger and halt the inferior after - // the corresponding instruction has been executed. + // Watchpoints trigger and halt the inferior after the corresponding + // instruction has been executed. after = true; return error; } @@ -1076,8 +1076,8 @@ Status ProcessFreeBSD::SetupSoftwareSingleStepping(lldb::tid_t tid) { "Emulation was successful but PC wasn't updated"); next_pc = pc_it->second.GetAsUInt64(); } else if (pc_it == baton.m_register_values.end()) { - // Emulate instruction failed and it haven't changed PC. Advance PC - // with the size of the current opcode because the emulation of all + // Emulate instruction failed and it haven't changed PC. Advance PC with + // the size of the current opcode because the emulation of all // PC modifying instruction should be successful. The failure most // likely caused by a not supported instruction which don't modify PC. next_pc = diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp index feba3af8fcf..a498e559915 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp @@ -41,8 +41,8 @@ using namespace lldb; using namespace lldb_private; -// We disable the tracing of ptrace calls for integration builds to -// avoid the additional indirection and checks. +// We disable the tracing of ptrace calls for integration builds to avoid the +// additional indirection and checks. #ifndef LLDB_CONFIGURATION_BUILDANDINTEGRATION // Wrapper for ptrace to catch errors and log calls. @@ -61,9 +61,8 @@ const char *Get_PT_IO_OP(int op) { } } -// Wrapper for ptrace to catch errors and log calls. -// Note that ptrace sets errno on error because -1 is reserved as a valid -// result. +// Wrapper for ptrace to catch errors and log calls. Note that ptrace sets +// errno on error because -1 is reserved as a valid result. extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data, const char *reqName, const char *file, int line) { long int result; @@ -130,8 +129,8 @@ extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data, return result; } -// Wrapper for ptrace when logging is not required. -// Sets errno to 0 prior to calling ptrace. +// Wrapper for ptrace when logging is not required. Sets errno to 0 prior to +// calling ptrace. extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data) { long result = 0; errno = 0; @@ -875,9 +874,9 @@ bool ProcessMonitor::Launch(LaunchArgs *args) { if (PTRACE(PT_TRACE_ME, 0, NULL, 0) < 0) exit(ePtraceFailed); - // terminal has already dupped the tty descriptors to stdin/out/err. - // This closes original fd from which they were copied (and avoids - // leaking descriptors to the debugged process. + // terminal has already dupped the tty descriptors to stdin/out/err. This + // closes original fd from which they were copied (and avoids leaking + // descriptors to the debugged process. terminal.CloseSlaveFileDescriptor(); // Do not inherit setgid powers. @@ -1102,9 +1101,9 @@ ProcessMessage ProcessMonitor::MonitorSIGTRAP(ProcessMonitor *monitor, break; case (SIGTRAP /* | (PTRACE_EVENT_EXIT << 8) */): { - // The inferior process is about to exit. Maintain the process in a - // state of "limbo" until we are explicitly commanded to detach, - // destroy, resume, etc. + // The inferior process is about to exit. Maintain the process in a state + // of "limbo" until we are explicitly commanded to detach, destroy, resume, + // etc. unsigned long data = 0; if (!monitor->GetEventMessage(tid, &data)) data = -1; @@ -1159,8 +1158,8 @@ ProcessMessage ProcessMonitor::MonitorSignal(ProcessMonitor *monitor, Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); // POSIX says that process behaviour is undefined after it ignores a SIGFPE, - // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a - // kill(2) or raise(3). Similarly for tgkill(2) on FreeBSD. + // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a kill(2) + // or raise(3). Similarly for tgkill(2) on FreeBSD. // // IOW, user generated signals never generate what we consider to be a // "crash". @@ -1196,8 +1195,8 @@ ProcessMessage ProcessMonitor::MonitorSignal(ProcessMonitor *monitor, } // else; Use atleast si_signo info for other si_code } - // Everything else is "normal" and does not require any special action on - // our part. + // Everything else is "normal" and does not require any special action on our + // part. return ProcessMessage::Signal(tid, signo); } @@ -1423,14 +1422,14 @@ void ProcessMonitor::StopMonitor() { } // FIXME: On Linux, when a new thread is created, we receive to notifications, -// (1) a SIGTRAP|PTRACE_EVENT_CLONE from the main process thread with the -// child thread id as additional information, and (2) a SIGSTOP|SI_USER from -// the new child thread indicating that it has is stopped because we attached. -// We have no guarantee of the order in which these arrive, but we need both -// before we are ready to proceed. We currently keep a list of threads which -// have sent the initial SIGSTOP|SI_USER event. Then when we receive the -// SIGTRAP|PTRACE_EVENT_CLONE notification, if the initial stop has not occurred -// we call ProcessMonitor::WaitForInitialTIDStop() to wait for it. +// (1) a SIGTRAP|PTRACE_EVENT_CLONE from the main process thread with the child +// thread id as additional information, and (2) a SIGSTOP|SI_USER from the new +// child thread indicating that it has is stopped because we attached. We have +// no guarantee of the order in which these arrive, but we need both before we +// are ready to proceed. We currently keep a list of threads which have sent +// the initial SIGSTOP|SI_USER event. Then when we receive the +// SIGTRAP|PTRACE_EVENT_CLONE notification, if the initial stop has not +// occurred we call ProcessMonitor::WaitForInitialTIDStop() to wait for it. // // Right now, the above logic is in ProcessPOSIX, so we need a definition of // this function in the FreeBSD ProcessMonitor implementation even if it isn't diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp index b911ee22201..734167e1fc9 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp @@ -130,14 +130,14 @@ bool RegisterContextPOSIXProcessMonitor_mips64::ReadRegister( bool success = ReadRegister(full_reg, value); if (success) { - // If our read was not aligned (for ah,bh,ch,dh), shift our returned value - // one byte to the right. + // If our read was not aligned (for ah,bh,ch,dh), shift our returned + // value one byte to the right. if (is_subreg && (reg_info->byte_offset & 0x1)) value.SetUInt64(value.GetAsUInt64() >> 8); // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (value.GetByteSize() > reg_info->byte_size) value.SetType(reg_info); } diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp index bc1d4df89fc..6736e5f5b80 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp @@ -140,8 +140,8 @@ bool RegisterContextPOSIXProcessMonitor_powerpc::ReadRegister( if (success) { // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (value.GetByteSize() > reg_info->byte_size) value.SetType(reg_info); } diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp index 4608520dba4..7db7f803b37 100644 --- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp @@ -193,14 +193,14 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister( bool success = ReadRegister(full_reg, value); if (success) { - // If our read was not aligned (for ah,bh,ch,dh), shift our returned value - // one byte to the right. + // If our read was not aligned (for ah,bh,ch,dh), shift our returned + // value one byte to the right. if (is_subreg && (reg_info->byte_offset & 0x1)) value.SetUInt64(value.GetAsUInt64() >> 8); // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (value.GetByteSize() > reg_info->byte_size) value.SetType(reg_info); } @@ -221,7 +221,8 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister( value.SetBytes(m_fpr.fxsave.xmm[reg - m_reg_info.first_xmm].bytes, reg_info->byte_size, byte_order); if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) { - // Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes + // Concatenate ymm using the register halves in xmm.bytes and + // ymmh.bytes if (GetFPRType() == eXSAVE && CopyXSTATEtoYMM(reg, byte_order)) value.SetBytes(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, reg_info->byte_size, byte_order); @@ -233,11 +234,10 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister( return false; } - // Get pointer to m_fpr.fxsave variable and set the data from it. - // Byte offsets of all registers are calculated wrt 'UserArea' structure. - // However, ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)} - // and stores them in 'm_fpr' (of type FPR structure). To extract values of - // fpu + // Get pointer to m_fpr.fxsave variable and set the data from it. Byte + // offsets of all registers are calculated wrt 'UserArea' structure. However, + // ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)} and stores + // them in 'm_fpr' (of type FPR structure). To extract values of fpu // registers, m_fpr should be read at byte offsets calculated wrt to FPR // structure. @@ -299,12 +299,12 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::WriteRegister( return false; } } else { - // Get pointer to m_fpr.fxsave variable and set the data to it. - // Byte offsets of all registers are calculated wrt 'UserArea' structure. - // However, WriteFPR() takes m_fpr (of type FPR structure) and writes only - // fpu - // registers using ptrace(PT_SETFPREGS,..) API. Hence fpu registers should - // be written in m_fpr at byte offsets calculated wrt FPR structure. + // Get pointer to m_fpr.fxsave variable and set the data to it. Byte + // offsets of all registers are calculated wrt 'UserArea' structure. + // However, WriteFPR() takes m_fpr (of type FPR structure) and writes + // only fpu registers using ptrace(PT_SETFPREGS,..) API. Hence fpu + // registers should be written in m_fpr at byte offsets calculated wrt + // FPR structure. // Since, FPR structure is also one of the member of UserArea structure. // byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) - |