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 "base/array_ref.h"
23 #include "base/macros.h"
24 #include "base/mutex.h"
25 #include "debug/dwarf/dwarf_constants.h"
26 #include "debug/debug_info.h"
27 #include "linker/elf_builder.h"
28 
29 namespace art {
30 class OatHeader;
31 namespace mirror {
32 class Class;
33 }  // namespace mirror
34 namespace debug {
35 struct MethodDebugInfo;
36 
37 template <typename ElfTypes>
38 void WriteDebugInfo(
39     linker::ElfBuilder<ElfTypes>* builder,
40     const DebugInfo& debug_info,
41     dwarf::CFIFormat cfi_format,
42     bool write_oat_patches);
43 
44 std::vector<uint8_t> MakeMiniDebugInfo(
45     InstructionSet isa,
46     const InstructionSetFeatures* features,
47     uint64_t text_section_address,
48     size_t text_section_size,
49     uint64_t dex_section_address,
50     size_t dex_section_size,
51     const DebugInfo& debug_info);
52 
53 std::vector<uint8_t> MakeElfFileForJIT(
54     InstructionSet isa,
55     const InstructionSetFeatures* features,
56     bool mini_debug_info,
57     ArrayRef<const MethodDebugInfo> method_infos);
58 
59 std::vector<uint8_t> WriteDebugElfFileForClasses(
60     InstructionSet isa,
61     const InstructionSetFeatures* features,
62     const ArrayRef<mirror::Class*>& types)
63     REQUIRES_SHARED(Locks::mutator_lock_);
64 
65 }  // namespace debug
66 }  // namespace art
67 
68 #endif  // ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_
69