1 /* 2 * Copyright (C) 2016 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_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_ 18 #define ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_ 19 20 #include <vector> 21 22 #include "arch/instruction_set_features.h" 23 #include "base/array_ref.h" 24 #include "base/macros.h" 25 #include "base/mutex.h" 26 #include "debug/debug_info.h" 27 #include "dwarf/dwarf_constants.h" 28 #include "elf/elf_builder.h" 29 30 namespace art { 31 class OatHeader; 32 namespace mirror { 33 class Class; 34 } // namespace mirror 35 namespace debug { 36 struct MethodDebugInfo; 37 38 template <typename ElfTypes> 39 void WriteDebugInfo( 40 ElfBuilder<ElfTypes>* builder, 41 const DebugInfo& debug_info); 42 43 std::vector<uint8_t> MakeMiniDebugInfo( 44 InstructionSet isa, 45 const InstructionSetFeatures* features, 46 uint64_t text_section_address, 47 size_t text_section_size, 48 uint64_t dex_section_address, 49 size_t dex_section_size, 50 const DebugInfo& debug_info); 51 52 std::vector<uint8_t> MakeElfFileForJIT( 53 InstructionSet isa, 54 const InstructionSetFeatures* features, 55 bool mini_debug_info, 56 const MethodDebugInfo& method_info); 57 58 std::vector<uint8_t> PackElfFileForJIT( 59 InstructionSet isa, 60 const InstructionSetFeatures* features, 61 std::vector<ArrayRef<const uint8_t>>& added_elf_files, 62 std::vector<const void*>& removed_symbols, 63 /*out*/ size_t* num_symbols); 64 65 std::vector<uint8_t> WriteDebugElfFileForClasses( 66 InstructionSet isa, 67 const InstructionSetFeatures* features, 68 const ArrayRef<mirror::Class*>& types) 69 REQUIRES_SHARED(Locks::mutator_lock_); 70 71 } // namespace debug 72 } // namespace art 73 74 #endif // ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_ 75