From 440a9b3b3e6aa60c14e73a97dd85c9ada0898569 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Thu, 15 Feb 2018 17:47:29 +0000 Subject: Add timestamps to JIT/DEX native debug info. This a forward-looking change intended to allow simpleperf to reliably correlate samples and native debug information. I have added the timestamps to both JIT and DEX, and refactored the code in the process to avoid code duplication. Test: testrunner.py -t 137 Change-Id: I45fa4310305aff540e036db9af15a86c5b8b7aff --- runtime/jit/debugger_interface.h | 41 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) (limited to 'runtime/jit/debugger_interface.h') diff --git a/runtime/jit/debugger_interface.h b/runtime/jit/debugger_interface.h index 8c4bb3fdf4..3d25910f26 100644 --- a/runtime/jit/debugger_interface.h +++ b/runtime/jit/debugger_interface.h @@ -26,45 +26,26 @@ namespace art { -extern "C" { - struct JITCodeEntry; -} - // Notify native tools (e.g. libunwind) that DEX file has been opened. -// The pointer needs to point the start of the dex data (not the DexFile* object). -void RegisterDexFileForNative(Thread* current_thread, const void* dexfile_header); +// It takes the lock itself. The parameter must point to dex data (not the DexFile* object). +void AddNativeDebugInfoForDex(Thread* current_thread, ArrayRef dexfile); // Notify native tools (e.g. libunwind) that DEX file has been closed. -// The pointer needs to point the start of the dex data (not the DexFile* object). -void DeregisterDexFileForNative(Thread* current_thread, const void* dexfile_header); - -// Notify native debugger about new JITed code by passing in-memory ELF. -// It takes ownership of the in-memory ELF file. -JITCodeEntry* CreateJITCodeEntry(const std::vector& symfile) - REQUIRES(Locks::native_debug_interface_lock_); - -// Notify native debugger that JITed code has been removed. -// It also releases the associated in-memory ELF file. -void DeleteJITCodeEntry(JITCodeEntry* entry) - REQUIRES(Locks::native_debug_interface_lock_); - -// Helper method to track life-time of JITCodeEntry. -// It registers given code address as being described by the given entry. -void IncrementJITCodeEntryRefcount(JITCodeEntry* entry, uintptr_t code_address) - REQUIRES(Locks::native_debug_interface_lock_); +// It takes the lock itself. The parameter must point to dex data (not the DexFile* object). +void RemoveNativeDebugInfoForDex(Thread* current_thread, ArrayRef dexfile); -// Helper method to track life-time of JITCodeEntry. -// It de-registers given code address as being described by the given entry. -void DecrementJITCodeEntryRefcount(JITCodeEntry* entry, uintptr_t code_address) +// Notify native tools about new JITed code by passing in-memory ELF. +// The handle is the object that is being described (needed to be able to remove the entry). +// The method will make copy of the passed ELF file (to shrink it to the minimum size). +void AddNativeDebugInfoForJit(const void* handle, const std::vector& symfile) REQUIRES(Locks::native_debug_interface_lock_); -// Find the registered JITCodeEntry for given code address. -// There can be only one entry per address at any given time. -JITCodeEntry* GetJITCodeEntry(uintptr_t code_address) +// Notify native debugger that JITed code has been removed and free the debug info. +void RemoveNativeDebugInfoForJit(const void* handle) REQUIRES(Locks::native_debug_interface_lock_); // Returns approximate memory used by all JITCodeEntries. -size_t GetJITCodeEntryMemUsage() +size_t GetJitNativeDebugInfoMemUsage() REQUIRES(Locks::native_debug_interface_lock_); } // namespace art -- cgit v1.2.3-59-g8ed1b