From 14f1b3e8826ce43b978db93a62d1166055db5394 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 2 Jan 2017 19:26:05 +0000 Subject: Vendor import of lldb trunk r290819: https://llvm.org/svn/llvm-project/lldb/trunk@290819 --- .../MacOSX/AppleGetPendingItemsHandler.h | 141 +++++++++++---------- 1 file changed, 73 insertions(+), 68 deletions(-) (limited to 'source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h') diff --git a/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h b/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h index 96fbf4a548c4..824619f5cfe0 100644 --- a/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h +++ b/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h @@ -1,4 +1,5 @@ -//===-- AppleGetPendingItemsHandler.h ----------------------------*- C++ -*-===// +//===-- AppleGetPendingItemsHandler.h ----------------------------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -18,12 +19,13 @@ // Other libraries and framework includes // Project includes -#include "lldb/lldb-public.h" #include "lldb/Core/Error.h" #include "lldb/Symbol/CompilerType.h" +#include "lldb/lldb-public.h" // This class will insert a UtilityFunction into the inferior process for -// calling libBacktraceRecording's __introspection_dispatch_queue_get_pending_items() +// calling libBacktraceRecording's +// __introspection_dispatch_queue_get_pending_items() // function. The function in the inferior will return a struct by value // with these members: // @@ -38,82 +40,85 @@ // space (items_buffer_size in size) which must be mach_vm_deallocate'd by // lldb. count is the number of items that were stored in the buffer. // -// The AppleGetPendingItemsHandler object should persist so that the UtilityFunction +// The AppleGetPendingItemsHandler object should persist so that the +// UtilityFunction // can be reused multiple times. -namespace lldb_private -{ +namespace lldb_private { class AppleGetPendingItemsHandler { public: + AppleGetPendingItemsHandler(lldb_private::Process *process); - AppleGetPendingItemsHandler (lldb_private::Process *process); - - ~AppleGetPendingItemsHandler(); - - struct GetPendingItemsReturnInfo - { - lldb::addr_t items_buffer_ptr; /* the address of the pending items buffer from libBacktraceRecording */ - lldb::addr_t items_buffer_size; /* the size of the pending items buffer from libBacktraceRecording */ - uint64_t count; /* the number of pending items included in the buffer */ - - GetPendingItemsReturnInfo () : - items_buffer_ptr(LLDB_INVALID_ADDRESS), - items_buffer_size(0), - count(0) - {} - }; - - //---------------------------------------------------------- - /// Get the list of pending items for a given queue via a call to - /// __introspection_dispatch_queue_get_pending_items. If there's a page of - /// memory that needs to be freed, pass in the address and size and it will - /// be freed before getting the list of queues. - /// - /// @param [in] thread - /// The thread to run this plan on. - /// - /// @param [in] queue - /// The dispatch_queue_t value for the queue of interest. - /// - /// @param [in] page_to_free - /// An address of an inferior process vm page that needs to be deallocated, - /// LLDB_INVALID_ADDRESS if this is not needed. - /// - /// @param [in] page_to_free_size - /// The size of the vm page that needs to be deallocated if an address was - /// passed in to page_to_free. - /// - /// @param [out] error - /// This object will be updated with the error status / error string from any failures encountered. - /// - /// @returns - /// The result of the inferior function call execution. If there was a failure of any kind while getting - /// the information, the items_buffer_ptr value will be LLDB_INVALID_ADDRESS. - //---------------------------------------------------------- - GetPendingItemsReturnInfo - GetPendingItems (Thread &thread, lldb::addr_t queue, lldb::addr_t page_to_free, uint64_t page_to_free_size, lldb_private::Error &error); - - - void - Detach (); - -private: + ~AppleGetPendingItemsHandler(); + struct GetPendingItemsReturnInfo { + lldb::addr_t items_buffer_ptr; /* the address of the pending items buffer + from libBacktraceRecording */ lldb::addr_t - SetupGetPendingItemsFunction (Thread &thread, ValueList &get_pending_items_arglist); + items_buffer_size; /* the size of the pending items buffer from + libBacktraceRecording */ + uint64_t count; /* the number of pending items included in the buffer */ + + GetPendingItemsReturnInfo() + : items_buffer_ptr(LLDB_INVALID_ADDRESS), items_buffer_size(0), + count(0) {} + }; + + //---------------------------------------------------------- + /// Get the list of pending items for a given queue via a call to + /// __introspection_dispatch_queue_get_pending_items. If there's a page of + /// memory that needs to be freed, pass in the address and size and it will + /// be freed before getting the list of queues. + /// + /// @param [in] thread + /// The thread to run this plan on. + /// + /// @param [in] queue + /// The dispatch_queue_t value for the queue of interest. + /// + /// @param [in] page_to_free + /// An address of an inferior process vm page that needs to be + /// deallocated, + /// LLDB_INVALID_ADDRESS if this is not needed. + /// + /// @param [in] page_to_free_size + /// The size of the vm page that needs to be deallocated if an address was + /// passed in to page_to_free. + /// + /// @param [out] error + /// This object will be updated with the error status / error string from + /// any failures encountered. + /// + /// @returns + /// The result of the inferior function call execution. If there was a + /// failure of any kind while getting + /// the information, the items_buffer_ptr value will be + /// LLDB_INVALID_ADDRESS. + //---------------------------------------------------------- + GetPendingItemsReturnInfo GetPendingItems(Thread &thread, lldb::addr_t queue, + lldb::addr_t page_to_free, + uint64_t page_to_free_size, + lldb_private::Error &error); + + void Detach(); + +private: + lldb::addr_t + SetupGetPendingItemsFunction(Thread &thread, + ValueList &get_pending_items_arglist); - static const char *g_get_pending_items_function_name; - static const char *g_get_pending_items_function_code; + static const char *g_get_pending_items_function_name; + static const char *g_get_pending_items_function_code; - lldb_private::Process *m_process; - std::unique_ptr m_get_pending_items_impl_code; - std::mutex m_get_pending_items_function_mutex; + lldb_private::Process *m_process; + std::unique_ptr m_get_pending_items_impl_code; + std::mutex m_get_pending_items_function_mutex; - lldb::addr_t m_get_pending_items_return_buffer_addr; - std::mutex m_get_pending_items_retbuffer_mutex; + lldb::addr_t m_get_pending_items_return_buffer_addr; + std::mutex m_get_pending_items_retbuffer_mutex; }; -} // using namespace lldb_private +} // using namespace lldb_private -#endif // lldb_AppleGetPendingItemsHandler_h_ +#endif // lldb_AppleGetPendingItemsHandler_h_ -- cgit v1.2.3