blob: fb5e81b03ca58a71ed33afb9cb557880047adff1 [file] [log] [blame]
David Srbecky67feb172015-12-17 19:57:44 +00001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_RUNTIME_JIT_DEBUGGER_INTERFACE_H_
18#define ART_RUNTIME_JIT_DEBUGGER_INTERFACE_H_
19
20#include <inttypes.h>
David Srbecky5cc349f2015-12-18 15:04:48 +000021#include <memory>
Vladimir Marko93205e32016-04-13 11:59:46 +010022#include <vector>
David Srbecky67feb172015-12-17 19:57:44 +000023
David Srbeckyc684f332018-01-19 17:38:06 +000024#include "base/array_ref.h"
Andreas Gampe7fbc4a52018-11-28 08:26:47 -080025#include "base/locks.h"
David Srbeckyc684f332018-01-19 17:38:06 +000026
David Srbecky67feb172015-12-17 19:57:44 +000027namespace art {
28
David Srbeckyfb3de3d2018-01-29 16:11:49 +000029// Notify native tools (e.g. libunwind) that DEX file has been opened.
David Srbecky440a9b32018-02-15 17:47:29 +000030// It takes the lock itself. The parameter must point to dex data (not the DexFile* object).
31void AddNativeDebugInfoForDex(Thread* current_thread, ArrayRef<const uint8_t> dexfile);
David Srbeckyfb3de3d2018-01-29 16:11:49 +000032
33// Notify native tools (e.g. libunwind) that DEX file has been closed.
David Srbecky440a9b32018-02-15 17:47:29 +000034// It takes the lock itself. The parameter must point to dex data (not the DexFile* object).
35void RemoveNativeDebugInfoForDex(Thread* current_thread, ArrayRef<const uint8_t> dexfile);
David Srbeckyc684f332018-01-19 17:38:06 +000036
David Srbecky440a9b32018-02-15 17:47:29 +000037// Notify native tools about new JITed code by passing in-memory ELF.
38// The handle is the object that is being described (needed to be able to remove the entry).
39// The method will make copy of the passed ELF file (to shrink it to the minimum size).
40void AddNativeDebugInfoForJit(const void* handle, const std::vector<uint8_t>& symfile)
David Srbeckyfb3de3d2018-01-29 16:11:49 +000041 REQUIRES(Locks::native_debug_interface_lock_);
David Srbecky67feb172015-12-17 19:57:44 +000042
David Srbecky440a9b32018-02-15 17:47:29 +000043// Notify native debugger that JITed code has been removed and free the debug info.
44void RemoveNativeDebugInfoForJit(const void* handle)
David Srbeckyfb3de3d2018-01-29 16:11:49 +000045 REQUIRES(Locks::native_debug_interface_lock_);
David Srbeckyc684f332018-01-19 17:38:06 +000046
47// Returns approximate memory used by all JITCodeEntries.
David Srbecky440a9b32018-02-15 17:47:29 +000048size_t GetJitNativeDebugInfoMemUsage()
David Srbeckyfb3de3d2018-01-29 16:11:49 +000049 REQUIRES(Locks::native_debug_interface_lock_);
David Srbecky5cc349f2015-12-18 15:04:48 +000050
David Srbecky67feb172015-12-17 19:57:44 +000051} // namespace art
52
53#endif // ART_RUNTIME_JIT_DEBUGGER_INTERFACE_H_