blob: d24ca9b203f8a7e187d2f170005b53637afb2213 [file] [log] [blame]
David Srbecky3b9d57a2015-04-10 00:22:14 +01001/*
David Srbeckyc5bfa972016-02-05 15:49:10 +00002 * Copyright (C) 2016 The Android Open Source Project
David Srbecky3b9d57a2015-04-10 00:22:14 +01003 *
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
David Srbeckyc5bfa972016-02-05 15:49:10 +000017#ifndef ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_
18#define ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_
David Srbecky3b9d57a2015-04-10 00:22:14 +010019
David Srbecky09c2a6b2016-03-11 17:11:44 +000020#include <vector>
21
David Brazdild9c90372016-09-14 16:53:55 +010022#include "base/array_ref.h"
Tamas Berghammer86e42782016-01-05 14:29:02 +000023#include "base/macros.h"
24#include "base/mutex.h"
David Srbecky4fda4eb2016-02-05 13:34:46 +000025#include "debug/dwarf/dwarf_constants.h"
Vladimir Marko74527972016-11-29 15:57:32 +000026#include "linker/elf_builder.h"
David Srbecky3b9d57a2015-04-10 00:22:14 +010027
28namespace art {
David Srbecky09c2a6b2016-03-11 17:11:44 +000029class OatHeader;
Tamas Berghammer86e42782016-01-05 14:29:02 +000030namespace mirror {
31class Class;
Andreas Gampedeae7db2017-05-30 09:56:41 -070032} // namespace mirror
David Srbeckyc5bfa972016-02-05 15:49:10 +000033namespace debug {
Tamas Berghammer86e42782016-01-05 14:29:02 +000034struct MethodDebugInfo;
David Srbecky3b9d57a2015-04-10 00:22:14 +010035
David Srbeckye0febdf2015-12-17 20:53:07 +000036template <typename ElfTypes>
David Srbeckyfe736b72016-03-09 11:44:44 +000037void WriteDebugInfo(
Vladimir Marko74527972016-11-29 15:57:32 +000038 linker::ElfBuilder<ElfTypes>* builder,
David Srbeckyfe736b72016-03-09 11:44:44 +000039 const ArrayRef<const MethodDebugInfo>& method_infos,
40 dwarf::CFIFormat cfi_format,
41 bool write_oat_patches);
David Srbecky3b9d57a2015-04-10 00:22:14 +010042
David Srbeckyfe736b72016-03-09 11:44:44 +000043std::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);
David Srbecky5b1c2ca2016-01-25 17:32:41 +000049
Vladimir Marko93205e32016-04-13 11:59:46 +010050std::vector<uint8_t> WriteDebugElfFileForMethods(
David Srbeckyfe736b72016-03-09 11:44:44 +000051 InstructionSet isa,
52 const InstructionSetFeatures* features,
53 const ArrayRef<const MethodDebugInfo>& method_infos);
Tamas Berghammer86e42782016-01-05 14:29:02 +000054
Vladimir Marko93205e32016-04-13 11:59:46 +010055std::vector<uint8_t> WriteDebugElfFileForClasses(
David Srbeckyfe736b72016-03-09 11:44:44 +000056 InstructionSet isa,
57 const InstructionSetFeatures* features,
58 const ArrayRef<mirror::Class*>& types)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070059 REQUIRES_SHARED(Locks::mutator_lock_);
David Srbecky5cc349f2015-12-18 15:04:48 +000060
David Srbeckyc5bfa972016-02-05 15:49:10 +000061} // namespace debug
David Srbecky3b9d57a2015-04-10 00:22:14 +010062} // namespace art
63
David Srbeckyc5bfa972016-02-05 15:49:10 +000064#endif // ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_