• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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>
21 #include <vector>
22 
23 #include "arch/instruction_set_features.h"
24 #include "base/array_ref.h"
25 #include "base/locks.h"
26 
27 namespace art {
28 
29 class DexFile;
30 class Thread;
31 
32 // This method is declared in the compiler library.
33 // We need to pass it by pointer to be able to call it from runtime.
34 typedef std::vector<uint8_t> PackElfFileForJITFunction(
35     InstructionSet isa,
36     const InstructionSetFeatures* features,
37     std::vector<ArrayRef<const uint8_t>>& added_elf_files,
38     std::vector<const void*>& removed_symbols,
39     /*out*/ size_t* num_symbols);
40 
41 // Notify native tools (e.g. libunwind) that DEX file has been opened.
42 void AddNativeDebugInfoForDex(Thread* self, const DexFile* dexfile);
43 
44 // Notify native tools (e.g. libunwind) that DEX file has been closed.
45 void RemoveNativeDebugInfoForDex(Thread* self, const DexFile* dexfile);
46 
47 // Notify native tools (e.g. libunwind) that JIT has compiled a new method.
48 // The method will make copy of the passed ELF file (to shrink it to the minimum size).
49 void AddNativeDebugInfoForJit(Thread* self,
50                               const void* code_ptr,
51                               const std::vector<uint8_t>& symfile,
52                               PackElfFileForJITFunction pack,
53                               InstructionSet isa,
54                               const InstructionSetFeatures* features);
55 
56 // Notify native tools (e.g. libunwind) that JIT code has been garbage collected.
57 void RemoveNativeDebugInfoForJit(Thread* self, const void* code_ptr);
58 
59 // Returns approximate memory used by debug info for JIT code.
60 size_t GetJitMiniDebugInfoMemUsage();
61 
62 }  // namespace art
63 
64 #endif  // ART_RUNTIME_JIT_DEBUGGER_INTERFACE_H_
65