From 8678acd5ede8cd705228e854ad9c39b850913b2f Mon Sep 17 00:00:00 2001 From: Nico Rieck Date: Mon, 17 Mar 2014 01:46:52 +0000 Subject: [PATCH] llvm-readobj: Print referred symbol name for CLR token definition llvm-svn: 204024 --- llvm/test/tools/llvm-readobj/cxx-cli-aux.test | 2 +- llvm/tools/llvm-readobj/COFFDumper.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/llvm/test/tools/llvm-readobj/cxx-cli-aux.test b/llvm/test/tools/llvm-readobj/cxx-cli-aux.test index eac3041b1cce..90e73c033a86 100644 --- a/llvm/test/tools/llvm-readobj/cxx-cli-aux.test +++ b/llvm/test/tools/llvm-readobj/cxx-cli-aux.test @@ -36,7 +36,7 @@ CHECK-NEXT: AuxSymbolCount: 1 CHECK-NEXT: AuxCLRToken { CHECK-NEXT: AuxType: 1 CHECK-NEXT: Reserved: 0 -CHECK-NEXT: SymbolTableIndex: 19 +CHECK-NEXT: SymbolTableIndex: ?PerAppDomain@@$$Q3HA (19) CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00 00 00) CHECK-NEXT: } CHECK-NEXT: } diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp index 28ac3cb4164d..34115f481ae5 100644 --- a/llvm/tools/llvm-readobj/COFFDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFDumper.cpp @@ -1058,10 +1058,19 @@ void COFFDumper::printSymbol(symbol_iterator SymI) { if (error(getSymbolAuxData(Obj, Symbol + I, Aux))) break; + const coff_symbol *ReferredSym; + StringRef ReferredName; + error_code EC; + if ((EC = Obj->getSymbol(Aux->SymbolTableIndex, ReferredSym)) || + (EC = Obj->getSymbolName(ReferredSym, ReferredName))) { + ReferredName = ""; + error(EC); + } + DictScope AS(W, "AuxCLRToken"); W.printNumber("AuxType", Aux->AuxType); W.printNumber("Reserved", Aux->Reserved); - W.printNumber("SymbolTableIndex", Aux->SymbolTableIndex); + W.printNumber("SymbolTableIndex", ReferredName, Aux->SymbolTableIndex); W.printBinary("Unused", Aux->Unused); } else {