1 //===------ utils/obj2yaml.hpp - obj2yaml conversion tool -------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 // This file declares some helper routines, and also the format-specific
8 // writers. To add a new format, add the declaration here, and, in a separate
9 // source file, implement it.
10 //===----------------------------------------------------------------------===//
11 
12 #ifndef LLVM_TOOLS_OBJ2YAML_OBJ2YAML_H
13 #define LLVM_TOOLS_OBJ2YAML_OBJ2YAML_H
14 
15 #include "llvm/Object/COFF.h"
16 #include "llvm/Object/Minidump.h"
17 #include "llvm/Object/Wasm.h"
18 #include "llvm/Object/XCOFFObjectFile.h"
19 #include "llvm/Support/raw_ostream.h"
20 #include "llvm/Support/MemoryBufferRef.h"
21 #include <system_error>
22 
23 std::error_code coff2yaml(llvm::raw_ostream &Out,
24                           const llvm::object::COFFObjectFile &Obj);
25 llvm::Error elf2yaml(llvm::raw_ostream &Out,
26                          const llvm::object::ObjectFile &Obj);
27 llvm::Error macho2yaml(llvm::raw_ostream &Out,
28                            const llvm::object::Binary &Obj);
29 llvm::Error minidump2yaml(llvm::raw_ostream &Out,
30                           const llvm::object::MinidumpFile &Obj);
31 std::error_code xcoff2yaml(llvm::raw_ostream &Out,
32                            const llvm::object::XCOFFObjectFile &Obj);
33 std::error_code wasm2yaml(llvm::raw_ostream &Out,
34                           const llvm::object::WasmObjectFile &Obj);
35 llvm::Error archive2yaml(llvm::raw_ostream &Out, llvm::MemoryBufferRef Source);
36 
37 // Forward decls for dwarf2yaml
38 namespace llvm {
39 class DWARFContext;
40 namespace DWARFYAML {
41 struct Data;
42 }
43 }
44 
45 void dumpDebugAbbrev(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
46 llvm::Error dumpDebugAddr(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
47 llvm::Error dumpDebugARanges(llvm::DWARFContext &DCtx,
48                              llvm::DWARFYAML::Data &Y);
49 void dumpDebugPubSections(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
50 void dumpDebugInfo(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
51 void dumpDebugLines(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
52 llvm::Error dumpDebugRanges(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
53 llvm::Error dumpDebugStrings(llvm::DWARFContext &DCtx,
54                              llvm::DWARFYAML::Data &Y);
55 
56 #endif
57