blob: 17beb4baca05d83684ebe50a74d2c326b0471899 [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>
Vladimir Marko93205e32016-04-13 11:59:46 +010021#include <vector>
David Srbecky67feb172015-12-17 19:57:44 +000022
David Srbecky0b21e412018-12-05 13:24:06 +000023#include "arch/instruction_set_features.h"
Andreas Gampe7fbc4a52018-11-28 08:26:47 -080024#include "base/locks.h"
David Srbeckyc684f332018-01-19 17:38:06 +000025
David Srbecky67feb172015-12-17 19:57:44 +000026namespace art {
27
David Srbeckyafc60cd2018-12-05 11:59:31 +000028class DexFile;
29class Thread;
30
David Srbecky0b21e412018-12-05 13:24:06 +000031// This method is declared in the compiler library.
32// We need to pass it by pointer to be able to call it from runtime.
33typedef std::vector<uint8_t> PackElfFileForJITFunction(
34 InstructionSet isa,
35 const InstructionSetFeatures* features,
36 std::vector<const uint8_t*>& added_elf_files,
37 std::vector<const void*>& removed_symbols,
38 /*out*/ size_t* num_symbols);
39
David Srbeckyfb3de3d2018-01-29 16:11:49 +000040// Notify native tools (e.g. libunwind) that DEX file has been opened.
David Srbecky0b21e412018-12-05 13:24:06 +000041void AddNativeDebugInfoForDex(Thread* self, const DexFile* dexfile);
David Srbeckyfb3de3d2018-01-29 16:11:49 +000042
43// Notify native tools (e.g. libunwind) that DEX file has been closed.
David Srbecky0b21e412018-12-05 13:24:06 +000044void RemoveNativeDebugInfoForDex(Thread* self, const DexFile* dexfile);
David Srbeckyc684f332018-01-19 17:38:06 +000045
David Srbeckyafc60cd2018-12-05 11:59:31 +000046// Notify native tools (e.g. libunwind) that JIT has compiled a new method.
David Srbecky440a9b32018-02-15 17:47:29 +000047// The method will make copy of the passed ELF file (to shrink it to the minimum size).
David Srbeckyafc60cd2018-12-05 11:59:31 +000048void AddNativeDebugInfoForJit(Thread* self,
49 const void* code_ptr,
David Srbecky0b21e412018-12-05 13:24:06 +000050 const std::vector<uint8_t>& symfile,
51 PackElfFileForJITFunction pack,
52 InstructionSet isa,
53 const InstructionSetFeatures* features);
David Srbecky67feb172015-12-17 19:57:44 +000054
David Srbeckyafc60cd2018-12-05 11:59:31 +000055// Notify native tools (e.g. libunwind) that JIT code has been garbage collected.
David Srbecky0b21e412018-12-05 13:24:06 +000056void RemoveNativeDebugInfoForJit(Thread* self, const void* code_ptr);
David Srbeckyc684f332018-01-19 17:38:06 +000057
David Srbeckyafc60cd2018-12-05 11:59:31 +000058// Returns approximate memory used by debug info for JIT code.
David Srbecky0b21e412018-12-05 13:24:06 +000059size_t GetJitMiniDebugInfoMemUsage();
David Srbecky5cc349f2015-12-18 15:04:48 +000060
David Srbecky67feb172015-12-17 19:57:44 +000061} // namespace art
62
63#endif // ART_RUNTIME_JIT_DEBUGGER_INTERFACE_H_