| 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/MemoryBufferRef.h" |
| 20 | #include "llvm/Support/raw_ostream.h" |
| 21 | #include <system_error> |
| 22 | |
| 23 | enum RawSegments : unsigned { none = 0, data = 1, linkedit = 1 << 1 }; |
| 24 | std::error_code coff2yaml(llvm::raw_ostream &Out, |
| 25 | const llvm::object::COFFObjectFile &Obj); |
| 26 | llvm::Error elf2yaml(llvm::raw_ostream &Out, |
| 27 | const llvm::object::ObjectFile &Obj); |
| 28 | llvm::Error macho2yaml(llvm::raw_ostream &Out, const llvm::object::Binary &Obj, |
| 29 | unsigned RawSegments); |
| 30 | llvm::Error minidump2yaml(llvm::raw_ostream &Out, |
| 31 | const llvm::object::MinidumpFile &Obj); |
| 32 | llvm::Error xcoff2yaml(llvm::raw_ostream &Out, |
| 33 | const llvm::object::XCOFFObjectFile &Obj); |
| 34 | std::error_code wasm2yaml(llvm::raw_ostream &Out, |
| 35 | const llvm::object::WasmObjectFile &Obj); |
| 36 | llvm::Error archive2yaml(llvm::raw_ostream &Out, llvm::MemoryBufferRef Source); |
| 37 | llvm::Error offload2yaml(llvm::raw_ostream &Out, llvm::MemoryBufferRef Source); |
| 38 | llvm::Error dxcontainer2yaml(llvm::raw_ostream &Out, |
| 39 | llvm::MemoryBufferRef Source); |
| 40 | |
| 41 | // Forward decls for dwarf2yaml |
| 42 | namespace llvm { |
| 43 | class DWARFContext; |
| 44 | namespace DWARFYAML { |
| 45 | struct Data; |
| 46 | } |
| 47 | } // namespace llvm |
| 48 | |
| 49 | llvm::Error dumpDebugAbbrev(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y); |
| 50 | llvm::Error dumpDebugAddr(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y); |
| 51 | llvm::Error dumpDebugARanges(llvm::DWARFContext &DCtx, |
| 52 | llvm::DWARFYAML::Data &Y); |
| 53 | void dumpDebugPubSections(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y); |
| 54 | void dumpDebugInfo(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y); |
| 55 | void dumpDebugLines(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y); |
| 56 | llvm::Error dumpDebugRanges(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y); |
| 57 | llvm::Error dumpDebugStrings(llvm::DWARFContext &DCtx, |
| 58 | llvm::DWARFYAML::Data &Y); |
| 59 | |
| 60 | #endif |
| 61 | |