[llvm] r198637 - For the 'C' disassembler API, add a new ReferenceType for the
Reid Kleckner
rnk at google.com
Thu Jan 16 09:32:29 PST 2014
Thanks!
On Mon, Jan 6, 2014 at 2:08 PM, Kevin Enderby <enderby at apple.com> wrote:
> Author: enderby
> Date: Mon Jan 6 16:08:08 2014
> New Revision: 198637
>
> URL: http://llvm.org/viewvc/llvm-project?rev=198637&view=rev
> Log:
> For the 'C' disassembler API, add a new ReferenceType for the
> SymbolLookUp() call back to return a demangled C++ name to
> be used as a comment.
>
> For example darwin's otool(1) program the uses the llvm
> disassembler now can produce disassembly like:
>
> callq __ZNK4llvm6Target20createMCDisassemblerERKNS_15MCSubtargetInfoE ##
> llvm::Target::createMCDisassembler(llvm::MCSubtargetInfo const&) const
>
> Also fix a bug in LLVMDisasmInstruction() that was not flushing
> the raw_svector_ostream for the disassembled instruction string
> before copying it to the output buffer that was causing truncation
> of the output.
>
> rdar://10173828
>
> Modified:
> llvm/trunk/include/llvm-c/Disassembler.h
> llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp
> llvm/trunk/lib/MC/MCExternalSymbolizer.cpp
>
> Modified: llvm/trunk/include/llvm-c/Disassembler.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Disassembler.h?rev=198637&r1=198636&r2=198637&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm-c/Disassembler.h (original)
> +++ llvm/trunk/include/llvm-c/Disassembler.h Mon Jan 6 16:08:08 2014
> @@ -141,6 +141,9 @@ typedef const char *(*LLVMSymbolLookupCa
> /* The output reference is to a Objective-C class ref. */
> #define LLVMDisassembler_ReferenceType_Out_Objc_Class_Ref 8
>
> +/* The output reference is to a C++ symbol name. */
> +#define LLVMDisassembler_ReferenceType_DeMangled_Name 9
> +
> #ifdef __cplusplus
> extern "C" {
> #endif /* !defined(__cplusplus) */
>
> Modified: llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp?rev=198637&r1=198636&r2=198637&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp (original)
> +++ llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp Mon Jan 6 16:08:08
> 2014
> @@ -298,6 +298,7 @@ size_t LLVMDisasmInstruction(LLVMDisasmC
> emitLatency(DC, Inst);
>
> emitComments(DC, FormattedOS);
> + OS.flush();
>
> assert(OutStringSize != 0 && "Output buffer cannot be zero size");
> size_t OutputSize = std::min(OutStringSize-1, InsnStr.size());
>
> Modified: llvm/trunk/lib/MC/MCExternalSymbolizer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExternalSymbolizer.cpp?rev=198637&r1=198636&r2=198637&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCExternalSymbolizer.cpp (original)
> +++ llvm/trunk/lib/MC/MCExternalSymbolizer.cpp Mon Jan 6 16:08:08 2014
> @@ -56,6 +56,9 @@ bool MCExternalSymbolizer::tryAddingSymb
> if (Name) {
> SymbolicOp.AddSymbol.Name = Name;
> SymbolicOp.AddSymbol.Present = true;
> + // If Name is a C++ symbol name put the human readable name in a
> comment.
> + if(ReferenceType == LLVMDisassembler_ReferenceType_DeMangled_Name)
> + cStream << ReferenceName;
> }
> // For branches always create an MCExpr so it gets printed as hex
> address.
> else if (IsBranch) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140116/2476c4be/attachment.html>
More information about the llvm-commits
mailing list