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/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
index 3f0c7db..007a593 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
@@ -119,20 +119,18 @@
}
// Compile our __lldb_backtrace_recording_get_item_info() function (from the
-// source above in g_get_item_info_function_code) if we don't find that function
-// in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// source above in g_get_item_info_function_code) if we don't find that
+// function in the inferior already with USE_BUILTIN_FUNCTION defined. (e.g.
+// this would be the case for testing.)
//
-// Insert the __lldb_backtrace_recording_get_item_info into the inferior process
-// if needed.
+// Insert the __lldb_backtrace_recording_get_item_info into the inferior
+// process if needed.
//
// Write the get_item_info_arglist into the inferior's memory space to prepare
// for the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction(
Thread &thread, ValueList &get_item_info_arglist) {
@@ -146,7 +144,8 @@
{
std::lock_guard<std::mutex> guard(m_get_item_info_function_mutex);
- // First stage is to make the UtilityFunction to hold our injected function:
+ // First stage is to make the UtilityFunction to hold our injected
+ // function:
if (!m_get_item_info_impl_code.get()) {
if (g_get_item_info_function_code != NULL) {
@@ -209,10 +208,9 @@
diagnostics.Clear();
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_item_info_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_item_info_arglist, diagnostics)) {
@@ -272,8 +270,7 @@
// uint64_t page_to_free_size)
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
index e3d03a6..0de32bf 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
@@ -121,11 +121,10 @@
}
}
-// Compile our __lldb_backtrace_recording_get_pending_items() function (from the
-// source above in g_get_pending_items_function_code) if we don't find that
-// function in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// Compile our __lldb_backtrace_recording_get_pending_items() function (from
+// the source above in g_get_pending_items_function_code) if we don't find that
+// function in the inferior already with USE_BUILTIN_FUNCTION defined. (e.g.
+// this would be the case for testing.)
//
// Insert the __lldb_backtrace_recording_get_pending_items into the inferior
// process if needed.
@@ -134,8 +133,7 @@
// prepare for the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(
Thread &thread, ValueList &get_pending_items_arglist) {
@@ -212,10 +210,9 @@
}
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_pending_items_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_pending_items_arglist, diagnostics)) {
@@ -279,8 +276,7 @@
// uint64_t page_to_free_size)
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
index c1654eb..7855b36 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
@@ -118,9 +118,9 @@
}
// Construct a CompilerType for the structure that
-// g_get_current_queues_function_code will return by value
-// so we can extract the fields after performing the function call.
-// i.e. we are getting this struct returned to us:
+// g_get_current_queues_function_code will return by value so we can extract
+// the fields after performing the function call. i.e. we are getting this
+// struct returned to us:
//
// struct get_current_queues_return_values
// {
@@ -130,11 +130,9 @@
// };
// Compile our __lldb_backtrace_recording_get_current_queues() function (from
-// the
-// source above in g_get_current_queues_function_code) if we don't find that
-// function in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// the source above in g_get_current_queues_function_code) if we don't find
+// that function in the inferior already with USE_BUILTIN_FUNCTION defined.
+// (e.g. this would be the case for testing.)
//
// Insert the __lldb_backtrace_recording_get_current_queues into the inferior
// process if needed.
@@ -143,8 +141,7 @@
// the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t
AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread,
@@ -217,10 +214,9 @@
diagnostics.Clear();
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_queues_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_queues_arglist, diagnostics)) {
@@ -280,8 +276,7 @@
// uint64_t page_to_free_size);
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
index 8d83922..09ab660 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
@@ -128,11 +128,9 @@
}
// Compile our __lldb_backtrace_recording_get_thread_item_info() function (from
-// the
-// source above in g_get_thread_item_info_function_code) if we don't find that
-// function in the inferior
-// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for
-// testing.)
+// the source above in g_get_thread_item_info_function_code) if we don't find
+// that function in the inferior already with USE_BUILTIN_FUNCTION defined.
+// (e.g. this would be the case for testing.)
//
// Insert the __lldb_backtrace_recording_get_thread_item_info into the inferior
// process if needed.
@@ -141,8 +139,7 @@
// prepare for the call.
//
// Returns the address of the arguments written down in the inferior process,
-// which can be used to
-// make the function call.
+// which can be used to make the function call.
lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
Thread &thread, ValueList &get_thread_item_info_arglist) {
@@ -221,10 +218,9 @@
diagnostics.Clear();
// Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // like it might be a race condition if other threads were calling into here,
+ // but actually it isn't because we allocate a new args structure for this
+ // call by passing args_addr = LLDB_INVALID_ADDRESS...
if (!get_thread_item_info_caller->WriteFunctionArguments(
exe_ctx, args_addr, get_thread_item_info_arglist, diagnostics)) {
@@ -266,8 +262,7 @@
// Set up the arguments for a call to
- // struct get_thread_item_info_return_values
- // {
+ // struct get_thread_item_info_return_values {
// uint64_t item_info_buffer_ptr; /* the address of the items buffer
// from libBacktraceRecording */
// uint64_t item_info_buffer_size; /* the size of the items buffer from
@@ -283,8 +278,7 @@
// uint64_t page_to_free_size)
// Where the return_buffer argument points to a 24 byte region of memory
- // already allocated by lldb in
- // the inferior process.
+ // already allocated by lldb in the inferior process.
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
index 1a538b2..4748d5e 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -34,9 +34,9 @@
using namespace lldb_private;
//----------------------------------------------------------------------
-// Create an instance of this class. This function is filled into
-// the plugin info class that gets handed out by the plugin factory and
-// allows the lldb to instantiate an instance of this class.
+// Create an instance of this class. This function is filled into the plugin
+// info class that gets handed out by the plugin factory and allows the lldb to
+// instantiate an instance of this class.
//----------------------------------------------------------------------
SystemRuntime *SystemRuntimeMacOSX::CreateInstance(Process *process) {
bool create = false;
@@ -125,17 +125,15 @@
ReadLibdispatchOffsets();
if (m_libdispatch_offsets.IsValid()) {
// dispatch_qaddr is from a thread_info(THREAD_IDENTIFIER_INFO) call for a
- // thread -
- // deref it to get the address of the dispatch_queue_t structure for this
- // thread's
- // queue.
+ // thread - deref it to get the address of the dispatch_queue_t structure
+ // for this thread's queue.
Status error;
addr_t dispatch_queue_addr =
m_process->ReadPointerFromMemory(dispatch_qaddr, error);
if (error.Success()) {
if (m_libdispatch_offsets.dqo_version >= 4) {
- // libdispatch versions 4+, pointer to dispatch name is in the
- // queue structure.
+ // libdispatch versions 4+, pointer to dispatch name is in the queue
+ // structure.
addr_t pointer_to_label_address =
dispatch_queue_addr + m_libdispatch_offsets.dqo_label;
addr_t label_addr =
@@ -248,10 +246,8 @@
ReadLibdispatchOffsets();
if (m_libdispatch_offsets.IsValid()) {
// dispatch_qaddr is from a thread_info(THREAD_IDENTIFIER_INFO) call for a
- // thread -
- // deref it to get the address of the dispatch_queue_t structure for this
- // thread's
- // queue.
+ // thread - deref it to get the address of the dispatch_queue_t structure
+ // for this thread's queue.
Status error;
uint64_t dispatch_queue_addr =
m_process->ReadPointerFromMemory(dispatch_qaddr, error);
@@ -287,8 +283,8 @@
dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType(
g_dispatch_queue_offsets_symbol_name, eSymbolTypeData);
- // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion") and
- // later
+ // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion")
+ // and later
if (dispatch_queue_offsets_symbol == NULL) {
ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib", false));
module_sp = m_process->GetTarget().GetImages().FindFirstModule(
@@ -320,8 +316,7 @@
lldb::offset_t data_offset = 0;
// The struct LibdispatchOffsets is a series of uint16_t's - extract them
- // all
- // in one big go.
+ // all in one big go.
data.GetU16(&data_offset, &m_libdispatch_offsets.dqo_version,
sizeof(struct LibdispatchOffsets) / sizeof(uint16_t));
}
@@ -368,8 +363,7 @@
lldb::offset_t data_offset = 0;
// The struct LibpthreadOffsets is a series of uint16_t's - extract them
- // all
- // in one big go.
+ // all in one big go.
data.GetU16(&data_offset, &m_libpthread_offsets.plo_version,
sizeof(struct LibpthreadOffsets) / sizeof(uint16_t));
}
@@ -407,10 +401,8 @@
if (m_dispatch_tsd_indexes_addr != LLDB_INVALID_ADDRESS) {
// We don't need to check the version number right now, it will be at least 2,
-// but
-// keep this code around to fetch just the version # for the future where we
-// need
-// to fetch alternate versions of the struct.
+// but keep this code around to fetch just the version # for the future where
+// we need to fetch alternate versions of the struct.
#if 0
uint16_t dti_version = 2;
Address dti_struct_addr;
@@ -473,12 +465,9 @@
Status error;
// real_thread is either an actual, live thread (in which case we need to
- // call into
- // libBacktraceRecording to find its originator) or it is an extended
- // backtrace itself,
- // in which case we get the token from it and call into
- // libBacktraceRecording to find
- // the originator of that token.
+ // call into libBacktraceRecording to find its originator) or it is an
+ // extended backtrace itself, in which case we get the token from it and
+ // call into libBacktraceRecording to find the originator of that token.
if (real_thread->GetExtendedBacktraceToken() != LLDB_INVALID_ADDRESS) {
originating_thread_sp = GetExtendedBacktraceFromItemRef(
@@ -735,13 +724,11 @@
}
// We either didn't have libBacktraceRecording (and need to create the queues
- // list based on threads)
- // or we did get the queues list from libBacktraceRecording but some special
- // queues may not be
- // included in its information. This is needed because libBacktraceRecording
- // will only list queues with pending or running items by default - but the
- // magic com.apple.main-thread
- // queue on thread 1 is always around.
+ // list based on threads) or we did get the queues list from
+ // libBacktraceRecording but some special queues may not be included in its
+ // information. This is needed because libBacktraceRecording will only list
+ // queues with pending or running items by default - but the magic com.apple
+ // .main-thread queue on thread 1 is always around.
for (ThreadSP thread_sp : m_process->Threads()) {
if (thread_sp->GetAssociatedWithLibdispatchQueue() != eLazyBoolNo) {
@@ -769,12 +756,10 @@
}
// Returns either an array of introspection_dispatch_item_info_ref's for the
-// pending items on
-// a queue or an array introspection_dispatch_item_info_ref's and code addresses
-// for the
-// pending items on a queue. The information about each of these pending items
-// then needs to
-// be fetched individually by passing the ref to libBacktraceRecording.
+// pending items on a queue or an array introspection_dispatch_item_info_ref's
+// and code addresses for the pending items on a queue. The information about
+// each of these pending items then needs to be fetched individually by passing
+// the ref to libBacktraceRecording.
SystemRuntimeMacOSX::PendingItemsForQueue
SystemRuntimeMacOSX::GetPendingItemRefsForQueue(lldb::addr_t queue) {
@@ -927,8 +912,8 @@
offset_t offset = 0;
uint64_t queues_read = 0;
- // The information about the queues is stored in this format (v1):
- // typedef struct introspection_dispatch_queue_info_s {
+ // The information about the queues is stored in this format (v1): typedef
+ // struct introspection_dispatch_queue_info_s {
// uint32_t offset_to_next;
// dispatch_queue_t queue;
// uint64_t serialnum; // queue's serialnum in the process, as