summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2013-11-01 00:00:07 +0000
committerKevin Enderby <enderby@apple.com>2013-11-01 00:00:07 +0000
commit6f45b1f0d689d2cafd3a64be9b548bb8bb0927b0 (patch)
tree00296ccb43a02510ab31031028d2bc0dc28a82d1 /include
parent36fd930ca4e4cda7286c3e1eb189397a0575a128 (diff)
downloadllvm-6f45b1f0d689d2cafd3a64be9b548bb8bb0927b0.tar.gz
llvm-6f45b1f0d689d2cafd3a64be9b548bb8bb0927b0.tar.bz2
llvm-6f45b1f0d689d2cafd3a64be9b548bb8bb0927b0.tar.xz
Add to the disassembler C API output reference types for
Objective-C data structures. This is allows tools such as darwin's otool(1) that uses the LLVM disassembler take a pointer value being loaded by an instruction and add a comment to what it is being referenced to make following disassembly of Objective-C programs more readable. For example disassembling the Mac OS X TextEdit app one will see comments like the following: movq 0x20684(%rip), %rsi ## Objc selector ref: standardUserDefaults movq 0x21985(%rip), %rdi ## Objc class ref: _OBJC_CLASS_$_NSUserDefaults movq 0x1d156(%rip), %r14 ## Objc message: +[NSUserDefaults standardUserDefaults] leaq 0x23615(%rip), %rdx ## Objc cfstring ref: @"SelectLinePanel" callq 0x10001386c ## Objc message: -[[%rdi super] initWithWindowNibName:] These diffs also include putting quotes around C strings in literal pools and uses "symbol address" in the comment when adding a symbol name to the comment to tell these types of references apart: leaq 0x4f(%rip), %rax ## literal pool for: "Hello world" movq 0x1c3ea(%rip), %rax ## literal pool symbol address: ___stack_chk_guard Of course the easy changes are in the LLVM disassembler and the hard work is up to the implementer of the SymbolLookUp() call back. rdar://10602439 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Disassembler.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm-c/Disassembler.h b/include/llvm-c/Disassembler.h
index 5e0b6183bb..79bcfcdab9 100644
--- a/include/llvm-c/Disassembler.h
+++ b/include/llvm-c/Disassembler.h
@@ -130,6 +130,17 @@ typedef const char *(*LLVMSymbolLookupCallback)(void *DisInfo,
/* The output reference is to a cstring address in a literal pool. */
#define LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr 3
+/* The output reference is to a Objective-C CoreFoundation string. */
+#define LLVMDisassembler_ReferenceType_Out_Objc_CFString_Ref 4
+/* The output reference is to a Objective-C message. */
+#define LLVMDisassembler_ReferenceType_Out_Objc_Message 5
+/* The output reference is to a Objective-C message ref. */
+#define LLVMDisassembler_ReferenceType_Out_Objc_Message_Ref 6
+/* The output reference is to a Objective-C selector ref. */
+#define LLVMDisassembler_ReferenceType_Out_Objc_Selector_Ref 7
+/* The output reference is to a Objective-C class ref. */
+#define LLVMDisassembler_ReferenceType_Out_Objc_Class_Ref 8
+
#ifdef __cplusplus
extern "C" {
#endif /* !defined(__cplusplus) */