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
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 39059e6..f380835 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -337,8 +337,8 @@
// Attach to the requested process.
// An attach will cause the thread to stop with a SIGSTOP.
if ((status = PtraceWrapper(PTRACE_ATTACH, tid)).Fail()) {
- // No such thread. The thread may have exited.
- // More error handling may be needed.
+ // No such thread. The thread may have exited. More error handling
+ // may be needed.
if (status.GetError() == ESRCH) {
it = tids_to_attach.erase(it);
continue;
@@ -348,11 +348,11 @@
int wpid =
llvm::sys::RetryAfterSignal(-1, ::waitpid, tid, nullptr, __WALL);
- // Need to use __WALL otherwise we receive an error with errno=ECHLD
- // At this point we should have a thread stopped if waitpid succeeds.
+ // Need to use __WALL otherwise we receive an error with errno=ECHLD At
+ // this point we should have a thread stopped if waitpid succeeds.
if (wpid < 0) {
- // No such thread. The thread may have exited.
- // More error handling may be needed.
+ // No such thread. The thread may have exited. More error handling
+ // may be needed.
if (errno == ESRCH) {
it = tids_to_attach.erase(it);
continue;
@@ -397,8 +397,8 @@
// appropriate ptrace flags here (PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK)
ptrace_opts |= PTRACE_O_TRACECLONE;
- // Have the tracer notify us before execve returns
- // (needed to disable legacy SIGTRAP generation)
+ // Have the tracer notify us before execve returns (needed to disable legacy
+ // SIGTRAP generation)
ptrace_opts |= PTRACE_O_TRACEEXEC;
return PtraceWrapper(PTRACE_SETOPTIONS, pid, nullptr, (void *)ptrace_opts);
@@ -438,8 +438,8 @@
auto thread_sp = GetThreadByID(pid);
if (!thread_sp) {
- // Normally, the only situation when we cannot find the thread is if we have
- // just received a new thread notification. This is indicated by
+ // Normally, the only situation when we cannot find the thread is if we
+ // have just received a new thread notification. This is indicated by
// GetSignalInfo() returning si_code == SI_USER and si_pid == 0
LLDB_LOG(log, "received notification about an unknown tid {0}.", pid);
@@ -471,15 +471,15 @@
MonitorSignal(info, *thread_sp, exited);
} else {
if (info_err.GetError() == EINVAL) {
- // This is a group stop reception for this tid.
- // We can reach here if we reinject SIGSTOP, SIGSTP, SIGTTIN or SIGTTOU
- // into the tracee, triggering the group-stop mechanism. Normally
- // receiving these would stop the process, pending a SIGCONT. Simulating
- // this state in a debugger is hard and is generally not needed (one use
- // case is debugging background task being managed by a shell). For
- // general use, it is sufficient to stop the process in a signal-delivery
- // stop which happens before the group stop. This done by MonitorSignal
- // and works correctly for all signals.
+ // This is a group stop reception for this tid. We can reach here if we
+ // reinject SIGSTOP, SIGSTP, SIGTTIN or SIGTTOU into the tracee,
+ // triggering the group-stop mechanism. Normally receiving these would
+ // stop the process, pending a SIGCONT. Simulating this state in a
+ // debugger is hard and is generally not needed (one use case is
+ // debugging background task being managed by a shell). For general use,
+ // it is sufficient to stop the process in a signal-delivery stop which
+ // happens before the group stop. This done by MonitorSignal and works
+ // correctly for all signals.
LLDB_LOG(log,
"received a group stop for pid {0} tid {1}. Transparent "
"handling of group stops not supported, resuming the "
@@ -505,8 +505,8 @@
if (is_main_thread) {
// Notify the delegate - our process is not available but appears to
- // have been killed outside
- // our control. Is eStateExited the right exit state in this case?
+ // have been killed outside our control. Is eStateExited the right
+ // exit state in this case?
SetExitStatus(status, true);
SetState(StateType::eStateExited, true);
} else {
@@ -575,19 +575,14 @@
switch (info.si_code) {
// TODO: these two cases are required if we want to support tracing of the
- // inferiors' children. We'd need this to debug a monitor.
- // case (SIGTRAP | (PTRACE_EVENT_FORK << 8)):
- // case (SIGTRAP | (PTRACE_EVENT_VFORK << 8)):
+ // inferiors' children. We'd need this to debug a monitor. case (SIGTRAP |
+ // (PTRACE_EVENT_FORK << 8)): case (SIGTRAP | (PTRACE_EVENT_VFORK << 8)):
case (SIGTRAP | (PTRACE_EVENT_CLONE << 8)): {
// This is the notification on the parent thread which informs us of new
- // thread
- // creation.
- // We don't want to do anything with the parent thread so we just resume it.
- // In case we
- // want to implement "break on thread creation" functionality, we would need
- // to stop
- // here.
+ // thread creation. We don't want to do anything with the parent thread so
+ // we just resume it. In case we want to implement "break on thread
+ // creation" functionality, we would need to stop here.
unsigned long event_message = 0;
if (GetEventMessage(thread.GetID(), &event_message).Fail()) {
@@ -637,10 +632,10 @@
}
case (SIGTRAP | (PTRACE_EVENT_EXIT << 8)): {
- // The inferior process or one of its threads is about to exit.
- // We don't want to do anything with the thread so we just resume it. In
- // case we want to implement "break on thread exit" functionality, we would
- // need to stop here.
+ // The inferior process or one of its threads is about to exit. We don't
+ // want to do anything with the thread so we just resume it. In case we
+ // want to implement "break on thread exit" functionality, we would need to
+ // stop here.
unsigned long data = 0;
if (GetEventMessage(thread.GetID(), &data).Fail())
@@ -658,8 +653,8 @@
// Due to a kernel bug, we may sometimes get this stop after the inferior
// gets a SIGKILL. This confuses our state tracking logic in
// ResumeThread(), since normally, we should not be receiving any ptrace
- // events while the inferior is stopped. This makes sure that the inferior
- // is resumed and exits normally.
+ // events while the inferior is stopped. This makes sure that the
+ // inferior is resumed and exits normally.
state = eStateRunning;
}
ResumeThread(thread, state, LLDB_INVALID_SIGNAL_NUMBER);
@@ -705,8 +700,8 @@
case SI_KERNEL:
#if defined __mips__
- // For mips there is no special signal for watchpoint
- // So we check for watchpoint in kernel trap
+ // For mips there is no special signal for watchpoint So we check for
+ // watchpoint in kernel trap
{
// If a watchpoint was hit, report it
uint32_t wp_index;
@@ -782,8 +777,8 @@
LLDB_LOG(log, "received watchpoint event, pid = {0}, wp_index = {1}",
thread.GetID(), wp_index);
- // Mark the thread as stopped at watchpoint.
- // The address is at (lldb::addr_t)info->si_addr if we need it.
+ // Mark the thread as stopped at watchpoint. The address is at
+ // (lldb::addr_t)info->si_addr if we need it.
thread.SetStoppedByWatchpoint(wp_index);
// We need to tell all other running threads before we notify the delegate
@@ -799,8 +794,8 @@
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 Linux.
+ // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a kill(2)
+ // or raise(3). Similarly for tgkill(2) on Linux.
//
// IOW, user generated signals never generate what we consider to be a
// "crash".
@@ -819,22 +814,22 @@
// This is a tgkill()-based stop.
LLDB_LOG(log, "pid {0} tid {1}, thread stopped", GetID(), thread.GetID());
- // Check that we're not already marked with a stop reason.
- // Note this thread really shouldn't already be marked as stopped - if we
- // were, that would imply that the kernel signaled us with the thread
- // stopping which we handled and marked as stopped, and that, without an
- // intervening resume, we received another stop. It is more likely that we
- // are missing the marking of a run state somewhere if we find that the
- // thread was marked as stopped.
+ // Check that we're not already marked with a stop reason. Note this thread
+ // really shouldn't already be marked as stopped - if we were, that would
+ // imply that the kernel signaled us with the thread stopping which we
+ // handled and marked as stopped, and that, without an intervening resume,
+ // we received another stop. It is more likely that we are missing the
+ // marking of a run state somewhere if we find that the thread was marked
+ // as stopped.
const StateType thread_state = thread.GetState();
if (!StateIsStoppedState(thread_state, false)) {
// An inferior thread has stopped because of a SIGSTOP we have sent it.
// Generally, these are not important stops and we don't want to report
// them as they are just used to stop other threads when one thread (the
// one with the *real* stop reason) hits a breakpoint (watchpoint,
- // etc...). However, in the case of an asynchronous Interrupt(), this *is*
- // the real stop reason, so we leave the signal intact if this is the
- // thread that was chosen as the triggering thread.
+ // etc...). However, in the case of an asynchronous Interrupt(), this
+ // *is* the real stop reason, so we leave the signal intact if this is
+ // the thread that was chosen as the triggering thread.
if (m_pending_notification_tid != LLDB_INVALID_THREAD_ID) {
if (m_pending_notification_tid == thread.GetID())
thread.SetStoppedBySignal(SIGSTOP, &info);
@@ -863,8 +858,8 @@
return;
}
- // Check if debugger should stop at this signal or just ignore it
- // and resume the inferior.
+ // Check if debugger should stop at this signal or just ignore it and resume
+ // the inferior.
if (m_signals_to_ignore.find(signo) != m_signals_to_ignore.end()) {
ResumeThread(thread, thread.GetState(), signo);
return;
@@ -915,9 +910,9 @@
return true;
}
- // The emulator only fill in the dwarf regsiter numbers (and in some case
- // the generic register numbers). Get the full register info from the
- // register context based on the dwarf register numbers.
+ // The emulator only fill in the dwarf regsiter numbers (and in some case the
+ // generic register numbers). Get the full register info from the register
+ // context based on the dwarf register numbers.
const RegisterInfo *full_reg_info =
emulator_baton->m_reg_context.GetRegisterInfo(
eRegisterKindDWARF, reg_info->kinds[eRegisterKindDWARF]);
@@ -1001,8 +996,8 @@
else
next_flags = ReadFlags(register_context);
} 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 = register_context.GetPC() + emulator_ap->GetOpcode().GetByteSize();
@@ -1033,8 +1028,8 @@
error = SetSoftwareBreakpoint(next_pc, 0);
}
- // If setting the breakpoint fails because next_pc is out of
- // the address space, ignore it and let the debugee segfault.
+ // If setting the breakpoint fails because next_pc is out of the address
+ // space, ignore it and let the debugee segfault.
if (error.GetError() == EIO || error.GetError() == EFAULT) {
return Status();
} else if (error.Fail())
@@ -1165,8 +1160,8 @@
}
Status NativeProcessLinux::Interrupt() {
- // Pick a running thread (or if none, a not-dead stopped thread) as
- // the chosen thread that will be the stop-reason thread.
+ // Pick a running thread (or if none, a not-dead stopped thread) as the
+ // chosen thread that will be the stop-reason thread.
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
NativeThreadProtocol *running_thread = nullptr;
@@ -1174,15 +1169,15 @@
LLDB_LOG(log, "selecting running thread for interrupt target");
for (const auto &thread : m_threads) {
- // If we have a running or stepping thread, we'll call that the
- // target of the interrupt.
+ // If we have a running or stepping thread, we'll call that the target of
+ // the interrupt.
const auto thread_state = thread->GetState();
if (thread_state == eStateRunning || thread_state == eStateStepping) {
running_thread = thread.get();
break;
} else if (!stopped_thread && StateIsStoppedState(thread_state, true)) {
- // Remember the first non-dead stopped thread. We'll use that as a backup
- // if there are no running threads.
+ // Remember the first non-dead stopped thread. We'll use that as a
+ // backup if there are no running threads.
stopped_thread = thread.get();
}
}
@@ -1251,9 +1246,8 @@
StringExtractor line_extractor(maps_line);
// Format: {address_start_hex}-{address_end_hex} perms offset dev inode
- // pathname
- // perms: rwxp (letter is present if set, '-' if not, final character is
- // p=private, s=shared).
+ // pathname perms: rwxp (letter is present if set, '-' if not, final
+ // character is p=private, s=shared).
// Parse out the starting address
lldb::addr_t start_address = line_extractor.GetHexMaxU64(false, 0);
@@ -1334,8 +1328,8 @@
// the virtual address space,
// with no perms if it is not mapped.
- // Use an approach that reads memory regions from /proc/{pid}/maps.
- // Assume proc maps entries are in ascending order.
+ // Use an approach that reads memory regions from /proc/{pid}/maps. Assume
+ // proc maps entries are in ascending order.
// FIXME assert if we find differently.
if (m_supports_mem_region == LazyBool::eLazyBoolNo) {
@@ -1386,10 +1380,8 @@
}
// If we made it here, we didn't find an entry that contained the given
- // address. Return the
- // load_addr as start and the amount of bytes betwwen load address and the end
- // of the memory as
- // size.
+ // address. Return the load_addr as start and the amount of bytes betwwen
+ // load address and the end of the memory as size.
range_info.GetRange().SetRangeBase(load_addr);
range_info.GetRange().SetRangeEnd(LLDB_INVALID_ADDRESS);
range_info.SetReadable(MemoryRegionInfo::OptionalBool::eNo);
@@ -1434,8 +1426,8 @@
if (m_mem_region_cache.empty()) {
// No entries after attempting to read them. This shouldn't happen if
- // /proc/{pid}/maps is supported. Assume we don't support map entries
- // via procfs.
+ // /proc/{pid}/maps is supported. Assume we don't support map entries via
+ // procfs.
m_supports_mem_region = LazyBool::eLazyBoolNo;
LLDB_LOG(log,
"failed to find any procfs maps entries, assuming no support "
@@ -1462,8 +1454,8 @@
Status NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions,
lldb::addr_t &addr) {
// FIXME implementing this requires the equivalent of
-// InferiorCallPOSIX::InferiorCallMmap, which depends on
-// functional ThreadPlans working with Native*Protocol.
+// InferiorCallPOSIX::InferiorCallMmap, which depends on functional ThreadPlans
+// working with Native*Protocol.
#if 1
return Status("not implemented yet");
#else
@@ -1478,8 +1470,7 @@
prot |= eMmapProtExec;
// TODO implement this directly in NativeProcessLinux
- // (and lift to NativeProcessPOSIX if/when that class is
- // refactored out).
+ // (and lift to NativeProcessPOSIX if/when that class is refactored out).
if (InferiorCallMmap(this, addr, 0, size, prot,
eMmapFlagsAnon | eMmapFlagsPrivate, -1, 0)) {
m_addr_to_mmap_size[addr] = size;
@@ -1505,10 +1496,9 @@
}
size_t NativeProcessLinux::UpdateThreads() {
- // The NativeProcessLinux monitoring threads are always up to date
- // with respect to thread state and they keep the thread list
- // populated properly. All this method needs to do is return the
- // thread count.
+ // The NativeProcessLinux monitoring threads are always up to date with
+ // respect to thread state and they keep the thread list populated properly.
+ // All this method needs to do is return the thread count.
return m_threads.size();
}
@@ -1647,9 +1637,9 @@
assert(false && "unexpected si_code for SIGSEGV");
break;
case SI_KERNEL:
- // Linux will occasionally send spurious SI_KERNEL codes.
- // (this is poorly documented in sigaction)
- // One way to get this is via unaligned SIMD loads.
+ // Linux will occasionally send spurious SI_KERNEL codes. (this is
+ // poorly documented in sigaction) One way to get this is via unaligned
+ // SIMD loads.
reason = ProcessMessage::eInvalidAddress; // for lack of anything better
break;
case SEGV_MAPERR:
@@ -1785,8 +1775,7 @@
size_t &bytes_read) {
if (ProcessVmReadvSupported()) {
// The process_vm_readv path is about 50 times faster than ptrace api. We
- // want to use
- // this syscall if it is supported.
+ // want to use this syscall if it is supported.
const ::pid_t pid = GetID();
@@ -2093,12 +2082,11 @@
Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD);
LLDB_LOG(log, "tid: {0}", thread.GetID());
- // Before we do the resume below, first check if we have a pending
- // stop notification that is currently waiting for
- // all threads to stop. This is potentially a buggy situation since
- // we're ostensibly waiting for threads to stop before we send out the
- // pending notification, and here we are resuming one before we send
- // out the pending stop notification.
+ // Before we do the resume below, first check if we have a pending stop
+ // notification that is currently waiting for all threads to stop. This is
+ // potentially a buggy situation since we're ostensibly waiting for threads
+ // to stop before we send out the pending notification, and here we are
+ // resuming one before we send out the pending stop notification.
if (m_pending_notification_tid != LLDB_INVALID_THREAD_ID) {
LLDB_LOG(log,
"about to resume tid {0} per explicit request but we have a "
@@ -2107,8 +2095,8 @@
thread.GetID(), m_pending_notification_tid);
}
- // Request a resume. We expect this to be synchronous and the system
- // to reflect it is running after this completes.
+ // Request a resume. We expect this to be synchronous and the system to
+ // reflect it is running after this completes.
switch (state) {
case eStateRunning: {
const auto resume_result = thread.Resume(signo);
@@ -2137,8 +2125,8 @@
m_pending_notification_tid = triggering_tid;
- // Request a stop for all the thread stops that need to be stopped
- // and are not already known to be stopped.
+ // Request a stop for all the thread stops that need to be stopped and are
+ // not already known to be stopped.
for (const auto &thread : m_threads) {
if (StateIsRunningState(thread->GetState()))
static_cast<NativeThreadLinux *>(thread.get())->RequestStop();
@@ -2184,8 +2172,7 @@
if (m_pending_notification_tid != LLDB_INVALID_THREAD_ID &&
StateIsRunningState(thread.GetState())) {
// We will need to wait for this new thread to stop as well before firing
- // the
- // notification.
+ // the notification.
thread.RequestStop();
}
}
@@ -2221,9 +2208,8 @@
}
}
-// Wrapper for ptrace to catch errors and log calls.
-// Note that ptrace sets errno on error because -1 can be a valid result (i.e.
-// for PTRACE_PEEK*)
+// Wrapper for ptrace to catch errors and log calls. Note that ptrace sets
+// errno on error because -1 can be a valid result (i.e. for PTRACE_PEEK*)
Status NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
void *data, size_t data_size,
long *result) {
@@ -2421,8 +2407,8 @@
}
if (iter->second->GetTraceID() == m_pt_proces_trace_id) {
- // traceid maps to the whole process so we have to erase it from the
- // thread group.
+ // traceid maps to the whole process so we have to erase it from the thread
+ // group.
LLDB_LOG(log, "traceid maps to process");
m_pt_traced_thread_group.erase(thread);
}
@@ -2473,8 +2459,8 @@
if (thread == LLDB_INVALID_THREAD_ID) {
for (auto& iter : m_processor_trace_monitor) {
if (iter.second->GetTraceID() == traceid) {
- // Stopping a trace instance for an individual thread
- // hence there will only be one traceid that can match.
+ // Stopping a trace instance for an individual thread hence there will
+ // only be one traceid that can match.
m_processor_trace_monitor.erase(iter.first);
return error;
}
@@ -2504,8 +2490,8 @@
LLDB_LOG(log, "UID - {0} , Thread -{1}", traceid, thread);
if (traceid == m_pt_proces_trace_id) {
- // traceid maps to the whole process so we have to erase it from the
- // thread group.
+ // traceid maps to the whole process so we have to erase it from the thread
+ // group.
LLDB_LOG(log, "traceid maps to process");
m_pt_traced_thread_group.erase(thread);
}
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
index cb05416..7492916 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -184,14 +184,14 @@
error = ReadRegisterRaw(full_reg, reg_value);
if (error.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))
reg_value.SetUInt64(reg_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 (reg_value.GetByteSize() > reg_info->byte_size)
reg_value.SetType(reg_info);
}
@@ -558,8 +558,8 @@
uint32_t control_value = 0, wp_index = 0, addr_word_offset = 0, byte_mask = 0;
lldb::addr_t real_addr = addr;
- // Check if we are setting watchpoint other than read/write/access
- // Also update watchpoint flag to match Arm write-read bit configuration.
+ // Check if we are setting watchpoint other than read/write/access Also
+ // update watchpoint flag to match Arm write-read bit configuration.
switch (watch_flags) {
case 1:
watch_flags = 2;
@@ -579,9 +579,9 @@
if (size == 0 || size > 4)
return LLDB_INVALID_INDEX32;
- // Check 4-byte alignment for hardware watchpoint target address.
- // Below is a hack to recalculate address and size in order to
- // make sure we can watch non 4-byte alligned addresses as well.
+ // Check 4-byte alignment for hardware watchpoint target address. Below is a
+ // hack to recalculate address and size in order to make sure we can watch
+ // non 4-byte alligned addresses as well.
if (addr & 0x03) {
uint8_t watch_mask = (addr & 0x03) + size;
@@ -874,12 +874,10 @@
uint32_t offset, const char *reg_name, uint32_t size,
RegisterValue &value) {
// PTRACE_PEEKUSER don't work in the aarch64 linux kernel used on android
- // devices (always return
- // "Bad address"). To avoid using PTRACE_PEEKUSER we read out the full GPR
- // register set instead.
- // This approach is about 4 times slower but the performance overhead is
- // negligible in
- // comparision to processing time in lldb-server.
+ // devices (always return "Bad address"). To avoid using PTRACE_PEEKUSER we
+ // read out the full GPR register set instead. This approach is about 4 times
+ // slower but the performance overhead is negligible in comparision to
+ // processing time in lldb-server.
assert(offset % 4 == 0 && "Try to write a register with unaligned offset");
if (offset + sizeof(uint32_t) > sizeof(m_gpr_arm))
return Status("Register isn't fit into the size of the GPR area");
@@ -895,13 +893,10 @@
Status NativeRegisterContextLinux_arm::DoWriteRegisterValue(
uint32_t offset, const char *reg_name, const RegisterValue &value) {
// PTRACE_POKEUSER don't work in the aarch64 linux kernel used on android
- // devices (always return
- // "Bad address"). To avoid using PTRACE_POKEUSER we read out the full GPR
- // register set, modify
- // the requested register and write it back. This approach is about 4 times
- // slower but the
- // performance overhead is negligible in comparision to processing time in
- // lldb-server.
+ // devices (always return "Bad address"). To avoid using PTRACE_POKEUSER we
+ // read out the full GPR register set, modify the requested register and
+ // write it back. This approach is about 4 times slower but the performance
+ // overhead is negligible in comparision to processing time in lldb-server.
assert(offset % 4 == 0 && "Try to write a register with unaligned offset");
if (offset + sizeof(uint32_t) > sizeof(m_gpr_arm))
return Status("Register isn't fit into the size of the GPR area");
@@ -915,9 +910,8 @@
// will clear thumb bit of new PC if we are already in thumb mode; that is
// CPSR thumb mode bit is set.
if (offset / sizeof(uint32_t) == gpr_pc_arm) {
- // Check if we are already in thumb mode and
- // thumb bit of current PC is read out to be zero and
- // thumb bit of next PC is read out to be one.
+ // Check if we are already in thumb mode and thumb bit of current PC is
+ // read out to be zero and thumb bit of next PC is read out to be one.
if ((m_gpr_arm[gpr_cpsr_arm] & 0x20) && !(m_gpr_arm[gpr_pc_arm] & 0x01) &&
(value.GetAsUInt32() & 0x01)) {
reg_value &= (~1ull);
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index c483260..41fe446 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -28,8 +28,7 @@
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
// System includes - They have to be included after framework includes because
-// they define some
-// macros which collide with variable names in other modules
+// they define some macros which collide with variable names in other modules
#include <sys/socket.h>
// NT_PRSTATUS and NT_FPREGSET definition
#include <elf.h>
@@ -207,14 +206,14 @@
error = ReadRegisterRaw(full_reg, reg_value);
if (error.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))
reg_value.SetUInt64(reg_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 (reg_value.GetByteSize() > reg_info->byte_size)
reg_value.SetType(reg_info);
}
@@ -562,8 +561,8 @@
uint32_t control_value = 0, wp_index = 0;
lldb::addr_t real_addr = addr;
- // Check if we are setting watchpoint other than read/write/access
- // Also update watchpoint flag to match AArch64 write-read bit configuration.
+ // Check if we are setting watchpoint other than read/write/access Also
+ // update watchpoint flag to match AArch64 write-read bit configuration.
switch (watch_flags) {
case 1:
watch_flags = 2;
@@ -581,9 +580,9 @@
if (size != 1 && size != 2 && size != 4 && size != 8)
return LLDB_INVALID_INDEX32;
- // Check 8-byte alignment for hardware watchpoint target address.
- // Below is a hack to recalculate address and size in order to
- // make sure we can watch non 8-byte alligned addresses as well.
+ // Check 8-byte alignment for hardware watchpoint target address. Below is a
+ // hack to recalculate address and size in order to make sure we can watch
+ // non 8-byte alligned addresses as well.
if (addr & 0x07) {
uint8_t watch_mask = (addr & 0x07) + size;
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
index 32c04a4..69194b3 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
@@ -140,9 +140,9 @@
break;
}
- // Initialize m_iovec to point to the buffer and buffer size
- // using the conventions of Berkeley style UIO structures, as required
- // by PTRACE extensions.
+ // Initialize m_iovec to point to the buffer and buffer size using the
+ // conventions of Berkeley style UIO structures, as required by PTRACE
+ // extensions.
m_iovec.iov_base = &m_msa;
m_iovec.iov_len = sizeof(MSA_linux_mips);
@@ -337,7 +337,8 @@
uint8_t byte_size = reg_info->byte_size;
lldbassert(reg_info->byte_offset < sizeof(UserArea));
- // Initialise the FP and MSA buffers by reading all co-processor 1 registers
+ // Initialise the FP and MSA buffers by reading all co-processor 1
+ // registers
ReadCP1();
if (IsFPR(reg_index)) {
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
index 6b1d03b..6aa4af6 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
@@ -26,8 +26,7 @@
#include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h"
// System includes - They have to be included after framework includes because
-// they define some
-// macros which collide with variable names in other modules
+// they define some macros which collide with variable names in other modules
#include <sys/socket.h>
#include <elf.h>
#include <asm/ptrace.h>
@@ -569,8 +568,8 @@
lldb::addr_t real_addr = addr;
uint32_t rw_mode = 0;
- // Check if we are setting watchpoint other than read/write/access
- // Update watchpoint flag to match ppc64le write-read bit configuration.
+ // Check if we are setting watchpoint other than read/write/access Update
+ // watchpoint flag to match ppc64le write-read bit configuration.
switch (watch_flags) {
case eWatchpointKindWrite:
rw_mode = PPC_BREAKPOINT_TRIGGER_WRITE;
@@ -591,9 +590,9 @@
if (size != 1 && size != 2 && size != 4 && size != 8)
return LLDB_INVALID_INDEX32;
- // Check 8-byte alignment for hardware watchpoint target address.
- // Below is a hack to recalculate address and size in order to
- // make sure we can watch non 8-byte alligned addresses as well.
+ // Check 8-byte alignment for hardware watchpoint target address. Below is a
+ // hack to recalculate address and size in order to make sure we can watch
+ // non 8-byte alligned addresses as well.
if (addr & 0x07) {
addr_t begin = llvm::alignDown(addr, 8);
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
index 3406ee5..36da2b0 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
@@ -372,10 +372,10 @@
DoReadRegisterSet(NT_S390_SYSTEM_CALL, dst, 4);
dst += 4;
- // To enable inferior function calls while the process is stopped in
- // an interrupted system call, we need to clear the system call flag.
- // It will be restored to its original value by WriteAllRegisterValues.
- // Again we ignore error if the regset is unsupported.
+ // To enable inferior function calls while the process is stopped in an
+ // interrupted system call, we need to clear the system call flag. It will be
+ // restored to its original value by WriteAllRegisterValues. Again we ignore
+ // error if the regset is unsupported.
uint32_t system_call = 0;
DoWriteRegisterSet(NT_S390_SYSTEM_CALL, &system_call, 4);
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
index 84ffe9b..87f4b8d 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -329,9 +329,9 @@
break;
}
- // Initialize m_iovec to point to the buffer and buffer size
- // using the conventions of Berkeley style UIO structures, as required
- // by PTRACE extensions.
+ // Initialize m_iovec to point to the buffer and buffer size using the
+ // conventions of Berkeley style UIO structures, as required by PTRACE
+ // extensions.
m_iovec.iov_base = &m_fpr;
m_iovec.iov_len = sizeof(m_fpr);
@@ -420,14 +420,14 @@
error = ReadRegisterRaw(full_reg, reg_value);
if (error.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))
reg_value.SetUInt64(reg_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 (reg_value.GetByteSize() > reg_info->byte_size)
reg_value.SetType(reg_info);
}
@@ -448,7 +448,8 @@
reg_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 (CopyXSTATEtoYMM(reg, byte_order))
reg_value.SetBytes(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
reg_info->byte_size, byte_order);
@@ -492,8 +493,7 @@
// Byte offsets of all registers are calculated wrt 'UserArea' structure.
// However, ReadFPR() reads fpu registers {using ptrace(PTRACE_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
+ // fpu registers, m_fpr should be read at byte offsets calculated wrt to FPR
// structure.
// Since, FPR structure is also one of the member of UserArea structure.
@@ -599,11 +599,10 @@
// 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(PTRACE_SETFPREGS,..) API. Hence fpu registers
- // should
- // be written in m_fpr at byte offsets calculated wrt FPR structure.
+ // However, WriteFPR() takes m_fpr (of type FPR structure) and writes
+ // only fpu registers using ptrace(PTRACE_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) -
@@ -1093,8 +1092,7 @@
if (error.Fail())
return error;
- // for watchpoints 0, 1, 2, or 3, respectively,
- // set bits 1, 3, 5, or 7
+ // for watchpoints 0, 1, 2, or 3, respectively, set bits 1, 3, 5, or 7
uint64_t enable_bit = 1 << (2 * wp_index);
// set bits 16-17, 20-21, 24-25, or 28-29
@@ -1132,8 +1130,8 @@
RegisterValue reg_value;
- // for watchpoints 0, 1, 2, or 3, respectively,
- // clear bits 0, 1, 2, or 3 of the debug status register (DR6)
+ // for watchpoints 0, 1, 2, or 3, respectively, clear bits 0, 1, 2, or 3 of
+ // the debug status register (DR6)
Status error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value);
if (error.Fail())
return false;
@@ -1143,9 +1141,9 @@
if (error.Fail())
return false;
- // for watchpoints 0, 1, 2, or 3, respectively,
- // clear bits {0-1,16-19}, {2-3,20-23}, {4-5,24-27}, or {6-7,28-31}
- // of the debug control register (DR7)
+ // for watchpoints 0, 1, 2, or 3, respectively, clear bits {0-1,16-19},
+ // {2-3,20-23}, {4-5,24-27}, or {6-7,28-31} of the debug control register
+ // (DR7)
error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value);
if (error.Fail())
return false;
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index 0db3bd5..4ab2a9a 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -211,8 +211,8 @@
m_stop_info.reason = StopReason::eStopReasonNone;
m_stop_description.clear();
- // If watchpoints have been set, but none on this thread,
- // then this is a new thread. So set all existing watchpoints.
+ // If watchpoints have been set, but none on this thread, then this is a new
+ // thread. So set all existing watchpoints.
if (m_watchpoint_index_map.empty()) {
NativeProcessLinux &process = GetProcess();
@@ -263,8 +263,8 @@
data = signo;
// If hardware single-stepping is not supported, we just do a continue. The
- // breakpoint on the
- // next instruction has been setup in NativeProcessLinux::Resume.
+ // breakpoint on the next instruction has been setup in
+ // NativeProcessLinux::Resume.
return NativeProcessLinux::PtraceWrapper(
GetProcess().SupportHardwareSingleStepping() ? PTRACE_SINGLESTEP
: PTRACE_CONT,
diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp
index 251cb4b..c57a2da 100644
--- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp
+++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp
@@ -59,9 +59,9 @@
bool WorkaroundNeeded() {
// We shall spawn a child, and use it to verify the debug capabilities of the
- // cpu. We shall iterate through the cpus, bind the child to each one in turn,
- // and verify that single-stepping works on that cpu. A workaround is needed
- // if we find at least one broken cpu.
+ // cpu. We shall iterate through the cpus, bind the child to each one in
+ // turn, and verify that single-stepping works on that cpu. A workaround is
+ // needed if we find at least one broken cpu.
Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD);
::pid_t child_pid = fork();