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

source code of llvm/tools/obj2yaml/obj2yaml.h