blob: 1ce3c6f6f85c792acd4428f4dc7ddb92927e3baa [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;
David Srbecky8fc2f952019-07-31 18:40:09 +010032struct JITCodeEntry;
Tamas Berghammer86e42782016-01-05 14:29:02 +000033namespace mirror {
34class Class;
Andreas Gampedeae7db2017-05-30 09:56:41 -070035} // namespace mirror
David Srbeckyc5bfa972016-02-05 15:49:10 +000036namespace debug {
Tamas Berghammer86e42782016-01-05 14:29:02 +000037struct MethodDebugInfo;
David Srbecky3b9d57a2015-04-10 00:22:14 +010038
David Srbeckye0febdf2015-12-17 20:53:07 +000039template <typename ElfTypes>
David Srbeckyfe736b72016-03-09 11:44:44 +000040void WriteDebugInfo(
David Srbecky2faab002019-02-12 16:35:48 +000041 ElfBuilder<ElfTypes>* builder,
David Srbecky7370d922019-02-12 14:00:30 +000042 const DebugInfo& debug_info);
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 Srbeckybe50f9a2018-12-05 10:48:42 +000057 const MethodDebugInfo& method_info);
Tamas Berghammer86e42782016-01-05 14:29:02 +000058
David Srbecky0b21e412018-12-05 13:24:06 +000059std::vector<uint8_t> PackElfFileForJIT(
David Srbeckye09b87e2019-08-19 21:31:31 +010060 ArrayRef<const JITCodeEntry*> jit_entries,
David Srbecky8fc2f952019-07-31 18:40:09 +010061 ArrayRef<const void*> removed_symbols,
David Srbecky76b9c692019-04-01 19:36:33 +010062 bool compress,
David Srbecky0b21e412018-12-05 13:24:06 +000063 /*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_