//===-- AppleGetQueuesHandler.cpp -----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "AppleGetQueuesHandler.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Core/Module.h" #include "lldb/Core/Value.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" usingnamespacelldb; usingnamespacelldb_private; const char *AppleGetQueuesHandler::g_get_current_queues_function_name = …; const char *AppleGetQueuesHandler::g_get_current_queues_function_code = …; AppleGetQueuesHandler::AppleGetQueuesHandler(Process *process) : … { … } AppleGetQueuesHandler::~AppleGetQueuesHandler() = default; 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: // // struct get_current_queues_return_values // { // introspection_dispatch_queue_info_t *queues_buffer; // uint64_t queues_buffer_size; // uint64_t count; // }; // 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.) // // Insert the __lldb_backtrace_recording_get_current_queues into the inferior // process if needed. // // Write the get_queues_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. lldb::addr_t AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, ValueList &get_queues_arglist) { … } AppleGetQueuesHandler::GetQueuesReturnInfo AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free, uint64_t page_to_free_size, Status &error) { … }