blob: e442e0016c80e6c8708348011628cb839f73549d [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"
David Srbecky32210b92017-12-04 14:39:21 +000026#include "debug/debug_info.h"
Vladimir Marko74527972016-11-29 15:57:32 +000027#include "linker/elf_builder.h"
David Srbecky3b9d57a2015-04-10 00:22:14 +010028
29namespace art {
David Srbecky09c2a6b2016-03-11 17:11:44 +000030class OatHeader;
Tamas Berghammer86e42782016-01-05 14:29:02 +000031namespace mirror {
32class Class;
Andreas Gampedeae7db2017-05-30 09:56:41 -070033} // namespace mirror
David Srbeckyc5bfa972016-02-05 15:49:10 +000034namespace debug {
Tamas Berghammer86e42782016-01-05 14:29:02 +000035struct MethodDebugInfo;
David Srbecky3b9d57a2015-04-10 00:22:14 +010036
David Srbeckye0febdf2015-12-17 20:53:07 +000037template <typename ElfTypes>
David Srbeckyfe736b72016-03-09 11:44:44 +000038void WriteDebugInfo(
Vladimir Marko74527972016-11-29 15:57:32 +000039 linker::ElfBuilder<ElfTypes>* builder,
David Srbecky32210b92017-12-04 14:39:21 +000040 const DebugInfo& debug_info,
David Srbeckyfe736b72016-03-09 11:44:44 +000041 dwarf::CFIFormat cfi_format,
42 bool write_oat_patches);
David Srbecky3b9d57a2015-04-10 00:22:14 +010043
David Srbeckyfe736b72016-03-09 11:44:44 +000044std::vector<uint8_t> MakeMiniDebugInfo(
45 InstructionSet isa,
46 const InstructionSetFeatures* features,
David Srbeckyf4886df2017-12-11 16:06:29 +000047 uint64_t text_section_address,
David Srbeckyfe736b72016-03-09 11:44:44 +000048 size_t text_section_size,
David Srbecky32210b92017-12-04 14:39:21 +000049 uint64_t dex_section_address,
50 size_t dex_section_size,
51 const DebugInfo& debug_info);
David Srbecky5b1c2ca2016-01-25 17:32:41 +000052
David Srbeckyf4886df2017-12-11 16:06:29 +000053std::vector<uint8_t> MakeElfFileForJIT(
David Srbeckyfe736b72016-03-09 11:44:44 +000054 InstructionSet isa,
55 const InstructionSetFeatures* features,
David Srbeckyf4886df2017-12-11 16:06:29 +000056 bool mini_debug_info,
David Srbeckyc684f332018-01-19 17:38:06 +000057 ArrayRef<const MethodDebugInfo> method_infos);
Tamas Berghammer86e42782016-01-05 14:29:02 +000058
Vladimir Marko93205e32016-04-13 11:59:46 +010059std::vector<uint8_t> WriteDebugElfFileForClasses(
David Srbeckyfe736b72016-03-09 11:44:44 +000060 InstructionSet isa,
61 const InstructionSetFeatures* features,
62 const ArrayRef<mirror::Class*>& types)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070063 REQUIRES_SHARED(Locks::mutator_lock_);
David Srbecky5cc349f2015-12-18 15:04:48 +000064
David Srbeckyc5bfa972016-02-05 15:49:10 +000065} // namespace debug
David Srbecky3b9d57a2015-04-10 00:22:14 +010066} // namespace art
67
David Srbeckyc5bfa972016-02-05 15:49:10 +000068#endif // ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_