From 7fdf44440ca47bbb3f52e2c01d77895fe1a2e0e1 Mon Sep 17 00:00:00 2001 From: Rafael Auler Date: Wed, 7 Mar 2018 19:19:51 +0000 Subject: [DebugInfo] Support DWARF expressions in eh_frame This patch enhances DWARFDebugFrame with the capability of parsing and printing DWARF expressions in CFI instructions. It also makes FDEs and CIEs accessible to lib users, so they can process them in client tools that rely on LLVM. To make it self-contained with a test case, it teaches llvm-readobj to be able to dump EH frames and checks they are correct in a unit test. The llvm-readobj code is Maksim Panchenko's work (maksfb). Reviewers: JDevlieghere, espindola Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D43313 llvm-svn: 326932 --- llvm/tools/llvm-readobj/ELFDumper.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/tools/llvm-readobj/ELFDumper.cpp') diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp index 36cda459225..6b6582b7566 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "ARMEHABIPrinter.h" +#include "DwarfCFIEHPrinter.h" #include "Error.h" #include "ObjDumper.h" #include "StackMapPrinter.h" @@ -1808,6 +1809,11 @@ void ELFDumper::printValue(uint64_t Type, uint64_t Value) { template void ELFDumper::printUnwindInfo() { + const unsigned Machine = Obj->getHeader()->e_machine; + if (Machine == EM_386 || Machine == EM_X86_64) { + DwarfCFIEH::PrinterContext Ctx(W, Obj); + return Ctx.printUnwindInformation(); + } W.startLine() << "UnwindInfo not implemented.\n"; } -- cgit v1.2.3