diff options
Diffstat (limited to 'lldb/source/Plugins/SystemRuntime/MacOSX')
5 files changed, 70 insertions, 103 deletions
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp index 3f0c7db676f..007a59378fc 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -119,20 +119,18 @@ void AppleGetItemInfoHandler::Detach() { } // 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 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction( { 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 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction( 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 @@ AppleGetItemInfoHandler::GetItemInfo(Thread &thread, uint64_t item, // 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 e3d03a6f948..0de32bf1141 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -121,11 +121,10 @@ void AppleGetPendingItemsHandler::Detach() { } } -// 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 @@ void AppleGetPendingItemsHandler::Detach() { // 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 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction( } // 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 @@ AppleGetPendingItemsHandler::GetPendingItems(Thread &thread, addr_t queue, // 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 c1654eb62cc..7855b3603a3 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -118,9 +118,9 @@ void AppleGetQueuesHandler::Detach() { } // 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 @@ void AppleGetQueuesHandler::Detach() { // }; // 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 @@ void AppleGetQueuesHandler::Detach() { // 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 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, 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 @@ AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free, // 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 8d83922af1e..09ab6600a9f 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -128,11 +128,9 @@ void AppleGetThreadItemInfoHandler::Detach() { } // 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 @@ void AppleGetThreadItemInfoHandler::Detach() { // 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 @@ lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction( 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 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread, // 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 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread, // 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 1a538b236c1..4748d5e8622 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -34,9 +34,9 @@ using namespace lldb; 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 @@ SystemRuntimeMacOSX::GetQueueNameFromThreadQAddress(addr_t dispatch_qaddr) { 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 @@ SystemRuntimeMacOSX::GetQueueIDFromThreadQAddress(lldb::addr_t dispatch_qaddr) { 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 @@ void SystemRuntimeMacOSX::ReadLibdispatchOffsetsAddress() { 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 @@ void SystemRuntimeMacOSX::ReadLibdispatchOffsets() { 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 @@ void SystemRuntimeMacOSX::ReadLibpthreadOffsets() { 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 @@ void SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes() { 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 @@ ThreadSP SystemRuntimeMacOSX::GetExtendedBacktraceThread(ThreadSP real_thread, 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 @@ void SystemRuntimeMacOSX::PopulateQueueList( } // 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 @@ void SystemRuntimeMacOSX::PopulateQueueList( } // 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 @@ void SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR( 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 |