blob: 14a5edbace4d115813c4e778b75c94feb0076abf [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 Srbecky2faab002019-02-12 16:35:48 +000022#include "arch/instruction_set_features.h"
David Brazdild9c90372016-09-14 16:53:55 +010023#include "base/array_ref.h"
Tamas Berghammer86e42782016-01-05 14:29:02 +000024#include "base/macros.h"
25#include "base/mutex.h"
David Srbecky32210b92017-12-04 14:39:21 +000026#include "debug/debug_info.h"
David Srbecky2faab002019-02-12 16:35:48 +000027#include "dwarf/dwarf_constants.h"
28#include "elf/elf_builder.h"
David Srbecky3b9d57a2015-04-10 00:22:14 +010029
30namespace art {
David Srbecky09c2a6b2016-03-11 17:11:44 +000031class OatHeader;
Tamas Berghammer86e42782016-01-05 14:29:02 +000032namespace mirror {
33class Class;
Andreas Gampedeae7db2017-05-30 09:56:41 -070034} // namespace mirror
David Srbeckyc5bfa972016-02-05 15:49:10 +000035namespace debug {
Tamas Berghammer86e42782016-01-05 14:29:02 +000036struct MethodDebugInfo;
David Srbecky3b9d57a2015-04-10 00:22:14 +010037
David Srbeckye0febdf2015-12-17 20:53:07 +000038template <typename ElfTypes>
David Srbeckyfe736b72016-03-09 11:44:44 +000039void WriteDebugInfo(
David Srbecky2faab002019-02-12 16:35:48 +000040 ElfBuilder<ElfTypes>* builder,
David Srbecky7370d922019-02-12 14:00:30 +000041 const DebugInfo& debug_info);
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,
David Srbeckyf4886df2017-12-11 16:06:29 +000046 uint64_t text_section_address,
David Srbeckyfe736b72016-03-09 11:44:44 +000047 size_t text_section_size,
David Srbecky32210b92017-12-04 14:39:21 +000048 uint64_t dex_section_address,
49 size_t dex_section_size,
50 const DebugInfo& debug_info);
David Srbecky5b1c2ca2016-01-25 17:32:41 +000051
David Srbeckyf4886df2017-12-11 16:06:29 +000052std::vector<uint8_t> MakeElfFileForJIT(
David Srbeckyfe736b72016-03-09 11:44:44 +000053 InstructionSet isa,
54 const InstructionSetFeatures* features,
David Srbeckyf4886df2017-12-11 16:06:29 +000055 bool mini_debug_info,
David Srbeckybe50f9a2018-12-05 10:48:42 +000056 const MethodDebugInfo& method_info);
Tamas Berghammer86e42782016-01-05 14:29:02 +000057
David Srbecky0b21e412018-12-05 13:24:06 +000058std::vector<uint8_t> PackElfFileForJIT(
59 InstructionSet isa,
60 const InstructionSetFeatures* features,
David Srbecky53eb07f2019-02-12 16:34:55 +000061 std::vector<ArrayRef<const uint8_t>>& added_elf_files,
David Srbecky0b21e412018-12-05 13:24:06 +000062 std::vector<const void*>& removed_symbols,
63 /*out*/ size_t* num_symbols);
64
Vladimir Marko93205e32016-04-13 11:59:46 +010065std::vector<uint8_t> WriteDebugElfFileForClasses(
David Srbeckyfe736b72016-03-09 11:44:44 +000066 InstructionSet isa,
67 const InstructionSetFeatures* features,
68 const ArrayRef<mirror::Class*>& types)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070069 REQUIRES_SHARED(Locks::mutator_lock_);
David Srbecky5cc349f2015-12-18 15:04:48 +000070
David Srbeckyc5bfa972016-02-05 15:49:10 +000071} // namespace debug
David Srbecky3b9d57a2015-04-10 00:22:14 +010072} // namespace art
73
David Srbeckyc5bfa972016-02-05 15:49:10 +000074#endif // ART_COMPILER_DEBUG_ELF_DEBUG_WRITER_H_