obj2yaml.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #ifndef LLVM_TOOLS_OBJ2YAML_OBJ2YAML_H
  12. #define LLVM_TOOLS_OBJ2YAML_OBJ2YAML_H
  13. #include "llvm/Object/COFF.h"
  14. #include "llvm/Object/Minidump.h"
  15. #include "llvm/Object/Wasm.h"
  16. #include "llvm/Object/XCOFFObjectFile.h"
  17. #include "llvm/Support/raw_ostream.h"
  18. #include "llvm/Support/MemoryBufferRef.h"
  19. #include <system_error>
  20. enum RawSegments : unsigned { none = 0, data = 1, linkedit = 1 << 1 };
  21. std::error_code coff2yaml(llvm::raw_ostream &Out,
  22. const llvm::object::COFFObjectFile &Obj);
  23. llvm::Error elf2yaml(llvm::raw_ostream &Out,
  24. const llvm::object::ObjectFile &Obj);
  25. llvm::Error macho2yaml(llvm::raw_ostream &Out, const llvm::object::Binary &Obj,
  26. unsigned RawSegments);
  27. llvm::Error minidump2yaml(llvm::raw_ostream &Out,
  28. const llvm::object::MinidumpFile &Obj);
  29. llvm::Error xcoff2yaml(llvm::raw_ostream &Out,
  30. const llvm::object::XCOFFObjectFile &Obj);
  31. std::error_code wasm2yaml(llvm::raw_ostream &Out,
  32. const llvm::object::WasmObjectFile &Obj);
  33. llvm::Error archive2yaml(llvm::raw_ostream &Out, llvm::MemoryBufferRef Source);
  34. // Forward decls for dwarf2yaml
  35. namespace llvm {
  36. class DWARFContext;
  37. namespace DWARFYAML {
  38. struct Data;
  39. }
  40. }
  41. void dumpDebugAbbrev(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
  42. llvm::Error dumpDebugAddr(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
  43. llvm::Error dumpDebugARanges(llvm::DWARFContext &DCtx,
  44. llvm::DWARFYAML::Data &Y);
  45. void dumpDebugPubSections(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
  46. void dumpDebugInfo(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
  47. void dumpDebugLines(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
  48. llvm::Error dumpDebugRanges(llvm::DWARFContext &DCtx, llvm::DWARFYAML::Data &Y);
  49. llvm::Error dumpDebugStrings(llvm::DWARFContext &DCtx,
  50. llvm::DWARFYAML::Data &Y);
  51. #endif