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