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/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 69d62d9..6db30f7 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -382,8 +382,8 @@
// Check for any reason we want to move this breakpoint to other address.
addr = GetBreakableLoadAddress(addr);
- // Attempt to resolve our load address if possible, though it is ok if
- // it doesn't resolve to section/offset.
+ // Attempt to resolve our load address if possible, though it is ok if it
+ // doesn't resolve to section/offset.
// Try and resolve as a load address if possible
GetSectionLoadList().ResolveLoadAddress(addr, so_addr);
@@ -537,8 +537,7 @@
SearchFilterSP filter_sp;
if (containingModules == nullptr) {
// We could make a special "CU List only SearchFilter". Better yet was if
- // these could be composable,
- // but that will take a little reworking.
+ // these could be composable, but that will take a little reworking.
filter_sp.reset(new SearchFilterByModuleListAndCU(
shared_from_this(), FileSpecList(), *containingSourceFiles));
@@ -744,8 +743,8 @@
return true;
}
-// See also Watchpoint::SetWatchpointType(uint32_t type) and
-// the OptionGroupWatchpoint::WatchType enum type.
+// See also Watchpoint::SetWatchpointType(uint32_t type) and the
+// OptionGroupWatchpoint::WatchType enum type.
WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size,
const CompilerType *type, uint32_t kind,
Status &error) {
@@ -776,8 +775,8 @@
if (!CheckIfWatchpointsExhausted(this, error))
return wp_sp;
- // Currently we only support one watchpoint per address, with total number
- // of watchpoints limited by the hardware which the inferior is running on.
+ // Currently we only support one watchpoint per address, with total number of
+ // watchpoints limited by the hardware which the inferior is running on.
// Grab the list mutex while doing operations.
const bool notify = false; // Don't notify about all the state changes we do
@@ -814,9 +813,8 @@
wp_sp->GetID());
if (error.Fail()) {
- // Enabling the watchpoint on the device side failed.
- // Remove the said watchpoint from the list maintained by the target
- // instance.
+ // Enabling the watchpoint on the device side failed. Remove the said
+ // watchpoint from the list maintained by the target instance.
m_watchpoint_list.Remove(wp_sp->GetID(), true);
// See if we could provide more helpful error message.
if (!OptionGroupWatchpoint::IsWatchSizeSupported(size))
@@ -1028,8 +1026,7 @@
Breakpoint *bp = GetBreakpointByID(bp_id).get();
StructuredData::ObjectSP bkpt_save_sp = bp->SerializeToStructuredData();
// If the user explicitly asked to serialize a breakpoint, and we
- // can't, then
- // raise an error:
+ // can't, then raise an error:
if (!bkpt_save_sp) {
error.SetErrorStringWithFormat("Unable to serialize breakpoint %d",
bp_id);
@@ -1142,8 +1139,8 @@
return true; // Success!
}
-// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to
-// end operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end
+// to end operations.
bool Target::DisableAllWatchpoints(bool end_to_end) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
if (log)
@@ -1172,8 +1169,8 @@
return true; // Success!
}
-// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to
-// end operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end
+// to end operations.
bool Target::EnableAllWatchpoints(bool end_to_end) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
if (log)
@@ -1236,8 +1233,8 @@
return true; // Success!
}
-// Assumption: Caller holds the list mutex lock for m_watchpoint_list
-// during these operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list during
+// these operations.
bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
if (log)
@@ -1460,7 +1457,8 @@
if (compatible_local_arch || missing_local_arch) {
// If we haven't got a valid arch spec, or the architectures are compatible
- // update the architecture, unless the one we already have is more specified
+ // update the architecture, unless the one we already have is more
+ // specified
if (replace_local_arch)
m_arch = other;
LLDB_LOG(log, "set architecture to {0} ({1})",
@@ -1503,8 +1501,8 @@
bool Target::MergeArchitecture(const ArchSpec &arch_spec) {
if (arch_spec.IsValid()) {
if (m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
- // The current target arch is compatible with "arch_spec", see if we
- // can improve our current architecture using bits from "arch_spec"
+ // The current target arch is compatible with "arch_spec", see if we can
+ // improve our current architecture using bits from "arch_spec"
// Merge bits from arch_spec into "merged_arch" and set our architecture
ArchSpec merged_arch(m_arch.GetSpec());
@@ -1663,8 +1661,8 @@
lldb::addr_t *load_addr_ptr) {
error.Clear();
- // if we end up reading this from process memory, we will fill this
- // with the actual load address
+ // if we end up reading this from process memory, we will fill this with the
+ // actual load address
if (load_addr_ptr)
*load_addr_ptr = LLDB_INVALID_ADDRESS;
@@ -1676,16 +1674,16 @@
if (!addr.IsSectionOffset()) {
SectionLoadList §ion_load_list = GetSectionLoadList();
if (section_load_list.IsEmpty()) {
- // No sections are loaded, so we must assume we are not running
- // yet and anything we are given is a file address.
+ // No sections are loaded, so we must assume we are not running yet and
+ // anything we are given is a file address.
file_addr = addr.GetOffset(); // "addr" doesn't have a section, so its
// offset is the file address
m_images.ResolveFileAddress(file_addr, resolved_addr);
} else {
- // We have at least one section loaded. This can be because
- // we have manually loaded some sections with "target modules load ..."
- // or because we have have a live process that has sections loaded
- // through the dynamic loader
+ // We have at least one section loaded. This can be because we have
+ // manually loaded some sections with "target modules load ..." or
+ // because we have have a live process that has sections loaded through
+ // the dynamic loader
load_addr = addr.GetOffset(); // "addr" doesn't have a section, so its
// offset is the load address
section_load_list.ResolveLoadAddress(load_addr, resolved_addr);
@@ -1732,19 +1730,19 @@
*load_addr_ptr = load_addr;
return bytes_read;
}
- // If the address is not section offset we have an address that
- // doesn't resolve to any address in any currently loaded shared
- // libraries and we failed to read memory so there isn't anything
- // more we can do. If it is section offset, we might be able to
- // read cached memory from the object file.
+ // If the address is not section offset we have an address that doesn't
+ // resolve to any address in any currently loaded shared libraries and we
+ // failed to read memory so there isn't anything more we can do. If it is
+ // section offset, we might be able to read cached memory from the object
+ // file.
if (!resolved_addr.IsSectionOffset())
return 0;
}
}
if (!prefer_file_cache && resolved_addr.IsSectionOffset()) {
- // If we didn't already try and read from the object file cache, then
- // try it after failing to read from the process.
+ // If we didn't already try and read from the object file cache, then try
+ // it after failing to read from the process.
return ReadMemoryFromFileCache(resolved_addr, dst, dst_len, error);
}
return 0;
@@ -1761,8 +1759,8 @@
if (length == 0)
break;
out_str.append(buf, length);
- // If we got "length - 1" bytes, we didn't get the whole C string, we
- // need to read some more characters
+ // If we got "length - 1" bytes, we didn't get the whole C string, we need
+ // to read some more characters
if (length == sizeof(buf) - 1)
curr_addr += length;
else
@@ -1783,9 +1781,9 @@
addr_t curr_addr = addr.GetLoadAddress(this);
Address address(addr);
- // We could call m_process_sp->GetMemoryCacheLineSize() but I don't
- // think this really needs to be tied to the memory cache subsystem's
- // cache line size, so leave this as a fixed constant.
+ // We could call m_process_sp->GetMemoryCacheLineSize() but I don't think
+ // this really needs to be tied to the memory cache subsystem's cache line
+ // size, so leave this as a fixed constant.
const size_t cache_line_size = 512;
size_t bytes_left = dst_max_len - 1;
@@ -1876,18 +1874,18 @@
if (pointer_vm_addr != LLDB_INVALID_ADDRESS) {
SectionLoadList §ion_load_list = GetSectionLoadList();
if (section_load_list.IsEmpty()) {
- // No sections are loaded, so we must assume we are not running
- // yet and anything we are given is a file address.
+ // No sections are loaded, so we must assume we are not running yet and
+ // anything we are given is a file address.
m_images.ResolveFileAddress(pointer_vm_addr, pointer_addr);
} else {
- // We have at least one section loaded. This can be because
- // we have manually loaded some sections with "target modules load ..."
- // or because we have have a live process that has sections loaded
- // through the dynamic loader
+ // We have at least one section loaded. This can be because we have
+ // manually loaded some sections with "target modules load ..." or
+ // because we have have a live process that has sections loaded through
+ // the dynamic loader
section_load_list.ResolveLoadAddress(pointer_vm_addr, pointer_addr);
}
- // We weren't able to resolve the pointer value, so just return
- // an address with no section
+ // We weren't able to resolve the pointer value, so just return an
+ // address with no section
if (!pointer_addr.IsValid())
pointer_addr.SetOffset(pointer_vm_addr);
return true;
@@ -1903,9 +1901,8 @@
Status error;
// First see if we already have this module in our module list. If we do,
- // then we're done, we don't need
- // to consult the shared modules list. But only do this if we are passed a
- // UUID.
+ // then we're done, we don't need to consult the shared modules list. But
+ // only do this if we are passed a UUID.
if (module_spec.GetUUID().IsValid())
module_sp = m_images.FindFirstModule(module_spec);
@@ -1960,8 +1957,8 @@
}
// We found a module that wasn't in our target list. Let's make sure that
- // there wasn't an equivalent
- // module in the list already, and if there was, let's remove it.
+ // there wasn't an equivalent module in the list already, and if there was,
+ // let's remove it.
if (module_sp) {
ObjectFile *objfile = module_sp->GetObjectFile();
if (objfile) {
@@ -1995,18 +1992,14 @@
return ModuleSP();
}
// GetSharedModule is not guaranteed to find the old shared module, for
- // instance
- // in the common case where you pass in the UUID, it is only going to
- // find the one
- // module matching the UUID. In fact, it has no good way to know what
- // the "old module"
- // relevant to this target is, since there might be many copies of a
- // module with this file spec
- // in various running debug sessions, but only one of them will belong
- // to this target.
- // So let's remove the UUID from the module list, and look in the
- // target's module list.
- // Only do this if there is SOMETHING else in the module spec...
+ // instance in the common case where you pass in the UUID, it is only
+ // going to find the one module matching the UUID. In fact, it has no
+ // good way to know what the "old module" relevant to this target is,
+ // since there might be many copies of a module with this file spec in
+ // various running debug sessions, but only one of them will belong to
+ // this target. So let's remove the UUID from the module list, and look
+ // in the target's module list. Only do this if there is SOMETHING else
+ // in the module spec...
if (!old_module_sp) {
if (module_spec.GetUUID().IsValid() &&
!module_spec.GetFileSpec().GetFilename().IsEmpty() &&
@@ -2286,8 +2279,8 @@
if (expr.empty())
return execution_results;
- // We shouldn't run stop hooks in expressions.
- // Be sure to reset this if you return anywhere within this function.
+ // We shouldn't run stop hooks in expressions. Be sure to reset this if you
+ // return anywhere within this function.
bool old_suppress_value = m_suppress_stop_hooks;
m_suppress_stop_hooks = true;
@@ -2301,8 +2294,8 @@
CalculateExecutionContext(exe_ctx);
}
- // Make sure we aren't just trying to see the value of a persistent
- // variable (something like "$0")
+ // Make sure we aren't just trying to see the value of a persistent variable
+ // (something like "$0")
lldb::ExpressionVariableSP persistent_var_sp;
// Only check for persistent variables the expression starts with a '$'
if (expr[0] == '$')
@@ -2404,8 +2397,7 @@
code_addr |= 1ull;
} else if (addr_class == eAddressClassCodeAlternateISA) {
// We checked the address and the address claims to be the alternate
- // ISA
- // which means thumb, so set bit zero.
+ // ISA which means thumb, so set bit zero.
code_addr |= 1ull;
}
}
@@ -2471,8 +2463,8 @@
SectionLoadList §ion_load_list = GetSectionLoadList();
if (section_load_list.IsEmpty())
- // No sections are loaded, so we must assume we are not running yet
- // and need to operate only on file address.
+ // No sections are loaded, so we must assume we are not running yet and
+ // need to operate only on file address.
m_images.ResolveFileAddress(addr, resolved_addr);
else
section_load_list.ResolveLoadAddress(addr, resolved_addr);
@@ -2547,30 +2539,29 @@
} else if (i == 2) {
// Here we may get one 4-byte instruction or two 2-byte instructions.
if (num_insns == 2) {
- // Looks like there are two 2-byte instructions above our breakpoint
- // target address.
- // Now the upper 2-byte instruction is either a valid 2-byte
- // instruction or could be a part of it's upper 4-byte instruction.
- // In both cases we don't care because in this case lower 2-byte
- // instruction is definitely a valid instruction
- // and whatever i=1 iteration has found out is true.
+ // Looks like there are two 2-byte instructions above our
+ // breakpoint target address. Now the upper 2-byte instruction is
+ // either a valid 2-byte instruction or could be a part of it's
+ // upper 4-byte instruction. In both cases we don't care because in
+ // this case lower 2-byte instruction is definitely a valid
+ // instruction and whatever i=1 iteration has found out is true.
inst_to_choose = 1;
break;
} else if (insn_size == 4) {
// This instruction claims its a valid 4-byte instruction. But it
- // could be a part of it's upper 4-byte instruction.
- // Lets try scanning upper 2 bytes to verify this.
+ // could be a part of it's upper 4-byte instruction. Lets try
+ // scanning upper 2 bytes to verify this.
instruction_list.Append(prev_insn);
inst_to_choose = 2;
}
} else if (i == 3) {
if (insn_size == 4)
// FIXME: We reached here that means instruction at [target - 4] has
- // already claimed to be a 4-byte instruction,
- // and now instruction at [target - 6] is also claiming that it's a
- // 4-byte instruction. This can not be true.
- // In this case we can not decide the valid previous instruction so
- // we let lldb set the breakpoint at the address given by user.
+ // already claimed to be a 4-byte instruction, and now instruction
+ // at [target - 6] is also claiming that it's a 4-byte instruction.
+ // This can not be true. In this case we can not decide the valid
+ // previous instruction so we let lldb set the breakpoint at the
+ // address given by user.
inst_to_choose = 0;
else
// This is straight-forward
@@ -2686,8 +2677,8 @@
return;
// <rdar://problem/12027563> make sure we check that we are not stopped
- // because of us running a user expression
- // since in that case we do not want to run the stop-hooks
+ // because of us running a user expression since in that case we do not want
+ // to run the stop-hooks
if (m_process_sp->GetModIDRef().IsLastResumeForUserExpression())
return;
@@ -2976,18 +2967,16 @@
launch_info.GetFlags().Set(eLaunchFlagDebug);
// Get the value of synchronous execution here. If you wait till after you
- // have started to
- // run, then you could have hit a breakpoint, whose command might switch the
- // value, and
- // then you'll pick up that incorrect value.
+ // have started to run, then you could have hit a breakpoint, whose command
+ // might switch the value, and then you'll pick up that incorrect value.
Debugger &debugger = GetDebugger();
const bool synchronous_execution =
debugger.GetCommandInterpreter().GetSynchronous();
PlatformSP platform_sp(GetPlatform());
- // Finalize the file actions, and if none were given, default to opening
- // up a pseudo terminal
+ // Finalize the file actions, and if none were given, default to opening up a
+ // pseudo terminal
const bool default_to_use_pty = platform_sp ? platform_sp->IsHost() : false;
if (log)
log->Printf("Target::%s have platform=%s, platform_sp->IsHost()=%s, "
@@ -3026,10 +3015,10 @@
GetPlatform()->DebugProcess(launch_info, debugger, this, error);
// Cleanup the old process since someone might still have a strong
- // reference to this process and we would like to allow it to cleanup
- // as much as it can without the object being destroyed. We try to
- // lock the shared pointer and if that works, then someone else still
- // has a strong reference to the process.
+ // reference to this process and we would like to allow it to cleanup as
+ // much as it can without the object being destroyed. We try to lock the
+ // shared pointer and if that works, then someone else still has a strong
+ // reference to the process.
ProcessSP old_process_sp(process_wp.lock());
if (old_process_sp)
@@ -3153,8 +3142,8 @@
const ModuleSP old_exec_module_sp = GetExecutableModule();
- // If no process info was specified, then use the target executable
- // name as the process to attach to by default
+ // If no process info was specified, then use the target executable name as
+ // the process to attach to by default
if (!attach_info.ProcessInfoSpecified()) {
if (old_exec_module_sp)
attach_info.GetExecutableFile().GetFilename() =
@@ -3581,9 +3570,8 @@
bool will_modify,
uint32_t idx) const override {
// When getting the value for a key from the target options, we will always
- // try and grab the setting from the current target if there is one. Else we
- // just
- // use the one from this instance.
+ // try and grab the setting from the current target if there is one. Else
+ // we just use the one from this instance.
if (idx == ePropertyEnvVars)
GetHostEnvironmentIfNeeded();
@@ -3674,8 +3662,8 @@
m_collection_sp.reset(
new TargetOptionValueProperties(target, Target::GetGlobalProperties()));
- // Set callbacks to update launch_info whenever "settins set" updated any of
- // these properties
+ // Set callbacks to update launch_info whenever "settins set" updated any
+ // of these properties
m_collection_sp->SetValueChangedCallback(
ePropertyArg0, TargetProperties::Arg0ValueChangedCallback, this);
m_collection_sp->SetValueChangedCallback(