From 1c312f2b01b4d3369c56078ccaccd6a1d598a06a Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Tue, 1 Mar 2016 18:38:05 +0000 Subject: [PATCH] [DebugInfo] Dump CIE augmentation data as a list of hex bytes CIE augmentation data might contain non-printable characters. The patch prints the data as a list of hex bytes. Differential Revision: http://reviews.llvm.org/D17759 llvm-svn: 262361 --- lib/DebugInfo/DWARF/DWARFDebugFrame.cpp | 9 ++++-- .../llvm-objdump/Inputs/eh_frame.elf-mipsel | Bin 0 -> 7827 bytes test/tools/llvm-objdump/eh_frame-arm64.test | 2 +- test/tools/llvm-objdump/eh_frame-mipsel.test | 27 ++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100755 test/tools/llvm-objdump/Inputs/eh_frame.elf-mipsel create mode 100644 test/tools/llvm-objdump/eh_frame-mipsel.test diff --git a/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp index 6d59a8e1d24..3d2b9e9a05e 100644 --- a/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp +++ b/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp @@ -12,6 +12,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/Support/Casting.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/Dwarf.h" @@ -244,8 +245,12 @@ public: (int32_t)DataAlignmentFactor); OS << format(" Return address column: %d\n", (int32_t)ReturnAddressRegister); - if (!AugmentationData.empty()) - OS << " Augmentation data: " << AugmentationData << "\n"; + if (!AugmentationData.empty()) { + OS << " Augmentation data: "; + for (uint8_t Byte : AugmentationData) + OS << ' ' << hexdigit(Byte >> 4) << hexdigit(Byte & 0xf); + OS << "\n"; + } OS << "\n"; } diff --git a/test/tools/llvm-objdump/Inputs/eh_frame.elf-mipsel b/test/tools/llvm-objdump/Inputs/eh_frame.el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>t&yzGsDH}KHTYg&6E6?q^$@U$mk05B0@%dMgD1#yz(L2p z7xrHPKJ3DCz^7gKEnr!VlPeMr`u`r%I$+LRVjl#3^%fA<*&3U55%@u8 zygir?Hv+r;+XX!B%s1NW12)9|bAK@NhflhZ8oAMBO8w76ZaMAo#_j}g<$;)^_HOkg zu!*0*zf(2%d0;a?y_lcB02Z%>KlXo_{1({Ewj8~I)gPa34 z@BeGjztyhIiL2*IV5lhK{pnVhoU>`C3kQLFfzA3{i}iUBc+QD;gLjjpsPDJ%r|(;j z*VKOsnCqGT@xJwYHS%8qoBlPRe{TSr_0!uO9yJes`OL=|AInGq549fXw47b-8#za)0XyV+s;UIXG`1emTbCE(()D@)mqZKcJFE_B+i$# z_Vl$TO5?5S;yIF+F&xu)N{b{UQ7o6r<0B);+IH9A!2#Sp-!X{GY1{5zf^O?t6rH~$ zw#!*N!Mo*>n0sSak!>gQ_Gl(Q9M9P5=w`>qCj>{aLMByCB_lic?Aa|8*y-d%WLGpA z6@4B|j%Tw+jXymHx|KV(4#f8N*ap!ZlRw{zIwz`Dc&!{sBxG+_*OIejR8pCd7N_&J zjn71O&pun*-q$@K_GkeOQ*OtL#rRR)uP-f7K@_`x;9yrz_niYh>bgF*x5plgb@ufj zaLzTp@c5}Oxy2sgDYW~uI4zGvE^(Q!?!+-lwmLJz4?CGI!I=xc3M~1EU|;NNUYpq4 zcd#?oXCJ)v);oFz7u~D9e7CIgx9jS&!TI4``r)AFj{al5Ft~ee!^q-DIkB^orMx{B z&n4CO2sO{lST06^Lx8xcGrY|Y3zp^jAYj`Fs0pt64sziajinVv)P;opW}?24EEVfv hUh+X@seq literal 0 HcmV?d00001 diff --git a/test/tools/llvm-objdump/eh_frame-arm64.test b/test/tools/llvm-objdump/eh_frame-arm64.test index adfd4cc4f26..f6d2db88522 100644 --- a/test/tools/llvm-objdump/eh_frame-arm64.test +++ b/test/tools/llvm-objdump/eh_frame-arm64.test @@ -8,7 +8,7 @@ # CHECK: Code alignment factor: 1 # CHECK: Data alignment factor: -8 # CHECK: Return address column: 30 -# CHECK: Augmentation data: +# CHECK: Augmentation data: 10 # CHECK: DW_CFA_def_cfa: reg31 +0 diff --git a/test/tools/llvm-objdump/eh_frame-mipsel.test b/test/tools/llvm-objdump/eh_frame-mipsel.test new file mode 100644 index 00000000000..0592c8c212e --- /dev/null +++ b/test/tools/llvm-objdump/eh_frame-mipsel.test @@ -0,0 +1,27 @@ +# RUN: llvm-objdump -dwarf=frames %p/Inputs/eh_frame.elf-mipsel | FileCheck %s + +# CHECK: .eh_frame contents: + +# CHECK: 00000000 00000018 ffffffff CIE +# CHECK: Version: 1 +# CHECK: Augmentation: "zPLR" +# CHECK: Code alignment factor: 1 +# CHECK: Data alignment factor: -4 +# CHECK: Return address column: 31 +# CHECK: Augmentation data: 80 90 0B 41 00 00 0B + +# CHECK: DW_CFA_def_cfa: reg29 +0 + +# CHECK: 0000001c 00000018 00000020 FDE cie=00000020 pc=00400890...004008dc +# CHECK: DW_CFA_advance_loc: 4 +# CHECK: DW_CFA_def_cfa_offset: +24 +# CHECK: DW_CFA_advance_loc: 4 +# CHECK: DW_CFA_offset: reg31 -4 +# CHECK: DW_CFA_nop: + +# CHECK: 00000038 00000000 ffffffff CIE +# CHECK: Version: 0 +# CHECK: Augmentation: "" +# CHECK: Code alignment factor: 0 +# CHECK: Data alignment factor: 0 +# CHECK: Return address column: 0