[Lldb-commits] [lldb] r280751 - *** This commit represents a complete reformatting of the LLDB source code
Kate Stone via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 6 13:58:36 PDT 2016
Modified: lldb/trunk/examples/python/x86_64_target_definition.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/x86_64_target_definition.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/python/x86_64_target_definition.py (original)
+++ lldb/trunk/examples/python/x86_64_target_definition.py Tue Sep 6 15:57:50 2016
@@ -13,27 +13,27 @@
#
# This file can be used with the following setting:
# plugin.process.gdb-remote.target-definition-file
-# This setting should be used when you are trying to connect to a
+# This setting should be used when you are trying to connect to a
# remote GDB server that doesn't support any of the register discovery
-# packets that LLDB normally uses.
+# packets that LLDB normally uses.
#
# Why is this necessary? LLDB doesn't require a new build of LLDB that
# targets each new architecture you will debug with. Instead, all
-# architectures are supported and LLDB relies on extra GDB server
+# architectures are supported and LLDB relies on extra GDB server
# packets to discover the target we are connecting to so that is can
# show the right registers for each target. This allows the GDB server
# to change and add new registers without requiring a new LLDB build
# just so we can see new registers.
#
# This file implements the x86_64 registers for the darwin version of
-# GDB and allows you to connect to servers that use this register set.
-#
+# GDB and allows you to connect to servers that use this register set.
+#
# USAGE
#
# (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/x86_64_target_definition.py
# (lldb) gdb-remote other.baz.com:1234
#
-# The target definition file will get used if and only if the
+# The target definition file will get used if and only if the
# qRegisterInfo packets are not supported when connecting to a remote
# GDB server.
#----------------------------------------------------------------------
@@ -41,317 +41,738 @@ from lldb import *
# Compiler and DWARF register numbers
name_to_gcc_dwarf_regnum = {
- 'rax' : 0 ,
- 'rdx' : 1 ,
- 'rcx' : 2 ,
- 'rbx' : 3 ,
- 'rsi' : 4 ,
- 'rdi' : 5 ,
- 'rbp' : 6 ,
- 'rsp' : 7 ,
- 'r8' : 8 ,
- 'r9' : 9 ,
- 'r10' : 10,
- 'r11' : 11,
- 'r12' : 12,
- 'r13' : 13,
- 'r14' : 14,
- 'r15' : 15,
- 'rip' : 16,
- 'xmm0' : 17,
- 'xmm1' : 18,
- 'xmm2' : 19,
- 'xmm3' : 20,
- 'xmm4' : 21,
- 'xmm5' : 22,
- 'xmm6' : 23,
- 'xmm7' : 24,
- 'xmm8' : 25,
- 'xmm9' : 26,
- 'xmm10' : 27,
- 'xmm11' : 28,
- 'xmm12' : 29,
- 'xmm13' : 30,
- 'xmm14' : 31,
- 'xmm15' : 32,
- 'stmm0' : 33,
- 'stmm1' : 34,
- 'stmm2' : 35,
- 'stmm3' : 36,
- 'stmm4' : 37,
- 'stmm5' : 38,
- 'stmm6' : 39,
- 'stmm7' : 30,
- 'ymm0' : 41,
- 'ymm1' : 42,
- 'ymm2' : 43,
- 'ymm3' : 44,
- 'ymm4' : 45,
- 'ymm5' : 46,
- 'ymm6' : 47,
- 'ymm7' : 48,
- 'ymm8' : 49,
- 'ymm9' : 40,
- 'ymm10' : 41,
- 'ymm11' : 42,
- 'ymm12' : 43,
- 'ymm13' : 44,
- 'ymm14' : 45,
- 'ymm15' : 46
-};
+ 'rax': 0,
+ 'rdx': 1,
+ 'rcx': 2,
+ 'rbx': 3,
+ 'rsi': 4,
+ 'rdi': 5,
+ 'rbp': 6,
+ 'rsp': 7,
+ 'r8': 8,
+ 'r9': 9,
+ 'r10': 10,
+ 'r11': 11,
+ 'r12': 12,
+ 'r13': 13,
+ 'r14': 14,
+ 'r15': 15,
+ 'rip': 16,
+ 'xmm0': 17,
+ 'xmm1': 18,
+ 'xmm2': 19,
+ 'xmm3': 20,
+ 'xmm4': 21,
+ 'xmm5': 22,
+ 'xmm6': 23,
+ 'xmm7': 24,
+ 'xmm8': 25,
+ 'xmm9': 26,
+ 'xmm10': 27,
+ 'xmm11': 28,
+ 'xmm12': 29,
+ 'xmm13': 30,
+ 'xmm14': 31,
+ 'xmm15': 32,
+ 'stmm0': 33,
+ 'stmm1': 34,
+ 'stmm2': 35,
+ 'stmm3': 36,
+ 'stmm4': 37,
+ 'stmm5': 38,
+ 'stmm6': 39,
+ 'stmm7': 30,
+ 'ymm0': 41,
+ 'ymm1': 42,
+ 'ymm2': 43,
+ 'ymm3': 44,
+ 'ymm4': 45,
+ 'ymm5': 46,
+ 'ymm6': 47,
+ 'ymm7': 48,
+ 'ymm8': 49,
+ 'ymm9': 40,
+ 'ymm10': 41,
+ 'ymm11': 42,
+ 'ymm12': 43,
+ 'ymm13': 44,
+ 'ymm14': 45,
+ 'ymm15': 46
+}
name_to_gdb_regnum = {
- 'rax' : 0,
- 'rbx' : 1,
- 'rcx' : 2,
- 'rdx' : 3,
- 'rsi' : 4,
- 'rdi' : 5,
- 'rbp' : 6,
- 'rsp' : 7,
- 'r8' : 8,
- 'r9' : 9,
- 'r10' : 10,
- 'r11' : 11,
- 'r12' : 12,
- 'r13' : 13,
- 'r14' : 14,
- 'r15' : 15,
- 'rip' : 16,
- 'rflags': 17,
- 'cs' : 18,
- 'ss' : 19,
- 'ds' : 20,
- 'es' : 21,
- 'fs' : 22,
- 'gs' : 23,
- 'stmm0' : 24,
- 'stmm1' : 25,
- 'stmm2' : 26,
- 'stmm3' : 27,
- 'stmm4' : 28,
- 'stmm5' : 29,
- 'stmm6' : 30,
- 'stmm7' : 31,
- 'fctrl' : 32,
- 'fstat' : 33,
- 'ftag' : 34,
- 'fiseg' : 35,
- 'fioff' : 36,
- 'foseg' : 37,
- 'fooff' : 38,
- 'fop' : 39,
- 'xmm0' : 40,
- 'xmm1' : 41,
- 'xmm2' : 42,
- 'xmm3' : 43,
- 'xmm4' : 44,
- 'xmm5' : 45,
- 'xmm6' : 46,
- 'xmm7' : 47,
- 'xmm8' : 48,
- 'xmm9' : 49,
- 'xmm10' : 50,
- 'xmm11' : 51,
- 'xmm12' : 52,
- 'xmm13' : 53,
- 'xmm14' : 54,
- 'xmm15' : 55,
- 'mxcsr' : 56,
- 'ymm0' : 57,
- 'ymm1' : 58,
- 'ymm2' : 59,
- 'ymm3' : 60,
- 'ymm4' : 61,
- 'ymm5' : 62,
- 'ymm6' : 63,
- 'ymm7' : 64,
- 'ymm8' : 65,
- 'ymm9' : 66,
- 'ymm10' : 67,
- 'ymm11' : 68,
- 'ymm12' : 69,
- 'ymm13' : 70,
- 'ymm14' : 71,
- 'ymm15' : 72
-};
+ 'rax': 0,
+ 'rbx': 1,
+ 'rcx': 2,
+ 'rdx': 3,
+ 'rsi': 4,
+ 'rdi': 5,
+ 'rbp': 6,
+ 'rsp': 7,
+ 'r8': 8,
+ 'r9': 9,
+ 'r10': 10,
+ 'r11': 11,
+ 'r12': 12,
+ 'r13': 13,
+ 'r14': 14,
+ 'r15': 15,
+ 'rip': 16,
+ 'rflags': 17,
+ 'cs': 18,
+ 'ss': 19,
+ 'ds': 20,
+ 'es': 21,
+ 'fs': 22,
+ 'gs': 23,
+ 'stmm0': 24,
+ 'stmm1': 25,
+ 'stmm2': 26,
+ 'stmm3': 27,
+ 'stmm4': 28,
+ 'stmm5': 29,
+ 'stmm6': 30,
+ 'stmm7': 31,
+ 'fctrl': 32,
+ 'fstat': 33,
+ 'ftag': 34,
+ 'fiseg': 35,
+ 'fioff': 36,
+ 'foseg': 37,
+ 'fooff': 38,
+ 'fop': 39,
+ 'xmm0': 40,
+ 'xmm1': 41,
+ 'xmm2': 42,
+ 'xmm3': 43,
+ 'xmm4': 44,
+ 'xmm5': 45,
+ 'xmm6': 46,
+ 'xmm7': 47,
+ 'xmm8': 48,
+ 'xmm9': 49,
+ 'xmm10': 50,
+ 'xmm11': 51,
+ 'xmm12': 52,
+ 'xmm13': 53,
+ 'xmm14': 54,
+ 'xmm15': 55,
+ 'mxcsr': 56,
+ 'ymm0': 57,
+ 'ymm1': 58,
+ 'ymm2': 59,
+ 'ymm3': 60,
+ 'ymm4': 61,
+ 'ymm5': 62,
+ 'ymm6': 63,
+ 'ymm7': 64,
+ 'ymm8': 65,
+ 'ymm9': 66,
+ 'ymm10': 67,
+ 'ymm11': 68,
+ 'ymm12': 69,
+ 'ymm13': 70,
+ 'ymm14': 71,
+ 'ymm15': 72
+}
name_to_generic_regnum = {
- 'rip' : LLDB_REGNUM_GENERIC_PC,
- 'rsp' : LLDB_REGNUM_GENERIC_SP,
- 'rbp' : LLDB_REGNUM_GENERIC_FP,
- 'rdi' : LLDB_REGNUM_GENERIC_ARG1,
- 'rsi' : LLDB_REGNUM_GENERIC_ARG2,
- 'rdx' : LLDB_REGNUM_GENERIC_ARG3,
- 'rcx' : LLDB_REGNUM_GENERIC_ARG4,
- 'r8' : LLDB_REGNUM_GENERIC_ARG5,
- 'r9' : LLDB_REGNUM_GENERIC_ARG6
-};
+ 'rip': LLDB_REGNUM_GENERIC_PC,
+ 'rsp': LLDB_REGNUM_GENERIC_SP,
+ 'rbp': LLDB_REGNUM_GENERIC_FP,
+ 'rdi': LLDB_REGNUM_GENERIC_ARG1,
+ 'rsi': LLDB_REGNUM_GENERIC_ARG2,
+ 'rdx': LLDB_REGNUM_GENERIC_ARG3,
+ 'rcx': LLDB_REGNUM_GENERIC_ARG4,
+ 'r8': LLDB_REGNUM_GENERIC_ARG5,
+ 'r9': LLDB_REGNUM_GENERIC_ARG6
+}
-def get_reg_num (reg_num_dict, reg_name):
+def get_reg_num(reg_num_dict, reg_name):
if reg_name in reg_num_dict:
return reg_num_dict[reg_name]
return LLDB_INVALID_REGNUM
-def get_reg_num (reg_num_dict, reg_name):
+
+def get_reg_num(reg_num_dict, reg_name):
if reg_name in reg_num_dict:
return reg_num_dict[reg_name]
return LLDB_INVALID_REGNUM
-
+
x86_64_register_infos = [
-{ 'name':'rax' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'rbx' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'rcx' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'arg4' },
-{ 'name':'rdx' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'arg3' },
-{ 'name':'rsi' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'arg2' },
-{ 'name':'rdi' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'arg1' },
-{ 'name':'rbp' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'fp' },
-{ 'name':'rsp' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'sp' },
-{ 'name':'r8' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'arg5' },
-{ 'name':'r9' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'arg6' },
-{ 'name':'r10' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'r11' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'r12' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'r13' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'r14' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'r15' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo },
-{ 'name':'rip' , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint , 'format':eFormatAddressInfo, 'alt-name':'pc' },
-{ 'name':'rflags', 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'cs' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'ss' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'ds' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'es' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'fs' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'gs' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'stmm0' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'stmm1' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'stmm2' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'stmm3' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'stmm4' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'stmm5' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'stmm6' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'stmm7' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'fctrl' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'fstat' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'ftag' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'fiseg' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'fioff' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'foseg' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'fooff' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'fop' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-{ 'name':'xmm0' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm1' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm2' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm3' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm4' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm5' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm6' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm7' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm8' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm9' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm10' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm11' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm12' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm13' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm14' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'xmm15' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
-{ 'name':'mxcsr' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex },
-# Registers that are contained in or composed of one of more other registers
-{ 'name':'eax' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rax[31:0]' },
-{ 'name':'ebx' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rbx[31:0]' },
-{ 'name':'ecx' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rcx[31:0]' },
-{ 'name':'edx' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rdx[31:0]' },
-{ 'name':'edi' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rdi[31:0]' },
-{ 'name':'esi' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rsi[31:0]' },
-{ 'name':'ebp' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rbp[31:0]' },
-{ 'name':'esp' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rsp[31:0]' },
-{ 'name':'r8d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r8[31:0]' },
-{ 'name':'r9d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r9[31:0]' },
-{ 'name':'r10d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r10[31:0]' },
-{ 'name':'r11d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r11[31:0]' },
-{ 'name':'r12d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r12[31:0]' },
-{ 'name':'r13d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r13[31:0]' },
-{ 'name':'r14d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r14[31:0]' },
-{ 'name':'r15d' , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r15[31:0]' },
-
-{ 'name':'ax' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rax[15:0]' },
-{ 'name':'bx' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rbx[15:0]' },
-{ 'name':'cx' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rcx[15:0]' },
-{ 'name':'dx' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rdx[15:0]' },
-{ 'name':'di' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rdi[15:0]' },
-{ 'name':'si' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rsi[15:0]' },
-{ 'name':'bp' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rbp[15:0]' },
-{ 'name':'sp' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rsp[15:0]' },
-{ 'name':'r8w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r8[15:0]' },
-{ 'name':'r9w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r9[15:0]' },
-{ 'name':'r10w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r10[15:0]' },
-{ 'name':'r11w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r11[15:0]' },
-{ 'name':'r12w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r12[15:0]' },
-{ 'name':'r13w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r13[15:0]' },
-{ 'name':'r14w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r14[15:0]' },
-{ 'name':'r15w' , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r15[15:0]' },
-
-{ 'name':'ah' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rax[15:8]' },
-{ 'name':'bh' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rbx[15:8]' },
-{ 'name':'ch' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rcx[15:8]' },
-{ 'name':'dh' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rdx[15:8]' },
-
-{ 'name':'al' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rax[7:0]' },
-{ 'name':'bl' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rbx[7:0]' },
-{ 'name':'cl' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rcx[7:0]' },
-{ 'name':'dl' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rdx[7:0]' },
-{ 'name':'dil' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rdi[7:0]' },
-{ 'name':'sil' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rsi[7:0]' },
-{ 'name':'bpl' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rbp[7:0]' },
-{ 'name':'spl' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'rsp[7:0]' },
-{ 'name':'r8l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r8[7:0]' },
-{ 'name':'r9l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r9[7:0]' },
-{ 'name':'r10l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r10[7:0]' },
-{ 'name':'r11l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r11[7:0]' },
-{ 'name':'r12l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r12[7:0]' },
-{ 'name':'r13l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r13[7:0]' },
-{ 'name':'r14l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r14[7:0]' },
-{ 'name':'r15l' , 'set':0, 'bitsize':8 , 'encoding':eEncodingUint , 'format':eFormatHex , 'slice': 'r15[7:0]' },
-];
+ {'name': 'rax',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'rbx',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'rcx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'arg4'},
+ {'name': 'rdx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'arg3'},
+ {'name': 'rsi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'arg2'},
+ {'name': 'rdi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'arg1'},
+ {'name': 'rbp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'fp'},
+ {'name': 'rsp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'sp'},
+ {'name': 'r8', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'arg5'},
+ {'name': 'r9', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'arg6'},
+ {'name': 'r10',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'r11',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'r12',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'r13',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'r14',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'r15',
+ 'set': 0,
+ 'bitsize': 64,
+ 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo},
+ {'name': 'rip', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
+ 'format': eFormatAddressInfo, 'alt-name': 'pc'},
+ {'name': 'rflags', 'set': 0, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'cs', 'set': 0, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'ss', 'set': 0, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'ds', 'set': 0, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'es', 'set': 0, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'fs', 'set': 0, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'gs', 'set': 0, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'stmm0',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'stmm1',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'stmm2',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'stmm3',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'stmm4',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'stmm5',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'stmm6',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'stmm7',
+ 'set': 1,
+ 'bitsize': 80,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'fctrl', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'fstat', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'ftag', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'fiseg', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'fioff', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'foseg', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'fooff', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'fop', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ {'name': 'xmm0',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm1',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm2',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm3',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm4',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm5',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm6',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm7',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm8',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm9',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm10',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm11',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm12',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm13',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm14',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'xmm15',
+ 'set': 1,
+ 'bitsize': 128,
+ 'encoding': eEncodingVector,
+ 'format': eFormatVectorOfUInt8},
+ {'name': 'mxcsr', 'set': 1, 'bitsize': 32,
+ 'encoding': eEncodingUint, 'format': eFormatHex},
+ # Registers that are contained in or composed of one of more other
+ # registers
+ {'name': 'eax',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rax[31:0]'},
+ {'name': 'ebx',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rbx[31:0]'},
+ {'name': 'ecx',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rcx[31:0]'},
+ {'name': 'edx',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rdx[31:0]'},
+ {'name': 'edi',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rdi[31:0]'},
+ {'name': 'esi',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rsi[31:0]'},
+ {'name': 'ebp',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rbp[31:0]'},
+ {'name': 'esp',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rsp[31:0]'},
+ {'name': 'r8d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r8[31:0]'},
+ {'name': 'r9d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r9[31:0]'},
+ {'name': 'r10d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r10[31:0]'},
+ {'name': 'r11d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r11[31:0]'},
+ {'name': 'r12d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r12[31:0]'},
+ {'name': 'r13d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r13[31:0]'},
+ {'name': 'r14d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r14[31:0]'},
+ {'name': 'r15d',
+ 'set': 0,
+ 'bitsize': 32,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r15[31:0]'},
+
+ {'name': 'ax',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rax[15:0]'},
+ {'name': 'bx',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rbx[15:0]'},
+ {'name': 'cx',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rcx[15:0]'},
+ {'name': 'dx',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rdx[15:0]'},
+ {'name': 'di',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rdi[15:0]'},
+ {'name': 'si',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rsi[15:0]'},
+ {'name': 'bp',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rbp[15:0]'},
+ {'name': 'sp',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rsp[15:0]'},
+ {'name': 'r8w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r8[15:0]'},
+ {'name': 'r9w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r9[15:0]'},
+ {'name': 'r10w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r10[15:0]'},
+ {'name': 'r11w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r11[15:0]'},
+ {'name': 'r12w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r12[15:0]'},
+ {'name': 'r13w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r13[15:0]'},
+ {'name': 'r14w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r14[15:0]'},
+ {'name': 'r15w',
+ 'set': 0,
+ 'bitsize': 16,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r15[15:0]'},
+
+ {'name': 'ah',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rax[15:8]'},
+ {'name': 'bh',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rbx[15:8]'},
+ {'name': 'ch',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rcx[15:8]'},
+ {'name': 'dh',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rdx[15:8]'},
+
+ {'name': 'al',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rax[7:0]'},
+ {'name': 'bl',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rbx[7:0]'},
+ {'name': 'cl',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rcx[7:0]'},
+ {'name': 'dl',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rdx[7:0]'},
+ {'name': 'dil',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rdi[7:0]'},
+ {'name': 'sil',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rsi[7:0]'},
+ {'name': 'bpl',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rbp[7:0]'},
+ {'name': 'spl',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'rsp[7:0]'},
+ {'name': 'r8l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r8[7:0]'},
+ {'name': 'r9l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r9[7:0]'},
+ {'name': 'r10l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r10[7:0]'},
+ {'name': 'r11l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r11[7:0]'},
+ {'name': 'r12l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r12[7:0]'},
+ {'name': 'r13l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r13[7:0]'},
+ {'name': 'r14l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r14[7:0]'},
+ {'name': 'r15l',
+ 'set': 0,
+ 'bitsize': 8,
+ 'encoding': eEncodingUint,
+ 'format': eFormatHex,
+ 'slice': 'r15[7:0]'},
+]
g_target_definition = None
-def get_target_definition ():
+
+def get_target_definition():
global g_target_definition
- if g_target_definition == None:
+ if g_target_definition is None:
g_target_definition = {}
offset = 0
for reg_info in x86_64_register_infos:
reg_name = reg_info['name']
-
- # Only fill in the offset if there is no 'slice' in the register info
+
+ # Only fill in the offset if there is no 'slice' in the register
+ # info
if 'slice' not in reg_info and 'composite' not in reg_info:
reg_info['offset'] = offset
- offset += reg_info['bitsize']/8
-
- # Set the GCC/DWARF register number for this register if it has one
+ offset += reg_info['bitsize'] / 8
+
+ # Set the GCC/DWARF register number for this register if it has one
reg_num = get_reg_num(name_to_gcc_dwarf_regnum, reg_name)
if reg_num != LLDB_INVALID_REGNUM:
reg_info['gcc'] = reg_num
reg_info['dwarf'] = reg_num
-
- # Set the generic register number for this register if it has one
+
+ # Set the generic register number for this register if it has one
reg_num = get_reg_num(name_to_generic_regnum, reg_name)
if reg_num != LLDB_INVALID_REGNUM:
reg_info['generic'] = reg_num
- # Set the GDB register number for this register if it has one
+ # Set the GDB register number for this register if it has one
reg_num = get_reg_num(name_to_gdb_regnum, reg_name)
if reg_num != LLDB_INVALID_REGNUM:
reg_info['gdb'] = reg_num
- g_target_definition['sets'] = ['General Purpose Registers', 'Floating Point Registers']
+ g_target_definition['sets'] = [
+ 'General Purpose Registers',
+ 'Floating Point Registers']
g_target_definition['registers'] = x86_64_register_infos
- g_target_definition['host-info'] = { 'triple' : 'x86_64-apple-macosx', 'endian': eByteOrderLittle }
+ g_target_definition[
+ 'host-info'] = {'triple': 'x86_64-apple-macosx', 'endian': eByteOrderLittle}
g_target_definition['g-packet-size'] = offset
return g_target_definition
+
def get_dynamic_setting(target, setting_name):
if setting_name == 'gdb-server-target-definition':
- return get_target_definition()
\ No newline at end of file
+ return get_target_definition()
Modified: lldb/trunk/examples/scripting/dictionary.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/scripting/dictionary.c?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/scripting/dictionary.c (original)
+++ lldb/trunk/examples/scripting/dictionary.c Tue Sep 6 15:57:50 2016
@@ -6,13 +6,12 @@
// License. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-#include <stdlib.h>
-#include <stdio.h>
#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-typedef struct tree_node
-{
+typedef struct tree_node {
const char *word;
struct tree_node *left;
struct tree_node *right;
@@ -22,22 +21,20 @@ typedef struct tree_node
alphabet character and ends at the last alphabet character, i.e. it
strips off beginning or ending quotes, punctuation, etc. */
-char *
-strip (char **word)
-{
+char *strip(char **word) {
char *start = *word;
- int len = strlen (start);
+ int len = strlen(start);
char *end = start + len - 1;
- while ((start < end) && (!isalpha (start[0])))
+ while ((start < end) && (!isalpha(start[0])))
start++;
- while ((end > start) && (!isalpha (end[0])))
+ while ((end > start) && (!isalpha(end[0])))
end--;
if (start > end)
return NULL;
-
+
end[1] = '\0';
*word = start;
@@ -48,116 +45,95 @@ strip (char **word)
each node), and a new word, inserts the word at the appropriate
place in the tree. */
-void
-insert (tree_node *root, char *word)
-{
+void insert(tree_node *root, char *word) {
if (root == NULL)
return;
- int compare_value = strcmp (word, root->word);
+ int compare_value = strcmp(word, root->word);
if (compare_value == 0)
return;
- if (compare_value < 0)
- {
- if (root->left != NULL)
- insert (root->left, word);
- else
- {
- tree_node *new_node = (tree_node *) malloc (sizeof (tree_node));
- new_node->word = strdup (word);
- new_node->left = NULL;
- new_node->right = NULL;
- root->left = new_node;
- }
+ if (compare_value < 0) {
+ if (root->left != NULL)
+ insert(root->left, word);
+ else {
+ tree_node *new_node = (tree_node *)malloc(sizeof(tree_node));
+ new_node->word = strdup(word);
+ new_node->left = NULL;
+ new_node->right = NULL;
+ root->left = new_node;
}
- else
- {
- if (root->right != NULL)
- insert (root->right, word);
- else
- {
- tree_node *new_node = (tree_node *) malloc (sizeof (tree_node));
- new_node->word = strdup (word);
- new_node->left = NULL;
- new_node->right = NULL;
- root->right = new_node;
- }
+ } else {
+ if (root->right != NULL)
+ insert(root->right, word);
+ else {
+ tree_node *new_node = (tree_node *)malloc(sizeof(tree_node));
+ new_node->word = strdup(word);
+ new_node->left = NULL;
+ new_node->right = NULL;
+ root->right = new_node;
}
+ }
}
/* Read in a text file and storea all the words from the file in a
binary search tree. */
-void
-populate_dictionary (tree_node **dictionary, char *filename)
-{
+void populate_dictionary(tree_node **dictionary, char *filename) {
FILE *in_file;
char word[1024];
- in_file = fopen (filename, "r");
- if (in_file)
- {
- while (fscanf (in_file, "%s", word) == 1)
- {
- char *new_word = (strdup (word));
- new_word = strip (&new_word);
- if (*dictionary == NULL)
- {
- tree_node *new_node = (tree_node *) malloc (sizeof (tree_node));
- new_node->word = new_word;
- new_node->left = NULL;
- new_node->right = NULL;
- *dictionary = new_node;
- }
- else
- insert (*dictionary, new_word);
- }
+ in_file = fopen(filename, "r");
+ if (in_file) {
+ while (fscanf(in_file, "%s", word) == 1) {
+ char *new_word = (strdup(word));
+ new_word = strip(&new_word);
+ if (*dictionary == NULL) {
+ tree_node *new_node = (tree_node *)malloc(sizeof(tree_node));
+ new_node->word = new_word;
+ new_node->left = NULL;
+ new_node->right = NULL;
+ *dictionary = new_node;
+ } else
+ insert(*dictionary, new_word);
}
+ }
}
/* Given a binary search tree and a word, search for the word
in the binary search tree. */
-int
-find_word (tree_node *dictionary, char *word)
-{
+int find_word(tree_node *dictionary, char *word) {
if (!word || !dictionary)
return 0;
- int compare_value = strcmp (word, dictionary->word);
+ int compare_value = strcmp(word, dictionary->word);
if (compare_value == 0)
return 1;
else if (compare_value < 0)
- return find_word (dictionary->left, word);
+ return find_word(dictionary->left, word);
else
- return find_word (dictionary->right, word);
+ return find_word(dictionary->right, word);
}
/* Print out the words in the binary search tree, in sorted order. */
-void
-print_tree (tree_node *dictionary)
-{
+void print_tree(tree_node *dictionary) {
if (!dictionary)
return;
if (dictionary->left)
- print_tree (dictionary->left);
-
- printf ("%s\n", dictionary->word);
+ print_tree(dictionary->left);
+ printf("%s\n", dictionary->word);
if (dictionary->right)
- print_tree (dictionary->right);
+ print_tree(dictionary->right);
}
-
-int
-main (int argc, char **argv)
-{
+int main(int argc, char **argv) {
tree_node *dictionary = NULL;
char buffer[1024];
char *filename;
@@ -169,32 +145,29 @@ main (int argc, char **argv)
if (!filename)
return -1;
- populate_dictionary (&dictionary, filename);
- fprintf (stdout, "Dictionary loaded.\nEnter search word: ");
- while (!done && fgets (buffer, sizeof(buffer), stdin))
- {
- char *word = buffer;
- int len = strlen (word);
- int i;
-
- for (i = 0; i < len; ++i)
- word[i] = tolower (word[i]);
-
- if ((len > 0) && (word[len-1] == '\n'))
- {
- word[len-1] = '\0';
- len = len - 1;
- }
-
- if (find_word (dictionary, word))
- fprintf (stdout, "Yes!\n");
- else
- fprintf (stdout, "No!\n");
-
- fprintf (stdout, "Enter search word: ");
+ populate_dictionary(&dictionary, filename);
+ fprintf(stdout, "Dictionary loaded.\nEnter search word: ");
+ while (!done && fgets(buffer, sizeof(buffer), stdin)) {
+ char *word = buffer;
+ int len = strlen(word);
+ int i;
+
+ for (i = 0; i < len; ++i)
+ word[i] = tolower(word[i]);
+
+ if ((len > 0) && (word[len - 1] == '\n')) {
+ word[len - 1] = '\0';
+ len = len - 1;
}
-
- fprintf (stdout, "\n");
+
+ if (find_word(dictionary, word))
+ fprintf(stdout, "Yes!\n");
+ else
+ fprintf(stdout, "No!\n");
+
+ fprintf(stdout, "Enter search word: ");
+ }
+
+ fprintf(stdout, "\n");
return 0;
}
-
Modified: lldb/trunk/examples/scripting/tree_utils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/scripting/tree_utils.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/scripting/tree_utils.py (original)
+++ lldb/trunk/examples/scripting/tree_utils.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,4 @@
-"""
+"""
# ===-- tree_utils.py ---------------------------------------*- Python -*-===//
#
# The LLVM Compiler Infrastructure
@@ -9,7 +9,7 @@
# ===---------------------------------------------------------------------===//
tree_utils.py - A set of functions for examining binary
-search trees, based on the example search tree defined in
+search trees, based on the example search tree defined in
dictionary.c. These functions contain calls to LLDB API
functions, and assume that the LLDB Python module has been
imported.
@@ -20,7 +20,7 @@ http://lldb.llvm.org/scripting.html
"""
-def DFS (root, word, cur_path):
+def DFS(root, word, cur_path):
"""
Recursively traverse a binary search tree containing
words sorted alphabetically, searching for a particular
@@ -33,21 +33,21 @@ def DFS (root, word, cur_path):
the one defined in dictionary.c It uses LLDB API
functions to examine and traverse the tree nodes.
"""
-
+
# Get pointer field values out of node 'root'
- root_word_ptr = root.GetChildMemberWithName ("word")
- left_child_ptr = root.GetChildMemberWithName ("left")
- right_child_ptr = root.GetChildMemberWithName ("right")
+ root_word_ptr = root.GetChildMemberWithName("word")
+ left_child_ptr = root.GetChildMemberWithName("left")
+ right_child_ptr = root.GetChildMemberWithName("right")
- # Get the word out of the word pointer and strip off
+ # Get the word out of the word pointer and strip off
# surrounding quotes (added by call to GetSummary).
root_word = root_word_ptr.GetSummary()
- end = len (root_word) - 1
+ end = len(root_word) - 1
if root_word[0] == '"' and root_word[end] == '"':
root_word = root_word[1:end]
- end = len (root_word) - 1
+ end = len(root_word) - 1
if root_word[0] == '\'' and root_word[end] == '\'':
root_word = root_word[1:end]
@@ -59,23 +59,23 @@ def DFS (root, word, cur_path):
# Check to see if left child is NULL
- if left_child_ptr.GetValue() == None:
+ if left_child_ptr.GetValue() is None:
return ""
else:
cur_path = cur_path + "L"
- return DFS (left_child_ptr, word, cur_path)
+ return DFS(left_child_ptr, word, cur_path)
else:
# Check to see if right child is NULL
- if right_child_ptr.GetValue() == None:
+ if right_child_ptr.GetValue() is None:
return ""
else:
cur_path = cur_path + "R"
- return DFS (right_child_ptr, word, cur_path)
-
+ return DFS(right_child_ptr, word, cur_path)
+
-def tree_size (root):
+def tree_size(root):
"""
Recursively traverse a binary search tree, counting
the nodes in the tree. Returns the final count.
@@ -84,20 +84,20 @@ def tree_size (root):
the one defined in dictionary.c It uses LLDB API
functions to examine and traverse the tree nodes.
"""
- if (root.GetValue == None):
+ if (root.GetValue is None):
return 0
- if (int (root.GetValue(), 16) == 0):
+ if (int(root.GetValue(), 16) == 0):
return 0
- left_size = tree_size (root.GetChildAtIndex(1));
- right_size = tree_size (root.GetChildAtIndex(2));
+ left_size = tree_size(root.GetChildAtIndex(1))
+ right_size = tree_size(root.GetChildAtIndex(2))
total_size = left_size + right_size + 1
return total_size
-
-def print_tree (root):
+
+def print_tree(root):
"""
Recursively traverse a binary search tree, printing out
the words at the nodes in alphabetical order (the
@@ -107,12 +107,12 @@ def print_tree (root):
the one defined in dictionary.c It uses LLDB API
functions to examine and traverse the tree nodes.
"""
- if (root.GetChildAtIndex(1).GetValue() != None) and (int (root.GetChildAtIndex(1).GetValue(), 16) != 0):
- print_tree (root.GetChildAtIndex(1))
+ if (root.GetChildAtIndex(1).GetValue() is not None) and (
+ int(root.GetChildAtIndex(1).GetValue(), 16) != 0):
+ print_tree(root.GetChildAtIndex(1))
print root.GetChildAtIndex(0).GetSummary()
- if (root.GetChildAtIndex(2).GetValue() != None) and (int (root.GetChildAtIndex(2).GetValue(), 16) != 0):
- print_tree (root.GetChildAtIndex(2))
-
-
+ if (root.GetChildAtIndex(2).GetValue() is not None) and (
+ int(root.GetChildAtIndex(2).GetValue(), 16) != 0):
+ print_tree(root.GetChildAtIndex(2))
Modified: lldb/trunk/examples/summaries/cocoa/CFArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFArray.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFArray.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFArray.py Tue Sep 6 15:57:50 2016
@@ -22,183 +22,212 @@ statistics.add_metric('code_notrun')
# much less functional than the other two cases below
# just runs code to get to the count and then returns
# no children
+
+
class NSArrayKVC_SynthProvider:
- def adjust_for_architecture(self):
- pass
+ def adjust_for_architecture(self):
+ pass
- def __init__(self, valobj, dict, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- num_children_vo = self.valobj.CreateValueFromExpression("count","(int)[" + stream.GetData() + " count]");
- if num_children_vo.IsValid():
- return num_children_vo.GetValueAsUnsigned(0)
- return "<variable is not NSArray>"
+ def __init__(self, valobj, dict, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ num_children_vo = self.valobj.CreateValueFromExpression(
+ "count", "(int)[" + stream.GetData() + " count]")
+ if num_children_vo.IsValid():
+ return num_children_vo.GetValueAsUnsigned(0)
+ return "<variable is not NSArray>"
# much less functional than the other two cases below
# just runs code to get to the count and then returns
# no children
+
+
class NSArrayCF_SynthProvider:
- def adjust_for_architecture(self):
- pass
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, dict, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not (self.sys_params.types_cache.ulong):
+ self.sys_params.types_cache.ulong = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ num_children_vo = self.valobj.CreateChildAtOffset(
+ "count", self.sys_params.cfruntime_size, self.sys_params.types_cache.ulong)
+ return num_children_vo.GetValueAsUnsigned(0)
- def __init__(self, valobj, dict, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not (self.sys_params.types_cache.ulong):
- self.sys_params.types_cache.ulong = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- num_children_vo = self.valobj.CreateChildAtOffset("count",
- self.sys_params.cfruntime_size,
- self.sys_params.types_cache.ulong)
- return num_children_vo.GetValueAsUnsigned(0)
class NSArrayI_SynthProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, dict, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.long):
- self.sys_params.types_cache.long = self.valobj.GetType().GetBasicType(lldb.eBasicTypeLong)
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # skip the isa pointer and get at the size
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- count = self.valobj.CreateChildAtOffset("count",
- self.sys_params.pointer_size,
- self.sys_params.types_cache.long);
- return count.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, dict, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.long):
+ self.sys_params.types_cache.long = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeLong)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # skip the isa pointer and get at the size
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ count = self.valobj.CreateChildAtOffset(
+ "count",
+ self.sys_params.pointer_size,
+ self.sys_params.types_cache.long)
+ return count.GetValueAsUnsigned(0)
+
class NSArrayM_SynthProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, dict, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.long):
- self.sys_params.types_cache.long = self.valobj.GetType().GetBasicType(lldb.eBasicTypeLong)
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # skip the isa pointer and get at the size
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- count = self.valobj.CreateChildAtOffset("count",
- self.sys_params.pointer_size,
- self.sys_params.types_cache.long);
- return count.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, dict, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.long):
+ self.sys_params.types_cache.long = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeLong)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # skip the isa pointer and get at the size
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ count = self.valobj.CreateChildAtOffset(
+ "count",
+ self.sys_params.pointer_size,
+ self.sys_params.types_cache.long)
+ return count.GetValueAsUnsigned(0)
# this is the actual synth provider, but is just a wrapper that checks
# whether valobj is an instance of __NSArrayI or __NSArrayM and sets up an
-# appropriate backend layer to do the computations
+# appropriate backend layer to do the computations
+
+
class NSArray_SynthProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, dict):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.adjust_for_architecture()
- self.error = False
- self.wrapper = self.make_wrapper()
- self.invalid = (self.wrapper == None)
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- if self.wrapper == None:
- return 0;
- return self.wrapper.num_children()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- if self.wrapper == None:
- return
- self.wrapper.update()
-
- # this code acts as our defense against NULL and uninitialized
- # NSArray pointers, which makes it much longer than it would be otherwise
- def make_wrapper(self):
- logger = lldb.formatters.Logger.Logger()
- if self.valobj.GetValueAsUnsigned() == 0:
- self.error = True
- return lldb.runtime.objc.objc_runtime.InvalidPointer_Description(True)
- else:
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(self.valobj,statistics)
- if wrapper:
- self.error = True
- return wrapper
-
- name_string = class_data.class_name()
-
- logger >> "Class name is " + str(name_string)
-
- if name_string == '__NSArrayI':
- wrapper = NSArrayI_SynthProvider(self.valobj, dict, class_data.sys_params)
- statistics.metric_hit('code_notrun',self.valobj.GetName())
- elif name_string == '__NSArrayM':
- wrapper = NSArrayM_SynthProvider(self.valobj, dict, class_data.sys_params)
- statistics.metric_hit('code_notrun',self.valobj.GetName())
- elif name_string == '__NSCFArray':
- wrapper = NSArrayCF_SynthProvider(self.valobj, dict, class_data.sys_params)
- statistics.metric_hit('code_notrun',self.valobj.GetName())
- else:
- wrapper = NSArrayKVC_SynthProvider(self.valobj, dict, class_data.sys_params)
- statistics.metric_hit('unknown_class',str(self.valobj.GetName()) + " seen as " + name_string)
- return wrapper;
-
-def CFArray_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = NSArray_SynthProvider(valobj,dict);
- if provider.invalid == False:
- if provider.error == True:
- return provider.wrapper.message()
- try:
- summary = int(provider.num_children());
- except:
- summary = None
- logger >> "provider gave me " + str(summary)
- if summary == None:
- summary = '<variable is not NSArray>'
- elif isinstance(summary,basestring):
- pass
- else:
- # we format it like it were a CFString to make it look the same as the summary from Xcode
- summary = '@"' + str(summary) + (" objects" if summary != 1 else " object") + '"'
- return summary
- return 'Summary Unavailable'
+ def adjust_for_architecture(self):
+ pass
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F CFArray.CFArray_SummaryProvider NSArray CFArrayRef CFMutableArrayRef")
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.adjust_for_architecture()
+ self.error = False
+ self.wrapper = self.make_wrapper()
+ self.invalid = (self.wrapper is None)
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.wrapper is None:
+ return 0
+ return self.wrapper.num_children()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.wrapper is None:
+ return
+ self.wrapper.update()
+
+ # this code acts as our defense against NULL and uninitialized
+ # NSArray pointers, which makes it much longer than it would be otherwise
+ def make_wrapper(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.valobj.GetValueAsUnsigned() == 0:
+ self.error = True
+ return lldb.runtime.objc.objc_runtime.InvalidPointer_Description(
+ True)
+ else:
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ self.valobj, statistics)
+ if wrapper:
+ self.error = True
+ return wrapper
+
+ name_string = class_data.class_name()
+
+ logger >> "Class name is " + str(name_string)
+
+ if name_string == '__NSArrayI':
+ wrapper = NSArrayI_SynthProvider(
+ self.valobj, dict, class_data.sys_params)
+ statistics.metric_hit('code_notrun', self.valobj.GetName())
+ elif name_string == '__NSArrayM':
+ wrapper = NSArrayM_SynthProvider(
+ self.valobj, dict, class_data.sys_params)
+ statistics.metric_hit('code_notrun', self.valobj.GetName())
+ elif name_string == '__NSCFArray':
+ wrapper = NSArrayCF_SynthProvider(
+ self.valobj, dict, class_data.sys_params)
+ statistics.metric_hit('code_notrun', self.valobj.GetName())
+ else:
+ wrapper = NSArrayKVC_SynthProvider(
+ self.valobj, dict, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class', str(
+ self.valobj.GetName()) + " seen as " + name_string)
+ return wrapper
+
+
+def CFArray_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = NSArray_SynthProvider(valobj, dict)
+ if not provider.invalid:
+ if provider.error:
+ return provider.wrapper.message()
+ try:
+ summary = int(provider.num_children())
+ except:
+ summary = None
+ logger >> "provider gave me " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSArray>'
+ elif isinstance(summary, basestring):
+ pass
+ else:
+ # we format it like it were a CFString to make it look the same as
+ # the summary from Xcode
+ summary = '@"' + str(summary) + \
+ (" objects" if summary != 1 else " object") + '"'
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F CFArray.CFArray_SummaryProvider NSArray CFArrayRef CFMutableArrayRef")
Modified: lldb/trunk/examples/summaries/cocoa/CFBag.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFBag.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFBag.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFBag.py Tue Sep 6 15:57:50 2016
@@ -22,125 +22,142 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the length for an CFBag, so they need not
# obey the interface specification for synthetic children providers
+
+
class CFBagRef_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # 12 bytes on i386
- # 20 bytes on x64
- # most probably 2 pointers and 4 bytes of data
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- if self.sys_params.is_64_bit:
- return 20
- else:
- return 12
-
- def length(self):
- logger = lldb.formatters.Logger.Logger()
- size = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- return size.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # 12 bytes on i386
+ # 20 bytes on x64
+ # most probably 2 pointers and 4 bytes of data
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.sys_params.is_64_bit:
+ return 20
+ else:
+ return 12
+
+ def length(self):
+ logger = lldb.formatters.Logger.Logger()
+ size = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ return size.GetValueAsUnsigned(0)
class CFBagUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def length(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- num_children_vo = self.valobj.CreateValueFromExpression("count","(int)CFBagGetCount(" + stream.GetData() + " )")
- if num_children_vo.IsValid():
- return num_children_vo.GetValueAsUnsigned(0)
- return "<variable is not CFBag>"
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def length(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ num_children_vo = self.valobj.CreateValueFromExpression(
+ "count", "(int)CFBagGetCount(" + stream.GetData() + " )")
+ if num_children_vo.IsValid():
+ return num_children_vo.GetValueAsUnsigned(0)
+ return "<variable is not CFBag>"
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- actual_name = name_string
-
- logger >> "name string got was " + str(name_string) + " but actual name is " + str(actual_name)
-
- if class_data.is_cftype():
- # CFBag does not expose an actual NSWrapper type, so we have to check that this is
- # an NSCFType and then check we are a pointer-to __CFBag
- valobj_type = valobj.GetType()
- if valobj_type.IsValid() and valobj_type.IsPointerType():
- valobj_type = valobj_type.GetPointeeType()
- if valobj_type.IsValid():
- actual_name = valobj_type.GetName()
- if actual_name == '__CFBag' or \
- actual_name == 'const struct __CFBag':
- wrapper = CFBagRef_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- return wrapper
- wrapper = CFBagUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + actual_name)
- return wrapper;
-
-def CFBag_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.length();
- except:
- summary = None
- logger >> "summary got from provider: " + str(summary)
- # for some reason, one needs to clear some bits for the count
- # to be correct when using CF(Mutable)BagRef on x64
- # the bit mask was derived through experimentation
- # (if counts start looking weird, then most probably
- # the mask needs to be changed)
- if summary == None:
- summary = '<variable is not CFBag>'
- elif isinstance(summary,basestring):
- pass
- else:
- if provider.sys_params.is_64_bit:
- summary = summary & ~0x1fff000000000000
- if summary == 1:
- summary = '@"1 value"'
- else:
- summary = '@"' + str(summary) + ' values"'
- return summary
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F CFBag.CFBag_SummaryProvider CFBagRef CFMutableBagRef")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ actual_name = name_string
+
+ logger >> "name string got was " + \
+ str(name_string) + " but actual name is " + str(actual_name)
+
+ if class_data.is_cftype():
+ # CFBag does not expose an actual NSWrapper type, so we have to check that this is
+ # an NSCFType and then check we are a pointer-to __CFBag
+ valobj_type = valobj.GetType()
+ if valobj_type.IsValid() and valobj_type.IsPointerType():
+ valobj_type = valobj_type.GetPointeeType()
+ if valobj_type.IsValid():
+ actual_name = valobj_type.GetName()
+ if actual_name == '__CFBag' or \
+ actual_name == 'const struct __CFBag':
+ wrapper = CFBagRef_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ return wrapper
+ wrapper = CFBagUnknown_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ actual_name)
+ return wrapper
+
+
+def CFBag_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.length()
+ except:
+ summary = None
+ logger >> "summary got from provider: " + str(summary)
+ # for some reason, one needs to clear some bits for the count
+ # to be correct when using CF(Mutable)BagRef on x64
+ # the bit mask was derived through experimentation
+ # (if counts start looking weird, then most probably
+ # the mask needs to be changed)
+ if summary is None:
+ summary = '<variable is not CFBag>'
+ elif isinstance(summary, basestring):
+ pass
+ else:
+ if provider.sys_params.is_64_bit:
+ summary = summary & ~0x1fff000000000000
+ if summary == 1:
+ summary = '@"1 value"'
+ else:
+ summary = '@"' + str(summary) + ' values"'
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F CFBag.CFBag_SummaryProvider CFBagRef CFMutableBagRef")
Modified: lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFBinaryHeap.py Tue Sep 6 15:57:50 2016
@@ -22,121 +22,140 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the length for an CFBinaryHeap, so they need not
# obey the interface specification for synthetic children providers
+
+
class CFBinaryHeapRef_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # 8 bytes on i386
- # 16 bytes on x64
- # most probably 2 pointers
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return 2 * self.sys_params.pointer_size
-
- def length(self):
- logger = lldb.formatters.Logger.Logger()
- size = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- return size.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # 8 bytes on i386
+ # 16 bytes on x64
+ # most probably 2 pointers
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return 2 * self.sys_params.pointer_size
+
+ def length(self):
+ logger = lldb.formatters.Logger.Logger()
+ size = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ return size.GetValueAsUnsigned(0)
class CFBinaryHeapUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def length(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- num_children_vo = self.valobj.CreateValueFromExpression("count","(int)CFBinaryHeapGetCount(" + stream.GetData() + " )");
- if num_children_vo.IsValid():
- return num_children_vo.GetValueAsUnsigned(0)
- return '<variable is not CFBinaryHeap>'
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def length(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ num_children_vo = self.valobj.CreateValueFromExpression(
+ "count", "(int)CFBinaryHeapGetCount(" + stream.GetData() + " )")
+ if num_children_vo.IsValid():
+ return num_children_vo.GetValueAsUnsigned(0)
+ return '<variable is not CFBinaryHeap>'
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- actual_name = class_data.class_name()
-
- logger >> "name string got was " + str(name_string) + " but actual name is " + str(actual_name)
-
- if class_data.is_cftype():
- # CFBinaryHeap does not expose an actual NSWrapper type, so we have to check that this is
- # an NSCFType and then check we are a pointer-to CFBinaryHeap
- valobj_type = valobj.GetType()
- if valobj_type.IsValid() and valobj_type.IsPointerType():
- valobj_type = valobj_type.GetPointeeType()
- if valobj_type.IsValid():
- actual_name = valobj_type.GetName()
- if actual_name == '__CFBinaryHeap':
- wrapper = CFBinaryHeapRef_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- return wrapper
- wrapper = CFBinaryHeapUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def CFBinaryHeap_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.length();
- except:
- summary = None
- logger >> "summary got from provider: " + str(summary)
- # for some reason, one needs to clear some bits for the count
- # to be correct when using CF(Mutable)BagRef on x64
- # the bit mask was derived through experimentation
- # (if counts start looking weird, then most probably
- # the mask needs to be changed)
- if summary == None:
- summary = '<variable is not CFBinaryHeap>'
- elif isinstance(summary,basestring):
- pass
- else:
- if provider.sys_params.is_64_bit:
- summary = summary & ~0x1fff000000000000
- if summary == 1:
- return '@"1 item"'
- else:
- summary = '@"' + str(summary) + ' items"'
- return summary
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F CFBinaryHeap.CFBinaryHeap_SummaryProvider CFBinaryHeapRef")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ actual_name = class_data.class_name()
+
+ logger >> "name string got was " + \
+ str(name_string) + " but actual name is " + str(actual_name)
+
+ if class_data.is_cftype():
+ # CFBinaryHeap does not expose an actual NSWrapper type, so we have to check that this is
+ # an NSCFType and then check we are a pointer-to CFBinaryHeap
+ valobj_type = valobj.GetType()
+ if valobj_type.IsValid() and valobj_type.IsPointerType():
+ valobj_type = valobj_type.GetPointeeType()
+ if valobj_type.IsValid():
+ actual_name = valobj_type.GetName()
+ if actual_name == '__CFBinaryHeap':
+ wrapper = CFBinaryHeapRef_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ return wrapper
+ wrapper = CFBinaryHeapUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def CFBinaryHeap_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.length()
+ except:
+ summary = None
+ logger >> "summary got from provider: " + str(summary)
+ # for some reason, one needs to clear some bits for the count
+ # to be correct when using CF(Mutable)BagRef on x64
+ # the bit mask was derived through experimentation
+ # (if counts start looking weird, then most probably
+ # the mask needs to be changed)
+ if summary is None:
+ summary = '<variable is not CFBinaryHeap>'
+ elif isinstance(summary, basestring):
+ pass
+ else:
+ if provider.sys_params.is_64_bit:
+ summary = summary & ~0x1fff000000000000
+ if summary == 1:
+ return '@"1 item"'
+ else:
+ summary = '@"' + str(summary) + ' items"'
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F CFBinaryHeap.CFBinaryHeap_SummaryProvider CFBinaryHeapRef")
Modified: lldb/trunk/examples/summaries/cocoa/CFBitVector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFBitVector.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFBitVector.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFBitVector.py Tue Sep 6 15:57:50 2016
@@ -13,23 +13,28 @@ import lldb.formatters.metrics
import lldb.formatters.Logger
# first define some utility functions
+
+
def byte_index(abs_pos):
- logger = lldb.formatters.Logger.Logger()
- return abs_pos/8
+ logger = lldb.formatters.Logger.Logger()
+ return abs_pos / 8
+
def bit_index(abs_pos):
- logger = lldb.formatters.Logger.Logger()
- return abs_pos & 7
+ logger = lldb.formatters.Logger.Logger()
+ return abs_pos & 7
+
+
+def get_bit(byte, index):
+ logger = lldb.formatters.Logger.Logger()
+ if index < 0 or index > 7:
+ return None
+ return (byte >> (7 - index)) & 1
+
-def get_bit(byte,index):
- logger = lldb.formatters.Logger.Logger()
- if index < 0 or index > 7:
- return None
- return (byte >> (7-index)) & 1
-
-def grab_array_item_data(pointer,index):
- logger = lldb.formatters.Logger.Logger()
- return pointer.GetPointeeData(index,1)
+def grab_array_item_data(pointer, index):
+ logger = lldb.formatters.Logger.Logger()
+ return pointer.GetPointeeData(index, 1)
statistics = lldb.formatters.metrics.Metrics()
statistics.add_metric('invalid_isa')
@@ -40,136 +45,162 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but a summary for a CF*BitVector, so they need not
# obey the interface specification for synthetic children providers
+
+
class CFBitVectorKnown_SummaryProvider:
- def adjust_for_architecture(self):
- logger = lldb.formatters.Logger.Logger()
- self.uiint_size = self.sys_params.types_cache.NSUInteger.GetByteSize()
- pass
-
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- if not(self.sys_params.types_cache.charptr):
- self.sys_params.types_cache.charptr = self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType()
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # we skip the CFRuntimeBase
- # then the next CFIndex is the count
- # then we skip another CFIndex and then we get at a byte array
- # that wraps the individual bits
-
- def contents(self):
- logger = lldb.formatters.Logger.Logger()
- count_vo = self.valobj.CreateChildAtOffset("count",self.sys_params.cfruntime_size,
- self.sys_params.types_cache.NSUInteger)
- count = count_vo.GetValueAsUnsigned(0)
- if count == 0:
- return '(empty)'
-
- array_vo = self.valobj.CreateChildAtOffset("data",
- self.sys_params.cfruntime_size+2*self.uiint_size,
- self.sys_params.types_cache.charptr)
-
- data_list = []
- cur_byte_pos = None
- for i in range(0,count):
- if cur_byte_pos == None:
- cur_byte_pos = byte_index(i)
- cur_byte = grab_array_item_data(array_vo,cur_byte_pos)
- cur_byte_val = cur_byte.uint8[0]
- else:
- byte_pos = byte_index(i)
- # do not fetch the pointee data every single time through
- if byte_pos != cur_byte_pos:
- cur_byte_pos = byte_pos
- cur_byte = grab_array_item_data(array_vo,cur_byte_pos)
- cur_byte_val = cur_byte.uint8[0]
- bit = get_bit(cur_byte_val,bit_index(i))
- if (i % 4) == 0:
- data_list.append(' ')
- if bit == 1:
- data_list.append('1')
- else:
- data_list.append('0')
- return ''.join(data_list)
+
+ def adjust_for_architecture(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.uiint_size = self.sys_params.types_cache.NSUInteger.GetByteSize()
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ if not(self.sys_params.types_cache.charptr):
+ self.sys_params.types_cache.charptr = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeChar).GetPointerType()
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # we skip the CFRuntimeBase
+ # then the next CFIndex is the count
+ # then we skip another CFIndex and then we get at a byte array
+ # that wraps the individual bits
+
+ def contents(self):
+ logger = lldb.formatters.Logger.Logger()
+ count_vo = self.valobj.CreateChildAtOffset(
+ "count",
+ self.sys_params.cfruntime_size,
+ self.sys_params.types_cache.NSUInteger)
+ count = count_vo.GetValueAsUnsigned(0)
+ if count == 0:
+ return '(empty)'
+
+ array_vo = self.valobj.CreateChildAtOffset(
+ "data",
+ self.sys_params.cfruntime_size +
+ 2 *
+ self.uiint_size,
+ self.sys_params.types_cache.charptr)
+
+ data_list = []
+ cur_byte_pos = None
+ for i in range(0, count):
+ if cur_byte_pos is None:
+ cur_byte_pos = byte_index(i)
+ cur_byte = grab_array_item_data(array_vo, cur_byte_pos)
+ cur_byte_val = cur_byte.uint8[0]
+ else:
+ byte_pos = byte_index(i)
+ # do not fetch the pointee data every single time through
+ if byte_pos != cur_byte_pos:
+ cur_byte_pos = byte_pos
+ cur_byte = grab_array_item_data(array_vo, cur_byte_pos)
+ cur_byte_val = cur_byte.uint8[0]
+ bit = get_bit(cur_byte_val, bit_index(i))
+ if (i % 4) == 0:
+ data_list.append(' ')
+ if bit == 1:
+ data_list.append('1')
+ else:
+ data_list.append('0')
+ return ''.join(data_list)
class CFBitVectorUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def contents(self):
- logger = lldb.formatters.Logger.Logger()
- return '<unable to summarize this CFBitVector>'
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def contents(self):
+ logger = lldb.formatters.Logger.Logger()
+ return '<unable to summarize this CFBitVector>'
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- actual_name = name_string
-
- logger >> "name string got was " + str(name_string) + " but actual name is " + str(actual_name)
-
- if class_data.is_cftype():
- # CFBitVectorRef does not expose an actual NSWrapper type, so we have to check that this is
- # an NSCFType and then check we are a pointer-to CFBitVectorRef
- valobj_type = valobj.GetType()
- if valobj_type.IsValid() and valobj_type.IsPointerType():
- valobj_type = valobj_type.GetPointeeType()
- if valobj_type.IsValid():
- actual_name = valobj_type.GetName()
- if actual_name == '__CFBitVector' or actual_name == '__CFMutableBitVector':
- wrapper = CFBitVectorKnown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = CFBitVectorUnknown_SummaryProvider(valobj, class_data.sys_params)
- print actual_name
- else:
- wrapper = CFBitVectorUnknown_SummaryProvider(valobj, class_data.sys_params)
- print name_string
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def CFBitVector_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.contents();
- except:
- summary = None
- logger >> "summary got from provider: " + str(summary)
- if summary == None or summary == '':
- summary = '<variable is not CFBitVector>'
- return summary
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F CFBitVector.CFBitVector_SummaryProvider CFBitVectorRef CFMutableBitVectorRef")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ actual_name = name_string
+
+ logger >> "name string got was " + \
+ str(name_string) + " but actual name is " + str(actual_name)
+
+ if class_data.is_cftype():
+ # CFBitVectorRef does not expose an actual NSWrapper type, so we have to check that this is
+ # an NSCFType and then check we are a pointer-to CFBitVectorRef
+ valobj_type = valobj.GetType()
+ if valobj_type.IsValid() and valobj_type.IsPointerType():
+ valobj_type = valobj_type.GetPointeeType()
+ if valobj_type.IsValid():
+ actual_name = valobj_type.GetName()
+ if actual_name == '__CFBitVector' or actual_name == '__CFMutableBitVector':
+ wrapper = CFBitVectorKnown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = CFBitVectorUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ print actual_name
+ else:
+ wrapper = CFBitVectorUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ print name_string
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def CFBitVector_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.contents()
+ except:
+ summary = None
+ logger >> "summary got from provider: " + str(summary)
+ if summary is None or summary == '':
+ summary = '<variable is not CFBitVector>'
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F CFBitVector.CFBitVector_SummaryProvider CFBitVectorRef CFMutableBitVectorRef")
Modified: lldb/trunk/examples/summaries/cocoa/CFDictionary.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFDictionary.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFDictionary.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFDictionary.py Tue Sep 6 15:57:50 2016
@@ -22,213 +22,242 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the count for an NSDictionary, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSCFDictionary_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # empirically determined on both 32 and 64bit desktop Mac OS X
- # probably boils down to 2 pointers and 4 bytes of data, but
- # the description of __CFDictionary is not readily available so most
- # of this is guesswork, plain and simple
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- if self.sys_params.is_64_bit:
- return 20
- else:
- return 12
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- num_children_vo = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- return num_children_vo.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # empirically determined on both 32 and 64bit desktop Mac OS X
+ # probably boils down to 2 pointers and 4 bytes of data, but
+ # the description of __CFDictionary is not readily available so most
+ # of this is guesswork, plain and simple
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.sys_params.is_64_bit:
+ return 20
+ else:
+ return 12
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ num_children_vo = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ return num_children_vo.GetValueAsUnsigned(0)
class NSDictionaryI_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # we just need to skip the ISA and the count immediately follows
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- num_children_vo = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- value = num_children_vo.GetValueAsUnsigned(0)
- if value != None:
- # the MS6bits on immutable dictionaries seem to be taken by the LSB of capacity
- # not sure if it is a bug or some weird sort of feature, but masking that out
- # gets the count right
- if self.sys_params.is_64_bit:
- value = value & ~0xFC00000000000000
- else:
- value = value & ~0xFC000000
- return value
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # we just need to skip the ISA and the count immediately follows
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ num_children_vo = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ value = num_children_vo.GetValueAsUnsigned(0)
+ if value is not None:
+ # the MS6bits on immutable dictionaries seem to be taken by the LSB of capacity
+ # not sure if it is a bug or some weird sort of feature, but masking that out
+ # gets the count right
+ if self.sys_params.is_64_bit:
+ value = value & ~0xFC00000000000000
+ else:
+ value = value & ~0xFC000000
+ return value
+
class NSDictionaryM_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # we just need to skip the ISA and the count immediately follows
- def offset(self):
- return self.sys_params.pointer_size
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- num_children_vo = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- value = num_children_vo.GetValueAsUnsigned(0)
- if value != None:
- # the MS6bits on immutable dictionaries seem to be taken by the LSB of capacity
- # not sure if it is a bug or some weird sort of feature, but masking that out
- # gets the count right
- if self.sys_params.is_64_bit:
- value = value & ~0xFC00000000000000
- else:
- value = value & ~0xFC000000
- return value
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # we just need to skip the ISA and the count immediately follows
+ def offset(self):
+ return self.sys_params.pointer_size
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ num_children_vo = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ value = num_children_vo.GetValueAsUnsigned(0)
+ if value is not None:
+ # the MS6bits on immutable dictionaries seem to be taken by the LSB of capacity
+ # not sure if it is a bug or some weird sort of feature, but masking that out
+ # gets the count right
+ if self.sys_params.is_64_bit:
+ value = value & ~0xFC00000000000000
+ else:
+ value = value & ~0xFC000000
+ return value
+
class NSDictionaryUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- num_children_vo = self.valobj.CreateValueFromExpression("count","(int)[" + stream.GetData() + " count]");
- if num_children_vo.IsValid():
- return num_children_vo.GetValueAsUnsigned(0)
- return '<variable is not NSDictionary>'
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ num_children_vo = self.valobj.CreateValueFromExpression(
+ "count", "(int)[" + stream.GetData() + " count]")
+ if num_children_vo.IsValid():
+ return num_children_vo.GetValueAsUnsigned(0)
+ return '<variable is not NSDictionary>'
def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
-
- logger >> "class name is: " + str(name_string)
-
- if name_string == '__NSCFDictionary':
- wrapper = NSCFDictionary_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- elif name_string == '__NSDictionaryI':
- wrapper = NSDictionaryI_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- elif name_string == '__NSDictionaryM':
- wrapper = NSDictionaryM_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSDictionaryUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def CFDictionary_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.num_children();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- return '<variable is not NSDictionary>'
- if isinstance(summary,basestring):
- return summary
- return str(summary) + (" key/value pairs" if summary != 1 else " key/value pair")
- return 'Summary Unavailable'
-
-def CFDictionary_SummaryProvider2 (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.num_children();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- summary = '<variable is not CFDictionary>'
- if isinstance(summary,basestring):
- return summary
- else:
- # needed on OSX Mountain Lion
- if provider.sys_params.is_64_bit:
- summary = summary & ~0x0f1f000000000000
- summary = '@"' + str(summary) + (' entries"' if summary != 1 else ' entry"')
- return summary
- return 'Summary Unavailable'
-
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F CFDictionary.CFDictionary_SummaryProvider NSDictionary")
- debugger.HandleCommand("type summary add -F CFDictionary.CFDictionary_SummaryProvider2 CFDictionaryRef CFMutableDictionaryRef")
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == '__NSCFDictionary':
+ wrapper = NSCFDictionary_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ elif name_string == '__NSDictionaryI':
+ wrapper = NSDictionaryI_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ elif name_string == '__NSDictionaryM':
+ wrapper = NSDictionaryM_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSDictionaryUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def CFDictionary_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.num_children()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ return '<variable is not NSDictionary>'
+ if isinstance(summary, basestring):
+ return summary
+ return str(summary) + (" key/value pairs" if summary !=
+ 1 else " key/value pair")
+ return 'Summary Unavailable'
+
+
+def CFDictionary_SummaryProvider2(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.num_children()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ summary = '<variable is not CFDictionary>'
+ if isinstance(summary, basestring):
+ return summary
+ else:
+ # needed on OSX Mountain Lion
+ if provider.sys_params.is_64_bit:
+ summary = summary & ~0x0f1f000000000000
+ summary = '@"' + str(summary) + \
+ (' entries"' if summary != 1 else ' entry"')
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F CFDictionary.CFDictionary_SummaryProvider NSDictionary")
+ debugger.HandleCommand(
+ "type summary add -F CFDictionary.CFDictionary_SummaryProvider2 CFDictionaryRef CFMutableDictionaryRef")
Modified: lldb/trunk/examples/summaries/cocoa/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/CFString.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/CFString.py (original)
+++ lldb/trunk/examples/summaries/cocoa/CFString.py Tue Sep 6 15:57:50 2016
@@ -11,315 +11,341 @@ import lldb
import lldb.runtime.objc.objc_runtime
import lldb.formatters.Logger
-def CFString_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = CFStringSynthProvider(valobj,dict);
- if provider.invalid == False:
- try:
- summary = provider.get_child_at_index(provider.get_child_index("content"))
- if type(summary) == lldb.SBValue:
- summary = summary.GetSummary()
- else:
- summary = '"' + summary + '"'
- except:
- summary = None
- if summary == None:
- summary = '<variable is not NSString>'
- return '@'+summary
- return ''
-
-def CFAttributedString_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- offset = valobj.GetTarget().GetProcess().GetAddressByteSize()
- pointee = valobj.GetValueAsUnsigned(0)
- summary = '<variable is not NSAttributedString>'
- if pointee != None and pointee != 0:
- pointee = pointee + offset
- child_ptr = valobj.CreateValueFromAddress("string_ptr",pointee,valobj.GetType())
- child = child_ptr.CreateValueFromAddress("string_data",child_ptr.GetValueAsUnsigned(),valobj.GetType()).AddressOf()
- provider = CFStringSynthProvider(child,dict);
- if provider.invalid == False:
- try:
- summary = provider.get_child_at_index(provider.get_child_index("content")).GetSummary();
- except:
- summary = '<variable is not NSAttributedString>'
- if summary == None:
- summary = '<variable is not NSAttributedString>'
- return '@'+summary
-
-
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F CFString.CFString_SummaryProvider NSString CFStringRef CFMutableStringRef")
- debugger.HandleCommand("type summary add -F CFString.CFAttributedString_SummaryProvider NSAttributedString")
+
+def CFString_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = CFStringSynthProvider(valobj, dict)
+ if not provider.invalid:
+ try:
+ summary = provider.get_child_at_index(
+ provider.get_child_index("content"))
+ if isinstance(summary, lldb.SBValue):
+ summary = summary.GetSummary()
+ else:
+ summary = '"' + summary + '"'
+ except:
+ summary = None
+ if summary is None:
+ summary = '<variable is not NSString>'
+ return '@' + summary
+ return ''
+
+
+def CFAttributedString_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ offset = valobj.GetTarget().GetProcess().GetAddressByteSize()
+ pointee = valobj.GetValueAsUnsigned(0)
+ summary = '<variable is not NSAttributedString>'
+ if pointee is not None and pointee != 0:
+ pointee = pointee + offset
+ child_ptr = valobj.CreateValueFromAddress(
+ "string_ptr", pointee, valobj.GetType())
+ child = child_ptr.CreateValueFromAddress(
+ "string_data",
+ child_ptr.GetValueAsUnsigned(),
+ valobj.GetType()).AddressOf()
+ provider = CFStringSynthProvider(child, dict)
+ if not provider.invalid:
+ try:
+ summary = provider.get_child_at_index(
+ provider.get_child_index("content")).GetSummary()
+ except:
+ summary = '<variable is not NSAttributedString>'
+ if summary is None:
+ summary = '<variable is not NSAttributedString>'
+ return '@' + summary
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F CFString.CFString_SummaryProvider NSString CFStringRef CFMutableStringRef")
+ debugger.HandleCommand(
+ "type summary add -F CFString.CFAttributedString_SummaryProvider NSAttributedString")
+
class CFStringSynthProvider:
- def __init__(self,valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.update()
-
- # children other than "content" are for debugging only and must not be used in production code
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- if self.invalid:
- return 0;
- return 6;
-
- def read_unicode(self, pointer,max_len=2048):
- logger = lldb.formatters.Logger.Logger()
- process = self.valobj.GetTarget().GetProcess()
- error = lldb.SBError()
- pystr = u''
- # cannot do the read at once because the length value has
- # a weird encoding. better play it safe here
- while max_len > 0:
- content = process.ReadMemory(pointer, 2, error)
- new_bytes = bytearray(content)
- b0 = new_bytes[0]
- b1 = new_bytes[1]
- pointer = pointer + 2
- if b0 == 0 and b1 == 0:
- break
- # rearrange bytes depending on endianness
- # (do we really need this or is Cocoa going to
- # use Windows-compatible little-endian even
- # if the target is big endian?)
- if self.is_little:
- value = b1 * 256 + b0
- else:
- value = b0 * 256 + b1
- pystr = pystr + unichr(value)
- # read max_len unicode values, not max_len bytes
- max_len = max_len - 1
- return pystr
-
- # handle the special case strings
- # only use the custom code for the tested LP64 case
- def handle_special(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_64_bit == False:
- # for 32bit targets, use safe ObjC code
- return self.handle_unicode_string_safe()
- offset = 12
- pointer = self.valobj.GetValueAsUnsigned(0) + offset
- pystr = self.read_unicode(pointer)
- return self.valobj.CreateValueFromExpression("content",
- "(char*)\"" + pystr.encode('utf-8') + "\"")
-
- # last resort call, use ObjC code to read; the final aim is to
- # be able to strip this call away entirely and only do the read
- # ourselves
- def handle_unicode_string_safe(self):
- return self.valobj.CreateValueFromExpression("content",
- "(char*)\"" + self.valobj.GetObjectDescription() + "\"");
-
- def handle_unicode_string(self):
- logger = lldb.formatters.Logger.Logger()
- # step 1: find offset
- if self.inline:
- pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
- if self.explicit == False:
- # untested, use the safe code path
- return self.handle_unicode_string_safe();
- else:
- # a full pointer is skipped here before getting to the live data
- pointer = pointer + self.pointer_size
- else:
- pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base()
- # read 8 bytes here and make an address out of them
- try:
- char_type = self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType()
- vopointer = self.valobj.CreateValueFromAddress("dummy",pointer,char_type);
- pointer = vopointer.GetValueAsUnsigned(0)
- except:
- return self.valobj.CreateValueFromExpression("content",
- '(char*)"@\"invalid NSString\""')
- # step 2: read Unicode data at pointer
- pystr = self.read_unicode(pointer)
- # step 3: return it
- return pystr.encode('utf-8')
-
- def handle_inline_explicit(self):
- logger = lldb.formatters.Logger.Logger()
- offset = 3*self.pointer_size
- offset = offset + self.valobj.GetValueAsUnsigned(0)
- return self.valobj.CreateValueFromExpression("content",
- "(char*)(" + str(offset) + ")")
-
- def handle_mutable_string(self):
- logger = lldb.formatters.Logger.Logger()
- offset = 2 * self.pointer_size
- data = self.valobj.CreateChildAtOffset("content",
- offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
- data_value = data.GetValueAsUnsigned(0)
- if self.explicit and self.unicode:
- return self.read_unicode(data_value).encode('utf-8')
- else:
- data_value = data_value + 1
- return self.valobj.CreateValueFromExpression("content", "(char*)(" + str(data_value) + ")")
-
- def handle_UTF8_inline(self):
- logger = lldb.formatters.Logger.Logger()
- offset = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
- if self.explicit == False:
- offset = offset + 1;
- return self.valobj.CreateValueFromAddress("content",
- offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)).AddressOf();
-
- def handle_UTF8_not_inline(self):
- logger = lldb.formatters.Logger.Logger()
- offset = self.size_of_cfruntime_base();
- return self.valobj.CreateChildAtOffset("content",
- offset,self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
-
- def get_child_at_index(self,index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Querying for child [" + str(index) + "]"
- if index == 0:
- return self.valobj.CreateValueFromExpression("mutable",
- str(int(self.mutable)));
- if index == 1:
- return self.valobj.CreateValueFromExpression("inline",
- str(int(self.inline)));
- if index == 2:
- return self.valobj.CreateValueFromExpression("explicit",
- str(int(self.explicit)));
- if index == 3:
- return self.valobj.CreateValueFromExpression("unicode",
- str(int(self.unicode)));
- if index == 4:
- return self.valobj.CreateValueFromExpression("special",
- str(int(self.special)));
- if index == 5:
- # we are handling the several possible combinations of flags.
- # for each known combination we have a function that knows how to
- # go fetch the data from memory instead of running code. if a string is not
- # correctly displayed, one should start by finding a combination of flags that
- # makes it different from these known cases, and provide a new reader function
- # if this is not possible, a new flag might have to be made up (like the "special" flag
- # below, which is not a real flag in CFString), or alternatively one might need to use
- # the ObjC runtime helper to detect the new class and deal with it accordingly
- #print 'mutable = ' + str(self.mutable)
- #print 'inline = ' + str(self.inline)
- #print 'explicit = ' + str(self.explicit)
- #print 'unicode = ' + str(self.unicode)
- #print 'special = ' + str(self.special)
- if self.mutable == True:
- return self.handle_mutable_string()
- elif self.inline == True and self.explicit == True and \
- self.unicode == False and self.special == False and \
- self.mutable == False:
- return self.handle_inline_explicit()
- elif self.unicode == True:
- return self.handle_unicode_string();
- elif self.special == True:
- return self.handle_special();
- elif self.inline == True:
- return self.handle_UTF8_inline();
- else:
- return self.handle_UTF8_not_inline();
-
- def get_child_index(self,name):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Querying for child ['" + str(name) + "']"
- if name == "content":
- return self.num_children() - 1;
- if name == "mutable":
- return 0;
- if name == "inline":
- return 1;
- if name == "explicit":
- return 2;
- if name == "unicode":
- return 3;
- if name == "special":
- return 4;
-
- # CFRuntimeBase is defined as having an additional
- # 4 bytes (padding?) on LP64 architectures
- # to get its size we add up sizeof(pointer)+4
- # and then add 4 more bytes if we are on a 64bit system
- def size_of_cfruntime_base(self):
- logger = lldb.formatters.Logger.Logger()
- return self.pointer_size+4+(4 if self.is_64_bit else 0)
-
- # the info bits are part of the CFRuntimeBase structure
- # to get at them we have to skip a uintptr_t and then get
- # at the least-significant byte of a 4 byte array. If we are
- # on big-endian this means going to byte 3, if we are on
- # little endian (OSX & iOS), this means reading byte 0
- def offset_of_info_bits(self):
- logger = lldb.formatters.Logger.Logger()
- offset = self.pointer_size
- if self.is_little == False:
- offset = offset + 3;
- return offset;
-
- def read_info_bits(self):
- logger = lldb.formatters.Logger.Logger()
- cfinfo = self.valobj.CreateChildAtOffset("cfinfo",
- self.offset_of_info_bits(),
- self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar));
- cfinfo.SetFormat(11)
- info = cfinfo.GetValue();
- if info != None:
- self.invalid = False;
- return int(info,0);
- else:
- self.invalid = True;
- return None;
-
- # calculating internal flag bits of the CFString object
- # this stuff is defined and discussed in CFString.c
- def is_mutable(self):
- logger = lldb.formatters.Logger.Logger()
- return (self.info_bits & 1) == 1;
-
- def is_inline(self):
- logger = lldb.formatters.Logger.Logger()
- return (self.info_bits & 0x60) == 0;
-
- # this flag's name is ambiguous, it turns out
- # we must skip a length byte to get at the data
- # when this flag is False
- def has_explicit_length(self):
- logger = lldb.formatters.Logger.Logger()
- return (self.info_bits & (1 | 4)) != 4;
-
- # probably a subclass of NSString. obtained this from [str pathExtension]
- # here info_bits = 0 and Unicode data at the start of the padding word
- # in the long run using the isa value might be safer as a way to identify this
- # instead of reading the info_bits
- def is_special_case(self):
- logger = lldb.formatters.Logger.Logger()
- return self.info_bits == 0;
-
- def is_unicode(self):
- logger = lldb.formatters.Logger.Logger()
- return (self.info_bits & 0x10) == 0x10;
-
- # preparing ourselves to read into memory
- # by adjusting architecture-specific info
- def adjust_for_architecture(self):
- logger = lldb.formatters.Logger.Logger()
- self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize()
- self.is_64_bit = self.pointer_size == 8
- self.is_little = self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle
-
- # reading info bits out of the CFString and computing
- # useful values to get at the real data
- def compute_flags(self):
- logger = lldb.formatters.Logger.Logger()
- self.info_bits = self.read_info_bits();
- if self.info_bits == None:
- return;
- self.mutable = self.is_mutable();
- self.inline = self.is_inline();
- self.explicit = self.has_explicit_length();
- self.unicode = self.is_unicode();
- self.special = self.is_special_case();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
- self.compute_flags();
+
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.update()
+
+ # children other than "content" are for debugging only and must not be
+ # used in production code
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.invalid:
+ return 0
+ return 6
+
+ def read_unicode(self, pointer, max_len=2048):
+ logger = lldb.formatters.Logger.Logger()
+ process = self.valobj.GetTarget().GetProcess()
+ error = lldb.SBError()
+ pystr = u''
+ # cannot do the read at once because the length value has
+ # a weird encoding. better play it safe here
+ while max_len > 0:
+ content = process.ReadMemory(pointer, 2, error)
+ new_bytes = bytearray(content)
+ b0 = new_bytes[0]
+ b1 = new_bytes[1]
+ pointer = pointer + 2
+ if b0 == 0 and b1 == 0:
+ break
+ # rearrange bytes depending on endianness
+ # (do we really need this or is Cocoa going to
+ # use Windows-compatible little-endian even
+ # if the target is big endian?)
+ if self.is_little:
+ value = b1 * 256 + b0
+ else:
+ value = b0 * 256 + b1
+ pystr = pystr + unichr(value)
+ # read max_len unicode values, not max_len bytes
+ max_len = max_len - 1
+ return pystr
+
+ # handle the special case strings
+ # only use the custom code for the tested LP64 case
+ def handle_special(self):
+ logger = lldb.formatters.Logger.Logger()
+ if not self.is_64_bit:
+ # for 32bit targets, use safe ObjC code
+ return self.handle_unicode_string_safe()
+ offset = 12
+ pointer = self.valobj.GetValueAsUnsigned(0) + offset
+ pystr = self.read_unicode(pointer)
+ return self.valobj.CreateValueFromExpression(
+ "content", "(char*)\"" + pystr.encode('utf-8') + "\"")
+
+ # last resort call, use ObjC code to read; the final aim is to
+ # be able to strip this call away entirely and only do the read
+ # ourselves
+ def handle_unicode_string_safe(self):
+ return self.valobj.CreateValueFromExpression(
+ "content", "(char*)\"" + self.valobj.GetObjectDescription() + "\"")
+
+ def handle_unicode_string(self):
+ logger = lldb.formatters.Logger.Logger()
+ # step 1: find offset
+ if self.inline:
+ pointer = self.valobj.GetValueAsUnsigned(
+ 0) + self.size_of_cfruntime_base()
+ if not self.explicit:
+ # untested, use the safe code path
+ return self.handle_unicode_string_safe()
+ else:
+ # a full pointer is skipped here before getting to the live
+ # data
+ pointer = pointer + self.pointer_size
+ else:
+ pointer = self.valobj.GetValueAsUnsigned(
+ 0) + self.size_of_cfruntime_base()
+ # read 8 bytes here and make an address out of them
+ try:
+ char_type = self.valobj.GetType().GetBasicType(
+ lldb.eBasicTypeChar).GetPointerType()
+ vopointer = self.valobj.CreateValueFromAddress(
+ "dummy", pointer, char_type)
+ pointer = vopointer.GetValueAsUnsigned(0)
+ except:
+ return self.valobj.CreateValueFromExpression(
+ "content", '(char*)"@\"invalid NSString\""')
+ # step 2: read Unicode data at pointer
+ pystr = self.read_unicode(pointer)
+ # step 3: return it
+ return pystr.encode('utf-8')
+
+ def handle_inline_explicit(self):
+ logger = lldb.formatters.Logger.Logger()
+ offset = 3 * self.pointer_size
+ offset = offset + self.valobj.GetValueAsUnsigned(0)
+ return self.valobj.CreateValueFromExpression(
+ "content", "(char*)(" + str(offset) + ")")
+
+ def handle_mutable_string(self):
+ logger = lldb.formatters.Logger.Logger()
+ offset = 2 * self.pointer_size
+ data = self.valobj.CreateChildAtOffset(
+ "content", offset, self.valobj.GetType().GetBasicType(
+ lldb.eBasicTypeChar).GetPointerType())
+ data_value = data.GetValueAsUnsigned(0)
+ if self.explicit and self.unicode:
+ return self.read_unicode(data_value).encode('utf-8')
+ else:
+ data_value = data_value + 1
+ return self.valobj.CreateValueFromExpression(
+ "content", "(char*)(" + str(data_value) + ")")
+
+ def handle_UTF8_inline(self):
+ logger = lldb.formatters.Logger.Logger()
+ offset = self.valobj.GetValueAsUnsigned(
+ 0) + self.size_of_cfruntime_base()
+ if not self.explicit:
+ offset = offset + 1
+ return self.valobj.CreateValueFromAddress(
+ "content", offset, self.valobj.GetType().GetBasicType(
+ lldb.eBasicTypeChar)).AddressOf()
+
+ def handle_UTF8_not_inline(self):
+ logger = lldb.formatters.Logger.Logger()
+ offset = self.size_of_cfruntime_base()
+ return self.valobj.CreateChildAtOffset(
+ "content", offset, self.valobj.GetType().GetBasicType(
+ lldb.eBasicTypeChar).GetPointerType())
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Querying for child [" + str(index) + "]"
+ if index == 0:
+ return self.valobj.CreateValueFromExpression(
+ "mutable", str(int(self.mutable)))
+ if index == 1:
+ return self.valobj.CreateValueFromExpression("inline",
+ str(int(self.inline)))
+ if index == 2:
+ return self.valobj.CreateValueFromExpression(
+ "explicit", str(int(self.explicit)))
+ if index == 3:
+ return self.valobj.CreateValueFromExpression(
+ "unicode", str(int(self.unicode)))
+ if index == 4:
+ return self.valobj.CreateValueFromExpression(
+ "special", str(int(self.special)))
+ if index == 5:
+ # we are handling the several possible combinations of flags.
+ # for each known combination we have a function that knows how to
+ # go fetch the data from memory instead of running code. if a string is not
+ # correctly displayed, one should start by finding a combination of flags that
+ # makes it different from these known cases, and provide a new reader function
+ # if this is not possible, a new flag might have to be made up (like the "special" flag
+ # below, which is not a real flag in CFString), or alternatively one might need to use
+ # the ObjC runtime helper to detect the new class and deal with it accordingly
+ # print 'mutable = ' + str(self.mutable)
+ # print 'inline = ' + str(self.inline)
+ # print 'explicit = ' + str(self.explicit)
+ # print 'unicode = ' + str(self.unicode)
+ # print 'special = ' + str(self.special)
+ if self.mutable:
+ return self.handle_mutable_string()
+ elif self.inline and self.explicit and \
+ self.unicode == False and self.special == False and \
+ self.mutable == False:
+ return self.handle_inline_explicit()
+ elif self.unicode:
+ return self.handle_unicode_string()
+ elif self.special:
+ return self.handle_special()
+ elif self.inline:
+ return self.handle_UTF8_inline()
+ else:
+ return self.handle_UTF8_not_inline()
+
+ def get_child_index(self, name):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Querying for child ['" + str(name) + "']"
+ if name == "content":
+ return self.num_children() - 1
+ if name == "mutable":
+ return 0
+ if name == "inline":
+ return 1
+ if name == "explicit":
+ return 2
+ if name == "unicode":
+ return 3
+ if name == "special":
+ return 4
+
+ # CFRuntimeBase is defined as having an additional
+ # 4 bytes (padding?) on LP64 architectures
+ # to get its size we add up sizeof(pointer)+4
+ # and then add 4 more bytes if we are on a 64bit system
+ def size_of_cfruntime_base(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.pointer_size + 4 + (4 if self.is_64_bit else 0)
+
+ # the info bits are part of the CFRuntimeBase structure
+ # to get at them we have to skip a uintptr_t and then get
+ # at the least-significant byte of a 4 byte array. If we are
+ # on big-endian this means going to byte 3, if we are on
+ # little endian (OSX & iOS), this means reading byte 0
+ def offset_of_info_bits(self):
+ logger = lldb.formatters.Logger.Logger()
+ offset = self.pointer_size
+ if not self.is_little:
+ offset = offset + 3
+ return offset
+
+ def read_info_bits(self):
+ logger = lldb.formatters.Logger.Logger()
+ cfinfo = self.valobj.CreateChildAtOffset(
+ "cfinfo",
+ self.offset_of_info_bits(),
+ self.valobj.GetType().GetBasicType(
+ lldb.eBasicTypeChar))
+ cfinfo.SetFormat(11)
+ info = cfinfo.GetValue()
+ if info is not None:
+ self.invalid = False
+ return int(info, 0)
+ else:
+ self.invalid = True
+ return None
+
+ # calculating internal flag bits of the CFString object
+ # this stuff is defined and discussed in CFString.c
+ def is_mutable(self):
+ logger = lldb.formatters.Logger.Logger()
+ return (self.info_bits & 1) == 1
+
+ def is_inline(self):
+ logger = lldb.formatters.Logger.Logger()
+ return (self.info_bits & 0x60) == 0
+
+ # this flag's name is ambiguous, it turns out
+ # we must skip a length byte to get at the data
+ # when this flag is False
+ def has_explicit_length(self):
+ logger = lldb.formatters.Logger.Logger()
+ return (self.info_bits & (1 | 4)) != 4
+
+ # probably a subclass of NSString. obtained this from [str pathExtension]
+ # here info_bits = 0 and Unicode data at the start of the padding word
+ # in the long run using the isa value might be safer as a way to identify this
+ # instead of reading the info_bits
+ def is_special_case(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.info_bits == 0
+
+ def is_unicode(self):
+ logger = lldb.formatters.Logger.Logger()
+ return (self.info_bits & 0x10) == 0x10
+
+ # preparing ourselves to read into memory
+ # by adjusting architecture-specific info
+ def adjust_for_architecture(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize()
+ self.is_64_bit = self.pointer_size == 8
+ self.is_little = self.valobj.GetTarget().GetProcess(
+ ).GetByteOrder() == lldb.eByteOrderLittle
+
+ # reading info bits out of the CFString and computing
+ # useful values to get at the real data
+ def compute_flags(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.info_bits = self.read_info_bits()
+ if self.info_bits is None:
+ return
+ self.mutable = self.is_mutable()
+ self.inline = self.is_inline()
+ self.explicit = self.has_explicit_length()
+ self.unicode = self.is_unicode()
+ self.special = self.is_special_case()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+ self.compute_flags()
Modified: lldb/trunk/examples/summaries/cocoa/Class.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/Class.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/Class.py (original)
+++ lldb/trunk/examples/summaries/cocoa/Class.py Tue Sep 6 15:57:50 2016
@@ -9,13 +9,14 @@ import lldb
import lldb.runtime.objc.objc_runtime
import lldb.formatters.Logger
-def Class_Summary(valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- runtime =lldb.runtime.objc.objc_runtime.ObjCRuntime.runtime_from_isa(valobj)
- if runtime == None or not runtime.is_valid():
- return '<error: unknown Class>'
- class_data = runtime.read_class_data()
- if class_data == None or not class_data.is_valid():
- return '<error: unknown Class>'
- return class_data.class_name()
+def Class_Summary(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ runtime = lldb.runtime.objc.objc_runtime.ObjCRuntime.runtime_from_isa(
+ valobj)
+ if runtime is None or not runtime.is_valid():
+ return '<error: unknown Class>'
+ class_data = runtime.read_class_data()
+ if class_data is None or not class_data.is_valid():
+ return '<error: unknown Class>'
+ return class_data.class_name()
Modified: lldb/trunk/examples/summaries/cocoa/Logger.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/Logger.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/Logger.py (original)
+++ lldb/trunk/examples/summaries/cocoa/Logger.py Tue Sep 6 15:57:50 2016
@@ -3,120 +3,131 @@ import sys
import os.path
import inspect
+
class NopLogger:
- def __init__(self):
- pass
- def write(self,data):
- pass
+ def __init__(self):
+ pass
+
+ def write(self, data):
+ pass
- def flush(self):
- pass
+ def flush(self):
+ pass
- def close(self):
- pass
+ def close(self):
+ pass
class StdoutLogger:
- def __init__(self):
- pass
- def write(self,data):
- print(data)
+ def __init__(self):
+ pass
+
+ def write(self, data):
+ print(data)
+
+ def flush(self):
+ pass
- def flush(self):
- pass
+ def close(self):
+ pass
- def close(self):
- pass
class FileLogger:
- def __init__(self, name):
- self.file = None
- try:
- name = os.path.abspath(name)
- self.file = open(name,'a')
- except:
- try:
- self.file = open('formatters.log','a')
- except:
- pass
-
- def write(self,data):
- if self.file != None:
- print(data,file=self.file)
- else:
- print(data)
-
- def flush(self):
- if self.file != None:
- self.file.flush()
-
- def close(self):
- if self.file != None:
- self.file.close()
- self.file = None
+
+ def __init__(self, name):
+ self.file = None
+ try:
+ name = os.path.abspath(name)
+ self.file = open(name, 'a')
+ except:
+ try:
+ self.file = open('formatters.log', 'a')
+ except:
+ pass
+
+ def write(self, data):
+ if self.file is not None:
+ print(data, file=self.file)
+ else:
+ print(data)
+
+ def flush(self):
+ if self.file is not None:
+ self.file.flush()
+
+ def close(self):
+ if self.file is not None:
+ self.file.close()
+ self.file = None
# to enable logging:
# define lldb.formatters.Logger._lldb_formatters_debug_level to any number greater than 0
# if you define it to any value greater than 1, the log will be automatically flushed after each write (slower but should make sure most of the stuff makes it to the log even if we crash)
# if you define it to any value greater than 2, the calling function's details will automatically be logged (even slower, but provides additional details)
-# if you need the log to go to a file instead of on screen, define lldb.formatters.Logger._lldb_formatters_debug_filename to a valid filename
+# if you need the log to go to a file instead of on screen, define
+# lldb.formatters.Logger._lldb_formatters_debug_filename to a valid
+# filename
+
+
class Logger:
- def __init__(self,autoflush=False,logcaller=False):
- global _lldb_formatters_debug_level
- global _lldb_formatters_debug_filename
- self.autoflush = autoflush
- want_log = False
- try:
- want_log = (_lldb_formatters_debug_level > 0)
- except:
- pass
- if not (want_log):
- self.impl = NopLogger()
- return
- want_file = False
- try:
- want_file = (_lldb_formatters_debug_filename != None and _lldb_formatters_debug_filename != '' and _lldb_formatters_debug_filename != 0)
- except:
- pass
- if want_file:
- self.impl = FileLogger(_lldb_formatters_debug_filename)
- else:
- self.impl = StdoutLogger()
- try:
- self.autoflush = (_lldb_formatters_debug_level > 1)
- except:
- self.autoflush = autoflush
- want_caller_info = False
- try:
- want_caller_info = (_lldb_formatters_debug_level > 2)
- except:
- pass
- if want_caller_info:
- self._log_caller()
-
- def _log_caller(self):
- caller = inspect.stack()[2]
- try:
- if caller != None and len(caller) > 3:
- self.write('Logging from function ' + str(caller))
- else:
- self.write('Caller info not available - Required caller logging not possible')
- finally:
- del caller # needed per Python docs to avoid keeping objects alive longer than we care
-
- def write(self,data):
- self.impl.write(data)
- if self.autoflush:
- self.flush()
- def __rshift__(self,data):
- self.write(data)
+ def __init__(self, autoflush=False, logcaller=False):
+ global _lldb_formatters_debug_level
+ global _lldb_formatters_debug_filename
+ self.autoflush = autoflush
+ want_log = False
+ try:
+ want_log = (_lldb_formatters_debug_level > 0)
+ except:
+ pass
+ if not (want_log):
+ self.impl = NopLogger()
+ return
+ want_file = False
+ try:
+ want_file = (_lldb_formatters_debug_filename is not None and _lldb_formatters_debug_filename !=
+ '' and _lldb_formatters_debug_filename != 0)
+ except:
+ pass
+ if want_file:
+ self.impl = FileLogger(_lldb_formatters_debug_filename)
+ else:
+ self.impl = StdoutLogger()
+ try:
+ self.autoflush = (_lldb_formatters_debug_level > 1)
+ except:
+ self.autoflush = autoflush
+ want_caller_info = False
+ try:
+ want_caller_info = (_lldb_formatters_debug_level > 2)
+ except:
+ pass
+ if want_caller_info:
+ self._log_caller()
+
+ def _log_caller(self):
+ caller = inspect.stack()[2]
+ try:
+ if caller is not None and len(caller) > 3:
+ self.write('Logging from function ' + str(caller))
+ else:
+ self.write(
+ 'Caller info not available - Required caller logging not possible')
+ finally:
+ del caller # needed per Python docs to avoid keeping objects alive longer than we care
+
+ def write(self, data):
+ self.impl.write(data)
+ if self.autoflush:
+ self.flush()
- def flush(self):
- self.impl.flush()
+ def __rshift__(self, data):
+ self.write(data)
- def close(self):
- self.impl.close()
+ def flush(self):
+ self.impl.flush()
+ def close(self):
+ self.impl.close()
Modified: lldb/trunk/examples/summaries/cocoa/NSBundle.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSBundle.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSBundle.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSBundle.py Tue Sep 6 15:57:50 2016
@@ -23,105 +23,123 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but a summary for an NSURL, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSBundleKnown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSString):
- self.sys_params.types_cache.NSString = self.valobj.GetTarget().FindFirstType('NSString').GetPointerType()
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # we need to skip the ISA, plus four other values
- # that are luckily each a pointer in size
- # which makes our computation trivial :-)
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return 5 * self.sys_params.pointer_size
-
- def url_text(self):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- text = self.valobj.CreateChildAtOffset("text",
- self.offset(),
- self.sys_params.types_cache.NSString)
- my_string = text.GetSummary()
- if (my_string == None) or (my_string == ''):
- statistics.metric_hit('unknown_class',str(self.valobj.GetName()) + " triggered unknown pointer location")
- return NSBundleUnknown_SummaryProvider(self.valobj, self.sys_params).url_text()
- else:
- statistics.metric_hit('code_notrun',self.valobj)
- return my_string
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSString):
+ self.sys_params.types_cache.NSString = self.valobj.GetTarget(
+ ).FindFirstType('NSString').GetPointerType()
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # we need to skip the ISA, plus four other values
+ # that are luckily each a pointer in size
+ # which makes our computation trivial :-)
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return 5 * self.sys_params.pointer_size
+
+ def url_text(self):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ text = self.valobj.CreateChildAtOffset(
+ "text", self.offset(), self.sys_params.types_cache.NSString)
+ my_string = text.GetSummary()
+ if (my_string is None) or (my_string == ''):
+ statistics.metric_hit(
+ 'unknown_class', str(
+ self.valobj.GetName()) + " triggered unknown pointer location")
+ return NSBundleUnknown_SummaryProvider(
+ self.valobj, self.sys_params).url_text()
+ else:
+ statistics.metric_hit('code_notrun', self.valobj)
+ return my_string
class NSBundleUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def url_text(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- expr = "(NSString*)[" + stream.GetData() + " bundlePath]"
- url_text_vo = self.valobj.CreateValueFromExpression("path",expr);
- if url_text_vo.IsValid():
- return url_text_vo.GetSummary()
- return '<variable is not NSBundle>'
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def url_text(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ expr = "(NSString*)[" + stream.GetData() + " bundlePath]"
+ url_text_vo = self.valobj.CreateValueFromExpression("path", expr)
+ if url_text_vo.IsValid():
+ return url_text_vo.GetSummary()
+ return '<variable is not NSBundle>'
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSBundle':
- wrapper = NSBundleKnown_SummaryProvider(valobj, class_data.sys_params)
- # [NSBundle mainBundle] does return an object that is
- # not correctly filled out for our purposes, so we still
- # end up having to run code in that case
- #statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSBundleUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def NSBundle_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.url_text();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None or summary == '':
- summary = '<variable is not NSBundle>'
- return summary
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSBundle.NSBundle_SummaryProvider NSBundle")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSBundle':
+ wrapper = NSBundleKnown_SummaryProvider(valobj, class_data.sys_params)
+ # [NSBundle mainBundle] does return an object that is
+ # not correctly filled out for our purposes, so we still
+ # end up having to run code in that case
+ # statistics.metric_hit('code_notrun',valobj)
+ else:
+ wrapper = NSBundleUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSBundle_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.url_text()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None or summary == '':
+ summary = '<variable is not NSBundle>'
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSBundle.NSBundle_SummaryProvider NSBundle")
Modified: lldb/trunk/examples/summaries/cocoa/NSData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSData.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSData.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSData.py Tue Sep 6 15:57:50 2016
@@ -22,142 +22,161 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the length for an NSData, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSConcreteData_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- logger >> "NSConcreteData_SummaryProvider __init__"
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- self.adjust_for_architecture();
-
- # one pointer is the ISA
- # then there are 32 bit worth of flags and other data
- # however, on 64bit systems these are padded to be a full
- # machine word long, which means we actually have two pointers
- # worth of data to skip
- def offset(self):
- return 2 * self.sys_params.pointer_size
-
- def length(self):
- logger = lldb.formatters.Logger.Logger()
- logger >> "NSConcreteData_SummaryProvider length"
- size = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- logger >> str(size)
- logger >> str(size.GetValueAsUnsigned(0))
- return size.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "NSConcreteData_SummaryProvider __init__"
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ self.adjust_for_architecture()
+
+ # one pointer is the ISA
+ # then there are 32 bit worth of flags and other data
+ # however, on 64bit systems these are padded to be a full
+ # machine word long, which means we actually have two pointers
+ # worth of data to skip
+ def offset(self):
+ return 2 * self.sys_params.pointer_size
+
+ def length(self):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "NSConcreteData_SummaryProvider length"
+ size = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ logger >> str(size)
+ logger >> str(size.GetValueAsUnsigned(0))
+ return size.GetValueAsUnsigned(0)
class NSDataUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- logger >> "NSDataUnknown_SummaryProvider __init__"
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- self.adjust_for_architecture();
-
- def length(self):
- logger = lldb.formatters.Logger.Logger()
- logger >> "NSDataUnknown_SummaryProvider length"
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- logger >> stream.GetData()
- num_children_vo = self.valobj.CreateValueFromExpression("count","(int)[" + stream.GetData() + " length]");
- logger >> "still in after expression: " + str(num_children_vo)
- if num_children_vo.IsValid():
- logger >> "wow - expr output is valid: " + str(num_children_vo.GetValueAsUnsigned())
- return num_children_vo.GetValueAsUnsigned(0)
- logger >> "invalid expr output - too bad"
- return '<variable is not NSData>'
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "NSDataUnknown_SummaryProvider __init__"
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ self.adjust_for_architecture()
+
+ def length(self):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "NSDataUnknown_SummaryProvider length"
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ logger >> stream.GetData()
+ num_children_vo = self.valobj.CreateValueFromExpression(
+ "count", "(int)[" + stream.GetData() + " length]")
+ logger >> "still in after expression: " + str(num_children_vo)
+ if num_children_vo.IsValid():
+ logger >> "wow - expr output is valid: " + \
+ str(num_children_vo.GetValueAsUnsigned())
+ return num_children_vo.GetValueAsUnsigned(0)
+ logger >> "invalid expr output - too bad"
+ return '<variable is not NSData>'
def GetSummary_Impl(valobj):
- global statistics
- logger = lldb.formatters.Logger.Logger()
- logger >> "NSData GetSummary_Impl"
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- logger >> "got a wrapper summary - using it"
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name: " + name_string
- if name_string == 'NSConcreteData' or \
- name_string == 'NSConcreteMutableData' or \
- name_string == '__NSCFData':
- wrapper = NSConcreteData_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSDataUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def NSData_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- logger >> "NSData_SummaryProvider"
- provider = GetSummary_Impl(valobj);
- logger >> "found a summary provider, it is: " + str(provider)
- if provider != None:
- try:
- summary = provider.length();
- except:
- summary = None
- logger >> "got a summary: it is " + str(summary)
- if summary == None:
- summary = '<variable is not NSData>'
- elif isinstance(summary,basestring):
- pass
- else:
- if summary == 1:
- summary = '1 byte'
- else:
- summary = str(summary) + ' bytes'
- return summary
- return 'Summary Unavailable'
-
-def NSData_SummaryProvider2 (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- logger >> "NSData_SummaryProvider2"
- provider = GetSummary_Impl(valobj);
- logger >> "found a summary provider, it is: " + str(provider)
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.length();
- except:
- summary = None
- logger >> "got a summary: it is " + str(summary)
- if summary == None:
- summary = '<variable is not CFData>'
- elif isinstance(summary,basestring):
- pass
- else:
- if summary == 1:
- summary = '@"1 byte"'
- else:
- summary = '@"' + str(summary) + ' bytes"'
- return summary
- return 'Summary Unavailable'
-
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSData.NSData_SummaryProvider NSData")
- debugger.HandleCommand("type summary add -F NSData.NSData_SummaryProvider2 CFDataRef CFMutableDataRef")
+ global statistics
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "NSData GetSummary_Impl"
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ logger >> "got a wrapper summary - using it"
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name: " + name_string
+ if name_string == 'NSConcreteData' or \
+ name_string == 'NSConcreteMutableData' or \
+ name_string == '__NSCFData':
+ wrapper = NSConcreteData_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSDataUnknown_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSData_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "NSData_SummaryProvider"
+ provider = GetSummary_Impl(valobj)
+ logger >> "found a summary provider, it is: " + str(provider)
+ if provider is not None:
+ try:
+ summary = provider.length()
+ except:
+ summary = None
+ logger >> "got a summary: it is " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSData>'
+ elif isinstance(summary, basestring):
+ pass
+ else:
+ if summary == 1:
+ summary = '1 byte'
+ else:
+ summary = str(summary) + ' bytes'
+ return summary
+ return 'Summary Unavailable'
+
+
+def NSData_SummaryProvider2(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "NSData_SummaryProvider2"
+ provider = GetSummary_Impl(valobj)
+ logger >> "found a summary provider, it is: " + str(provider)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.length()
+ except:
+ summary = None
+ logger >> "got a summary: it is " + str(summary)
+ if summary is None:
+ summary = '<variable is not CFData>'
+ elif isinstance(summary, basestring):
+ pass
+ else:
+ if summary == 1:
+ summary = '@"1 byte"'
+ else:
+ summary = '@"' + str(summary) + ' bytes"'
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSData.NSData_SummaryProvider NSData")
+ debugger.HandleCommand(
+ "type summary add -F NSData.NSData_SummaryProvider2 CFDataRef CFMutableDataRef")
Modified: lldb/trunk/examples/summaries/cocoa/NSDate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSDate.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSDate.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSDate.py Tue Sep 6 15:57:50 2016
@@ -27,243 +27,281 @@ statistics.add_metric('code_notrun')
# hence, all we need to know is the epoch year
python_epoch = time.gmtime(0).tm_year
-osx_epoch = datetime.date(2001,1,1).timetuple()
+osx_epoch = datetime.date(2001, 1, 1).timetuple()
+
def mkgmtime(t):
- logger = lldb.formatters.Logger.Logger()
- return time.mktime(t)-time.timezone
+ logger = lldb.formatters.Logger.Logger()
+ return time.mktime(t) - time.timezone
osx_epoch = mkgmtime(osx_epoch)
+
def osx_to_python_time(osx):
- logger = lldb.formatters.Logger.Logger()
- if python_epoch <= 2001:
- return osx + osx_epoch
- else:
- return osx - osx_epoch
+ logger = lldb.formatters.Logger.Logger()
+ if python_epoch <= 2001:
+ return osx + osx_epoch
+ else:
+ return osx - osx_epoch
# represent a struct_time as a string in the format used by Xcode
+
+
def xcode_format_time(X):
- logger = lldb.formatters.Logger.Logger()
- return time.strftime('%Y-%m-%d %H:%M:%S %Z',X)
+ logger = lldb.formatters.Logger.Logger()
+ return time.strftime('%Y-%m-%d %H:%M:%S %Z', X)
# represent a count-since-epoch as a string in the format used by Xcode
+
+
def xcode_format_count(X):
- logger = lldb.formatters.Logger.Logger()
- return xcode_format_time(time.localtime(X))
+ logger = lldb.formatters.Logger.Logger()
+ return xcode_format_time(time.localtime(X))
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the summary for NSDate, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSTaggedDate_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, info_bits, data, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
- # NSDate is not using its info_bits for info like NSNumber is
- # so we need to regroup info_bits and data
- self.data = ((data << 8) | (info_bits << 4))
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- # the value of the date-time object is wrapped into the pointer value
- # unfortunately, it is made as a time-delta after Jan 1 2001 midnight GMT
- # while all Python knows about is the "epoch", which is a platform-dependent
- # year (1970 of *nix) whose Jan 1 at midnight is taken as reference
- value_double = struct.unpack('d', struct.pack('Q', self.data))[0]
- if value_double == -63114076800.0:
- return '0001-12-30 00:00:00 +0000'
- return xcode_format_count(osx_to_python_time(value_double))
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, info_bits, data, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+ # NSDate is not using its info_bits for info like NSNumber is
+ # so we need to regroup info_bits and data
+ self.data = ((data << 8) | (info_bits << 4))
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ # the value of the date-time object is wrapped into the pointer value
+ # unfortunately, it is made as a time-delta after Jan 1 2001 midnight GMT
+ # while all Python knows about is the "epoch", which is a platform-dependent
+ # year (1970 of *nix) whose Jan 1 at midnight is taken as reference
+ value_double = struct.unpack('d', struct.pack('Q', self.data))[0]
+ if value_double == -63114076800.0:
+ return '0001-12-30 00:00:00 +0000'
+ return xcode_format_count(osx_to_python_time(value_double))
class NSUntaggedDate_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not (self.sys_params.types_cache.double):
- self.sys_params.types_cache.double = self.valobj.GetType().GetBasicType(lldb.eBasicTypeDouble)
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- value = self.valobj.CreateChildAtOffset("value",
- self.offset(),
- self.sys_params.types_cache.double)
- value_double = struct.unpack('d', struct.pack('Q', value.GetData().uint64[0]))[0]
- if value_double == -63114076800.0:
- return '0001-12-30 00:00:00 +0000'
- return xcode_format_count(osx_to_python_time(value_double))
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not (self.sys_params.types_cache.double):
+ self.sys_params.types_cache.double = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeDouble)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ value = self.valobj.CreateChildAtOffset(
+ "value", self.offset(), self.sys_params.types_cache.double)
+ value_double = struct.unpack(
+ 'd', struct.pack(
+ 'Q', value.GetData().uint64[0]))[0]
+ if value_double == -63114076800.0:
+ return '0001-12-30 00:00:00 +0000'
+ return xcode_format_count(osx_to_python_time(value_double))
+
class NSCalendarDate_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not (self.sys_params.types_cache.double):
- self.sys_params.types_cache.double = self.valobj.GetType().GetBasicType(lldb.eBasicTypeDouble)
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return 2*self.sys_params.pointer_size
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- value = self.valobj.CreateChildAtOffset("value",
- self.offset(),
- self.sys_params.types_cache.double)
- value_double = struct.unpack('d', struct.pack('Q', value.GetData().uint64[0]))[0]
- return xcode_format_count(osx_to_python_time(value_double))
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not (self.sys_params.types_cache.double):
+ self.sys_params.types_cache.double = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeDouble)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return 2 * self.sys_params.pointer_size
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ value = self.valobj.CreateChildAtOffset(
+ "value", self.offset(), self.sys_params.types_cache.double)
+ value_double = struct.unpack(
+ 'd', struct.pack(
+ 'Q', value.GetData().uint64[0]))[0]
+ return xcode_format_count(osx_to_python_time(value_double))
+
class NSTimeZoneClass_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not (self.sys_params.types_cache.voidptr):
- self.sys_params.types_cache.voidptr = self.valobj.GetType().GetBasicType(lldb.eBasicTypeVoid).GetPointerType()
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
-
- def timezone(self):
- logger = lldb.formatters.Logger.Logger()
- tz_string = self.valobj.CreateChildAtOffset("tz_name",
- self.offset(),
- self.sys_params.types_cache.voidptr)
- return CFString.CFString_SummaryProvider(tz_string,None)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not (self.sys_params.types_cache.voidptr):
+ self.sys_params.types_cache.voidptr = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeVoid).GetPointerType()
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def timezone(self):
+ logger = lldb.formatters.Logger.Logger()
+ tz_string = self.valobj.CreateChildAtOffset(
+ "tz_name", self.offset(), self.sys_params.types_cache.voidptr)
+ return CFString.CFString_SummaryProvider(tz_string, None)
+
class NSUnknownDate_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- expr = "(NSString*)[" + stream.GetData() + " description]"
- num_children_vo = self.valobj.CreateValueFromExpression("str",expr);
- if num_children_vo.IsValid():
- return num_children_vo.GetSummary()
- return '<variable is not NSDate>'
+ def adjust_for_architecture(self):
+ pass
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSDate' or name_string == '__NSDate' or name_string == '__NSTaggedDate':
- if class_data.is_tagged():
- wrapper = NSTaggedDate_SummaryProvider(valobj,class_data.info_bits(),class_data.value(), class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSUntaggedDate_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- elif name_string == 'NSCalendarDate':
- wrapper = NSCalendarDate_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- elif name_string == '__NSTimeZone':
- wrapper = NSTimeZoneClass_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSUnknownDate_SummaryProvider(valobj)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-
-def NSDate_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.value();
- except:
- summary = None
- if summary == None:
- summary = '<variable is not NSDate>'
- return str(summary)
- return 'Summary Unavailable'
-
-def NSTimeZone_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.timezone();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- summary = '<variable is not NSTimeZone>'
- return str(summary)
- return 'Summary Unavailable'
-
-
-def CFAbsoluteTime_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- try:
- value_double = struct.unpack('d', struct.pack('Q', valobj.GetData().uint64[0]))[0]
- return xcode_format_count(osx_to_python_time(value_double))
- except:
- return 'Summary Unavailable'
-
-
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSDate.NSDate_SummaryProvider NSDate")
- debugger.HandleCommand("type summary add -F NSDate.CFAbsoluteTime_SummaryProvider CFAbsoluteTime")
- debugger.HandleCommand("type summary add -F NSDate.NSTimeZone_SummaryProvider NSTimeZone CFTimeZoneRef")
+ def __init__(self, valobj):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ expr = "(NSString*)[" + stream.GetData() + " description]"
+ num_children_vo = self.valobj.CreateValueFromExpression("str", expr)
+ if num_children_vo.IsValid():
+ return num_children_vo.GetSummary()
+ return '<variable is not NSDate>'
+
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSDate' or name_string == '__NSDate' or name_string == '__NSTaggedDate':
+ if class_data.is_tagged():
+ wrapper = NSTaggedDate_SummaryProvider(
+ valobj, class_data.info_bits(), class_data.value(), class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSUntaggedDate_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ elif name_string == 'NSCalendarDate':
+ wrapper = NSCalendarDate_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ elif name_string == '__NSTimeZone':
+ wrapper = NSTimeZoneClass_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSUnknownDate_SummaryProvider(valobj)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSDate_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.value()
+ except:
+ summary = None
+ if summary is None:
+ summary = '<variable is not NSDate>'
+ return str(summary)
+ return 'Summary Unavailable'
+
+
+def NSTimeZone_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.timezone()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSTimeZone>'
+ return str(summary)
+ return 'Summary Unavailable'
+
+
+def CFAbsoluteTime_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ value_double = struct.unpack(
+ 'd', struct.pack(
+ 'Q', valobj.GetData().uint64[0]))[0]
+ return xcode_format_count(osx_to_python_time(value_double))
+ except:
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSDate.NSDate_SummaryProvider NSDate")
+ debugger.HandleCommand(
+ "type summary add -F NSDate.CFAbsoluteTime_SummaryProvider CFAbsoluteTime")
+ debugger.HandleCommand(
+ "type summary add -F NSDate.NSTimeZone_SummaryProvider NSTimeZone CFTimeZoneRef")
Modified: lldb/trunk/examples/summaries/cocoa/NSException.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSException.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSException.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSException.py Tue Sep 6 15:57:50 2016
@@ -18,97 +18,117 @@ statistics.add_metric('invalid_pointer')
statistics.add_metric('unknown_class')
statistics.add_metric('code_notrun')
+
class NSKnownException_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not (self.sys_params.types_cache.id):
- self.sys_params.types_cache.id = self.valobj.GetType().GetBasicType(lldb.eBasicTypeObjCID)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def offset_name(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
- def offset_reason(self):
- logger = lldb.formatters.Logger.Logger()
- return 2*self.sys_params.pointer_size
-
- def description(self):
- logger = lldb.formatters.Logger.Logger()
- name_ptr = self.valobj.CreateChildAtOffset("name",
- self.offset_name(),
- self.sys_params.types_cache.id)
- reason_ptr = self.valobj.CreateChildAtOffset("reason",
- self.offset_reason(),
- self.sys_params.types_cache.id)
- return 'name:' + CFString.CFString_SummaryProvider(name_ptr,None) + ' reason:' + CFString.CFString_SummaryProvider(reason_ptr,None)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not (self.sys_params.types_cache.id):
+ self.sys_params.types_cache.id = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeObjCID)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def offset_name(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def offset_reason(self):
+ logger = lldb.formatters.Logger.Logger()
+ return 2 * self.sys_params.pointer_size
+
+ def description(self):
+ logger = lldb.formatters.Logger.Logger()
+ name_ptr = self.valobj.CreateChildAtOffset(
+ "name", self.offset_name(), self.sys_params.types_cache.id)
+ reason_ptr = self.valobj.CreateChildAtOffset(
+ "reason", self.offset_reason(), self.sys_params.types_cache.id)
+ return 'name:' + CFString.CFString_SummaryProvider(
+ name_ptr, None) + ' reason:' + CFString.CFString_SummaryProvider(reason_ptr, None)
+
class NSUnknownException_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def description(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- name_vo = self.valobj.CreateValueFromExpression("name","(NSString*)[" + stream.GetData() + " name]");
- reason_vo = self.valobj.CreateValueFromExpression("reason","(NSString*)[" + stream.GetData() + " reason]");
- if name_vo.IsValid() and reason_vo.IsValid():
- return CFString.CFString_SummaryProvider(name_vo,None) + ' ' + CFString.CFString_SummaryProvider(reason_vo,None)
- return '<variable is not NSException>'
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def description(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ name_vo = self.valobj.CreateValueFromExpression(
+ "name", "(NSString*)[" + stream.GetData() + " name]")
+ reason_vo = self.valobj.CreateValueFromExpression(
+ "reason", "(NSString*)[" + stream.GetData() + " reason]")
+ if name_vo.IsValid() and reason_vo.IsValid():
+ return CFString.CFString_SummaryProvider(
+ name_vo, None) + ' ' + CFString.CFString_SummaryProvider(reason_vo, None)
+ return '<variable is not NSException>'
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSException':
- wrapper = NSKnownException_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSUnknownException_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def NSException_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.description();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- summary = '<variable is not NSException>'
- return str(summary)
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSException.NSException_SummaryProvider NSException")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSException':
+ wrapper = NSKnownException_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSUnknownException_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSException_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.description()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSException>'
+ return str(summary)
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSException.NSException_SummaryProvider NSException")
Modified: lldb/trunk/examples/summaries/cocoa/NSIndexSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSIndexSet.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSIndexSet.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSIndexSet.py Tue Sep 6 15:57:50 2016
@@ -22,129 +22,155 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the count of values for an NSIndexSet, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSIndexSetClass_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- if not(self.sys_params.types_cache.uint32):
- self.sys_params.types_cache.uint32 = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # NS(Mutable)IndexSet works in one of two modes: when having a compact block of data (e.g. a Range)
- # the count is stored in the set itself, 3 pointers into it
- # otherwise, it will store a pointer to an additional data structure (2 pointers into itself) and this
- # additional structure will contain the count two pointers deep
- # a bunch of flags allow us to detect an empty set, vs. a one-range set, vs. a multi-range set
- def count(self):
- logger = lldb.formatters.Logger.Logger()
- mode_chooser_vo = self.valobj.CreateChildAtOffset("mode_chooser",
- self.sys_params.pointer_size,
- self.sys_params.types_cache.uint32)
- mode_chooser = mode_chooser_vo.GetValueAsUnsigned(0)
- if self.sys_params.is_64_bit:
- mode_chooser = mode_chooser & 0x00000000FFFFFFFF
- # empty set
- if mode_chooser & 0x01 == 1:
- return 0
- # single range
- if mode_chooser & 0x02 == 2:
- mode = 1
- # multi range
- else:
- mode = 2
- if mode == 1:
- count_vo = self.valobj.CreateChildAtOffset("count",
- 3*self.sys_params.pointer_size,
- self.sys_params.types_cache.NSUInteger)
- else:
- count_ptr = self.valobj.CreateChildAtOffset("count_ptr",
- 2*self.sys_params.pointer_size,
- self.sys_params.types_cache.NSUInteger)
- count_vo = self.valobj.CreateValueFromAddress("count",
- count_ptr.GetValueAsUnsigned()+2*self.sys_params.pointer_size,
- self.sys_params.types_cache.NSUInteger)
- return count_vo.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ self.sys_params.types_cache.uint32 = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.sys_params.types_cache.uint32 = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ if not(self.sys_params.types_cache.uint32):
+ self.sys_params.types_cache.uint32 = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # NS(Mutable)IndexSet works in one of two modes: when having a compact block of data (e.g. a Range)
+ # the count is stored in the set itself, 3 pointers into it
+ # otherwise, it will store a pointer to an additional data structure (2 pointers into itself) and this
+ # additional structure will contain the count two pointers deep
+ # a bunch of flags allow us to detect an empty set, vs. a one-range set,
+ # vs. a multi-range set
+ def count(self):
+ logger = lldb.formatters.Logger.Logger()
+ mode_chooser_vo = self.valobj.CreateChildAtOffset(
+ "mode_chooser",
+ self.sys_params.pointer_size,
+ self.sys_params.types_cache.uint32)
+ mode_chooser = mode_chooser_vo.GetValueAsUnsigned(0)
+ if self.sys_params.is_64_bit:
+ mode_chooser = mode_chooser & 0x00000000FFFFFFFF
+ # empty set
+ if mode_chooser & 0x01 == 1:
+ return 0
+ # single range
+ if mode_chooser & 0x02 == 2:
+ mode = 1
+ # multi range
+ else:
+ mode = 2
+ if mode == 1:
+ count_vo = self.valobj.CreateChildAtOffset(
+ "count",
+ 3 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.NSUInteger)
+ else:
+ count_ptr = self.valobj.CreateChildAtOffset(
+ "count_ptr",
+ 2 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.NSUInteger)
+ count_vo = self.valobj.CreateValueFromAddress(
+ "count",
+ count_ptr.GetValueAsUnsigned() +
+ 2 *
+ self.sys_params.pointer_size,
+ self.sys_params.types_cache.NSUInteger)
+ return count_vo.GetValueAsUnsigned(0)
-class NSIndexSetUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def count(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- expr = "(int)[" + stream.GetData() + " count]"
- num_children_vo = self.valobj.CreateValueFromExpression("count",expr)
- if num_children_vo.IsValid():
- return num_children_vo.GetValueAsUnsigned(0)
- return '<variable is not NSIndexSet>'
+class NSIndexSetUnknown_SummaryProvider:
+ def adjust_for_architecture(self):
+ pass
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSIndexSet' or name_string == 'NSMutableIndexSet':
- wrapper = NSIndexSetClass_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSIndexSetUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-
-def NSIndexSet_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.count();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- summary = '<variable is not NSIndexSet>'
- if isinstance(summary, basestring):
- return summary
- else:
- summary = str(summary) + (' indexes' if summary != 1 else ' index')
- return summary
- return 'Summary Unavailable'
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def count(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ expr = "(int)[" + stream.GetData() + " count]"
+ num_children_vo = self.valobj.CreateValueFromExpression("count", expr)
+ if num_children_vo.IsValid():
+ return num_children_vo.GetValueAsUnsigned(0)
+ return '<variable is not NSIndexSet>'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSIndexSet.NSIndexSet_SummaryProvider NSIndexSet NSMutableIndexSet")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSIndexSet' or name_string == 'NSMutableIndexSet':
+ wrapper = NSIndexSetClass_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSIndexSetUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSIndexSet_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.count()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSIndexSet>'
+ if isinstance(summary, basestring):
+ return summary
+ else:
+ summary = str(summary) + (' indexes' if summary != 1 else ' index')
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSIndexSet.NSIndexSet_SummaryProvider NSIndexSet NSMutableIndexSet")
Modified: lldb/trunk/examples/summaries/cocoa/NSMachPort.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSMachPort.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSMachPort.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSMachPort.py Tue Sep 6 15:57:50 2016
@@ -22,102 +22,120 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the port number of an NSMachPort, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSMachPortKnown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # one pointer is the ISA
- # then we have one other internal pointer, plus
- # 4 bytes worth of flags. hence, these values
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- if self.sys_params.is_64_bit:
- return 20
- else:
- return 12
-
- def port(self):
- logger = lldb.formatters.Logger.Logger()
- vport = self.valobj.CreateChildAtOffset("port",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- return vport.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # one pointer is the ISA
+ # then we have one other internal pointer, plus
+ # 4 bytes worth of flags. hence, these values
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.sys_params.is_64_bit:
+ return 20
+ else:
+ return 12
+
+ def port(self):
+ logger = lldb.formatters.Logger.Logger()
+ vport = self.valobj.CreateChildAtOffset(
+ "port", self.offset(), self.sys_params.types_cache.NSUInteger)
+ return vport.GetValueAsUnsigned(0)
class NSMachPortUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def port(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- num_children_vo = self.valobj.CreateValueFromExpression("port","(int)[" + stream.GetData() + " machPort]")
- if num_children_vo.IsValid():
- return num_children_vo.GetValueAsUnsigned(0)
- return '<variable is not NSMachPort>'
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def port(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ num_children_vo = self.valobj.CreateValueFromExpression(
+ "port", "(int)[" + stream.GetData() + " machPort]")
+ if num_children_vo.IsValid():
+ return num_children_vo.GetValueAsUnsigned(0)
+ return '<variable is not NSMachPort>'
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSMachPort':
- wrapper = NSMachPortKnown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSMachPortUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def NSMachPort_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.port();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- summary = '<variable is not NSMachPort>'
- if isinstance(summary, basestring):
- return summay
- return 'mach port: ' + str(summary)
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSMachPort.NSMachPort_SummaryProvider NSMachPort")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSMachPort':
+ wrapper = NSMachPortKnown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSMachPortUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSMachPort_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.port()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSMachPort>'
+ if isinstance(summary, basestring):
+ return summay
+ return 'mach port: ' + str(summary)
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSMachPort.NSMachPort_SummaryProvider NSMachPort")
Modified: lldb/trunk/examples/summaries/cocoa/NSNotification.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSNotification.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSNotification.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSNotification.py Tue Sep 6 15:57:50 2016
@@ -19,92 +19,108 @@ statistics.add_metric('invalid_pointer')
statistics.add_metric('unknown_class')
statistics.add_metric('code_notrun')
+
class NSConcreteNotification_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not (self.sys_params.types_cache.id):
- self.sys_params.types_cache.id = self.valobj.GetType().GetBasicType(lldb.eBasicTypeObjCID)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # skip the ISA and go to the name pointer
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
-
- def name(self):
- logger = lldb.formatters.Logger.Logger()
- string_ptr = self.valobj.CreateChildAtOffset("name",
- self.offset(),
- self.sys_params.types_cache.id)
- return CFString.CFString_SummaryProvider(string_ptr,None)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not (self.sys_params.types_cache.id):
+ self.sys_params.types_cache.id = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeObjCID)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # skip the ISA and go to the name pointer
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def name(self):
+ logger = lldb.formatters.Logger.Logger()
+ string_ptr = self.valobj.CreateChildAtOffset(
+ "name", self.offset(), self.sys_params.types_cache.id)
+ return CFString.CFString_SummaryProvider(string_ptr, None)
class NSNotificationUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def name(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- name_vo = self.valobj.CreateValueFromExpression("name","(NSString*)[" + stream.GetData() + " name]")
- if name_vo.IsValid():
- return CFString.CFString_SummaryProvider(name_vo,None)
- return '<variable is not NSNotification>'
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def name(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ name_vo = self.valobj.CreateValueFromExpression(
+ "name", "(NSString*)[" + stream.GetData() + " name]")
+ if name_vo.IsValid():
+ return CFString.CFString_SummaryProvider(name_vo, None)
+ return '<variable is not NSNotification>'
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSConcreteNotification':
- wrapper = NSConcreteNotification_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSNotificationUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def NSNotification_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.name();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- summary = '<variable is not NSNotification>'
- return str(summary)
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSNotification.NSNotification_SummaryProvider NSNotification")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSConcreteNotification':
+ wrapper = NSConcreteNotification_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSNotificationUnknown_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSNotification_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.name()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSNotification>'
+ return str(summary)
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSNotification.NSNotification_SummaryProvider NSNotification")
Modified: lldb/trunk/examples/summaries/cocoa/NSNumber.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSNumber.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSNumber.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSNumber.py Tue Sep 6 15:57:50 2016
@@ -23,213 +23,247 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the port number of an NSNumber, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSTaggedNumber_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, info_bits, data, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.info_bits = info_bits
- self.data = data
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- # in spite of the plenty of types made available by the public NSNumber API
- # only a bunch of these are actually used in the internal implementation
- # unfortunately, the original type information appears to be lost
- # so we try to at least recover the proper magnitude of the data
- if self.info_bits == 0:
- return '(char)' + str(ord(ctypes.c_char(chr(self.data % 256)).value))
- if self.info_bits == 4:
- return '(short)' + str(ctypes.c_short(self.data % (256*256)).value)
- if self.info_bits == 8:
- return '(int)' + str(ctypes.c_int(self.data % (256*256*256*256)).value)
- if self.info_bits == 12:
- return '(long)' + str(ctypes.c_long(self.data).value)
- else:
- return 'unexpected value:(info=' + str(self.info_bits) + ", value = " + str(self.data) + ')'
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, info_bits, data, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.info_bits = info_bits
+ self.data = data
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ # in spite of the plenty of types made available by the public NSNumber API
+ # only a bunch of these are actually used in the internal implementation
+ # unfortunately, the original type information appears to be lost
+ # so we try to at least recover the proper magnitude of the data
+ if self.info_bits == 0:
+ return '(char)' + \
+ str(ord(ctypes.c_char(chr(self.data % 256)).value))
+ if self.info_bits == 4:
+ return '(short)' + \
+ str(ctypes.c_short(self.data % (256 * 256)).value)
+ if self.info_bits == 8:
+ return '(int)' + str(ctypes.c_int(self.data %
+ (256 * 256 * 256 * 256)).value)
+ if self.info_bits == 12:
+ return '(long)' + str(ctypes.c_long(self.data).value)
+ else:
+ return 'unexpected value:(info=' + str(self.info_bits) + \
+ ", value = " + str(self.data) + ')'
class NSUntaggedNumber_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.char):
- self.sys_params.types_cache.char = self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)
- if not(self.sys_params.types_cache.short):
- self.sys_params.types_cache.short = self.valobj.GetType().GetBasicType(lldb.eBasicTypeShort)
- if not(self.sys_params.types_cache.ushort):
- self.sys_params.types_cache.ushort = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedShort)
- if not(self.sys_params.types_cache.int):
- self.sys_params.types_cache.int = self.valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
- if not(self.sys_params.types_cache.long):
- self.sys_params.types_cache.long = self.valobj.GetType().GetBasicType(lldb.eBasicTypeLong)
- if not(self.sys_params.types_cache.ulong):
- self.sys_params.types_cache.ulong = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- if not(self.sys_params.types_cache.longlong):
- self.sys_params.types_cache.longlong = self.valobj.GetType().GetBasicType(lldb.eBasicTypeLongLong)
- if not(self.sys_params.types_cache.ulonglong):
- self.sys_params.types_cache.ulonglong = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLongLong)
- if not(self.sys_params.types_cache.float):
- self.sys_params.types_cache.float = self.valobj.GetType().GetBasicType(lldb.eBasicTypeFloat)
- if not(self.sys_params.types_cache.double):
- self.sys_params.types_cache.double = self.valobj.GetType().GetBasicType(lldb.eBasicTypeDouble)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- # we need to skip the ISA, then the next byte tells us what to read
- # we then skip one other full pointer worth of data and then fetch the contents
- # if we are fetching an int64 value, one more pointer must be skipped to get at our data
- data_type_vo = self.valobj.CreateChildAtOffset("dt",
- self.sys_params.pointer_size,
- self.sys_params.types_cache.char)
- data_type = ((data_type_vo.GetValueAsUnsigned(0) % 256) & 0x1F)
- data_offset = 2 * self.sys_params.pointer_size
- if data_type == 0B00001:
- data_vo = self.valobj.CreateChildAtOffset("data",
- data_offset,
- self.sys_params.types_cache.char)
- statistics.metric_hit('code_notrun',self.valobj)
- return '(char)' + str(ord(ctypes.c_char(chr(data_vo.GetValueAsUnsigned(0))).value))
- elif data_type == 0B0010:
- data_vo = self.valobj.CreateChildAtOffset("data",
- data_offset,
- self.sys_params.types_cache.short)
- statistics.metric_hit('code_notrun',self.valobj)
- return '(short)' + str(ctypes.c_short(data_vo.GetValueAsUnsigned(0) % (256*256)).value)
- # IF tagged pointers are possible on 32bit+v2 runtime
- # (of which the only existing instance should be iOS)
- # then values of this type might be tagged
- elif data_type == 0B0011:
- data_vo = self.valobj.CreateChildAtOffset("data",
- data_offset,
- self.sys_params.types_cache.int)
- statistics.metric_hit('code_notrun',self.valobj)
- return '(int)' + str(ctypes.c_int(data_vo.GetValueAsUnsigned(0)% (256*256*256*256)).value)
- # apparently, on is_64_bit architectures, these are the only values that will ever
- # be represented by a non tagged pointers
- elif data_type == 0B10001:
- data_offset = data_offset + 8 # 8 is needed even if we are on 32bit
- data_vo = self.valobj.CreateChildAtOffset("data",
- data_offset,
- self.sys_params.types_cache.longlong)
- statistics.metric_hit('code_notrun',self.valobj)
- return '(long)' + str(ctypes.c_long(data_vo.GetValueAsUnsigned(0)).value)
- elif data_type == 0B0100:
- if self.sys_params.is_64_bit:
- data_offset = data_offset + self.sys_params.pointer_size
- data_vo = self.valobj.CreateChildAtOffset("data",
- data_offset,
- self.sys_params.types_cache.longlong)
- statistics.metric_hit('code_notrun',self.valobj)
- return '(long)' + str(ctypes.c_long(data_vo.GetValueAsUnsigned(0)).value)
- elif data_type == 0B0101:
- data_vo = self.valobj.CreateChildAtOffset("data",
- data_offset,
- self.sys_params.types_cache.longlong)
- data_plain = int(str(data_vo.GetValueAsUnsigned(0) & 0x00000000FFFFFFFF))
- packed = struct.pack('I', data_plain)
- data_float = struct.unpack('f', packed)[0]
- statistics.metric_hit('code_notrun',self.valobj)
- return '(float)' + str(data_float)
- elif data_type == 0B0110:
- data_vo = self.valobj.CreateChildAtOffset("data",
- data_offset,
- self.sys_params.types_cache.longlong)
- data_plain = data_vo.GetValueAsUnsigned(0)
- data_double = struct.unpack('d', struct.pack('Q', data_plain))[0]
- statistics.metric_hit('code_notrun',self.valobj)
- return '(double)' + str(data_double)
- statistics.metric_hit('unknown_class',str(valobj.GetName()) + " had unknown data_type " + str(data_type))
- return 'unexpected: dt = ' + str(data_type)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.char):
+ self.sys_params.types_cache.char = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeChar)
+ if not(self.sys_params.types_cache.short):
+ self.sys_params.types_cache.short = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeShort)
+ if not(self.sys_params.types_cache.ushort):
+ self.sys_params.types_cache.ushort = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedShort)
+ if not(self.sys_params.types_cache.int):
+ self.sys_params.types_cache.int = self.valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
+ if not(self.sys_params.types_cache.long):
+ self.sys_params.types_cache.long = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeLong)
+ if not(self.sys_params.types_cache.ulong):
+ self.sys_params.types_cache.ulong = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ if not(self.sys_params.types_cache.longlong):
+ self.sys_params.types_cache.longlong = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeLongLong)
+ if not(self.sys_params.types_cache.ulonglong):
+ self.sys_params.types_cache.ulonglong = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLongLong)
+ if not(self.sys_params.types_cache.float):
+ self.sys_params.types_cache.float = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeFloat)
+ if not(self.sys_params.types_cache.double):
+ self.sys_params.types_cache.double = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeDouble)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ # we need to skip the ISA, then the next byte tells us what to read
+ # we then skip one other full pointer worth of data and then fetch the contents
+ # if we are fetching an int64 value, one more pointer must be skipped
+ # to get at our data
+ data_type_vo = self.valobj.CreateChildAtOffset(
+ "dt", self.sys_params.pointer_size, self.sys_params.types_cache.char)
+ data_type = ((data_type_vo.GetValueAsUnsigned(0) % 256) & 0x1F)
+ data_offset = 2 * self.sys_params.pointer_size
+ if data_type == 0B00001:
+ data_vo = self.valobj.CreateChildAtOffset(
+ "data", data_offset, self.sys_params.types_cache.char)
+ statistics.metric_hit('code_notrun', self.valobj)
+ return '(char)' + \
+ str(ord(ctypes.c_char(chr(data_vo.GetValueAsUnsigned(0))).value))
+ elif data_type == 0B0010:
+ data_vo = self.valobj.CreateChildAtOffset(
+ "data", data_offset, self.sys_params.types_cache.short)
+ statistics.metric_hit('code_notrun', self.valobj)
+ return '(short)' + str(
+ ctypes.c_short(
+ data_vo.GetValueAsUnsigned(0) %
+ (256 * 256)).value)
+ # IF tagged pointers are possible on 32bit+v2 runtime
+ # (of which the only existing instance should be iOS)
+ # then values of this type might be tagged
+ elif data_type == 0B0011:
+ data_vo = self.valobj.CreateChildAtOffset(
+ "data", data_offset, self.sys_params.types_cache.int)
+ statistics.metric_hit('code_notrun', self.valobj)
+ return '(int)' + str(ctypes.c_int(data_vo.GetValueAsUnsigned(0) %
+ (256 * 256 * 256 * 256)).value)
+ # apparently, on is_64_bit architectures, these are the only values that will ever
+ # be represented by a non tagged pointers
+ elif data_type == 0B10001:
+ data_offset = data_offset + 8 # 8 is needed even if we are on 32bit
+ data_vo = self.valobj.CreateChildAtOffset(
+ "data", data_offset, self.sys_params.types_cache.longlong)
+ statistics.metric_hit('code_notrun', self.valobj)
+ return '(long)' + \
+ str(ctypes.c_long(data_vo.GetValueAsUnsigned(0)).value)
+ elif data_type == 0B0100:
+ if self.sys_params.is_64_bit:
+ data_offset = data_offset + self.sys_params.pointer_size
+ data_vo = self.valobj.CreateChildAtOffset(
+ "data", data_offset, self.sys_params.types_cache.longlong)
+ statistics.metric_hit('code_notrun', self.valobj)
+ return '(long)' + \
+ str(ctypes.c_long(data_vo.GetValueAsUnsigned(0)).value)
+ elif data_type == 0B0101:
+ data_vo = self.valobj.CreateChildAtOffset(
+ "data", data_offset, self.sys_params.types_cache.longlong)
+ data_plain = int(
+ str(data_vo.GetValueAsUnsigned(0) & 0x00000000FFFFFFFF))
+ packed = struct.pack('I', data_plain)
+ data_float = struct.unpack('f', packed)[0]
+ statistics.metric_hit('code_notrun', self.valobj)
+ return '(float)' + str(data_float)
+ elif data_type == 0B0110:
+ data_vo = self.valobj.CreateChildAtOffset(
+ "data", data_offset, self.sys_params.types_cache.longlong)
+ data_plain = data_vo.GetValueAsUnsigned(0)
+ data_double = struct.unpack('d', struct.pack('Q', data_plain))[0]
+ statistics.metric_hit('code_notrun', self.valobj)
+ return '(double)' + str(data_double)
+ statistics.metric_hit(
+ 'unknown_class', str(
+ valobj.GetName()) + " had unknown data_type " + str(data_type))
+ return 'unexpected: dt = ' + str(data_type)
class NSUnknownNumber_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- expr = "(NSString*)[" + stream.GetData() + " stringValue]"
- num_children_vo = self.valobj.CreateValueFromExpression("str",expr)
- if num_children_vo.IsValid():
- return num_children_vo.GetSummary()
- return '<variable is not NSNumber>'
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ expr = "(NSString*)[" + stream.GetData() + " stringValue]"
+ num_children_vo = self.valobj.CreateValueFromExpression("str", expr)
+ if num_children_vo.IsValid():
+ return num_children_vo.GetSummary()
+ return '<variable is not NSNumber>'
+
def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSNumber' or name_string == '__NSCFNumber':
- if class_data.is_tagged():
- wrapper = NSTaggedNumber_SummaryProvider(valobj,class_data.info_bits(),class_data.value(), class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- # the wrapper might be unable to decipher what is into the NSNumber
- # and then have to run code on it
- wrapper = NSUntaggedNumber_SummaryProvider(valobj, class_data.sys_params)
- else:
- wrapper = NSUnknownNumber_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-
-def NSNumber_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.value();
- except Exception as foo:
- print foo
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSNumber' or name_string == '__NSCFNumber':
+ if class_data.is_tagged():
+ wrapper = NSTaggedNumber_SummaryProvider(
+ valobj, class_data.info_bits(), class_data.value(), class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ # the wrapper might be unable to decipher what is into the NSNumber
+ # and then have to run code on it
+ wrapper = NSUntaggedNumber_SummaryProvider(
+ valobj, class_data.sys_params)
+ else:
+ wrapper = NSUnknownNumber_SummaryProvider(
+ valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSNumber_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.value()
+ except Exception as foo:
+ print foo
# except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None:
- summary = '<variable is not NSNumber>'
- return str(summary)
- return 'Summary Unavailable'
-
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None:
+ summary = '<variable is not NSNumber>'
+ return str(summary)
+ return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSNumber.NSNumber_SummaryProvider NSNumber")
- debugger.HandleCommand("type summary add -F NSNumber.NSNumber_SummaryProvider __NSCFBoolean")
- debugger.HandleCommand("type summary add -F NSNumber.NSNumber_SummaryProvider __NSCFNumber")
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSNumber.NSNumber_SummaryProvider NSNumber")
+ debugger.HandleCommand(
+ "type summary add -F NSNumber.NSNumber_SummaryProvider __NSCFBoolean")
+ debugger.HandleCommand(
+ "type summary add -F NSNumber.NSNumber_SummaryProvider __NSCFNumber")
Modified: lldb/trunk/examples/summaries/cocoa/NSSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSSet.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSSet.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSSet.py Tue Sep 6 15:57:50 2016
@@ -22,242 +22,268 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the port number of an NSMachPort, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSCFSet_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # one pointer is the ISA
- # then we have one other internal pointer, plus
- # 4 bytes worth of flags. hence, these values
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- if self.sys_params.is_64_bit:
- return 20
- else:
- return 12
-
- def count(self):
- logger = lldb.formatters.Logger.Logger()
- vcount = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- return vcount.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # one pointer is the ISA
+ # then we have one other internal pointer, plus
+ # 4 bytes worth of flags. hence, these values
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.sys_params.is_64_bit:
+ return 20
+ else:
+ return 12
+
+ def count(self):
+ logger = lldb.formatters.Logger.Logger()
+ vcount = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ return vcount.GetValueAsUnsigned(0)
class NSSetUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def count(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- expr = "(int)[" + stream.GetData() + " count]"
- num_children_vo = self.valobj.CreateValueFromExpression("count",expr)
- if num_children_vo.IsValid():
- return num_children_vo.GetValueAsUnsigned(0)
- return '<variable is not NSSet>'
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def count(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ expr = "(int)[" + stream.GetData() + " count]"
+ num_children_vo = self.valobj.CreateValueFromExpression("count", expr)
+ if num_children_vo.IsValid():
+ return num_children_vo.GetValueAsUnsigned(0)
+ return '<variable is not NSSet>'
+
class NSSetI_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # we just need to skip the ISA and the count immediately follows
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
-
- def count(self):
- logger = lldb.formatters.Logger.Logger()
- num_children_vo = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- value = num_children_vo.GetValueAsUnsigned(0)
- if value != None:
- # the MSB on immutable sets seems to be taken by some other data
- # not sure if it is a bug or some weird sort of feature, but masking it out
- # gets the count right (unless, of course, someone's dictionaries grow
- # too large - but I have not tested this)
- if self.sys_params.is_64_bit:
- value = value & ~0xFF00000000000000
- else:
- value = value & ~0xFF000000
- return value
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # we just need to skip the ISA and the count immediately follows
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def count(self):
+ logger = lldb.formatters.Logger.Logger()
+ num_children_vo = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ value = num_children_vo.GetValueAsUnsigned(0)
+ if value is not None:
+ # the MSB on immutable sets seems to be taken by some other data
+ # not sure if it is a bug or some weird sort of feature, but masking it out
+ # gets the count right (unless, of course, someone's dictionaries grow
+ # too large - but I have not tested this)
+ if self.sys_params.is_64_bit:
+ value = value & ~0xFF00000000000000
+ else:
+ value = value & ~0xFF000000
+ return value
+
class NSSetM_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSUInteger):
- if self.sys_params.is_64_bit:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- else:
- self.sys_params.types_cache.NSUInteger = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # we just need to skip the ISA and the count immediately follows
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
-
- def count(self):
- logger = lldb.formatters.Logger.Logger()
- num_children_vo = self.valobj.CreateChildAtOffset("count",
- self.offset(),
- self.sys_params.types_cache.NSUInteger)
- return num_children_vo.GetValueAsUnsigned(0)
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSUInteger):
+ if self.sys_params.is_64_bit:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ else:
+ self.sys_params.types_cache.NSUInteger = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # we just need to skip the ISA and the count immediately follows
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def count(self):
+ logger = lldb.formatters.Logger.Logger()
+ num_children_vo = self.valobj.CreateChildAtOffset(
+ "count", self.offset(), self.sys_params.types_cache.NSUInteger)
+ return num_children_vo.GetValueAsUnsigned(0)
class NSCountedSet_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not (self.sys_params.types_cache.voidptr):
- self.sys_params.types_cache.voidptr = self.valobj.GetType().GetBasicType(lldb.eBasicTypeVoid).GetPointerType()
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # an NSCountedSet is implemented using a CFBag whose pointer just follows the ISA
- def offset(self):
- logger = lldb.formatters.Logger.Logger()
- return self.sys_params.pointer_size
-
- def count(self):
- logger = lldb.formatters.Logger.Logger()
- cfbag_vo = self.valobj.CreateChildAtOffset("bag_impl",
- self.offset(),
- self.sys_params.types_cache.voidptr)
- return CFBag.CFBagRef_SummaryProvider(cfbag_vo,self.sys_params).length()
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not (self.sys_params.types_cache.voidptr):
+ self.sys_params.types_cache.voidptr = self.valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeVoid).GetPointerType()
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # an NSCountedSet is implemented using a CFBag whose pointer just follows
+ # the ISA
+ def offset(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.sys_params.pointer_size
+
+ def count(self):
+ logger = lldb.formatters.Logger.Logger()
+ cfbag_vo = self.valobj.CreateChildAtOffset(
+ "bag_impl", self.offset(), self.sys_params.types_cache.voidptr)
+ return CFBag.CFBagRef_SummaryProvider(
+ cfbag_vo, self.sys_params).length()
def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == '__NSCFSet':
- wrapper = NSCFSet_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- elif name_string == '__NSSetI':
- wrapper = NSSetI_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- elif name_string == '__NSSetM':
- wrapper = NSSetM_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- elif name_string == 'NSCountedSet':
- wrapper = NSCountedSet_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSSetUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-
-def NSSet_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- try:
- summary = provider.count();
- except:
- summary = None
- if summary == None:
- summary = '<variable is not NSSet>'
- if isinstance(summary, basestring):
- return summary
- else:
- summary = str(summary) + (' objects' if summary != 1 else ' object')
- return summary
- return 'Summary Unavailable'
-
-def NSSet_SummaryProvider2 (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.count();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- # for some reason, one needs to clear some bits for the count returned
- # to be correct when using directly CF*SetRef as compared to NS*Set
- # this only happens on 64bit, and the bit mask was derived through
- # experimentation (if counts start looking weird, then most probably
- # the mask needs to be changed)
- if summary == None:
- summary = '<variable is not CFSet>'
- if isinstance(summary, basestring):
- return summary
- else:
- if provider.sys_params.is_64_bit:
- summary = summary & ~0x1fff000000000000
- summary = '@"' + str(summary) + (' values"' if summary != 1 else ' value"')
- return summary
- return 'Summary Unavailable'
-
-
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSSet.NSSet_SummaryProvider NSSet")
- debugger.HandleCommand("type summary add -F NSSet.NSSet_SummaryProvider2 CFSetRef CFMutableSetRef")
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == '__NSCFSet':
+ wrapper = NSCFSet_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ elif name_string == '__NSSetI':
+ wrapper = NSSetI_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ elif name_string == '__NSSetM':
+ wrapper = NSSetM_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ elif name_string == 'NSCountedSet':
+ wrapper = NSCountedSet_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSSetUnknown_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSSet_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ try:
+ summary = provider.count()
+ except:
+ summary = None
+ if summary is None:
+ summary = '<variable is not NSSet>'
+ if isinstance(summary, basestring):
+ return summary
+ else:
+ summary = str(summary) + \
+ (' objects' if summary != 1 else ' object')
+ return summary
+ return 'Summary Unavailable'
+
+
+def NSSet_SummaryProvider2(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.count()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ # for some reason, one needs to clear some bits for the count returned
+ # to be correct when using directly CF*SetRef as compared to NS*Set
+ # this only happens on 64bit, and the bit mask was derived through
+ # experimentation (if counts start looking weird, then most probably
+ # the mask needs to be changed)
+ if summary is None:
+ summary = '<variable is not CFSet>'
+ if isinstance(summary, basestring):
+ return summary
+ else:
+ if provider.sys_params.is_64_bit:
+ summary = summary & ~0x1fff000000000000
+ summary = '@"' + str(summary) + \
+ (' values"' if summary != 1 else ' value"')
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSSet.NSSet_SummaryProvider NSSet")
+ debugger.HandleCommand(
+ "type summary add -F NSSet.NSSet_SummaryProvider2 CFSetRef CFMutableSetRef")
Modified: lldb/trunk/examples/summaries/cocoa/NSURL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSURL.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSURL.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSURL.py Tue Sep 6 15:57:50 2016
@@ -22,116 +22,132 @@ statistics.add_metric('code_notrun')
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but a summary for an NSURL, so they need not
# obey the interface specification for synthetic children providers
+
+
class NSURLKnown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- if not(self.sys_params.types_cache.NSString):
- self.sys_params.types_cache.NSString = self.valobj.GetTarget().FindFirstType('NSString').GetPointerType()
- if not(self.sys_params.types_cache.NSURL):
- self.sys_params.types_cache.NSURL = self.valobj.GetTarget().FindFirstType('NSURL').GetPointerType()
- self.update();
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- # one pointer is the ISA
- # then there is one more pointer and 8 bytes of plain data
- # (which are also present on a 32-bit system)
- # then there is a pointer to an NSString which is the url text
- # optionally, the next pointer is another NSURL which is the "base"
- # of this one when doing NSURLs composition (incidentally, NSURLs can
- # recurse the base+text mechanism to any desired depth)
- def offset_text(self):
- logger = lldb.formatters.Logger.Logger()
- return 24 if self.sys_params.is_64_bit else 16
- def offset_base(self):
- logger = lldb.formatters.Logger.Logger()
- return self.offset_text()+self.sys_params.pointer_size
-
- def url_text(self):
- logger = lldb.formatters.Logger.Logger()
- text = self.valobj.CreateChildAtOffset("text",
- self.offset_text(),
- self.sys_params.types_cache.NSString)
- base = self.valobj.CreateChildAtOffset("base",
- self.offset_base(),
- self.sys_params.types_cache.NSURL)
- my_string = CFString.CFString_SummaryProvider(text,None)
- if len(my_string) > 0 and base.GetValueAsUnsigned(0) != 0:
- # remove final " from myself
- my_string = my_string[0:len(my_string)-1]
- my_string = my_string + ' -- '
- my_base_string = NSURL_SummaryProvider(base,None)
- if len(my_base_string) > 2:
- # remove @" marker from base URL string
- my_base_string = my_base_string[2:]
- my_string = my_string + my_base_string
- return my_string
+ def adjust_for_architecture(self):
+ pass
+
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ if not(self.sys_params.types_cache.NSString):
+ self.sys_params.types_cache.NSString = self.valobj.GetTarget(
+ ).FindFirstType('NSString').GetPointerType()
+ if not(self.sys_params.types_cache.NSURL):
+ self.sys_params.types_cache.NSURL = self.valobj.GetTarget(
+ ).FindFirstType('NSURL').GetPointerType()
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ # one pointer is the ISA
+ # then there is one more pointer and 8 bytes of plain data
+ # (which are also present on a 32-bit system)
+ # then there is a pointer to an NSString which is the url text
+ # optionally, the next pointer is another NSURL which is the "base"
+ # of this one when doing NSURLs composition (incidentally, NSURLs can
+ # recurse the base+text mechanism to any desired depth)
+ def offset_text(self):
+ logger = lldb.formatters.Logger.Logger()
+ return 24 if self.sys_params.is_64_bit else 16
+
+ def offset_base(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.offset_text() + self.sys_params.pointer_size
+
+ def url_text(self):
+ logger = lldb.formatters.Logger.Logger()
+ text = self.valobj.CreateChildAtOffset(
+ "text", self.offset_text(), self.sys_params.types_cache.NSString)
+ base = self.valobj.CreateChildAtOffset(
+ "base", self.offset_base(), self.sys_params.types_cache.NSURL)
+ my_string = CFString.CFString_SummaryProvider(text, None)
+ if len(my_string) > 0 and base.GetValueAsUnsigned(0) != 0:
+ # remove final " from myself
+ my_string = my_string[0:len(my_string) - 1]
+ my_string = my_string + ' -- '
+ my_base_string = NSURL_SummaryProvider(base, None)
+ if len(my_base_string) > 2:
+ # remove @" marker from base URL string
+ my_base_string = my_base_string[2:]
+ my_string = my_string + my_base_string
+ return my_string
class NSURLUnknown_SummaryProvider:
- def adjust_for_architecture(self):
- pass
- def __init__(self, valobj, params):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.sys_params = params
- self.update()
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture();
-
- def url_text(self):
- logger = lldb.formatters.Logger.Logger()
- stream = lldb.SBStream()
- self.valobj.GetExpressionPath(stream)
- url_text_vo = self.valobj.CreateValueFromExpression("url","(NSString*)[" + stream.GetData() + " description]")
- if url_text_vo.IsValid():
- return CFString.CFString_SummaryProvider(url_text_vo,None)
- return '<variable is not NSURL>'
+ def adjust_for_architecture(self):
+ pass
+ def __init__(self, valobj, params):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.sys_params = params
+ self.update()
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture()
+
+ def url_text(self):
+ logger = lldb.formatters.Logger.Logger()
+ stream = lldb.SBStream()
+ self.valobj.GetExpressionPath(stream)
+ url_text_vo = self.valobj.CreateValueFromExpression(
+ "url", "(NSString*)[" + stream.GetData() + " description]")
+ if url_text_vo.IsValid():
+ return CFString.CFString_SummaryProvider(url_text_vo, None)
+ return '<variable is not NSURL>'
-def GetSummary_Impl(valobj):
- logger = lldb.formatters.Logger.Logger()
- global statistics
- class_data,wrapper =lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
- if wrapper:
- return wrapper
-
- name_string = class_data.class_name()
- logger >> "class name is: " + str(name_string)
-
- if name_string == 'NSURL':
- wrapper = NSURLKnown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('code_notrun',valobj)
- else:
- wrapper = NSURLUnknown_SummaryProvider(valobj, class_data.sys_params)
- statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
- return wrapper;
-
-def NSURL_SummaryProvider (valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- provider = GetSummary_Impl(valobj);
- if provider != None:
- if isinstance(provider,lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
- return provider.message()
- try:
- summary = provider.url_text();
- except:
- summary = None
- logger >> "got summary " + str(summary)
- if summary == None or summary == '':
- summary = '<variable is not NSURL>'
- return summary
- return 'Summary Unavailable'
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand("type summary add -F NSURL.NSURL_SummaryProvider NSURL CFURLRef")
+def GetSummary_Impl(valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global statistics
+ class_data, wrapper = lldb.runtime.objc.objc_runtime.Utilities.prepare_class_detection(
+ valobj, statistics)
+ if wrapper:
+ return wrapper
+
+ name_string = class_data.class_name()
+ logger >> "class name is: " + str(name_string)
+
+ if name_string == 'NSURL':
+ wrapper = NSURLKnown_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit('code_notrun', valobj)
+ else:
+ wrapper = NSURLUnknown_SummaryProvider(valobj, class_data.sys_params)
+ statistics.metric_hit(
+ 'unknown_class',
+ valobj.GetName() +
+ " seen as " +
+ name_string)
+ return wrapper
+
+
+def NSURL_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ provider = GetSummary_Impl(valobj)
+ if provider is not None:
+ if isinstance(
+ provider,
+ lldb.runtime.objc.objc_runtime.SpecialSituation_Description):
+ return provider.message()
+ try:
+ summary = provider.url_text()
+ except:
+ summary = None
+ logger >> "got summary " + str(summary)
+ if summary is None or summary == '':
+ summary = '<variable is not NSURL>'
+ return summary
+ return 'Summary Unavailable'
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ "type summary add -F NSURL.NSURL_SummaryProvider NSURL CFURLRef")
Modified: lldb/trunk/examples/summaries/cocoa/Selector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/Selector.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/Selector.py (original)
+++ lldb/trunk/examples/summaries/cocoa/Selector.py Tue Sep 6 15:57:50 2016
@@ -7,8 +7,13 @@ License. See LICENSE.TXT for details.
"""
import lldb
-def SEL_Summary(valobj,dict):
- return valobj.Cast(valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType()).GetSummary()
-def SELPointer_Summary(valobj,dict):
- return valobj.CreateValueFromAddress('text',valobj.GetValueAsUnsigned(0),valobj.GetType().GetBasicType(lldb.eBasicTypeChar)).AddressOf().GetSummary()
+def SEL_Summary(valobj, dict):
+ return valobj.Cast(valobj.GetType().GetBasicType(
+ lldb.eBasicTypeChar).GetPointerType()).GetSummary()
+
+
+def SELPointer_Summary(valobj, dict):
+ return valobj.CreateValueFromAddress(
+ 'text', valobj.GetValueAsUnsigned(0), valobj.GetType().GetBasicType(
+ lldb.eBasicTypeChar)).AddressOf().GetSummary()
Modified: lldb/trunk/examples/summaries/cocoa/attrib_fromdict.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/attrib_fromdict.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/attrib_fromdict.py (original)
+++ lldb/trunk/examples/summaries/cocoa/attrib_fromdict.py Tue Sep 6 15:57:50 2016
@@ -5,34 +5,38 @@ part of The LLVM Compiler Infrastructure
This file is distributed under the University of Illinois Open Source
License. See LICENSE.TXT for details.
"""
+
+
class AttributesDictionary:
- def __init__(self, allow_reset = True):
- self.__dict__['_dictionary'] = {} # need to do it this way to prevent endless recursion
- self.__dict__['_allow_reset'] = allow_reset
-
- def __getattr__(self,name):
- if not self._check_exists(name):
- return None
- value = self._dictionary[name]
- return value
-
- def _set_impl(self,name,value):
- self._dictionary[name] = value
-
- def _check_exists(self,name):
- return name in self._dictionary
-
- def __setattr__(self,name,value):
- if self._allow_reset:
- self._set_impl(name,value)
- else:
- self.set_if_necessary(name,value)
-
- def set_if_necessary(self,name,value):
- if not self._check_exists(name):
- self._set_impl(name,value)
- return True
- return False
- def __len__(self):
- return len(self._dictionary)
\ No newline at end of file
+ def __init__(self, allow_reset=True):
+ # need to do it this way to prevent endless recursion
+ self.__dict__['_dictionary'] = {}
+ self.__dict__['_allow_reset'] = allow_reset
+
+ def __getattr__(self, name):
+ if not self._check_exists(name):
+ return None
+ value = self._dictionary[name]
+ return value
+
+ def _set_impl(self, name, value):
+ self._dictionary[name] = value
+
+ def _check_exists(self, name):
+ return name in self._dictionary
+
+ def __setattr__(self, name, value):
+ if self._allow_reset:
+ self._set_impl(name, value)
+ else:
+ self.set_if_necessary(name, value)
+
+ def set_if_necessary(self, name, value):
+ if not self._check_exists(name):
+ self._set_impl(name, value)
+ return True
+ return False
+
+ def __len__(self):
+ return len(self._dictionary)
Modified: lldb/trunk/examples/summaries/cocoa/cache.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/cache.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/cache.py (original)
+++ lldb/trunk/examples/summaries/cocoa/cache.py Tue Sep 6 15:57:50 2016
@@ -7,29 +7,30 @@ License. See LICENSE.TXT for details.
"""
import lldb.formatters.metrics
+
class Cache:
- def __init__(self):
- self.data = {}
- self.statistics = lldb.formatters.metrics.Metrics()
- self.statistics.add_metric('hit')
- self.statistics.add_metric('miss')
-
- def look_for_key(self,key):
- if key in self.data:
- return True
- return False
-
- def add_item(self,key,value,ok_to_replace=True):
- if not(ok_to_replace) and self.look_for_key(key):
- return False
- self.data[key] = value
- return True
-
- def get_value(self,key,default=None):
- if self.look_for_key(key):
- self.statistics.metric_hit('hit',key)
- return self.data[key]
- else:
- self.statistics.metric_hit('miss',key)
- return default
+ def __init__(self):
+ self.data = {}
+ self.statistics = lldb.formatters.metrics.Metrics()
+ self.statistics.add_metric('hit')
+ self.statistics.add_metric('miss')
+
+ def look_for_key(self, key):
+ if key in self.data:
+ return True
+ return False
+
+ def add_item(self, key, value, ok_to_replace=True):
+ if not(ok_to_replace) and self.look_for_key(key):
+ return False
+ self.data[key] = value
+ return True
+
+ def get_value(self, key, default=None):
+ if self.look_for_key(key):
+ self.statistics.metric_hit('hit', key)
+ return self.data[key]
+ else:
+ self.statistics.metric_hit('miss', key)
+ return default
Modified: lldb/trunk/examples/summaries/cocoa/metrics.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/metrics.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/metrics.py (original)
+++ lldb/trunk/examples/summaries/cocoa/metrics.py Tue Sep 6 15:57:50 2016
@@ -6,89 +6,107 @@ This file is distributed under the Unive
License. See LICENSE.TXT for details.
"""
import lldb
-import time, datetime
+import time
+import datetime
import inspect
+
class TimeMetrics:
- @staticmethod
- def generate(label=None):
- return TimeMetrics(label)
-
- def __init__(self,lbl=None):
- self.label = "" if lbl is None else lbl
- pass
-
- def __enter__(self):
- caller = inspect.stack()[1]
- self.function = str(caller)
- self.enter_time = time.clock()
-
- def __exit__(self, a,b,c):
- self.exit_time = time.clock()
- print("It took " + str(self.exit_time - self.enter_time) + " time units to run through " + self.function + self.label)
- return False
+
+ @staticmethod
+ def generate(label=None):
+ return TimeMetrics(label)
+
+ def __init__(self, lbl=None):
+ self.label = "" if lbl is None else lbl
+ pass
+
+ def __enter__(self):
+ caller = inspect.stack()[1]
+ self.function = str(caller)
+ self.enter_time = time.clock()
+
+ def __exit__(self, a, b, c):
+ self.exit_time = time.clock()
+ print("It took " + str(self.exit_time - self.enter_time) +
+ " time units to run through " + self.function + self.label)
+ return False
+
class Counter:
- def __init__(self):
- self.count = 0
- self.list = []
- def update(self,name):
- self.count = self.count + 1
- # avoid getting the full dump of this ValueObject just to save its metrics
- if isinstance(name,lldb.SBValue):
- self.list.append(name.GetName())
- else:
- self.list.append(str(name))
- def __str__(self):
- return str(self.count) + " times, for items [" + str(self.list) + "]"
+
+ def __init__(self):
+ self.count = 0
+ self.list = []
+
+ def update(self, name):
+ self.count = self.count + 1
+ # avoid getting the full dump of this ValueObject just to save its
+ # metrics
+ if isinstance(name, lldb.SBValue):
+ self.list.append(name.GetName())
+ else:
+ self.list.append(str(name))
+
+ def __str__(self):
+ return str(self.count) + " times, for items [" + str(self.list) + "]"
+
class MetricsPrinter_Verbose:
- def __init__(self,metrics):
- self.metrics = metrics
- def __str__(self):
- string = ""
- for key,value in self.metrics.metrics.items():
- string = string + "metric " + str(key) + ": " + str(value) + "\n"
- return string
+
+ def __init__(self, metrics):
+ self.metrics = metrics
+
+ def __str__(self):
+ string = ""
+ for key, value in self.metrics.metrics.items():
+ string = string + "metric " + str(key) + ": " + str(value) + "\n"
+ return string
+
class MetricsPrinter_Compact:
- def __init__(self,metrics):
- self.metrics = metrics
- def __str__(self):
- string = ""
- for key,value in self.metrics.metrics.items():
- string = string + "metric " + str(key) + " was hit " + str(value.count) + " times\n"
- return string
+
+ def __init__(self, metrics):
+ self.metrics = metrics
+
+ def __str__(self):
+ string = ""
+ for key, value in self.metrics.metrics.items():
+ string = string + "metric " + \
+ str(key) + " was hit " + str(value.count) + " times\n"
+ return string
+
class Metrics:
- def __init__(self):
- self.metrics = {}
- def add_metric(self,name):
- self.metrics[name] = Counter()
+ def __init__(self):
+ self.metrics = {}
+
+ def add_metric(self, name):
+ self.metrics[name] = Counter()
- def metric_hit(self,metric,trigger):
- self.metrics[metric].update(trigger)
+ def metric_hit(self, metric, trigger):
+ self.metrics[metric].update(trigger)
- def __getitem__(self,key):
- return self.metrics[key]
-
- def __getattr__(self,name):
- if name == 'compact':
- return MetricsPrinter_Compact(self)
- if name == 'verbose':
- return MetricsPrinter_Verbose(self)
- raise AttributeError("%r object has no attribute %r" %
- (type(self).__name__, name))
-
- def __str__(self):
- return str(self.verbose)
-
- def metric_success(self,metric):
- total_count = 0
- metric_count = self[metric].count
- for key,value in self.metrics.items():
- total_count = total_count + value.count
- if total_count > 0:
- return metric_count / float(total_count)
- return 0
+ def __getitem__(self, key):
+ return self.metrics[key]
+
+ def __getattr__(self, name):
+ if name == 'compact':
+ return MetricsPrinter_Compact(self)
+ if name == 'verbose':
+ return MetricsPrinter_Verbose(self)
+ raise AttributeError("%r object has no attribute %r" %
+ (type(self).__name__, name))
+
+ def __str__(self):
+ return str(self.verbose)
+
+ def metric_success(self, metric):
+ total_count = 0
+ metric_count = self[metric].count
+ for key, value in self.metrics.items():
+ total_count = total_count + value.count
+ if total_count > 0:
+ return metric_count / float(total_count)
+ return 0
Modified: lldb/trunk/examples/summaries/cocoa/objc_runtime.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/objc_runtime.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/objc_runtime.py (original)
+++ lldb/trunk/examples/summaries/cocoa/objc_runtime.py Tue Sep 6 15:57:50 2016
@@ -11,556 +11,641 @@ import lldb.formatters.attrib_fromdict
import functools
import lldb.formatters.Logger
+
class Utilities:
- @staticmethod
- def read_ascii(process, pointer,max_len=128):
- logger = lldb.formatters.Logger.Logger()
- error = lldb.SBError()
- content = None
- try:
- content = process.ReadCStringFromMemory(pointer,max_len,error)
- except:
- pass
- if content is None or len(content) == 0 or error.fail:
- return None
- return content
-
- @staticmethod
- def is_valid_pointer(pointer, pointer_size, allow_tagged=0, allow_NULL=0):
- logger = lldb.formatters.Logger.Logger()
- if pointer is None:
- return 0
- if pointer == 0:
- return allow_NULL
- if allow_tagged and (pointer % 2) == 1:
- return 1
- return ((pointer % pointer_size) == 0)
-
- # Objective-C runtime has a rule that pointers in a class_t will only have bits 0 thru 46 set
- # so if any pointer has bits 47 thru 63 high we know that this is not a valid isa
- @staticmethod
- def is_allowed_pointer(pointer):
- logger = lldb.formatters.Logger.Logger()
- if pointer is None:
- return 0
- return ((pointer & 0xFFFF800000000000) == 0)
-
- @staticmethod
- def read_child_of(valobj,offset,type):
- logger = lldb.formatters.Logger.Logger()
- if offset == 0 and type.GetByteSize() == valobj.GetByteSize():
- return valobj.GetValueAsUnsigned()
- child = valobj.CreateChildAtOffset("childUNK",offset,type)
- if child is None or child.IsValid() == 0:
- return None;
- return child.GetValueAsUnsigned()
-
- @staticmethod
- def is_valid_identifier(name):
- logger = lldb.formatters.Logger.Logger()
- if name is None:
- return None
- if len(name) == 0:
- return None
- # technically, the ObjC runtime does not enforce any rules about what name a class can have
- # in practice, the commonly used byte values for a class name are the letters, digits and some
- # symbols: $, %, -, _, .
- # WARNING: this means that you cannot use this runtime implementation if you need to deal
- # with class names that use anything but what is allowed here
- ok_values = dict.fromkeys("$%_.-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
- return all(c in ok_values for c in name)
-
- @staticmethod
- def check_is_osx_lion(target):
- logger = lldb.formatters.Logger.Logger()
- # assume the only thing that has a Foundation.framework is a Mac
- # assume anything < Lion does not even exist
- try:
- mod = target.module['Foundation']
- except:
- mod = None
- if mod is None or mod.IsValid() == 0:
- return None
- ver = mod.GetVersion()
- if ver is None or ver == []:
- return None
- return (ver[0] < 900)
-
- # a utility method that factors out code common to almost all the formatters
- # takes in an SBValue and a metrics object
- # returns a class_data and a wrapper (or None, if the runtime alone can't decide on a wrapper)
- @staticmethod
- def prepare_class_detection(valobj,statistics):
- logger = lldb.formatters.Logger.Logger()
- class_data = ObjCRuntime(valobj)
- if class_data.is_valid() == 0:
- statistics.metric_hit('invalid_pointer',valobj)
- wrapper = InvalidPointer_Description(valobj.GetValueAsUnsigned(0) == 0)
- return class_data,wrapper
- class_data = class_data.read_class_data()
- if class_data.is_valid() == 0:
- statistics.metric_hit('invalid_isa',valobj)
- wrapper = InvalidISA_Description()
- return class_data,wrapper
- if class_data.is_kvo():
- class_data = class_data.get_superclass()
- if class_data.class_name() == '_NSZombie_OriginalClass':
- wrapper = ThisIsZombie_Description()
- return class_data,wrapper
- return class_data,None
+
+ @staticmethod
+ def read_ascii(process, pointer, max_len=128):
+ logger = lldb.formatters.Logger.Logger()
+ error = lldb.SBError()
+ content = None
+ try:
+ content = process.ReadCStringFromMemory(pointer, max_len, error)
+ except:
+ pass
+ if content is None or len(content) == 0 or error.fail:
+ return None
+ return content
+
+ @staticmethod
+ def is_valid_pointer(pointer, pointer_size, allow_tagged=0, allow_NULL=0):
+ logger = lldb.formatters.Logger.Logger()
+ if pointer is None:
+ return 0
+ if pointer == 0:
+ return allow_NULL
+ if allow_tagged and (pointer % 2) == 1:
+ return 1
+ return ((pointer % pointer_size) == 0)
+
+ # Objective-C runtime has a rule that pointers in a class_t will only have bits 0 thru 46 set
+ # so if any pointer has bits 47 thru 63 high we know that this is not a
+ # valid isa
+ @staticmethod
+ def is_allowed_pointer(pointer):
+ logger = lldb.formatters.Logger.Logger()
+ if pointer is None:
+ return 0
+ return ((pointer & 0xFFFF800000000000) == 0)
+
+ @staticmethod
+ def read_child_of(valobj, offset, type):
+ logger = lldb.formatters.Logger.Logger()
+ if offset == 0 and type.GetByteSize() == valobj.GetByteSize():
+ return valobj.GetValueAsUnsigned()
+ child = valobj.CreateChildAtOffset("childUNK", offset, type)
+ if child is None or child.IsValid() == 0:
+ return None
+ return child.GetValueAsUnsigned()
+
+ @staticmethod
+ def is_valid_identifier(name):
+ logger = lldb.formatters.Logger.Logger()
+ if name is None:
+ return None
+ if len(name) == 0:
+ return None
+ # technically, the ObjC runtime does not enforce any rules about what name a class can have
+ # in practice, the commonly used byte values for a class name are the letters, digits and some
+ # symbols: $, %, -, _, .
+ # WARNING: this means that you cannot use this runtime implementation if you need to deal
+ # with class names that use anything but what is allowed here
+ ok_values = dict.fromkeys(
+ "$%_.-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
+ return all(c in ok_values for c in name)
+
+ @staticmethod
+ def check_is_osx_lion(target):
+ logger = lldb.formatters.Logger.Logger()
+ # assume the only thing that has a Foundation.framework is a Mac
+ # assume anything < Lion does not even exist
+ try:
+ mod = target.module['Foundation']
+ except:
+ mod = None
+ if mod is None or mod.IsValid() == 0:
+ return None
+ ver = mod.GetVersion()
+ if ver is None or ver == []:
+ return None
+ return (ver[0] < 900)
+
+ # a utility method that factors out code common to almost all the formatters
+ # takes in an SBValue and a metrics object
+ # returns a class_data and a wrapper (or None, if the runtime alone can't
+ # decide on a wrapper)
+ @staticmethod
+ def prepare_class_detection(valobj, statistics):
+ logger = lldb.formatters.Logger.Logger()
+ class_data = ObjCRuntime(valobj)
+ if class_data.is_valid() == 0:
+ statistics.metric_hit('invalid_pointer', valobj)
+ wrapper = InvalidPointer_Description(
+ valobj.GetValueAsUnsigned(0) == 0)
+ return class_data, wrapper
+ class_data = class_data.read_class_data()
+ if class_data.is_valid() == 0:
+ statistics.metric_hit('invalid_isa', valobj)
+ wrapper = InvalidISA_Description()
+ return class_data, wrapper
+ if class_data.is_kvo():
+ class_data = class_data.get_superclass()
+ if class_data.class_name() == '_NSZombie_OriginalClass':
+ wrapper = ThisIsZombie_Description()
+ return class_data, wrapper
+ return class_data, None
class RoT_Data:
- def __init__(self,rot_pointer,params):
- logger = lldb.formatters.Logger.Logger()
- if (Utilities.is_valid_pointer(rot_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=0)):
- self.sys_params = params
- self.valobj = rot_pointer
- #self.flags = Utilities.read_child_of(self.valobj,0,self.sys_params.uint32_t)
- #self.instanceStart = Utilities.read_child_of(self.valobj,4,self.sys_params.uint32_t)
- self.instanceSize = None # lazy fetching
- offset = 24 if self.sys_params.is_64_bit else 16
- #self.ivarLayoutPtr = Utilities.read_child_of(self.valobj,offset,self.sys_params.addr_ptr_type)
- self.namePointer = Utilities.read_child_of(self.valobj,offset,self.sys_params.types_cache.addr_ptr_type)
- self.valid = 1 # self.check_valid()
- else:
- logger >> "Marking as invalid - rot is invalid"
- self.valid = 0
- if self.valid:
- self.name = Utilities.read_ascii(self.valobj.GetTarget().GetProcess(),self.namePointer)
- if not(Utilities.is_valid_identifier(self.name)):
- logger >> "Marking as invalid - name is invalid"
- self.valid = 0
-
- # perform sanity checks on the contents of this class_ro_t
- def check_valid(self):
- self.valid = 1
- # misaligned pointers seem to be possible for this field
- #if not(Utilities.is_valid_pointer(self.namePointer,self.sys_params.pointer_size,allow_tagged=0)):
- # self.valid = 0
- # pass
-
- def __str__(self):
- logger = lldb.formatters.Logger.Logger()
- return \
- "instanceSize = " + hex(self.instance_size()) + "\n" + \
- "namePointer = " + hex(self.namePointer) + " --> " + self.name
-
- def is_valid(self):
- return self.valid
-
- def instance_size(self,align=0):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid() == 0:
- return None
- if self.instanceSize is None:
- self.instanceSize = Utilities.read_child_of(self.valobj,8,self.sys_params.types_cache.uint32_t)
- if align:
- unalign = self.instance_size(0)
- if self.sys_params.is_64_bit:
- return ((unalign + 7) & ~7) % 0x100000000
- else:
- return ((unalign + 3) & ~3) % 0x100000000
- else:
- return self.instanceSize
+
+ def __init__(self, rot_pointer, params):
+ logger = lldb.formatters.Logger.Logger()
+ if (Utilities.is_valid_pointer(rot_pointer.GetValueAsUnsigned(),
+ params.pointer_size, allow_tagged=0)):
+ self.sys_params = params
+ self.valobj = rot_pointer
+ #self.flags = Utilities.read_child_of(self.valobj,0,self.sys_params.uint32_t)
+ #self.instanceStart = Utilities.read_child_of(self.valobj,4,self.sys_params.uint32_t)
+ self.instanceSize = None # lazy fetching
+ offset = 24 if self.sys_params.is_64_bit else 16
+ #self.ivarLayoutPtr = Utilities.read_child_of(self.valobj,offset,self.sys_params.addr_ptr_type)
+ self.namePointer = Utilities.read_child_of(
+ self.valobj, offset, self.sys_params.types_cache.addr_ptr_type)
+ self.valid = 1 # self.check_valid()
+ else:
+ logger >> "Marking as invalid - rot is invalid"
+ self.valid = 0
+ if self.valid:
+ self.name = Utilities.read_ascii(
+ self.valobj.GetTarget().GetProcess(), self.namePointer)
+ if not(Utilities.is_valid_identifier(self.name)):
+ logger >> "Marking as invalid - name is invalid"
+ self.valid = 0
+
+ # perform sanity checks on the contents of this class_ro_t
+ def check_valid(self):
+ self.valid = 1
+ # misaligned pointers seem to be possible for this field
+ # if not(Utilities.is_valid_pointer(self.namePointer,self.sys_params.pointer_size,allow_tagged=0)):
+ # self.valid = 0
+ # pass
+
+ def __str__(self):
+ logger = lldb.formatters.Logger.Logger()
+ return \
+ "instanceSize = " + hex(self.instance_size()) + "\n" + \
+ "namePointer = " + hex(self.namePointer) + " --> " + self.name
+
+ def is_valid(self):
+ return self.valid
+
+ def instance_size(self, align=0):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid() == 0:
+ return None
+ if self.instanceSize is None:
+ self.instanceSize = Utilities.read_child_of(
+ self.valobj, 8, self.sys_params.types_cache.uint32_t)
+ if align:
+ unalign = self.instance_size(0)
+ if self.sys_params.is_64_bit:
+ return ((unalign + 7) & ~7) % 0x100000000
+ else:
+ return ((unalign + 3) & ~3) % 0x100000000
+ else:
+ return self.instanceSize
+
class RwT_Data:
- def __init__(self,rwt_pointer,params):
- logger = lldb.formatters.Logger.Logger()
- if (Utilities.is_valid_pointer(rwt_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=0)):
- self.sys_params = params
- self.valobj = rwt_pointer
- #self.flags = Utilities.read_child_of(self.valobj,0,self.sys_params.uint32_t)
- #self.version = Utilities.read_child_of(self.valobj,4,self.sys_params.uint32_t)
- self.roPointer = Utilities.read_child_of(self.valobj,8,self.sys_params.types_cache.addr_ptr_type)
- self.check_valid()
- else:
- logger >> "Marking as invalid - rwt is invald"
- self.valid = 0
- if self.valid:
- self.rot = self.valobj.CreateValueFromData("rot",lldb.SBData.CreateDataFromUInt64Array(self.sys_params.endianness, self.sys_params.pointer_size, [self.roPointer]),self.sys_params.types_cache.addr_ptr_type)
+
+ def __init__(self, rwt_pointer, params):
+ logger = lldb.formatters.Logger.Logger()
+ if (Utilities.is_valid_pointer(rwt_pointer.GetValueAsUnsigned(),
+ params.pointer_size, allow_tagged=0)):
+ self.sys_params = params
+ self.valobj = rwt_pointer
+ #self.flags = Utilities.read_child_of(self.valobj,0,self.sys_params.uint32_t)
+ #self.version = Utilities.read_child_of(self.valobj,4,self.sys_params.uint32_t)
+ self.roPointer = Utilities.read_child_of(
+ self.valobj, 8, self.sys_params.types_cache.addr_ptr_type)
+ self.check_valid()
+ else:
+ logger >> "Marking as invalid - rwt is invald"
+ self.valid = 0
+ if self.valid:
+ self.rot = self.valobj.CreateValueFromData(
+ "rot", lldb.SBData.CreateDataFromUInt64Array(
+ self.sys_params.endianness, self.sys_params.pointer_size, [
+ self.roPointer]), self.sys_params.types_cache.addr_ptr_type)
# self.rot = self.valobj.CreateValueFromAddress("rot",self.roPointer,self.sys_params.types_cache.addr_ptr_type).AddressOf()
- self.data = RoT_Data(self.rot,self.sys_params)
+ self.data = RoT_Data(self.rot, self.sys_params)
+
+ # perform sanity checks on the contents of this class_rw_t
+ def check_valid(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.valid = 1
+ if not(
+ Utilities.is_valid_pointer(
+ self.roPointer,
+ self.sys_params.pointer_size,
+ allow_tagged=0)):
+ logger >> "Marking as invalid - ropointer is invalid"
+ self.valid = 0
+
+ def __str__(self):
+ logger = lldb.formatters.Logger.Logger()
+ return \
+ "roPointer = " + hex(self.roPointer)
+
+ def is_valid(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.valid:
+ return self.data.is_valid()
+ return 0
- # perform sanity checks on the contents of this class_rw_t
- def check_valid(self):
- logger = lldb.formatters.Logger.Logger()
- self.valid = 1
- if not(Utilities.is_valid_pointer(self.roPointer,self.sys_params.pointer_size,allow_tagged=0)):
- logger >> "Marking as invalid - ropointer is invalid"
- self.valid = 0
-
- def __str__(self):
- logger = lldb.formatters.Logger.Logger()
- return \
- "roPointer = " + hex(self.roPointer)
-
- def is_valid(self):
- logger = lldb.formatters.Logger.Logger()
- if self.valid:
- return self.data.is_valid()
- return 0
class Class_Data_V2:
- def __init__(self,isa_pointer,params):
- logger = lldb.formatters.Logger.Logger()
- if (isa_pointer != None) and (Utilities.is_valid_pointer(isa_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=0)):
- self.sys_params = params
- self.valobj = isa_pointer
- self.check_valid()
- else:
- logger >> "Marking as invalid - isa is invalid or None"
- self.valid = 0
- if self.valid:
- self.rwt = self.valobj.CreateValueFromData("rwt",lldb.SBData.CreateDataFromUInt64Array(self.sys_params.endianness, self.sys_params.pointer_size, [self.dataPointer]),self.sys_params.types_cache.addr_ptr_type)
+
+ def __init__(self, isa_pointer, params):
+ logger = lldb.formatters.Logger.Logger()
+ if (isa_pointer is not None) and (Utilities.is_valid_pointer(
+ isa_pointer.GetValueAsUnsigned(), params.pointer_size, allow_tagged=0)):
+ self.sys_params = params
+ self.valobj = isa_pointer
+ self.check_valid()
+ else:
+ logger >> "Marking as invalid - isa is invalid or None"
+ self.valid = 0
+ if self.valid:
+ self.rwt = self.valobj.CreateValueFromData(
+ "rwt", lldb.SBData.CreateDataFromUInt64Array(
+ self.sys_params.endianness, self.sys_params.pointer_size, [
+ self.dataPointer]), self.sys_params.types_cache.addr_ptr_type)
# self.rwt = self.valobj.CreateValueFromAddress("rwt",self.dataPointer,self.sys_params.types_cache.addr_ptr_type).AddressOf()
- self.data = RwT_Data(self.rwt,self.sys_params)
+ self.data = RwT_Data(self.rwt, self.sys_params)
+
+ # perform sanity checks on the contents of this class_t
+ # this call tries to minimize the amount of data fetched- as soon as we have "proven"
+ # that we have an invalid object, we stop reading
+ def check_valid(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.valid = 1
+
+ self.isaPointer = Utilities.read_child_of(
+ self.valobj, 0, self.sys_params.types_cache.addr_ptr_type)
+ if not(
+ Utilities.is_valid_pointer(
+ self.isaPointer,
+ self.sys_params.pointer_size,
+ allow_tagged=0)):
+ logger >> "Marking as invalid - isaPointer is invalid"
+ self.valid = 0
+ return
+ if not(Utilities.is_allowed_pointer(self.isaPointer)):
+ logger >> "Marking as invalid - isaPointer is not allowed"
+ self.valid = 0
+ return
+
+ self.cachePointer = Utilities.read_child_of(
+ self.valobj,
+ 2 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.addr_ptr_type)
+ if not(
+ Utilities.is_valid_pointer(
+ self.cachePointer,
+ self.sys_params.pointer_size,
+ allow_tagged=0)):
+ logger >> "Marking as invalid - cachePointer is invalid"
+ self.valid = 0
+ return
+ if not(Utilities.is_allowed_pointer(self.cachePointer)):
+ logger >> "Marking as invalid - cachePointer is not allowed"
+ self.valid = 0
+ return
+ self.dataPointer = Utilities.read_child_of(
+ self.valobj,
+ 4 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.addr_ptr_type)
+ if not(
+ Utilities.is_valid_pointer(
+ self.dataPointer,
+ self.sys_params.pointer_size,
+ allow_tagged=0)):
+ logger >> "Marking as invalid - dataPointer is invalid"
+ self.valid = 0
+ return
+ if not(Utilities.is_allowed_pointer(self.dataPointer)):
+ logger >> "Marking as invalid - dataPointer is not allowed"
+ self.valid = 0
+ return
+
+ self.superclassIsaPointer = Utilities.read_child_of(
+ self.valobj,
+ 1 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.addr_ptr_type)
+ if not(
+ Utilities.is_valid_pointer(
+ self.superclassIsaPointer,
+ self.sys_params.pointer_size,
+ allow_tagged=0,
+ allow_NULL=1)):
+ logger >> "Marking as invalid - superclassIsa is invalid"
+ self.valid = 0
+ return
+ if not(Utilities.is_allowed_pointer(self.superclassIsaPointer)):
+ logger >> "Marking as invalid - superclassIsa is not allowed"
+ self.valid = 0
+ return
+
+ # in general, KVO is implemented by transparently subclassing
+ # however, there could be exceptions where a class does something else
+ # internally to implement the feature - this method will have no clue that a class
+ # has been KVO'ed unless the standard implementation technique is used
+ def is_kvo(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ if self.class_name().startswith("NSKVONotifying_"):
+ return 1
+ return 0
+
+ # some CF classes have a valid ObjC isa in their CFRuntimeBase
+ # but instead of being class-specific this isa points to a match-'em-all class
+ # which is __NSCFType (the versions without __ also exists and we are matching to it
+ # just to be on the safe side)
+ def is_cftype(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
+
+ def get_superclass(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ parent_isa_pointer = self.valobj.CreateChildAtOffset(
+ "parent_isa", self.sys_params.pointer_size, self.sys_params.addr_ptr_type)
+ return Class_Data_V2(parent_isa_pointer, self.sys_params)
+ else:
+ return None
+
+ def class_name(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ return self.data.data.name
+ else:
+ return None
+
+ def is_valid(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.valid:
+ return self.data.is_valid()
+ return 0
+
+ def __str__(self):
+ logger = lldb.formatters.Logger.Logger()
+ return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
+ "superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
+ "cachePointer = " + hex(self.cachePointer) + "\n" + \
+ "data = " + hex(self.dataPointer)
+
+ def is_tagged(self):
+ return 0
+
+ def instance_size(self, align=0):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid() == 0:
+ return None
+ return self.rwt.rot.instance_size(align)
+
+# runtime v1 is much less intricate than v2 and stores relevant
+# information directly in the class_t object
- # perform sanity checks on the contents of this class_t
- # this call tries to minimize the amount of data fetched- as soon as we have "proven"
- # that we have an invalid object, we stop reading
- def check_valid(self):
- logger = lldb.formatters.Logger.Logger()
- self.valid = 1
-
- self.isaPointer = Utilities.read_child_of(self.valobj,0,self.sys_params.types_cache.addr_ptr_type)
- if not(Utilities.is_valid_pointer(self.isaPointer,self.sys_params.pointer_size,allow_tagged=0)):
- logger >> "Marking as invalid - isaPointer is invalid"
- self.valid = 0
- return
- if not(Utilities.is_allowed_pointer(self.isaPointer)):
- logger >> "Marking as invalid - isaPointer is not allowed"
- self.valid = 0
- return
-
- self.cachePointer = Utilities.read_child_of(self.valobj,2*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
- if not(Utilities.is_valid_pointer(self.cachePointer,self.sys_params.pointer_size,allow_tagged=0)):
- logger >> "Marking as invalid - cachePointer is invalid"
- self.valid = 0
- return
- if not(Utilities.is_allowed_pointer(self.cachePointer)):
- logger >> "Marking as invalid - cachePointer is not allowed"
- self.valid = 0
- return
- self.dataPointer = Utilities.read_child_of(self.valobj,4*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
- if not(Utilities.is_valid_pointer(self.dataPointer,self.sys_params.pointer_size,allow_tagged=0)):
- logger >> "Marking as invalid - dataPointer is invalid"
- self.valid = 0
- return
- if not(Utilities.is_allowed_pointer(self.dataPointer)):
- logger >> "Marking as invalid - dataPointer is not allowed"
- self.valid = 0
- return
-
- self.superclassIsaPointer = Utilities.read_child_of(self.valobj,1*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
- if not(Utilities.is_valid_pointer(self.superclassIsaPointer,self.sys_params.pointer_size,allow_tagged=0, allow_NULL=1)):
- logger >> "Marking as invalid - superclassIsa is invalid"
- self.valid = 0
- return
- if not(Utilities.is_allowed_pointer(self.superclassIsaPointer)):
- logger >> "Marking as invalid - superclassIsa is not allowed"
- self.valid = 0
- return
-
- # in general, KVO is implemented by transparently subclassing
- # however, there could be exceptions where a class does something else
- # internally to implement the feature - this method will have no clue that a class
- # has been KVO'ed unless the standard implementation technique is used
- def is_kvo(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- if self.class_name().startswith("NSKVONotifying_"):
- return 1
- return 0
-
- # some CF classes have a valid ObjC isa in their CFRuntimeBase
- # but instead of being class-specific this isa points to a match-'em-all class
- # which is __NSCFType (the versions without __ also exists and we are matching to it
- # just to be on the safe side)
- def is_cftype(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
-
- def get_superclass(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- parent_isa_pointer = self.valobj.CreateChildAtOffset("parent_isa",
- self.sys_params.pointer_size,
- self.sys_params.addr_ptr_type)
- return Class_Data_V2(parent_isa_pointer,self.sys_params)
- else:
- return None
-
- def class_name(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- return self.data.data.name
- else:
- return None
-
- def is_valid(self):
- logger = lldb.formatters.Logger.Logger()
- if self.valid:
- return self.data.is_valid()
- return 0
-
- def __str__(self):
- logger = lldb.formatters.Logger.Logger()
- return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
- "superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
- "cachePointer = " + hex(self.cachePointer) + "\n" + \
- "data = " + hex(self.dataPointer)
-
- def is_tagged(self):
- return 0
-
- def instance_size(self,align=0):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid() == 0:
- return None
- return self.rwt.rot.instance_size(align)
-# runtime v1 is much less intricate than v2 and stores relevant information directly in the class_t object
class Class_Data_V1:
- def __init__(self,isa_pointer,params):
- logger = lldb.formatters.Logger.Logger()
- if (isa_pointer != None) and (Utilities.is_valid_pointer(isa_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=0)):
- self.valid = 1
- self.sys_params = params
- self.valobj = isa_pointer
- self.check_valid()
- else:
- logger >> "Marking as invalid - isaPointer is invalid or None"
- self.valid = 0
- if self.valid:
- self.name = Utilities.read_ascii(self.valobj.GetTarget().GetProcess(),self.namePointer)
- if not(Utilities.is_valid_identifier(self.name)):
- logger >> "Marking as invalid - name is not valid"
- self.valid = 0
-
- # perform sanity checks on the contents of this class_t
- def check_valid(self):
- logger = lldb.formatters.Logger.Logger()
- self.valid = 1
-
- self.isaPointer = Utilities.read_child_of(self.valobj,0,self.sys_params.types_cache.addr_ptr_type)
- if not(Utilities.is_valid_pointer(self.isaPointer,self.sys_params.pointer_size,allow_tagged=0)):
- logger >> "Marking as invalid - isaPointer is invalid"
- self.valid = 0
- return
-
- self.superclassIsaPointer = Utilities.read_child_of(self.valobj,1*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
- if not(Utilities.is_valid_pointer(self.superclassIsaPointer,self.sys_params.pointer_size,allow_tagged=0,allow_NULL=1)):
- logger >> "Marking as invalid - superclassIsa is invalid"
- self.valid = 0
- return
-
- self.namePointer = Utilities.read_child_of(self.valobj,2*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
- #if not(Utilities.is_valid_pointer(self.namePointer,self.sys_params.pointer_size,allow_tagged=0,allow_NULL=0)):
- # self.valid = 0
- # return
-
- # in general, KVO is implemented by transparently subclassing
- # however, there could be exceptions where a class does something else
- # internally to implement the feature - this method will have no clue that a class
- # has been KVO'ed unless the standard implementation technique is used
- def is_kvo(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- if self.class_name().startswith("NSKVONotifying_"):
- return 1
- return 0
-
- # some CF classes have a valid ObjC isa in their CFRuntimeBase
- # but instead of being class-specific this isa points to a match-'em-all class
- # which is __NSCFType (the versions without __ also exists and we are matching to it
- # just to be on the safe side)
- def is_cftype(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
-
- def get_superclass(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- parent_isa_pointer = self.valobj.CreateChildAtOffset("parent_isa",
- self.sys_params.pointer_size,
- self.sys_params.addr_ptr_type)
- return Class_Data_V1(parent_isa_pointer,self.sys_params)
- else:
- return None
-
- def class_name(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- return self.name
- else:
- return None
-
- def is_valid(self):
- return self.valid
-
- def __str__(self):
- logger = lldb.formatters.Logger.Logger()
- return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
- "superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
- "namePointer = " + hex(self.namePointer) + " --> " + self.name + \
- "instanceSize = " + hex(self.instanceSize()) + "\n"
-
- def is_tagged(self):
- return 0
-
- def instance_size(self,align=0):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid() == 0:
- return None
- if self.instanceSize is None:
- self.instanceSize = Utilities.read_child_of(self.valobj,5*self.sys_params.pointer_size,self.sys_params.types_cache.addr_ptr_type)
- if align:
- unalign = self.instance_size(0)
- if self.sys_params.is_64_bit:
- return ((unalign + 7) & ~7) % 0x100000000
- else:
- return ((unalign + 3) & ~3) % 0x100000000
- else:
- return self.instanceSize
+
+ def __init__(self, isa_pointer, params):
+ logger = lldb.formatters.Logger.Logger()
+ if (isa_pointer is not None) and (Utilities.is_valid_pointer(
+ isa_pointer.GetValueAsUnsigned(), params.pointer_size, allow_tagged=0)):
+ self.valid = 1
+ self.sys_params = params
+ self.valobj = isa_pointer
+ self.check_valid()
+ else:
+ logger >> "Marking as invalid - isaPointer is invalid or None"
+ self.valid = 0
+ if self.valid:
+ self.name = Utilities.read_ascii(
+ self.valobj.GetTarget().GetProcess(), self.namePointer)
+ if not(Utilities.is_valid_identifier(self.name)):
+ logger >> "Marking as invalid - name is not valid"
+ self.valid = 0
+
+ # perform sanity checks on the contents of this class_t
+ def check_valid(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.valid = 1
+
+ self.isaPointer = Utilities.read_child_of(
+ self.valobj, 0, self.sys_params.types_cache.addr_ptr_type)
+ if not(
+ Utilities.is_valid_pointer(
+ self.isaPointer,
+ self.sys_params.pointer_size,
+ allow_tagged=0)):
+ logger >> "Marking as invalid - isaPointer is invalid"
+ self.valid = 0
+ return
+
+ self.superclassIsaPointer = Utilities.read_child_of(
+ self.valobj,
+ 1 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.addr_ptr_type)
+ if not(
+ Utilities.is_valid_pointer(
+ self.superclassIsaPointer,
+ self.sys_params.pointer_size,
+ allow_tagged=0,
+ allow_NULL=1)):
+ logger >> "Marking as invalid - superclassIsa is invalid"
+ self.valid = 0
+ return
+
+ self.namePointer = Utilities.read_child_of(
+ self.valobj,
+ 2 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.addr_ptr_type)
+ # if not(Utilities.is_valid_pointer(self.namePointer,self.sys_params.pointer_size,allow_tagged=0,allow_NULL=0)):
+ # self.valid = 0
+ # return
+
+ # in general, KVO is implemented by transparently subclassing
+ # however, there could be exceptions where a class does something else
+ # internally to implement the feature - this method will have no clue that a class
+ # has been KVO'ed unless the standard implementation technique is used
+ def is_kvo(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ if self.class_name().startswith("NSKVONotifying_"):
+ return 1
+ return 0
+
+ # some CF classes have a valid ObjC isa in their CFRuntimeBase
+ # but instead of being class-specific this isa points to a match-'em-all class
+ # which is __NSCFType (the versions without __ also exists and we are matching to it
+ # just to be on the safe side)
+ def is_cftype(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
+
+ def get_superclass(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ parent_isa_pointer = self.valobj.CreateChildAtOffset(
+ "parent_isa", self.sys_params.pointer_size, self.sys_params.addr_ptr_type)
+ return Class_Data_V1(parent_isa_pointer, self.sys_params)
+ else:
+ return None
+
+ def class_name(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ return self.name
+ else:
+ return None
+
+ def is_valid(self):
+ return self.valid
+
+ def __str__(self):
+ logger = lldb.formatters.Logger.Logger()
+ return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
+ "superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
+ "namePointer = " + hex(self.namePointer) + " --> " + self.name + \
+ "instanceSize = " + hex(self.instanceSize()) + "\n"
+
+ def is_tagged(self):
+ return 0
+
+ def instance_size(self, align=0):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid() == 0:
+ return None
+ if self.instanceSize is None:
+ self.instanceSize = Utilities.read_child_of(
+ self.valobj,
+ 5 * self.sys_params.pointer_size,
+ self.sys_params.types_cache.addr_ptr_type)
+ if align:
+ unalign = self.instance_size(0)
+ if self.sys_params.is_64_bit:
+ return ((unalign + 7) & ~7) % 0x100000000
+ else:
+ return ((unalign + 3) & ~3) % 0x100000000
+ else:
+ return self.instanceSize
# these are the only tagged pointers values for current versions
# of OSX - they might change in future OS releases, and no-one is
# advised to rely on these values, or any of the bitmasking formulas
# in TaggedClass_Data. doing otherwise is at your own risk
-TaggedClass_Values_Lion = {1 : 'NSNumber', \
- 5: 'NSManagedObject', \
- 6: 'NSDate', \
- 7: 'NSDateTS' };
-TaggedClass_Values_NMOS = {0: 'NSAtom', \
- 3 : 'NSNumber', \
- 4: 'NSDateTS', \
- 5: 'NSManagedObject', \
- 6: 'NSDate' };
+TaggedClass_Values_Lion = {1: 'NSNumber',
+ 5: 'NSManagedObject',
+ 6: 'NSDate',
+ 7: 'NSDateTS'}
+TaggedClass_Values_NMOS = {0: 'NSAtom',
+ 3: 'NSNumber',
+ 4: 'NSDateTS',
+ 5: 'NSManagedObject',
+ 6: 'NSDate'}
+
class TaggedClass_Data:
- def __init__(self,pointer,params):
- logger = lldb.formatters.Logger.Logger()
- global TaggedClass_Values_Lion,TaggedClass_Values_NMOS
- self.valid = 1
- self.name = None
- self.sys_params = params
- self.valobj = pointer
- self.val = (pointer & ~0x0000000000000000FF) >> 8
- self.class_bits = (pointer & 0xE) >> 1
- self.i_bits = (pointer & 0xF0) >> 4
-
- if self.sys_params.is_lion:
- if self.class_bits in TaggedClass_Values_Lion:
- self.name = TaggedClass_Values_Lion[self.class_bits]
- else:
- logger >> "Marking as invalid - not a good tagged pointer for Lion"
- self.valid = 0
- else:
- if self.class_bits in TaggedClass_Values_NMOS:
- self.name = TaggedClass_Values_NMOS[self.class_bits]
- else:
- logger >> "Marking as invalid - not a good tagged pointer for NMOS"
- self.valid = 0
-
-
- def is_valid(self):
- return self.valid
-
- def class_name(self):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid():
- return self.name
- else:
- return 0
-
- def value(self):
- return self.val if self.is_valid() else None
-
- def info_bits(self):
- return self.i_bits if self.is_valid() else None
-
- def is_kvo(self):
- return 0
-
- def is_cftype(self):
- return 0
-
- # we would need to go around looking for the superclass or ask the runtime
- # for now, we seem not to require support for this operation so we will merrily
- # pretend to be at a root point in the hierarchy
- def get_superclass(self):
- return None
-
- # anything that is handled here is tagged
- def is_tagged(self):
- return 1
-
- # it seems reasonable to say that a tagged pointer is the size of a pointer
- def instance_size(self,align=0):
- logger = lldb.formatters.Logger.Logger()
- if self.is_valid() == 0:
- return None
- return self.sys_params.pointer_size
+
+ def __init__(self, pointer, params):
+ logger = lldb.formatters.Logger.Logger()
+ global TaggedClass_Values_Lion, TaggedClass_Values_NMOS
+ self.valid = 1
+ self.name = None
+ self.sys_params = params
+ self.valobj = pointer
+ self.val = (pointer & ~0x0000000000000000FF) >> 8
+ self.class_bits = (pointer & 0xE) >> 1
+ self.i_bits = (pointer & 0xF0) >> 4
+
+ if self.sys_params.is_lion:
+ if self.class_bits in TaggedClass_Values_Lion:
+ self.name = TaggedClass_Values_Lion[self.class_bits]
+ else:
+ logger >> "Marking as invalid - not a good tagged pointer for Lion"
+ self.valid = 0
+ else:
+ if self.class_bits in TaggedClass_Values_NMOS:
+ self.name = TaggedClass_Values_NMOS[self.class_bits]
+ else:
+ logger >> "Marking as invalid - not a good tagged pointer for NMOS"
+ self.valid = 0
+
+ def is_valid(self):
+ return self.valid
+
+ def class_name(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid():
+ return self.name
+ else:
+ return 0
+
+ def value(self):
+ return self.val if self.is_valid() else None
+
+ def info_bits(self):
+ return self.i_bits if self.is_valid() else None
+
+ def is_kvo(self):
+ return 0
+
+ def is_cftype(self):
+ return 0
+
+ # we would need to go around looking for the superclass or ask the runtime
+ # for now, we seem not to require support for this operation so we will merrily
+ # pretend to be at a root point in the hierarchy
+ def get_superclass(self):
+ return None
+
+ # anything that is handled here is tagged
+ def is_tagged(self):
+ return 1
+
+ # it seems reasonable to say that a tagged pointer is the size of a pointer
+ def instance_size(self, align=0):
+ logger = lldb.formatters.Logger.Logger()
+ if self.is_valid() == 0:
+ return None
+ return self.sys_params.pointer_size
class InvalidClass_Data:
- def __init__(self):
- pass
- def is_valid(self):
- return 0
+
+ def __init__(self):
+ pass
+
+ def is_valid(self):
+ return 0
class Version:
- def __init__(self, major, minor, release, build_string):
- self._major = major
- self._minor = minor
- self._release = release
- self._build_string = build_string
-
- def get_major(self):
- return self._major
- def get_minor(self):
- return self._minor
- def get_release(self):
- return self._release
- def get_build_string(self):
- return self._build_string
-
- major = property(get_major,None)
- minor = property(get_minor,None)
- release = property(get_release,None)
- build_string = property(get_build_string,None)
-
- def __lt__(self,other):
- if (self.major < other.major):
- return 1
- if (self.minor < other.minor):
- return 1
- if (self.release < other.release):
- return 1
- # build strings are not compared since they are heavily platform-dependent and might not always
- # be available
- return 0
-
- def __eq__(self,other):
- return (self.major == other.major) and \
- (self.minor == other.minor) and \
- (self.release == other.release) and \
- (self.build_string == other.build_string)
-
- # Python 2.6 doesn't have functools.total_ordering, so we have to implement
- # other comparators
- def __gt__(self, other):
- return other < self
- def __le__(self, other):
- return not other < self
+ def __init__(self, major, minor, release, build_string):
+ self._major = major
+ self._minor = minor
+ self._release = release
+ self._build_string = build_string
+
+ def get_major(self):
+ return self._major
+
+ def get_minor(self):
+ return self._minor
+
+ def get_release(self):
+ return self._release
+
+ def get_build_string(self):
+ return self._build_string
+
+ major = property(get_major, None)
+ minor = property(get_minor, None)
+ release = property(get_release, None)
+ build_string = property(get_build_string, None)
+
+ def __lt__(self, other):
+ if (self.major < other.major):
+ return 1
+ if (self.minor < other.minor):
+ return 1
+ if (self.release < other.release):
+ return 1
+ # build strings are not compared since they are heavily platform-dependent and might not always
+ # be available
+ return 0
+
+ def __eq__(self, other):
+ return (self.major == other.major) and \
+ (self.minor == other.minor) and \
+ (self.release == other.release) and \
+ (self.build_string == other.build_string)
+
+ # Python 2.6 doesn't have functools.total_ordering, so we have to implement
+ # other comparators
+ def __gt__(self, other):
+ return other < self
+
+ def __le__(self, other):
+ return not other < self
- def __ge__(self, other):
- return not self < other
+ def __ge__(self, other):
+ return not self < other
runtime_version = lldb.formatters.cache.Cache()
@@ -568,214 +653,249 @@ os_version = lldb.formatters.cache.Cache
types_caches = lldb.formatters.cache.Cache()
isa_caches = lldb.formatters.cache.Cache()
+
class SystemParameters:
- def __init__(self,valobj):
- logger = lldb.formatters.Logger.Logger()
- self.adjust_for_architecture(valobj)
- self.adjust_for_process(valobj)
-
- def adjust_for_process(self, valobj):
- logger = lldb.formatters.Logger.Logger()
- global runtime_version
- global os_version
- global types_caches
- global isa_caches
-
- process = valobj.GetTarget().GetProcess()
- self.pid = process.GetUniqueID() # using the unique ID for added guarantees (see svn revision 172628 for further details)
-
- if runtime_version.look_for_key(self.pid):
- self.runtime_version = runtime_version.get_value(self.pid)
- else:
- self.runtime_version = ObjCRuntime.runtime_version(process)
- runtime_version.add_item(self.pid,self.runtime_version)
-
- if os_version.look_for_key(self.pid):
- self.is_lion = os_version.get_value(self.pid)
- else:
- self.is_lion = Utilities.check_is_osx_lion(valobj.GetTarget())
- os_version.add_item(self.pid,self.is_lion)
-
- if types_caches.look_for_key(self.pid):
- self.types_cache = types_caches.get_value(self.pid)
- else:
- self.types_cache = lldb.formatters.attrib_fromdict.AttributesDictionary(allow_reset=0)
- self.types_cache.addr_type = valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong)
- self.types_cache.addr_ptr_type = self.types_cache.addr_type.GetPointerType()
- self.types_cache.uint32_t = valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedInt)
- types_caches.add_item(self.pid,self.types_cache)
-
- if isa_caches.look_for_key(self.pid):
- self.isa_cache = isa_caches.get_value(self.pid)
- else:
- self.isa_cache = lldb.formatters.cache.Cache()
- isa_caches.add_item(self.pid,self.isa_cache)
-
- def adjust_for_architecture(self,valobj):
- process = valobj.GetTarget().GetProcess()
- self.pointer_size = process.GetAddressByteSize()
- self.is_64_bit = (self.pointer_size == 8)
- self.endianness = process.GetByteOrder()
- self.is_little = (self.endianness == lldb.eByteOrderLittle)
- self.cfruntime_size = 16 if self.is_64_bit else 8
-
- # a simple helper function that makes it more explicit that one is calculating
- # an offset that is made up of X pointers and Y bytes of additional data
- # taking into account pointer size - if you know there is going to be some padding
- # you can pass that in and it will be taken into account (since padding may be different between
- # 32 and 64 bit versions, you can pass padding value for both, the right one will be used)
- def calculate_offset(self, num_pointers = 0, bytes_count = 0, padding32 = 0, padding64 = 0):
- value = bytes_count + num_pointers*self.pointer_size
- return value + padding64 if self.is_64_bit else value + padding32
+
+ def __init__(self, valobj):
+ logger = lldb.formatters.Logger.Logger()
+ self.adjust_for_architecture(valobj)
+ self.adjust_for_process(valobj)
+
+ def adjust_for_process(self, valobj):
+ logger = lldb.formatters.Logger.Logger()
+ global runtime_version
+ global os_version
+ global types_caches
+ global isa_caches
+
+ process = valobj.GetTarget().GetProcess()
+ # using the unique ID for added guarantees (see svn revision 172628 for
+ # further details)
+ self.pid = process.GetUniqueID()
+
+ if runtime_version.look_for_key(self.pid):
+ self.runtime_version = runtime_version.get_value(self.pid)
+ else:
+ self.runtime_version = ObjCRuntime.runtime_version(process)
+ runtime_version.add_item(self.pid, self.runtime_version)
+
+ if os_version.look_for_key(self.pid):
+ self.is_lion = os_version.get_value(self.pid)
+ else:
+ self.is_lion = Utilities.check_is_osx_lion(valobj.GetTarget())
+ os_version.add_item(self.pid, self.is_lion)
+
+ if types_caches.look_for_key(self.pid):
+ self.types_cache = types_caches.get_value(self.pid)
+ else:
+ self.types_cache = lldb.formatters.attrib_fromdict.AttributesDictionary(
+ allow_reset=0)
+ self.types_cache.addr_type = valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedLong)
+ self.types_cache.addr_ptr_type = self.types_cache.addr_type.GetPointerType()
+ self.types_cache.uint32_t = valobj.GetType(
+ ).GetBasicType(lldb.eBasicTypeUnsignedInt)
+ types_caches.add_item(self.pid, self.types_cache)
+
+ if isa_caches.look_for_key(self.pid):
+ self.isa_cache = isa_caches.get_value(self.pid)
+ else:
+ self.isa_cache = lldb.formatters.cache.Cache()
+ isa_caches.add_item(self.pid, self.isa_cache)
+
+ def adjust_for_architecture(self, valobj):
+ process = valobj.GetTarget().GetProcess()
+ self.pointer_size = process.GetAddressByteSize()
+ self.is_64_bit = (self.pointer_size == 8)
+ self.endianness = process.GetByteOrder()
+ self.is_little = (self.endianness == lldb.eByteOrderLittle)
+ self.cfruntime_size = 16 if self.is_64_bit else 8
+
+ # a simple helper function that makes it more explicit that one is calculating
+ # an offset that is made up of X pointers and Y bytes of additional data
+ # taking into account pointer size - if you know there is going to be some padding
+ # you can pass that in and it will be taken into account (since padding may be different between
+ # 32 and 64 bit versions, you can pass padding value for both, the right
+ # one will be used)
+ def calculate_offset(
+ self,
+ num_pointers=0,
+ bytes_count=0,
+ padding32=0,
+ padding64=0):
+ value = bytes_count + num_pointers * self.pointer_size
+ return value + padding64 if self.is_64_bit else value + padding32
+
class ObjCRuntime:
- # the ObjC runtime has no explicit "version" field that we can use
- # instead, we discriminate v1 from v2 by looking for the presence
- # of a well-known section only present in v1
- @staticmethod
- def runtime_version(process):
- logger = lldb.formatters.Logger.Logger()
- if process.IsValid() == 0:
- logger >> "No process - bailing out"
- return None
- target = process.GetTarget()
- num_modules = target.GetNumModules()
- module_objc = None
- for idx in range(num_modules):
- module = target.GetModuleAtIndex(idx)
- if module.GetFileSpec().GetFilename() == 'libobjc.A.dylib':
- module_objc = module
- break
- if module_objc is None or module_objc.IsValid() == 0:
- logger >> "no libobjc - bailing out"
- return None
- num_sections = module.GetNumSections()
- section_objc = None
- for idx in range(num_sections):
- section = module.GetSectionAtIndex(idx)
- if section.GetName() == '__OBJC':
- section_objc = section
- break
- if section_objc != None and section_objc.IsValid():
- logger >> "found __OBJC: v1"
- return 1
- logger >> "no __OBJC: v2"
- return 2
-
- @staticmethod
- def runtime_from_isa(isa):
- logger = lldb.formatters.Logger.Logger()
- runtime = ObjCRuntime(isa)
- runtime.isa = isa
- return runtime
-
- def __init__(self,valobj):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj
- self.adjust_for_architecture()
- self.sys_params = SystemParameters(self.valobj)
- self.unsigned_value = self.valobj.GetValueAsUnsigned()
- self.isa_value = None
+ # the ObjC runtime has no explicit "version" field that we can use
+ # instead, we discriminate v1 from v2 by looking for the presence
+ # of a well-known section only present in v1
+ @staticmethod
+ def runtime_version(process):
+ logger = lldb.formatters.Logger.Logger()
+ if process.IsValid() == 0:
+ logger >> "No process - bailing out"
+ return None
+ target = process.GetTarget()
+ num_modules = target.GetNumModules()
+ module_objc = None
+ for idx in range(num_modules):
+ module = target.GetModuleAtIndex(idx)
+ if module.GetFileSpec().GetFilename() == 'libobjc.A.dylib':
+ module_objc = module
+ break
+ if module_objc is None or module_objc.IsValid() == 0:
+ logger >> "no libobjc - bailing out"
+ return None
+ num_sections = module.GetNumSections()
+ section_objc = None
+ for idx in range(num_sections):
+ section = module.GetSectionAtIndex(idx)
+ if section.GetName() == '__OBJC':
+ section_objc = section
+ break
+ if section_objc is not None and section_objc.IsValid():
+ logger >> "found __OBJC: v1"
+ return 1
+ logger >> "no __OBJC: v2"
+ return 2
+
+ @staticmethod
+ def runtime_from_isa(isa):
+ logger = lldb.formatters.Logger.Logger()
+ runtime = ObjCRuntime(isa)
+ runtime.isa = isa
+ return runtime
+
+ def __init__(self, valobj):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.adjust_for_architecture()
+ self.sys_params = SystemParameters(self.valobj)
+ self.unsigned_value = self.valobj.GetValueAsUnsigned()
+ self.isa_value = None
- def adjust_for_architecture(self):
- pass
+ def adjust_for_architecture(self):
+ pass
# an ObjC pointer can either be tagged or must be aligned
- def is_tagged(self):
- logger = lldb.formatters.Logger.Logger()
- if self.valobj is None:
- return 0
- return (Utilities.is_valid_pointer(self.unsigned_value,self.sys_params.pointer_size, allow_tagged=1) and \
- not(Utilities.is_valid_pointer(self.unsigned_value,self.sys_params.pointer_size, allow_tagged=0)))
-
- def is_valid(self):
- logger = lldb.formatters.Logger.Logger()
- if self.valobj is None:
- return 0
- if self.valobj.IsInScope() == 0:
- return 0
- return Utilities.is_valid_pointer(self.unsigned_value,self.sys_params.pointer_size, allow_tagged=1)
-
- def is_nil(self):
- return self.unsigned_value == 0
-
- def read_isa(self):
- logger = lldb.formatters.Logger.Logger()
- if self.isa_value != None:
- logger >> "using cached isa"
- return self.isa_value
- self.isa_pointer = self.valobj.CreateChildAtOffset("cfisa",
- 0,
- self.sys_params.types_cache.addr_ptr_type)
- if self.isa_pointer is None or self.isa_pointer.IsValid() == 0:
- logger >> "invalid isa - bailing out"
- return None;
- self.isa_value = self.isa_pointer.GetValueAsUnsigned(1)
- if self.isa_value == 1:
- logger >> "invalid isa value - bailing out"
- return None;
- return Ellipsis
-
- def read_class_data(self):
- logger = lldb.formatters.Logger.Logger()
- global isa_cache
- if self.is_tagged():
- # tagged pointers only exist in ObjC v2
- if self.sys_params.runtime_version == 2:
- logger >> "on v2 and tagged - maybe"
- # not every odd-valued pointer is actually tagged. most are just plain wrong
- # we could try and predetect this before even creating a TaggedClass_Data object
- # but unless performance requires it, this seems a cleaner way to tackle the task
- tentative_tagged = TaggedClass_Data(self.unsigned_value,self.sys_params)
- if tentative_tagged.is_valid():
- logger >> "truly tagged"
- return tentative_tagged
- else:
- logger >> "not tagged - error"
- return InvalidClass_Data()
- else:
- logger >> "on v1 and tagged - error"
- return InvalidClass_Data()
- if self.is_valid() == 0 or self.read_isa() is None:
- return InvalidClass_Data()
- data = self.sys_params.isa_cache.get_value(self.isa_value,default=None)
- if data != None:
- return data
- if self.sys_params.runtime_version == 2:
- data = Class_Data_V2(self.isa_pointer,self.sys_params)
- else:
- data = Class_Data_V1(self.isa_pointer,self.sys_params)
- if data is None:
- return InvalidClass_Data()
- if data.is_valid():
- self.sys_params.isa_cache.add_item(self.isa_value,data,ok_to_replace=1)
- return data
+ def is_tagged(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.valobj is None:
+ return 0
+ return (
+ Utilities.is_valid_pointer(
+ self.unsigned_value,
+ self.sys_params.pointer_size,
+ allow_tagged=1) and not(
+ Utilities.is_valid_pointer(
+ self.unsigned_value,
+ self.sys_params.pointer_size,
+ allow_tagged=0)))
+
+ def is_valid(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.valobj is None:
+ return 0
+ if self.valobj.IsInScope() == 0:
+ return 0
+ return Utilities.is_valid_pointer(
+ self.unsigned_value,
+ self.sys_params.pointer_size,
+ allow_tagged=1)
+
+ def is_nil(self):
+ return self.unsigned_value == 0
+
+ def read_isa(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.isa_value is not None:
+ logger >> "using cached isa"
+ return self.isa_value
+ self.isa_pointer = self.valobj.CreateChildAtOffset(
+ "cfisa", 0, self.sys_params.types_cache.addr_ptr_type)
+ if self.isa_pointer is None or self.isa_pointer.IsValid() == 0:
+ logger >> "invalid isa - bailing out"
+ return None
+ self.isa_value = self.isa_pointer.GetValueAsUnsigned(1)
+ if self.isa_value == 1:
+ logger >> "invalid isa value - bailing out"
+ return None
+ return Ellipsis
+
+ def read_class_data(self):
+ logger = lldb.formatters.Logger.Logger()
+ global isa_cache
+ if self.is_tagged():
+ # tagged pointers only exist in ObjC v2
+ if self.sys_params.runtime_version == 2:
+ logger >> "on v2 and tagged - maybe"
+ # not every odd-valued pointer is actually tagged. most are just plain wrong
+ # we could try and predetect this before even creating a TaggedClass_Data object
+ # but unless performance requires it, this seems a cleaner way
+ # to tackle the task
+ tentative_tagged = TaggedClass_Data(
+ self.unsigned_value, self.sys_params)
+ if tentative_tagged.is_valid():
+ logger >> "truly tagged"
+ return tentative_tagged
+ else:
+ logger >> "not tagged - error"
+ return InvalidClass_Data()
+ else:
+ logger >> "on v1 and tagged - error"
+ return InvalidClass_Data()
+ if self.is_valid() == 0 or self.read_isa() is None:
+ return InvalidClass_Data()
+ data = self.sys_params.isa_cache.get_value(
+ self.isa_value, default=None)
+ if data is not None:
+ return data
+ if self.sys_params.runtime_version == 2:
+ data = Class_Data_V2(self.isa_pointer, self.sys_params)
+ else:
+ data = Class_Data_V1(self.isa_pointer, self.sys_params)
+ if data is None:
+ return InvalidClass_Data()
+ if data.is_valid():
+ self.sys_params.isa_cache.add_item(
+ self.isa_value, data, ok_to_replace=1)
+ return data
+
+# these classes below can be used by the data formatters to provide a
+# consistent message that describes a given runtime-generated situation
+
-# these classes below can be used by the data formatters to provide a consistent message that describes a given runtime-generated situation
class SpecialSituation_Description:
- def message(self):
- return ''
+
+ def message(self):
+ return ''
+
class InvalidPointer_Description(SpecialSituation_Description):
- def __init__(self,nil):
- self.is_nil = nil
+ def __init__(self, nil):
+ self.is_nil = nil
+
+ def message(self):
+ if self.is_nil:
+ return '@"<nil>"'
+ else:
+ return '<invalid pointer>'
- def message(self):
- if self.is_nil:
- return '@"<nil>"'
- else:
- return '<invalid pointer>'
class InvalidISA_Description(SpecialSituation_Description):
- def __init__(self):
- pass
+ def __init__(self):
+ pass
+
+ def message(self):
+ return '<not an Objective-C object>'
- def message(self):
- return '<not an Objective-C object>'
class ThisIsZombie_Description(SpecialSituation_Description):
- def message(self):
- return '<freed object>'
\ No newline at end of file
+
+ def message(self):
+ return '<freed object>'
Modified: lldb/trunk/examples/summaries/objc.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/objc.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/objc.py (original)
+++ lldb/trunk/examples/summaries/objc.py Tue Sep 6 15:57:50 2016
@@ -1,16 +1,19 @@
# Summaries for common ObjC types that require Python scripting
# to be generated fit into this file
-def BOOL_SummaryProvider (valobj,dict):
- if not (valobj.IsValid()):
- return "<invalid>"
- if valobj.GetValueAsUnsigned() == 0:
- return "NO"
- else:
- return "YES"
-def BOOLRef_SummaryProvider (valobj, dict):
- return BOOL_SummaryProvider (valobj.GetChildAtIndex(0),dict)
+def BOOL_SummaryProvider(valobj, dict):
+ if not (valobj.IsValid()):
+ return "<invalid>"
+ if valobj.GetValueAsUnsigned() == 0:
+ return "NO"
+ else:
+ return "YES"
-def BOOLPtr_SummaryProvider (valobj,dict):
- return BOOL_SummaryProvider (valobj.Dereference(),dict)
+
+def BOOLRef_SummaryProvider(valobj, dict):
+ return BOOL_SummaryProvider(valobj.GetChildAtIndex(0), dict)
+
+
+def BOOLPtr_SummaryProvider(valobj, dict):
+ return BOOL_SummaryProvider(valobj.Dereference(), dict)
Modified: lldb/trunk/examples/summaries/pysummary.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/pysummary.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/pysummary.py (original)
+++ lldb/trunk/examples/summaries/pysummary.py Tue Sep 6 15:57:50 2016
@@ -1,18 +1,24 @@
import lldb
-def pyobj_summary (value,unused):
- if value == None or value.IsValid() == False or value.GetValueAsUnsigned(0) == 0:
- return "<invalid>"
- refcnt = value.GetChildMemberWithName("ob_refcnt")
- expr = "(char*)PyString_AsString( (PyObject*)PyObject_Str( (PyObject*)0x%x) )" % (value.GetValueAsUnsigned(0))
- expr_summary = value.target.EvaluateExpression(expr,lldb.SBExpressionOptions()).GetSummary()
- refcnt_value = "rc = %d" % (refcnt.GetValueAsUnsigned(0))
- return "%s (%s)" % (expr_summary,refcnt_value)
-def __lldb_init_module(debugger, unused):
- debugger.HandleCommand("type summary add PyObject --python-function pysummary.pyobj_summary")
- debugger.HandleCommand("type summary add lldb_private::PythonObject -s ${var.m_py_obj%S}")
- debugger.HandleCommand("type summary add lldb_private::PythonDictionary -s ${var.m_py_obj%S}")
- debugger.HandleCommand("type summary add lldb_private::PythonString -s ${var.m_py_obj%S}")
+def pyobj_summary(value, unused):
+ if value is None or value.IsValid() == False or value.GetValueAsUnsigned(0) == 0:
+ return "<invalid>"
+ refcnt = value.GetChildMemberWithName("ob_refcnt")
+ expr = "(char*)PyString_AsString( (PyObject*)PyObject_Str( (PyObject*)0x%x) )" % (
+ value.GetValueAsUnsigned(0))
+ expr_summary = value.target.EvaluateExpression(
+ expr, lldb.SBExpressionOptions()).GetSummary()
+ refcnt_value = "rc = %d" % (refcnt.GetValueAsUnsigned(0))
+ return "%s (%s)" % (expr_summary, refcnt_value)
+def __lldb_init_module(debugger, unused):
+ debugger.HandleCommand(
+ "type summary add PyObject --python-function pysummary.pyobj_summary")
+ debugger.HandleCommand(
+ "type summary add lldb_private::PythonObject -s ${var.m_py_obj%S}")
+ debugger.HandleCommand(
+ "type summary add lldb_private::PythonDictionary -s ${var.m_py_obj%S}")
+ debugger.HandleCommand(
+ "type summary add lldb_private::PythonString -s ${var.m_py_obj%S}")
Modified: lldb/trunk/examples/summaries/sp_cp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/sp_cp.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/sp_cp.py (original)
+++ lldb/trunk/examples/summaries/sp_cp.py Tue Sep 6 15:57:50 2016
@@ -6,56 +6,79 @@ This file is distributed under the Unive
License. See LICENSE.TXT for details.
"""
+
class SharedPtr_SyntheticChildrenProvider:
- def __init__(self,valobj,dict):
- self.valobj = valobj
- self.update()
- def update(self):
- pass
- def num_children(self):
- return 1
- def get_child_index(self,name):
- if name == "ptr":
- return 0
- if name == "count":
- return 1
- return None
- def get_child_at_index(self,index):
- if index == 0:
- return self.valobj.GetChildMemberWithName('_M_ptr')
- if index == 1:
- return self.valobj.GetChildMemberWithName('_M_refcount').GetChildMemberWithName('_M_pi').GetChildMemberWithName('_M_use_count')
- return None
-def SharedPtr_SummaryProvider (valobj,dict):
- return 'use = ' + str(valobj.GetChildMemberWithName("count").GetValueAsUnsigned())
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+ self.update()
+
+ def update(self):
+ pass
+
+ def num_children(self):
+ return 1
+
+ def get_child_index(self, name):
+ if name == "ptr":
+ return 0
+ if name == "count":
+ return 1
+ return None
+
+ def get_child_at_index(self, index):
+ if index == 0:
+ return self.valobj.GetChildMemberWithName('_M_ptr')
+ if index == 1:
+ return self.valobj.GetChildMemberWithName('_M_refcount').GetChildMemberWithName(
+ '_M_pi').GetChildMemberWithName('_M_use_count')
+ return None
+
+
+def SharedPtr_SummaryProvider(valobj, dict):
+ return 'use = ' + \
+ str(valobj.GetChildMemberWithName("count").GetValueAsUnsigned())
+
class ValueObjectSP_SyntheticChildrenProvider:
- def __init__(self,valobj,dict):
- self.valobj = valobj
- self.update()
- def update(self):
- pass
- def num_children(self):
- return 1
- def get_child_index(self,name):
- if name == "ptr":
- return 0
- if name == "count":
- return 1
- return None
- def get_child_at_index(self,index):
- if index == 0:
- return self.valobj.GetChildMemberWithName('ptr_')
- if index == 1:
- return self.valobj.GetChildMemberWithName('cntrl_').GetChildMemberWithName('shared_owners_')
- return None
-def ValueObjectSP_SummaryProvider (valobj,dict):
- return 'use = ' + str(1 + valobj.GetChildMemberWithName("count").GetValueAsUnsigned())
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+ self.update()
+
+ def update(self):
+ pass
+
+ def num_children(self):
+ return 1
+
+ def get_child_index(self, name):
+ if name == "ptr":
+ return 0
+ if name == "count":
+ return 1
+ return None
+
+ def get_child_at_index(self, index):
+ if index == 0:
+ return self.valobj.GetChildMemberWithName('ptr_')
+ if index == 1:
+ return self.valobj.GetChildMemberWithName(
+ 'cntrl_').GetChildMemberWithName('shared_owners_')
+ return None
+
+
+def ValueObjectSP_SummaryProvider(valobj, dict):
+ return 'use = ' + \
+ str(1 + valobj.GetChildMemberWithName("count").GetValueAsUnsigned())
+
def __lldb_init_module(debugger, dict):
- debugger.HandleCommand('type summary add -x ".*ValueObjectSP" --expand -F sp_cp.ValueObjectSP_SummaryProvider')
- debugger.HandleCommand('type synthetic add -x ".*ValueObjectSP" -l sp_cp.ValueObjectSP_SyntheticChildrenProvider')
- debugger.HandleCommand('type summary add -x ".*SP" --expand -F sp_cp.SharedPtr_SummaryProvider')
- debugger.HandleCommand('type synthetic add -x ".*SP" -l sp_cp.SharedPtr_SyntheticChildrenProvider')
+ debugger.HandleCommand(
+ 'type summary add -x ".*ValueObjectSP" --expand -F sp_cp.ValueObjectSP_SummaryProvider')
+ debugger.HandleCommand(
+ 'type synthetic add -x ".*ValueObjectSP" -l sp_cp.ValueObjectSP_SyntheticChildrenProvider')
+ debugger.HandleCommand(
+ 'type summary add -x ".*SP" --expand -F sp_cp.SharedPtr_SummaryProvider')
+ debugger.HandleCommand(
+ 'type synthetic add -x ".*SP" -l sp_cp.SharedPtr_SyntheticChildrenProvider')
Modified: lldb/trunk/examples/summaries/synth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/synth.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/synth.py (original)
+++ lldb/trunk/examples/summaries/synth.py Tue Sep 6 15:57:50 2016
@@ -1,57 +1,66 @@
import lldb
+
class PythonObjectSyntheticChildProvider(object):
- def __init__(self, value, internal_dict):
- self.value = value
- self.values = self.make_children()
- self.built_values = {}
- self.bo = self.value.target.byte_order
- self.ps = self.value.target.addr_size
-
- def make_children(self):
- pass
-
- def num_children(self):
- return len(self.values)
-
- def get_child_index(self, name):
- i = 0
- for N, value in self.values:
- if N == name: return i
- i += 1
- return None
-
- def update(self):
- pass
-
- def has_children(self):
- return len(self.values) > 0
-
- def gen_child(self, name, value):
- data = None; type = None
- if isinstance(value, int):
- data = lldb.SBData.CreateDataFromUInt32Array(self.bo, self.ps, [value])
- type = self.value.target.GetBasicType(lldb.eBasicTypeInt)
- elif isinstance(value, long):
- data = lldb.SBData.CreateDataFromUInt64Array(self.bo, self.ps, [value])
- type = self.value.target.GetBasicType(lldb.eBasicTypeLong)
- elif isinstance(value, float):
- data = lldb.SBData.CreateDataFromDoubleArray(self.bo, self.ps, [value])
- type = self.value.target.GetBasicType(lldb.eBasicTypeDouble)
- elif isinstance(value, str):
- data = lldb.SBData.CreateDataFromCString(self.bo, self.ps, value)
- type = self.value.target.GetBasicType(lldb.eBasicTypeChar).GetArrayType(len(value))
- if (data is not None) and (type is not None):
- return self.value.CreateValueFromData(name, data, type)
- return None
-
- def get_child_at_index(self, index):
- if index in self.built_values:
- return self.built_values[index]
-
- bv = None
-
- name, value = self.values[index]
- bv = self.gen_child(name, value)
- self.built_values[index] = bv
- return bv
+
+ def __init__(self, value, internal_dict):
+ self.value = value
+ self.values = self.make_children()
+ self.built_values = {}
+ self.bo = self.value.target.byte_order
+ self.ps = self.value.target.addr_size
+
+ def make_children(self):
+ pass
+
+ def num_children(self):
+ return len(self.values)
+
+ def get_child_index(self, name):
+ i = 0
+ for N, value in self.values:
+ if N == name:
+ return i
+ i += 1
+ return None
+
+ def update(self):
+ pass
+
+ def has_children(self):
+ return len(self.values) > 0
+
+ def gen_child(self, name, value):
+ data = None
+ type = None
+ if isinstance(value, int):
+ data = lldb.SBData.CreateDataFromUInt32Array(
+ self.bo, self.ps, [value])
+ type = self.value.target.GetBasicType(lldb.eBasicTypeInt)
+ elif isinstance(value, long):
+ data = lldb.SBData.CreateDataFromUInt64Array(
+ self.bo, self.ps, [value])
+ type = self.value.target.GetBasicType(lldb.eBasicTypeLong)
+ elif isinstance(value, float):
+ data = lldb.SBData.CreateDataFromDoubleArray(
+ self.bo, self.ps, [value])
+ type = self.value.target.GetBasicType(lldb.eBasicTypeDouble)
+ elif isinstance(value, str):
+ data = lldb.SBData.CreateDataFromCString(self.bo, self.ps, value)
+ type = self.value.target.GetBasicType(
+ lldb.eBasicTypeChar).GetArrayType(
+ len(value))
+ if (data is not None) and (type is not None):
+ return self.value.CreateValueFromData(name, data, type)
+ return None
+
+ def get_child_at_index(self, index):
+ if index in self.built_values:
+ return self.built_values[index]
+
+ bv = None
+
+ name, value = self.values[index]
+ bv = self.gen_child(name, value)
+ self.built_values[index] = bv
+ return bv
Modified: lldb/trunk/examples/summaries/unicode_strings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/unicode_strings.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/unicode_strings.py (original)
+++ lldb/trunk/examples/summaries/unicode_strings.py Tue Sep 6 15:57:50 2016
@@ -11,38 +11,43 @@ License. See LICENSE.TXT for details.
"""
import lldb
-def utf8_summary(value,unused):
- pointer = value.GetChildMemberWithName("first").GetValueAsUnsigned(0)
- length = value.GetChildMemberWithName("second").GetValueAsUnsigned(0)
- if pointer == 0:
- return False
- if length == 0:
- return '""'
- error = lldb.SBError()
- string_data = value.process.ReadMemory(pointer, length, error)
- return '"%s"' % (string_data) # utf8 is safe to emit as-is on OSX
-
-def utf16_summary(value,unused):
- pointer = value.GetChildMemberWithName("first").GetValueAsUnsigned(0)
- length = value.GetChildMemberWithName("second").GetValueAsUnsigned(0)
- # assume length is in bytes - if in UTF16 chars, just multiply by 2
- if pointer == 0:
- return False
- if length == 0:
- return '""'
- error = lldb.SBError()
- string_data = value.process.ReadMemory(pointer, length, error)
- return '"%s"' % (string_data.decode('utf-16').encode('utf-8')) # utf8 is safe to emit as-is on OSX
-
-def utf32_summary(value,unused):
- pointer = value.GetChildMemberWithName("first").GetValueAsUnsigned(0)
- length = value.GetChildMemberWithName("second").GetValueAsUnsigned(0)
- # assume length is in bytes - if in UTF32 chars, just multiply by 4
- if pointer == 0:
- return False
- if length == 0:
- return '""'
- error = lldb.SBError()
- string_data = value.process.ReadMemory(pointer, length, error)
- return '"%s"' % (string_data.decode('utf-32').encode('utf-8')) # utf8 is safe to emit as-is on OSX
+
+def utf8_summary(value, unused):
+ pointer = value.GetChildMemberWithName("first").GetValueAsUnsigned(0)
+ length = value.GetChildMemberWithName("second").GetValueAsUnsigned(0)
+ if pointer == 0:
+ return False
+ if length == 0:
+ return '""'
+ error = lldb.SBError()
+ string_data = value.process.ReadMemory(pointer, length, error)
+ return '"%s"' % (string_data) # utf8 is safe to emit as-is on OSX
+
+
+def utf16_summary(value, unused):
+ pointer = value.GetChildMemberWithName("first").GetValueAsUnsigned(0)
+ length = value.GetChildMemberWithName("second").GetValueAsUnsigned(0)
+ # assume length is in bytes - if in UTF16 chars, just multiply by 2
+ if pointer == 0:
+ return False
+ if length == 0:
+ return '""'
+ error = lldb.SBError()
+ string_data = value.process.ReadMemory(pointer, length, error)
+ # utf8 is safe to emit as-is on OSX
+ return '"%s"' % (string_data.decode('utf-16').encode('utf-8'))
+
+
+def utf32_summary(value, unused):
+ pointer = value.GetChildMemberWithName("first").GetValueAsUnsigned(0)
+ length = value.GetChildMemberWithName("second").GetValueAsUnsigned(0)
+ # assume length is in bytes - if in UTF32 chars, just multiply by 4
+ if pointer == 0:
+ return False
+ if length == 0:
+ return '""'
+ error = lldb.SBError()
+ string_data = value.process.ReadMemory(pointer, length, error)
+ # utf8 is safe to emit as-is on OSX
+ return '"%s"' % (string_data.decode('utf-32').encode('utf-8'))
Modified: lldb/trunk/examples/synthetic/bitfield/example.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/bitfield/example.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/bitfield/example.py (original)
+++ lldb/trunk/examples/synthetic/bitfield/example.py Tue Sep 6 15:57:50 2016
@@ -1,100 +1,123 @@
# Synthetic children provider example for class MaskedData
# to use me:
# command script import ./example.py --allow-reload
-# type synthetic add MaskedData --python-class example.MaskedData_SyntheticChildrenProvider
+# type synthetic add MaskedData --python-class
+# example.MaskedData_SyntheticChildrenProvider
+
+
class MaskedData_SyntheticChildrenProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj # remember the SBValue since you will not have another chance to get it :-)
- def num_children(self):
- # you could perform calculations involving the SBValue and/or its children to determine this value
- # here, we have an hardcoded value - but since you have stored the SBValue you could use it to
- # help figure out the correct thing to return here. if you return a number N, you should be prepared to
- # answer questions about N children
- return 4
-
- def has_children(self):
- # we simply say True here because we know we have 4 children
- # in general, you want to make this calculation as simple as possible
- # and return True if in doubt (you can always return num_children == 0 later)
- return True
-
- def get_child_index(self,name):
- # given a name, return its index
- # you can return None if you don't know the answer for a given name
- if name == "value":
- return 0
- # here, we are using a reserved C++ keyword as a child name - we could not do that in the source code
- # but we are free to use the names we like best in the synthetic children provider class
- # we are also not respecting the order of declaration in the C++ class itself - as long as
- # we are consistent, we can do that freely
- if name == "operator":
- return 1
- if name == "mask":
- return 2
- # this member does not exist in the original class - we will compute its value and show it to the user
- # when returning synthetic children, there is no need to only stick to what already exists in memory
- if name == "apply()":
- return 3
- return None # no clue, just say none
-
- def get_child_at_index(self,index):
- # precautionary measures
- if index < 0:
- return None
- if index > self.num_children():
- return None
- if self.valobj.IsValid() == False:
- return None
- if index == 0:
- return self.valobj.GetChildMemberWithName("value")
- if index == 1:
- # fetch the value of the operator
- op_chosen = self.valobj.GetChildMemberWithName("oper").GetValueAsUnsigned()
- # if it is a known value, return a descriptive string for it
- # we are not doing this in the most efficient possible way, but the code is very readable
- # and easy to maintain - if you change the values on the C++ side, the same changes must be made here
- if op_chosen == 0:
- return self.valobj.CreateValueFromExpression("operator",'(const char*)"none"')
- elif op_chosen == 1:
- return self.valobj.CreateValueFromExpression("operator",'(const char*)"AND"')
- elif op_chosen == 2:
- return self.valobj.CreateValueFromExpression("operator",'(const char*)"OR"')
- elif op_chosen == 3:
- return self.valobj.CreateValueFromExpression("operator",'(const char*)"XOR"')
- elif op_chosen == 4:
- return self.valobj.CreateValueFromExpression("operator",'(const char*)"NAND"')
- elif op_chosen == 5:
- return self.valobj.CreateValueFromExpression("operator",'(const char*)"NOR"')
- else:
- return self.valobj.CreateValueFromExpression("operator",'(const char*)"unknown"') # something else
- if index == 2:
- return self.valobj.GetChildMemberWithName("mask")
- if index == 3:
- # for this, we must fetch all the other elements
- # in an efficient implementation, we would be caching this data for efficiency
- value = self.valobj.GetChildMemberWithName("value").GetValueAsUnsigned()
- operator = self.valobj.GetChildMemberWithName("oper").GetValueAsUnsigned()
- mask = self.valobj.GetChildMemberWithName("mask").GetValueAsUnsigned()
- # compute the masked value according to the operator
- if operator == 1:
- value = value & mask
- elif operator == 2:
- value = value | mask
- elif operator == 3:
- value = value ^ mask
- elif operator == 4:
- value = ~(value & mask)
- elif operator == 5:
- value = ~(value | mask)
- else:
- pass
- value &= 0xFFFFFFFF # make sure Python does not extend our values to 64-bits
- # return it - again, not the most efficient possible way. we should actually be pushing the computed value
- # into an SBData, and using the SBData to create an SBValue - this has the advantage of readability
- return self.valobj.CreateValueFromExpression("apply()",'(uint32_t)(' + str(value) + ')')
-
- def update(self):
- # we do not do anything special in update - but this would be the right place to lookup
- # the data we use in get_child_at_index and cache it
- pass
+ def __init__(self, valobj, dict):
+ # remember the SBValue since you will not have another chance to get it
+ # :-)
+ self.valobj = valobj
+
+ def num_children(self):
+ # you could perform calculations involving the SBValue and/or its children to determine this value
+ # here, we have an hardcoded value - but since you have stored the SBValue you could use it to
+ # help figure out the correct thing to return here. if you return a number N, you should be prepared to
+ # answer questions about N children
+ return 4
+
+ def has_children(self):
+ # we simply say True here because we know we have 4 children
+ # in general, you want to make this calculation as simple as possible
+ # and return True if in doubt (you can always return num_children == 0
+ # later)
+ return True
+
+ def get_child_index(self, name):
+ # given a name, return its index
+ # you can return None if you don't know the answer for a given name
+ if name == "value":
+ return 0
+ # here, we are using a reserved C++ keyword as a child name - we could not do that in the source code
+ # but we are free to use the names we like best in the synthetic children provider class
+ # we are also not respecting the order of declaration in the C++ class itself - as long as
+ # we are consistent, we can do that freely
+ if name == "operator":
+ return 1
+ if name == "mask":
+ return 2
+ # this member does not exist in the original class - we will compute its value and show it to the user
+ # when returning synthetic children, there is no need to only stick to
+ # what already exists in memory
+ if name == "apply()":
+ return 3
+ return None # no clue, just say none
+
+ def get_child_at_index(self, index):
+ # precautionary measures
+ if index < 0:
+ return None
+ if index > self.num_children():
+ return None
+ if self.valobj.IsValid() == False:
+ return None
+ if index == 0:
+ return self.valobj.GetChildMemberWithName("value")
+ if index == 1:
+ # fetch the value of the operator
+ op_chosen = self.valobj.GetChildMemberWithName(
+ "oper").GetValueAsUnsigned()
+ # if it is a known value, return a descriptive string for it
+ # we are not doing this in the most efficient possible way, but the code is very readable
+ # and easy to maintain - if you change the values on the C++ side,
+ # the same changes must be made here
+ if op_chosen == 0:
+ return self.valobj.CreateValueFromExpression(
+ "operator", '(const char*)"none"')
+ elif op_chosen == 1:
+ return self.valobj.CreateValueFromExpression(
+ "operator", '(const char*)"AND"')
+ elif op_chosen == 2:
+ return self.valobj.CreateValueFromExpression(
+ "operator", '(const char*)"OR"')
+ elif op_chosen == 3:
+ return self.valobj.CreateValueFromExpression(
+ "operator", '(const char*)"XOR"')
+ elif op_chosen == 4:
+ return self.valobj.CreateValueFromExpression(
+ "operator", '(const char*)"NAND"')
+ elif op_chosen == 5:
+ return self.valobj.CreateValueFromExpression(
+ "operator", '(const char*)"NOR"')
+ else:
+ return self.valobj.CreateValueFromExpression(
+ "operator", '(const char*)"unknown"') # something else
+ if index == 2:
+ return self.valobj.GetChildMemberWithName("mask")
+ if index == 3:
+ # for this, we must fetch all the other elements
+ # in an efficient implementation, we would be caching this data for
+ # efficiency
+ value = self.valobj.GetChildMemberWithName(
+ "value").GetValueAsUnsigned()
+ operator = self.valobj.GetChildMemberWithName(
+ "oper").GetValueAsUnsigned()
+ mask = self.valobj.GetChildMemberWithName(
+ "mask").GetValueAsUnsigned()
+ # compute the masked value according to the operator
+ if operator == 1:
+ value = value & mask
+ elif operator == 2:
+ value = value | mask
+ elif operator == 3:
+ value = value ^ mask
+ elif operator == 4:
+ value = ~(value & mask)
+ elif operator == 5:
+ value = ~(value | mask)
+ else:
+ pass
+ value &= 0xFFFFFFFF # make sure Python does not extend our values to 64-bits
+ # return it - again, not the most efficient possible way. we should actually be pushing the computed value
+ # into an SBData, and using the SBData to create an SBValue - this
+ # has the advantage of readability
+ return self.valobj.CreateValueFromExpression(
+ "apply()", '(uint32_t)(' + str(value) + ')')
+
+ def update(self):
+ # we do not do anything special in update - but this would be the right place to lookup
+ # the data we use in get_child_at_index and cache it
+ pass
Modified: lldb/trunk/examples/synthetic/bitfield/program.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/bitfield/program.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/bitfield/program.cpp (original)
+++ lldb/trunk/examples/synthetic/bitfield/program.cpp Tue Sep 6 15:57:50 2016
@@ -1,74 +1,56 @@
typedef unsigned int uint32_t;
-enum MaskingOperator
-{
- eMaskingOperatorDefault = 0,
- eMaskingOperatorAnd = 1,
- eMaskingOperatorOr = 2,
- eMaskingOperatorXor = 3,
- eMaskingOperatorNand = 4,
- eMaskingOperatorNor = 5
+enum MaskingOperator {
+ eMaskingOperatorDefault = 0,
+ eMaskingOperatorAnd = 1,
+ eMaskingOperatorOr = 2,
+ eMaskingOperatorXor = 3,
+ eMaskingOperatorNand = 4,
+ eMaskingOperatorNor = 5
};
-class MaskedData
-{
+class MaskedData {
private:
- uint32_t value;
- uint32_t mask;
- MaskingOperator oper;
+ uint32_t value;
+ uint32_t mask;
+ MaskingOperator oper;
+
public:
- MaskedData( uint32_t V = 0,
- uint32_t M = 0,
- MaskingOperator P = eMaskingOperatorDefault) :
- value(V),
- mask(M),
- oper(P)
- {
- }
-
- uint32_t apply()
- {
- switch(oper)
- {
- case eMaskingOperatorAnd:
- return value & mask;
- case eMaskingOperatorOr:
- return value | mask;
- case eMaskingOperatorXor:
- return value ^ mask;
- case eMaskingOperatorNand:
- return ~(value & mask);
- case eMaskingOperatorNor:
- return ~(value | mask);
- case eMaskingOperatorDefault: // fall through
- default:
- return value;
- }
- }
-
- void setValue(uint32_t V)
- {
- value = V;
- }
-
- void setMask (uint32_t M)
- {
- mask = M;
- }
-
- void setOperator(MaskingOperator P)
- {
- oper = P;
- }
+ MaskedData(uint32_t V = 0, uint32_t M = 0,
+ MaskingOperator P = eMaskingOperatorDefault)
+ : value(V), mask(M), oper(P) {}
+
+ uint32_t apply() {
+ switch (oper) {
+ case eMaskingOperatorAnd:
+ return value & mask;
+ case eMaskingOperatorOr:
+ return value | mask;
+ case eMaskingOperatorXor:
+ return value ^ mask;
+ case eMaskingOperatorNand:
+ return ~(value & mask);
+ case eMaskingOperatorNor:
+ return ~(value | mask);
+ case eMaskingOperatorDefault: // fall through
+ default:
+ return value;
+ }
+ }
+
+ void setValue(uint32_t V) { value = V; }
+
+ void setMask(uint32_t M) { mask = M; }
+
+ void setOperator(MaskingOperator P) { oper = P; }
};
-int main()
-{
- MaskedData data_1(0xFF0F,0xA01F,eMaskingOperatorAnd);
- MaskedData data_2(data_1.apply(),0x1AFC,eMaskingOperatorXor);
- MaskedData data_3(data_2.apply(),0xFFCF,eMaskingOperatorOr);
- MaskedData data_4(data_3.apply(),0xAABC,eMaskingOperatorAnd);
- MaskedData data_5(data_4.apply(),0xFFAC,eMaskingOperatorNor);
- MaskedData data_6(data_5.apply(),0x0000BEEF,eMaskingOperatorAnd);
- return data_6.apply(); // <-- what comes out of here?
+int main() {
+ MaskedData data_1(0xFF0F, 0xA01F, eMaskingOperatorAnd);
+ MaskedData data_2(data_1.apply(), 0x1AFC, eMaskingOperatorXor);
+ MaskedData data_3(data_2.apply(), 0xFFCF, eMaskingOperatorOr);
+ MaskedData data_4(data_3.apply(), 0xAABC, eMaskingOperatorAnd);
+ MaskedData data_5(data_4.apply(), 0xFFAC, eMaskingOperatorNor);
+ MaskedData data_6(data_5.apply(), 0x0000BEEF, eMaskingOperatorAnd);
+ return data_6.apply(); // <-- what comes out of here?
}
\ No newline at end of file
Modified: lldb/trunk/examples/synthetic/gnu_libstdcpp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/gnu_libstdcpp.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/gnu_libstdcpp.py (original)
+++ lldb/trunk/examples/synthetic/gnu_libstdcpp.py Tue Sep 6 15:57:50 2016
@@ -7,446 +7,474 @@ import lldb.formatters.Logger
# You are encouraged to look at the STL implementation for your platform
# before relying on these formatters to do the right thing for your setup
+
class StdListSynthProvider:
- def __init__(self, valobj, dict):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj
- self.count = None
- logger >> "Providing synthetic children for a list named " + str(valobj.GetName())
-
- def next_node(self,node):
- logger = lldb.formatters.Logger.Logger()
- return node.GetChildMemberWithName('_M_next')
-
- def is_valid(self,node):
- logger = lldb.formatters.Logger.Logger()
- valid = self.value(self.next_node(node)) != self.node_address
- if valid:
- logger >> "%s is valid" % str(self.valobj.GetName())
- else:
- logger >> "synthetic value is not valid"
- return valid
-
- def value(self,node):
- logger = lldb.formatters.Logger.Logger()
- value = node.GetValueAsUnsigned()
- logger >> "synthetic value for {}: {}".format(str(self.valobj.GetName()), value)
- return value
-
- # Floyd's cycle-finding algorithm
- # try to detect if this list has a loop
- def has_loop(self):
- global _list_uses_loop_detector
- logger = lldb.formatters.Logger.Logger()
- if _list_uses_loop_detector == False:
- logger >> "Asked not to use loop detection"
- return False
- slow = self.next
- fast1 = self.next
- fast2 = self.next
- while self.is_valid(slow):
- slow_value = self.value(slow)
- fast1 = self.next_node(fast2)
- fast2 = self.next_node(fast1)
- if self.value(fast1) == slow_value or self.value(fast2) == slow_value:
- return True
- slow = self.next_node(slow)
- return False
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- if self.count is None:
- # libstdc++ 6.0.21 added dedicated count field.
- count_child = self.node.GetChildMemberWithName('_M_data')
- if count_child and count_child.IsValid():
- self.count = count_child.GetValueAsUnsigned(0)
- if self.count is None:
- self.count = self.num_children_impl()
- return self.count
-
- def num_children_impl(self):
- logger = lldb.formatters.Logger.Logger()
- try:
- next_val = self.next.GetValueAsUnsigned(0)
- prev_val = self.prev.GetValueAsUnsigned(0)
- # After a std::list has been initialized, both next and prev will be non-NULL
- if next_val == 0 or prev_val == 0:
- return 0
- if next_val == self.node_address:
- return 0
- if next_val == prev_val:
- return 1
- if self.has_loop():
- return 0
- size = 2
- current = self.next
- while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address:
- size = size + 1
- current = current.GetChildMemberWithName('_M_next')
- return (size - 1)
- except:
- return 0;
-
- def get_child_index(self,name):
- logger = lldb.formatters.Logger.Logger()
- try:
- return int(name.lstrip('[').rstrip(']'))
- except:
- return -1
-
- def get_child_at_index(self,index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Fetching child " + str(index)
- if index < 0:
- return None;
- if index >= self.num_children():
- return None;
- try:
- offset = index
- current = self.next
- while offset > 0:
- current = current.GetChildMemberWithName('_M_next')
- offset = offset - 1
- return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
- except:
- return None
-
- def extract_type(self):
- logger = lldb.formatters.Logger.Logger()
- list_type = self.valobj.GetType().GetUnqualifiedType()
- if list_type.IsReferenceType():
- list_type = list_type.GetDereferencedType()
- if list_type.GetNumberOfTemplateArguments() > 0:
- data_type = list_type.GetTemplateArgumentType(0)
- else:
- data_type = None
- return data_type
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- # preemptively setting this to None - we might end up changing our mind later
- self.count = None
- try:
- impl = self.valobj.GetChildMemberWithName('_M_impl')
- self.node = impl.GetChildMemberWithName('_M_node')
- self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
- self.next = self.node.GetChildMemberWithName('_M_next')
- self.prev = self.node.GetChildMemberWithName('_M_prev')
- self.data_type = self.extract_type()
- self.data_size = self.data_type.GetByteSize()
- except:
- pass
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.count = None
+ logger >> "Providing synthetic children for a list named " + \
+ str(valobj.GetName())
+
+ def next_node(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ return node.GetChildMemberWithName('_M_next')
+
+ def is_valid(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ valid = self.value(self.next_node(node)) != self.node_address
+ if valid:
+ logger >> "%s is valid" % str(self.valobj.GetName())
+ else:
+ logger >> "synthetic value is not valid"
+ return valid
+
+ def value(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ value = node.GetValueAsUnsigned()
+ logger >> "synthetic value for {}: {}".format(
+ str(self.valobj.GetName()), value)
+ return value
+
+ # Floyd's cycle-finding algorithm
+ # try to detect if this list has a loop
+ def has_loop(self):
+ global _list_uses_loop_detector
+ logger = lldb.formatters.Logger.Logger()
+ if not _list_uses_loop_detector:
+ logger >> "Asked not to use loop detection"
+ return False
+ slow = self.next
+ fast1 = self.next
+ fast2 = self.next
+ while self.is_valid(slow):
+ slow_value = self.value(slow)
+ fast1 = self.next_node(fast2)
+ fast2 = self.next_node(fast1)
+ if self.value(fast1) == slow_value or self.value(
+ fast2) == slow_value:
+ return True
+ slow = self.next_node(slow)
+ return False
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.count is None:
+ # libstdc++ 6.0.21 added dedicated count field.
+ count_child = self.node.GetChildMemberWithName('_M_data')
+ if count_child and count_child.IsValid():
+ self.count = count_child.GetValueAsUnsigned(0)
+ if self.count is None:
+ self.count = self.num_children_impl()
+ return self.count
+
+ def num_children_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ next_val = self.next.GetValueAsUnsigned(0)
+ prev_val = self.prev.GetValueAsUnsigned(0)
+ # After a std::list has been initialized, both next and prev will
+ # be non-NULL
+ if next_val == 0 or prev_val == 0:
+ return 0
+ if next_val == self.node_address:
+ return 0
+ if next_val == prev_val:
+ return 1
+ if self.has_loop():
+ return 0
+ size = 2
+ current = self.next
+ while current.GetChildMemberWithName(
+ '_M_next').GetValueAsUnsigned(0) != self.node_address:
+ size = size + 1
+ current = current.GetChildMemberWithName('_M_next')
+ return (size - 1)
+ except:
+ return 0
+
+ def get_child_index(self, name):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Fetching child " + str(index)
+ if index < 0:
+ return None
+ if index >= self.num_children():
+ return None
+ try:
+ offset = index
+ current = self.next
+ while offset > 0:
+ current = current.GetChildMemberWithName('_M_next')
+ offset = offset - 1
+ return current.CreateChildAtOffset(
+ '[' + str(index) + ']',
+ 2 * current.GetType().GetByteSize(),
+ self.data_type)
+ except:
+ return None
+
+ def extract_type(self):
+ logger = lldb.formatters.Logger.Logger()
+ list_type = self.valobj.GetType().GetUnqualifiedType()
+ if list_type.IsReferenceType():
+ list_type = list_type.GetDereferencedType()
+ if list_type.GetNumberOfTemplateArguments() > 0:
+ data_type = list_type.GetTemplateArgumentType(0)
+ else:
+ data_type = None
+ return data_type
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ # preemptively setting this to None - we might end up changing our mind
+ # later
+ self.count = None
+ try:
+ impl = self.valobj.GetChildMemberWithName('_M_impl')
+ self.node = impl.GetChildMemberWithName('_M_node')
+ self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
+ self.next = self.node.GetChildMemberWithName('_M_next')
+ self.prev = self.node.GetChildMemberWithName('_M_prev')
+ self.data_type = self.extract_type()
+ self.data_size = self.data_type.GetByteSize()
+ except:
+ pass
+
+ def has_children(self):
+ return True
- def has_children(self):
- return True
class StdVectorSynthProvider:
- class StdVectorImplementation(object):
- def __init__(self, valobj):
- self.valobj = valobj
- self.count = None
-
- def num_children(self):
- if self.count == None:
- self.count = self.num_children_impl()
- return self.count
-
- def num_children_impl(self):
- try:
- start_val = self.start.GetValueAsUnsigned(0)
- finish_val = self.finish.GetValueAsUnsigned(0)
- end_val = self.end.GetValueAsUnsigned(0)
- # Before a vector has been constructed, it will contain bad values
- # so we really need to be careful about the length we return since
- # uninitialized data can cause us to return a huge number. We need
- # to also check for any of the start, finish or end of storage values
- # being zero (NULL). If any are, then this vector has not been
- # initialized yet and we should return zero
-
- # Make sure nothing is NULL
- if start_val == 0 or finish_val == 0 or end_val == 0:
- return 0
- # Make sure start is less than finish
- if start_val >= finish_val:
- return 0
- # Make sure finish is less than or equal to end of storage
- if finish_val > end_val:
- return 0
-
- # if we have a struct (or other data type that the compiler pads to native word size)
- # this check might fail, unless the sizeof() we get is itself incremented to take the
- # padding bytes into account - on current clang it looks like this is the case
- num_children = (finish_val-start_val)
- if (num_children % self.data_size) != 0:
- return 0
- else:
- num_children = num_children/self.data_size
- return num_children
- except:
- return 0;
-
- def get_child_at_index(self, index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Retrieving child " + str(index)
- if index < 0:
- return None;
- if index >= self.num_children():
- return None;
- try:
- offset = index * self.data_size
- return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
- except:
- return None
-
- def update(self):
- # preemptively setting this to None - we might end up changing our mind later
- self.count = None
- try:
- impl = self.valobj.GetChildMemberWithName('_M_impl')
- self.start = impl.GetChildMemberWithName('_M_start')
- self.finish = impl.GetChildMemberWithName('_M_finish')
- self.end = impl.GetChildMemberWithName('_M_end_of_storage')
- self.data_type = self.start.GetType().GetPointeeType()
- self.data_size = self.data_type.GetByteSize()
- # if any of these objects is invalid, it means there is no point in trying to fetch anything
- if self.start.IsValid() and self.finish.IsValid() and self.end.IsValid() and self.data_type.IsValid():
- self.count = None
- else:
- self.count = 0
- except:
- pass
- return True
-
- class StdVBoolImplementation(object):
- def __init__(self, valobj, bool_type):
- self.valobj = valobj
- self.bool_type = bool_type
- self.valid = False
-
- def num_children(self):
- if self.valid:
- start = self.start_p.GetValueAsUnsigned(0)
- finish = self.finish_p.GetValueAsUnsigned(0)
- offset = self.offset.GetValueAsUnsigned(0)
- if finish >= start:
- return (finish - start) * 8 + offset
- return 0
-
- def get_child_at_index(self, index):
- if index >= self.num_children():
- return None
- element_type = self.start_p.GetType().GetPointeeType()
- element_bits = 8 * element_type.GetByteSize()
- element_offset = (index / element_bits) * element_type.GetByteSize()
- bit_offset = index % element_bits
- element = self.start_p.CreateChildAtOffset('['+str(index)+']',element_offset,element_type)
- bit = element.GetValueAsUnsigned(0) & (1 << bit_offset)
- if bit != 0:
- value_expr = "(bool)true"
- else:
- value_expr = "(bool)false"
- return self.valobj.CreateValueFromExpression("[%d]" % index, value_expr)
-
- def update(self):
- try:
- m_impl = self.valobj.GetChildMemberWithName('_M_impl')
- self.m_start = m_impl.GetChildMemberWithName('_M_start')
- self.m_finish = m_impl.GetChildMemberWithName('_M_finish')
- self.start_p = self.m_start.GetChildMemberWithName('_M_p')
- self.finish_p = self.m_finish.GetChildMemberWithName('_M_p')
- self.offset = self.m_finish.GetChildMemberWithName('_M_offset')
- self.valid = True
- except:
- self.valid = False
- return True
-
- def __init__(self, valobj, dict):
- logger = lldb.formatters.Logger.Logger()
- first_template_arg_type = valobj.GetType().GetTemplateArgumentType(0)
- if str(first_template_arg_type.GetName()) == "bool":
- self.impl = self.StdVBoolImplementation(valobj, first_template_arg_type)
- else:
- self.impl = self.StdVectorImplementation(valobj)
- logger >> "Providing synthetic children for a vector named " + str(valobj.GetName())
-
- def num_children(self):
- return self.impl.num_children()
-
- def get_child_index(self,name):
- try:
- return int(name.lstrip('[').rstrip(']'))
- except:
- return -1
+ class StdVectorImplementation(object):
+
+ def __init__(self, valobj):
+ self.valobj = valobj
+ self.count = None
+
+ def num_children(self):
+ if self.count is None:
+ self.count = self.num_children_impl()
+ return self.count
+
+ def num_children_impl(self):
+ try:
+ start_val = self.start.GetValueAsUnsigned(0)
+ finish_val = self.finish.GetValueAsUnsigned(0)
+ end_val = self.end.GetValueAsUnsigned(0)
+ # Before a vector has been constructed, it will contain bad values
+ # so we really need to be careful about the length we return since
+ # uninitialized data can cause us to return a huge number. We need
+ # to also check for any of the start, finish or end of storage values
+ # being zero (NULL). If any are, then this vector has not been
+ # initialized yet and we should return zero
+
+ # Make sure nothing is NULL
+ if start_val == 0 or finish_val == 0 or end_val == 0:
+ return 0
+ # Make sure start is less than finish
+ if start_val >= finish_val:
+ return 0
+ # Make sure finish is less than or equal to end of storage
+ if finish_val > end_val:
+ return 0
+
+ # if we have a struct (or other data type that the compiler pads to native word size)
+ # this check might fail, unless the sizeof() we get is itself incremented to take the
+ # padding bytes into account - on current clang it looks like
+ # this is the case
+ num_children = (finish_val - start_val)
+ if (num_children % self.data_size) != 0:
+ return 0
+ else:
+ num_children = num_children / self.data_size
+ return num_children
+ except:
+ return 0
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Retrieving child " + str(index)
+ if index < 0:
+ return None
+ if index >= self.num_children():
+ return None
+ try:
+ offset = index * self.data_size
+ return self.start.CreateChildAtOffset(
+ '[' + str(index) + ']', offset, self.data_type)
+ except:
+ return None
+
+ def update(self):
+ # preemptively setting this to None - we might end up changing our
+ # mind later
+ self.count = None
+ try:
+ impl = self.valobj.GetChildMemberWithName('_M_impl')
+ self.start = impl.GetChildMemberWithName('_M_start')
+ self.finish = impl.GetChildMemberWithName('_M_finish')
+ self.end = impl.GetChildMemberWithName('_M_end_of_storage')
+ self.data_type = self.start.GetType().GetPointeeType()
+ self.data_size = self.data_type.GetByteSize()
+ # if any of these objects is invalid, it means there is no
+ # point in trying to fetch anything
+ if self.start.IsValid() and self.finish.IsValid(
+ ) and self.end.IsValid() and self.data_type.IsValid():
+ self.count = None
+ else:
+ self.count = 0
+ except:
+ pass
+ return True
+
+ class StdVBoolImplementation(object):
+
+ def __init__(self, valobj, bool_type):
+ self.valobj = valobj
+ self.bool_type = bool_type
+ self.valid = False
+
+ def num_children(self):
+ if self.valid:
+ start = self.start_p.GetValueAsUnsigned(0)
+ finish = self.finish_p.GetValueAsUnsigned(0)
+ offset = self.offset.GetValueAsUnsigned(0)
+ if finish >= start:
+ return (finish - start) * 8 + offset
+ return 0
+
+ def get_child_at_index(self, index):
+ if index >= self.num_children():
+ return None
+ element_type = self.start_p.GetType().GetPointeeType()
+ element_bits = 8 * element_type.GetByteSize()
+ element_offset = (index / element_bits) * \
+ element_type.GetByteSize()
+ bit_offset = index % element_bits
+ element = self.start_p.CreateChildAtOffset(
+ '[' + str(index) + ']', element_offset, element_type)
+ bit = element.GetValueAsUnsigned(0) & (1 << bit_offset)
+ if bit != 0:
+ value_expr = "(bool)true"
+ else:
+ value_expr = "(bool)false"
+ return self.valobj.CreateValueFromExpression(
+ "[%d]" % index, value_expr)
+
+ def update(self):
+ try:
+ m_impl = self.valobj.GetChildMemberWithName('_M_impl')
+ self.m_start = m_impl.GetChildMemberWithName('_M_start')
+ self.m_finish = m_impl.GetChildMemberWithName('_M_finish')
+ self.start_p = self.m_start.GetChildMemberWithName('_M_p')
+ self.finish_p = self.m_finish.GetChildMemberWithName('_M_p')
+ self.offset = self.m_finish.GetChildMemberWithName('_M_offset')
+ self.valid = True
+ except:
+ self.valid = False
+ return True
+
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ first_template_arg_type = valobj.GetType().GetTemplateArgumentType(0)
+ if str(first_template_arg_type.GetName()) == "bool":
+ self.impl = self.StdVBoolImplementation(
+ valobj, first_template_arg_type)
+ else:
+ self.impl = self.StdVectorImplementation(valobj)
+ logger >> "Providing synthetic children for a vector named " + \
+ str(valobj.GetName())
+
+ def num_children(self):
+ return self.impl.num_children()
+
+ def get_child_index(self, name):
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1
- def get_child_at_index(self, index):
- return self.impl.get_child_at_index(index)
+ def get_child_at_index(self, index):
+ return self.impl.get_child_at_index(index)
- def update(self):
- return self.impl.update()
+ def update(self):
+ return self.impl.update()
- def has_children(self):
- return True
+ def has_children(self):
+ return True
class StdMapSynthProvider:
- def __init__(self, valobj, dict):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.count = None
- logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
-
- # we need this function as a temporary workaround for rdar://problem/10801549
- # which prevents us from extracting the std::pair<K,V> SBType out of the template
- # arguments for _Rep_Type _M_t in the map itself - because we have to make up the
- # typename and then find it, we may hit the situation were std::string has multiple
- # names but only one is actually referenced in the debug information. hence, we need
- # to replace the longer versions of std::string with the shorter one in order to be able
- # to find the type name
- def fixup_class_name(self, class_name):
- logger = lldb.formatters.Logger.Logger()
- if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
- return 'std::basic_string<char>',True
- if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
- return 'std::basic_string<char>',True
- if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
- return 'std::basic_string<char>',True
- if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
- return 'std::basic_string<char>',True
- return class_name,False
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- # preemptively setting this to None - we might end up changing our mind later
- self.count = None
- try:
- # we will set this to True if we find out that discovering a node in the map takes more steps than the overall size of the RB tree
- # if this gets set to True, then we will merrily return None for any child from that moment on
- self.garbage = False
- self.Mt = self.valobj.GetChildMemberWithName('_M_t')
- self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl')
- self.Mheader = self.Mimpl.GetChildMemberWithName('_M_header')
-
- map_type = self.valobj.GetType()
- if map_type.IsReferenceType():
- logger >> "Dereferencing type"
- map_type = map_type.GetDereferencedType()
-
- # Get the type of std::pair<key, value>. It is the first template
- # argument type of the 4th template argument to std::map.
- allocator_type = map_type.GetTemplateArgumentType(3)
- self.data_type = allocator_type.GetTemplateArgumentType(0)
- if not self.data_type:
- # GCC does not emit DW_TAG_template_type_parameter for
- # std::allocator<...>. For such a case, get the type of
- # std::pair from a member of std::map.
- rep_type = self.valobj.GetChildMemberWithName('_M_t').GetType()
- self.data_type = rep_type.GetTypedefedType().GetTemplateArgumentType(1)
-
- # from libstdc++ implementation of _M_root for rbtree
- self.Mroot = self.Mheader.GetChildMemberWithName('_M_parent')
- self.data_size = self.data_type.GetByteSize()
- self.skip_size = self.Mheader.GetType().GetByteSize()
- except:
- pass
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- if self.count == None:
- self.count = self.num_children_impl()
- return self.count
-
- def num_children_impl(self):
- logger = lldb.formatters.Logger.Logger()
- try:
- root_ptr_val = self.node_ptr_value(self.Mroot)
- if root_ptr_val == 0:
- return 0;
- count = self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
- logger >> "I have " + str(count) + " children available"
- return count
- except:
- return 0;
-
- def get_child_index(self,name):
- logger = lldb.formatters.Logger.Logger()
- try:
- return int(name.lstrip('[').rstrip(']'))
- except:
- return -1
-
- def get_child_at_index(self,index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Being asked to fetch child[" + str(index) + "]"
- if index < 0:
- return None
- if index >= self.num_children():
- return None;
- if self.garbage:
- logger >> "Returning None since we are a garbage tree"
- return None
- try:
- offset = index
- current = self.left(self.Mheader);
- while offset > 0:
- current = self.increment_node(current)
- offset = offset - 1;
- # skip all the base stuff and get at the data
- return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
- except:
- return None
-
- # utility functions
- def node_ptr_value(self,node):
- logger = lldb.formatters.Logger.Logger()
- return node.GetValueAsUnsigned(0)
-
- def right(self,node):
- logger = lldb.formatters.Logger.Logger()
- return node.GetChildMemberWithName("_M_right");
-
- def left(self,node):
- logger = lldb.formatters.Logger.Logger()
- return node.GetChildMemberWithName("_M_left");
-
- def parent(self,node):
- logger = lldb.formatters.Logger.Logger()
- return node.GetChildMemberWithName("_M_parent");
-
- # from libstdc++ implementation of iterator for rbtree
- def increment_node(self,node):
- logger = lldb.formatters.Logger.Logger()
- max_steps = self.num_children()
- if self.node_ptr_value(self.right(node)) != 0:
- x = self.right(node);
- max_steps -= 1
- while self.node_ptr_value(self.left(x)) != 0:
- x = self.left(x);
- max_steps -= 1
- logger >> str(max_steps) + " more to go before giving up"
- if max_steps <= 0:
- self.garbage = True
- return None
- return x;
- else:
- x = node;
- y = self.parent(x)
- max_steps -= 1
- while(self.node_ptr_value(x) == self.node_ptr_value(self.right(y))):
- x = y;
- y = self.parent(y);
- max_steps -= 1
- logger >> str(max_steps) + " more to go before giving up"
- if max_steps <= 0:
- self.garbage = True
- return None
- if self.node_ptr_value(self.right(x)) != self.node_ptr_value(y):
- x = y;
- return x;
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.count = None
+ logger >> "Providing synthetic children for a map named " + \
+ str(valobj.GetName())
+
+ # we need this function as a temporary workaround for rdar://problem/10801549
+ # which prevents us from extracting the std::pair<K,V> SBType out of the template
+ # arguments for _Rep_Type _M_t in the map itself - because we have to make up the
+ # typename and then find it, we may hit the situation were std::string has multiple
+ # names but only one is actually referenced in the debug information. hence, we need
+ # to replace the longer versions of std::string with the shorter one in order to be able
+ # to find the type name
+ def fixup_class_name(self, class_name):
+ logger = lldb.formatters.Logger.Logger()
+ if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
+ return 'std::basic_string<char>', True
+ if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
+ return 'std::basic_string<char>', True
+ if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
+ return 'std::basic_string<char>', True
+ if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
+ return 'std::basic_string<char>', True
+ return class_name, False
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ # preemptively setting this to None - we might end up changing our mind
+ # later
+ self.count = None
+ try:
+ # we will set this to True if we find out that discovering a node in the map takes more steps than the overall size of the RB tree
+ # if this gets set to True, then we will merrily return None for
+ # any child from that moment on
+ self.garbage = False
+ self.Mt = self.valobj.GetChildMemberWithName('_M_t')
+ self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl')
+ self.Mheader = self.Mimpl.GetChildMemberWithName('_M_header')
+
+ map_type = self.valobj.GetType()
+ if map_type.IsReferenceType():
+ logger >> "Dereferencing type"
+ map_type = map_type.GetDereferencedType()
+
+ # Get the type of std::pair<key, value>. It is the first template
+ # argument type of the 4th template argument to std::map.
+ allocator_type = map_type.GetTemplateArgumentType(3)
+ self.data_type = allocator_type.GetTemplateArgumentType(0)
+ if not self.data_type:
+ # GCC does not emit DW_TAG_template_type_parameter for
+ # std::allocator<...>. For such a case, get the type of
+ # std::pair from a member of std::map.
+ rep_type = self.valobj.GetChildMemberWithName('_M_t').GetType()
+ self.data_type = rep_type.GetTypedefedType().GetTemplateArgumentType(1)
+
+ # from libstdc++ implementation of _M_root for rbtree
+ self.Mroot = self.Mheader.GetChildMemberWithName('_M_parent')
+ self.data_size = self.data_type.GetByteSize()
+ self.skip_size = self.Mheader.GetType().GetByteSize()
+ except:
+ pass
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.count is None:
+ self.count = self.num_children_impl()
+ return self.count
+
+ def num_children_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ root_ptr_val = self.node_ptr_value(self.Mroot)
+ if root_ptr_val == 0:
+ return 0
+ count = self.Mimpl.GetChildMemberWithName(
+ '_M_node_count').GetValueAsUnsigned(0)
+ logger >> "I have " + str(count) + " children available"
+ return count
+ except:
+ return 0
+
+ def get_child_index(self, name):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Being asked to fetch child[" + str(index) + "]"
+ if index < 0:
+ return None
+ if index >= self.num_children():
+ return None
+ if self.garbage:
+ logger >> "Returning None since we are a garbage tree"
+ return None
+ try:
+ offset = index
+ current = self.left(self.Mheader)
+ while offset > 0:
+ current = self.increment_node(current)
+ offset = offset - 1
+ # skip all the base stuff and get at the data
+ return current.CreateChildAtOffset(
+ '[' + str(index) + ']', self.skip_size, self.data_type)
+ except:
+ return None
+
+ # utility functions
+ def node_ptr_value(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ return node.GetValueAsUnsigned(0)
+
+ def right(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ return node.GetChildMemberWithName("_M_right")
+
+ def left(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ return node.GetChildMemberWithName("_M_left")
+
+ def parent(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ return node.GetChildMemberWithName("_M_parent")
+
+ # from libstdc++ implementation of iterator for rbtree
+ def increment_node(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ max_steps = self.num_children()
+ if self.node_ptr_value(self.right(node)) != 0:
+ x = self.right(node)
+ max_steps -= 1
+ while self.node_ptr_value(self.left(x)) != 0:
+ x = self.left(x)
+ max_steps -= 1
+ logger >> str(max_steps) + " more to go before giving up"
+ if max_steps <= 0:
+ self.garbage = True
+ return None
+ return x
+ else:
+ x = node
+ y = self.parent(x)
+ max_steps -= 1
+ while(self.node_ptr_value(x) == self.node_ptr_value(self.right(y))):
+ x = y
+ y = self.parent(y)
+ max_steps -= 1
+ logger >> str(max_steps) + " more to go before giving up"
+ if max_steps <= 0:
+ self.garbage = True
+ return None
+ if self.node_ptr_value(self.right(x)) != self.node_ptr_value(y):
+ x = y
+ return x
- def has_children(self):
- return True
+ def has_children(self):
+ return True
_list_uses_loop_detector = True
Modified: lldb/trunk/examples/synthetic/libcxx.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/libcxx.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/libcxx.py (original)
+++ lldb/trunk/examples/synthetic/libcxx.py Tue Sep 6 15:57:50 2016
@@ -4,583 +4,633 @@ import lldb.formatters.Logger
# libcxx STL formatters for LLDB
# These formatters are based upon the implementation of libc++ that
# ships with current releases of OS X - They will not work for other implementations
-# of the standard C++ library - and they are bound to use the libc++-specific namespace
+# of the standard C++ library - and they are bound to use the
+# libc++-specific namespace
# the std::string summary is just an example for your convenience
# the actual summary that LLDB uses is C++ code inside the debugger's own core
# this could probably be made more efficient but since it only reads a handful of bytes at a time
# we probably don't need to worry too much about this for the time being
-def make_string(F,L):
- strval = ''
- G = F.GetData().uint8
- for X in range(L):
- V = G[X]
- if V == 0:
- break
- strval = strval + chr(V % 256)
- return '"' + strval + '"'
+
+
+def make_string(F, L):
+ strval = ''
+ G = F.GetData().uint8
+ for X in range(L):
+ V = G[X]
+ if V == 0:
+ break
+ strval = strval + chr(V % 256)
+ return '"' + strval + '"'
# if we ever care about big-endian, these two functions might need to change
+
+
def is_short_string(value):
- return True if (value & 1) == 0 else False
+ return True if (value & 1) == 0 else False
+
+
def extract_short_size(value):
- return ((value >> 1) % 256)
+ return ((value >> 1) % 256)
# some of the members of libc++ std::string are anonymous or have internal names that convey
# no external significance - we access them by index since this saves a name lookup that would add
-# no information for readers of the code, but when possible try to use meaningful variable names
-def stdstring_SummaryProvider(valobj,dict):
- logger = lldb.formatters.Logger.Logger()
- r = valobj.GetChildAtIndex(0)
- B = r.GetChildAtIndex(0)
- first = B.GetChildAtIndex(0)
- D = first.GetChildAtIndex(0)
- l = D.GetChildAtIndex(0)
- s = D.GetChildAtIndex(1)
- D20 = s.GetChildAtIndex(0)
- size_mode = D20.GetChildAtIndex(0).GetValueAsUnsigned(0)
- if is_short_string(size_mode):
- size = extract_short_size(size_mode)
- return make_string(s.GetChildAtIndex(1),size)
- else:
- data_ptr = l.GetChildAtIndex(2)
- size_vo = l.GetChildAtIndex(1)
- size = size_vo.GetValueAsUnsigned(0)+1 # the NULL terminator must be accounted for
- if size <= 1 or size == None: # should never be the case
- return '""'
- try:
- data = data_ptr.GetPointeeData(0,size)
- except:
- return '""'
- error = lldb.SBError()
- strval = data.GetString(error,0)
- if error.Fail():
- return '<error:' + error.GetCString() + '>'
- else:
- return '"' + strval + '"'
+# no information for readers of the code, but when possible try to use
+# meaningful variable names
+
+
+def stdstring_SummaryProvider(valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ r = valobj.GetChildAtIndex(0)
+ B = r.GetChildAtIndex(0)
+ first = B.GetChildAtIndex(0)
+ D = first.GetChildAtIndex(0)
+ l = D.GetChildAtIndex(0)
+ s = D.GetChildAtIndex(1)
+ D20 = s.GetChildAtIndex(0)
+ size_mode = D20.GetChildAtIndex(0).GetValueAsUnsigned(0)
+ if is_short_string(size_mode):
+ size = extract_short_size(size_mode)
+ return make_string(s.GetChildAtIndex(1), size)
+ else:
+ data_ptr = l.GetChildAtIndex(2)
+ size_vo = l.GetChildAtIndex(1)
+ # the NULL terminator must be accounted for
+ size = size_vo.GetValueAsUnsigned(0) + 1
+ if size <= 1 or size is None: # should never be the case
+ return '""'
+ try:
+ data = data_ptr.GetPointeeData(0, size)
+ except:
+ return '""'
+ error = lldb.SBError()
+ strval = data.GetString(error, 0)
+ if error.Fail():
+ return '<error:' + error.GetCString() + '>'
+ else:
+ return '"' + strval + '"'
+
class stdvector_SynthProvider:
- def __init__(self, valobj, dict):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
-
- def num_children(self):
- logger = lldb.formatters.Logger.Logger()
- try:
- start_val = self.start.GetValueAsUnsigned(0)
- finish_val = self.finish.GetValueAsUnsigned(0)
- # Before a vector has been constructed, it will contain bad values
- # so we really need to be careful about the length we return since
- # uninitialized data can cause us to return a huge number. We need
- # to also check for any of the start, finish or end of storage values
- # being zero (NULL). If any are, then this vector has not been
- # initialized yet and we should return zero
-
- # Make sure nothing is NULL
- if start_val == 0 or finish_val == 0:
- return 0
- # Make sure start is less than finish
- if start_val >= finish_val:
- return 0
-
- num_children = (finish_val-start_val)
- if (num_children % self.data_size) != 0:
- return 0
- else:
- num_children = num_children/self.data_size
- return num_children
- except:
- return 0;
-
- def get_child_index(self,name):
- logger = lldb.formatters.Logger.Logger()
- try:
- return int(name.lstrip('[').rstrip(']'))
- except:
- return -1
-
- def get_child_at_index(self,index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Retrieving child " + str(index)
- if index < 0:
- return None;
- if index >= self.num_children():
- return None;
- try:
- offset = index * self.data_size
- return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
- except:
- return None
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- try:
- self.start = self.valobj.GetChildMemberWithName('__begin_')
- self.finish = self.valobj.GetChildMemberWithName('__end_')
- # the purpose of this field is unclear, but it is the only field whose type is clearly T* for a vector<T>
- # if this ends up not being correct, we can use the APIs to get at template arguments
- data_type_finder = self.valobj.GetChildMemberWithName('__end_cap_').GetChildMemberWithName('__first_')
- self.data_type = data_type_finder.GetType().GetPointeeType()
- self.data_size = self.data_type.GetByteSize()
- except:
- pass
-
- def has_children(self):
- return True
-
-# Just an example: the actual summary is produced by a summary string: size=${svar%#}
-def stdvector_SummaryProvider(valobj,dict):
- prov = stdvector_SynthProvider(valobj,None)
- return 'size=' + str(prov.num_children())
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+
+ def num_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ start_val = self.start.GetValueAsUnsigned(0)
+ finish_val = self.finish.GetValueAsUnsigned(0)
+ # Before a vector has been constructed, it will contain bad values
+ # so we really need to be careful about the length we return since
+ # uninitialized data can cause us to return a huge number. We need
+ # to also check for any of the start, finish or end of storage values
+ # being zero (NULL). If any are, then this vector has not been
+ # initialized yet and we should return zero
+
+ # Make sure nothing is NULL
+ if start_val == 0 or finish_val == 0:
+ return 0
+ # Make sure start is less than finish
+ if start_val >= finish_val:
+ return 0
+
+ num_children = (finish_val - start_val)
+ if (num_children % self.data_size) != 0:
+ return 0
+ else:
+ num_children = num_children / self.data_size
+ return num_children
+ except:
+ return 0
+
+ def get_child_index(self, name):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Retrieving child " + str(index)
+ if index < 0:
+ return None
+ if index >= self.num_children():
+ return None
+ try:
+ offset = index * self.data_size
+ return self.start.CreateChildAtOffset(
+ '[' + str(index) + ']', offset, self.data_type)
+ except:
+ return None
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ self.start = self.valobj.GetChildMemberWithName('__begin_')
+ self.finish = self.valobj.GetChildMemberWithName('__end_')
+ # the purpose of this field is unclear, but it is the only field whose type is clearly T* for a vector<T>
+ # if this ends up not being correct, we can use the APIs to get at
+ # template arguments
+ data_type_finder = self.valobj.GetChildMemberWithName(
+ '__end_cap_').GetChildMemberWithName('__first_')
+ self.data_type = data_type_finder.GetType().GetPointeeType()
+ self.data_size = self.data_type.GetByteSize()
+ except:
+ pass
+
+ def has_children(self):
+ return True
+
+# Just an example: the actual summary is produced by a summary string:
+# size=${svar%#}
+
+
+def stdvector_SummaryProvider(valobj, dict):
+ prov = stdvector_SynthProvider(valobj, None)
+ return 'size=' + str(prov.num_children())
+
class stdlist_entry:
- def __init__(self,entry):
- logger = lldb.formatters.Logger.Logger()
- self.entry = entry
-
- def _next_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return stdlist_entry(self.entry.GetChildMemberWithName('__next_'))
-
- def _prev_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return stdlist_entry(self.entry.GetChildMemberWithName('__prev_'))
-
- def _value_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return self.entry.GetValueAsUnsigned(0)
-
- def _isnull_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return self._value_impl() == 0
-
- def _sbvalue_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return self.entry
-
- next = property(_next_impl,None)
- value = property(_value_impl,None)
- is_null = property(_isnull_impl,None)
- sbvalue = property(_sbvalue_impl,None)
+ def __init__(self, entry):
+ logger = lldb.formatters.Logger.Logger()
+ self.entry = entry
+
+ def _next_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return stdlist_entry(self.entry.GetChildMemberWithName('__next_'))
+
+ def _prev_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return stdlist_entry(self.entry.GetChildMemberWithName('__prev_'))
+
+ def _value_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.entry.GetValueAsUnsigned(0)
+
+ def _isnull_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self._value_impl() == 0
+
+ def _sbvalue_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.entry
+
+ next = property(_next_impl, None)
+ value = property(_value_impl, None)
+ is_null = property(_isnull_impl, None)
+ sbvalue = property(_sbvalue_impl, None)
+
class stdlist_iterator:
- def increment_node(self,node):
- logger = lldb.formatters.Logger.Logger()
- if node.is_null:
- return None
- return node.next
-
- def __init__(self,node):
- logger = lldb.formatters.Logger.Logger()
- self.node = stdlist_entry(node) # we convert the SBValue to an internal node object on entry
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- return self.node.sbvalue # and return the SBValue back on exit
-
- def next(self):
- logger = lldb.formatters.Logger.Logger()
- node = self.increment_node(self.node)
- if node != None and node.sbvalue.IsValid() and not(node.is_null):
- self.node = node
- return self.value()
- else:
- return None
-
- def advance(self,N):
- logger = lldb.formatters.Logger.Logger()
- if N < 0:
- return None
- if N == 0:
- return self.value()
- if N == 1:
- return self.next()
- while N > 0:
- self.next()
- N = N - 1
- return self.value()
+ def increment_node(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ if node.is_null:
+ return None
+ return node.next
+
+ def __init__(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ # we convert the SBValue to an internal node object on entry
+ self.node = stdlist_entry(node)
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.node.sbvalue # and return the SBValue back on exit
+
+ def next(self):
+ logger = lldb.formatters.Logger.Logger()
+ node = self.increment_node(self.node)
+ if node is not None and node.sbvalue.IsValid() and not(node.is_null):
+ self.node = node
+ return self.value()
+ else:
+ return None
+
+ def advance(self, N):
+ logger = lldb.formatters.Logger.Logger()
+ if N < 0:
+ return None
+ if N == 0:
+ return self.value()
+ if N == 1:
+ return self.next()
+ while N > 0:
+ self.next()
+ N = N - 1
+ return self.value()
class stdlist_SynthProvider:
- def __init__(self, valobj, dict):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj
- self.count = None
-
- def next_node(self,node):
- logger = lldb.formatters.Logger.Logger()
- return node.GetChildMemberWithName('__next_')
-
- def value(self,node):
- logger = lldb.formatters.Logger.Logger()
- return node.GetValueAsUnsigned()
-
- # Floyd's cycle-finding algorithm
- # try to detect if this list has a loop
- def has_loop(self):
- global _list_uses_loop_detector
- logger = lldb.formatters.Logger.Logger()
- if _list_uses_loop_detector == False:
- logger >> "Asked not to use loop detection"
- return False
- slow = stdlist_entry(self.head)
- fast1 = stdlist_entry(self.head)
- fast2 = stdlist_entry(self.head)
- while slow.next.value != self.node_address:
- slow_value = slow.value
- fast1 = fast2.next
- fast2 = fast1.next
- if fast1.value == slow_value or fast2.value == slow_value:
- return True
- slow = slow.next
- return False
-
- def num_children(self):
- global _list_capping_size
- logger = lldb.formatters.Logger.Logger()
- if self.count == None:
- self.count = self.num_children_impl()
- if self.count > _list_capping_size:
- self.count = _list_capping_size
- return self.count
-
- def num_children_impl(self):
- global _list_capping_size
- logger = lldb.formatters.Logger.Logger()
- try:
- next_val = self.head.GetValueAsUnsigned(0)
- prev_val = self.tail.GetValueAsUnsigned(0)
- # After a std::list has been initialized, both next and prev will be non-NULL
- if next_val == 0 or prev_val == 0:
- return 0
- if next_val == self.node_address:
- return 0
- if next_val == prev_val:
- return 1
- if self.has_loop():
- return 0
- size = 2
- current = stdlist_entry(self.head)
- while current.next.value != self.node_address:
- size = size + 1
- current = current.next
- if size > _list_capping_size:
- return _list_capping_size
- return (size - 1)
- except:
- return 0;
-
- def get_child_index(self,name):
- logger = lldb.formatters.Logger.Logger()
- try:
- return int(name.lstrip('[').rstrip(']'))
- except:
- return -1
-
- def get_child_at_index(self,index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Fetching child " + str(index)
- if index < 0:
- return None;
- if index >= self.num_children():
- return None;
- try:
- current = stdlist_iterator(self.head)
- current = current.advance(index)
- # we do not return __value_ because then all our children would be named __value_
- # we need to make a copy of __value__ with the right name - unfortunate
- obj = current.GetChildMemberWithName('__value_')
- obj_data = obj.GetData()
- return self.valobj.CreateValueFromData('[' + str(index) + ']',obj_data,self.data_type)
- except:
- return None
-
- def extract_type(self):
- logger = lldb.formatters.Logger.Logger()
- list_type = self.valobj.GetType().GetUnqualifiedType()
- if list_type.IsReferenceType():
- list_type = list_type.GetDereferencedType()
- if list_type.GetNumberOfTemplateArguments() > 0:
- data_type = list_type.GetTemplateArgumentType(0)
- else:
- data_type = None
- return data_type
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.count = None
- try:
- impl = self.valobj.GetChildMemberWithName('__end_')
- self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
- self.head = impl.GetChildMemberWithName('__next_')
- self.tail = impl.GetChildMemberWithName('__prev_')
- self.data_type = self.extract_type()
- self.data_size = self.data_type.GetByteSize()
- except:
- pass
-
- def has_children(self):
- return True
-
-
-# Just an example: the actual summary is produced by a summary string: size=${svar%#}
-def stdlist_SummaryProvider(valobj,dict):
- prov = stdlist_SynthProvider(valobj,None)
- return 'size=' + str(prov.num_children())
-# a tree node - this class makes the syntax in the actual iterator nicer to read and maintain
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.count = None
+
+ def next_node(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ return node.GetChildMemberWithName('__next_')
+
+ def value(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ return node.GetValueAsUnsigned()
+
+ # Floyd's cycle-finding algorithm
+ # try to detect if this list has a loop
+ def has_loop(self):
+ global _list_uses_loop_detector
+ logger = lldb.formatters.Logger.Logger()
+ if not _list_uses_loop_detector:
+ logger >> "Asked not to use loop detection"
+ return False
+ slow = stdlist_entry(self.head)
+ fast1 = stdlist_entry(self.head)
+ fast2 = stdlist_entry(self.head)
+ while slow.next.value != self.node_address:
+ slow_value = slow.value
+ fast1 = fast2.next
+ fast2 = fast1.next
+ if fast1.value == slow_value or fast2.value == slow_value:
+ return True
+ slow = slow.next
+ return False
+
+ def num_children(self):
+ global _list_capping_size
+ logger = lldb.formatters.Logger.Logger()
+ if self.count is None:
+ self.count = self.num_children_impl()
+ if self.count > _list_capping_size:
+ self.count = _list_capping_size
+ return self.count
+
+ def num_children_impl(self):
+ global _list_capping_size
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ next_val = self.head.GetValueAsUnsigned(0)
+ prev_val = self.tail.GetValueAsUnsigned(0)
+ # After a std::list has been initialized, both next and prev will
+ # be non-NULL
+ if next_val == 0 or prev_val == 0:
+ return 0
+ if next_val == self.node_address:
+ return 0
+ if next_val == prev_val:
+ return 1
+ if self.has_loop():
+ return 0
+ size = 2
+ current = stdlist_entry(self.head)
+ while current.next.value != self.node_address:
+ size = size + 1
+ current = current.next
+ if size > _list_capping_size:
+ return _list_capping_size
+ return (size - 1)
+ except:
+ return 0
+
+ def get_child_index(self, name):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Fetching child " + str(index)
+ if index < 0:
+ return None
+ if index >= self.num_children():
+ return None
+ try:
+ current = stdlist_iterator(self.head)
+ current = current.advance(index)
+ # we do not return __value_ because then all our children would be named __value_
+ # we need to make a copy of __value__ with the right name -
+ # unfortunate
+ obj = current.GetChildMemberWithName('__value_')
+ obj_data = obj.GetData()
+ return self.valobj.CreateValueFromData(
+ '[' + str(index) + ']', obj_data, self.data_type)
+ except:
+ return None
+
+ def extract_type(self):
+ logger = lldb.formatters.Logger.Logger()
+ list_type = self.valobj.GetType().GetUnqualifiedType()
+ if list_type.IsReferenceType():
+ list_type = list_type.GetDereferencedType()
+ if list_type.GetNumberOfTemplateArguments() > 0:
+ data_type = list_type.GetTemplateArgumentType(0)
+ else:
+ data_type = None
+ return data_type
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.count = None
+ try:
+ impl = self.valobj.GetChildMemberWithName('__end_')
+ self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
+ self.head = impl.GetChildMemberWithName('__next_')
+ self.tail = impl.GetChildMemberWithName('__prev_')
+ self.data_type = self.extract_type()
+ self.data_size = self.data_type.GetByteSize()
+ except:
+ pass
+
+ def has_children(self):
+ return True
+
+
+# Just an example: the actual summary is produced by a summary string:
+# size=${svar%#}
+def stdlist_SummaryProvider(valobj, dict):
+ prov = stdlist_SynthProvider(valobj, None)
+ return 'size=' + str(prov.num_children())
+
+# a tree node - this class makes the syntax in the actual iterator nicer
+# to read and maintain
+
+
class stdmap_iterator_node:
- def _left_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return stdmap_iterator_node(self.node.GetChildMemberWithName("__left_"))
-
- def _right_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return stdmap_iterator_node(self.node.GetChildMemberWithName("__right_"))
-
- def _parent_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return stdmap_iterator_node(self.node.GetChildMemberWithName("__parent_"))
-
- def _value_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return self.node.GetValueAsUnsigned(0)
-
- def _sbvalue_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return self.node
-
- def _null_impl(self):
- logger = lldb.formatters.Logger.Logger()
- return self.value == 0
-
- def __init__(self,node):
- logger = lldb.formatters.Logger.Logger()
- self.node = node
-
- left = property(_left_impl,None)
- right = property(_right_impl,None)
- parent = property(_parent_impl,None)
- value = property(_value_impl,None)
- is_null = property(_null_impl,None)
- sbvalue = property(_sbvalue_impl,None)
+
+ def _left_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return stdmap_iterator_node(
+ self.node.GetChildMemberWithName("__left_"))
+
+ def _right_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return stdmap_iterator_node(
+ self.node.GetChildMemberWithName("__right_"))
+
+ def _parent_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return stdmap_iterator_node(
+ self.node.GetChildMemberWithName("__parent_"))
+
+ def _value_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.node.GetValueAsUnsigned(0)
+
+ def _sbvalue_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.node
+
+ def _null_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.value == 0
+
+ def __init__(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ self.node = node
+
+ left = property(_left_impl, None)
+ right = property(_right_impl, None)
+ parent = property(_parent_impl, None)
+ value = property(_value_impl, None)
+ is_null = property(_null_impl, None)
+ sbvalue = property(_sbvalue_impl, None)
# a Python implementation of the tree iterator used by libc++
+
+
class stdmap_iterator:
- def tree_min(self,x):
- logger = lldb.formatters.Logger.Logger()
- steps = 0
- if x.is_null:
- return None
- while (not x.left.is_null):
- x = x.left
- steps += 1
- if steps > self.max_count:
- logger >> "Returning None - we overflowed"
- return None
- return x
-
- def tree_max(self,x):
- logger = lldb.formatters.Logger.Logger()
- if x.is_null:
- return None
- while (not x.right.is_null):
- x = x.right
- return x
-
- def tree_is_left_child(self,x):
- logger = lldb.formatters.Logger.Logger()
- if x.is_null:
- return None
- return True if x.value == x.parent.left.value else False
-
- def increment_node(self,node):
- logger = lldb.formatters.Logger.Logger()
- if node.is_null:
- return None
- if not node.right.is_null:
- return self.tree_min(node.right)
- steps = 0
- while (not self.tree_is_left_child(node)):
- steps += 1
- if steps > self.max_count:
- logger >> "Returning None - we overflowed"
- return None
- node = node.parent
- return node.parent
-
- def __init__(self,node,max_count=0):
- logger = lldb.formatters.Logger.Logger()
- self.node = stdmap_iterator_node(node) # we convert the SBValue to an internal node object on entry
- self.max_count = max_count
-
- def value(self):
- logger = lldb.formatters.Logger.Logger()
- return self.node.sbvalue # and return the SBValue back on exit
-
- def next(self):
- logger = lldb.formatters.Logger.Logger()
- node = self.increment_node(self.node)
- if node != None and node.sbvalue.IsValid() and not(node.is_null):
- self.node = node
- return self.value()
- else:
- return None
-
- def advance(self,N):
- logger = lldb.formatters.Logger.Logger()
- if N < 0:
- return None
- if N == 0:
- return self.value()
- if N == 1:
- return self.next()
- while N > 0:
- if self.next() == None:
- return None
- N = N - 1
- return self.value()
+ def tree_min(self, x):
+ logger = lldb.formatters.Logger.Logger()
+ steps = 0
+ if x.is_null:
+ return None
+ while (not x.left.is_null):
+ x = x.left
+ steps += 1
+ if steps > self.max_count:
+ logger >> "Returning None - we overflowed"
+ return None
+ return x
+
+ def tree_max(self, x):
+ logger = lldb.formatters.Logger.Logger()
+ if x.is_null:
+ return None
+ while (not x.right.is_null):
+ x = x.right
+ return x
+
+ def tree_is_left_child(self, x):
+ logger = lldb.formatters.Logger.Logger()
+ if x.is_null:
+ return None
+ return True if x.value == x.parent.left.value else False
+
+ def increment_node(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ if node.is_null:
+ return None
+ if not node.right.is_null:
+ return self.tree_min(node.right)
+ steps = 0
+ while (not self.tree_is_left_child(node)):
+ steps += 1
+ if steps > self.max_count:
+ logger >> "Returning None - we overflowed"
+ return None
+ node = node.parent
+ return node.parent
+
+ def __init__(self, node, max_count=0):
+ logger = lldb.formatters.Logger.Logger()
+ # we convert the SBValue to an internal node object on entry
+ self.node = stdmap_iterator_node(node)
+ self.max_count = max_count
+
+ def value(self):
+ logger = lldb.formatters.Logger.Logger()
+ return self.node.sbvalue # and return the SBValue back on exit
+
+ def next(self):
+ logger = lldb.formatters.Logger.Logger()
+ node = self.increment_node(self.node)
+ if node is not None and node.sbvalue.IsValid() and not(node.is_null):
+ self.node = node
+ return self.value()
+ else:
+ return None
+
+ def advance(self, N):
+ logger = lldb.formatters.Logger.Logger()
+ if N < 0:
+ return None
+ if N == 0:
+ return self.value()
+ if N == 1:
+ return self.next()
+ while N > 0:
+ if self.next() is None:
+ return None
+ N = N - 1
+ return self.value()
+
class stdmap_SynthProvider:
- def __init__(self, valobj, dict):
- logger = lldb.formatters.Logger.Logger()
- self.valobj = valobj;
- self.pointer_size = self.valobj.GetProcess().GetAddressByteSize()
- self.count = None
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.count = None
- try:
- # we will set this to True if we find out that discovering a node in the map takes more steps than the overall size of the RB tree
- # if this gets set to True, then we will merrily return None for any child from that moment on
- self.garbage = False
- self.tree = self.valobj.GetChildMemberWithName('__tree_')
- self.root_node = self.tree.GetChildMemberWithName('__begin_node_')
- # this data is either lazily-calculated, or cannot be inferred at this moment
- # we still need to mark it as None, meaning "please set me ASAP"
- self.data_type = None
- self.data_size = None
- self.skip_size = None
- except:
- pass
-
- def num_children(self):
- global _map_capping_size
- logger = lldb.formatters.Logger.Logger()
- if self.count == None:
- self.count = self.num_children_impl()
- if self.count > _map_capping_size:
- self.count = _map_capping_size
- return self.count
-
- def num_children_impl(self):
- logger = lldb.formatters.Logger.Logger()
- try:
- return self.valobj.GetChildMemberWithName('__tree_').GetChildMemberWithName('__pair3_').GetChildMemberWithName('__first_').GetValueAsUnsigned()
- except:
- return 0;
-
- def has_children(self):
- return True
-
- def get_data_type(self):
- logger = lldb.formatters.Logger.Logger()
- if self.data_type == None or self.data_size == None:
- if self.num_children() == 0:
- return False
- deref = self.root_node.Dereference()
- if not(deref.IsValid()):
- return False
- value = deref.GetChildMemberWithName('__value_')
- if not(value.IsValid()):
- return False
- self.data_type = value.GetType()
- self.data_size = self.data_type.GetByteSize()
- self.skip_size = None
- return True
- else:
- return True
-
- def get_value_offset(self,node):
- logger = lldb.formatters.Logger.Logger()
- if self.skip_size == None:
- node_type = node.GetType()
- fields_count = node_type.GetNumberOfFields()
- for i in range(fields_count):
- field = node_type.GetFieldAtIndex(i)
- if field.GetName() == '__value_':
- self.skip_size = field.GetOffsetInBytes()
- break
- return (self.skip_size != None)
-
- def get_child_index(self,name):
- logger = lldb.formatters.Logger.Logger()
- try:
- return int(name.lstrip('[').rstrip(']'))
- except:
- return -1
-
- def get_child_at_index(self,index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Retrieving child " + str(index)
- if index < 0:
- return None
- if index >= self.num_children():
- return None;
- if self.garbage:
- logger >> "Returning None since this tree is garbage"
- return None
- try:
- iterator = stdmap_iterator(self.root_node,max_count=self.num_children())
- # the debug info for libc++ std::map is such that __begin_node_ has a very nice and useful type
- # out of which we can grab the information we need - every other node has a less informative
- # type which omits all value information and only contains housekeeping information for the RB tree
- # hence, we need to know if we are at a node != 0, so that we can still get at the data
- need_to_skip = (index > 0)
- current = iterator.advance(index)
- if current == None:
- logger >> "Tree is garbage - returning None"
- self.garbage = True
- return None
- if self.get_data_type():
- if not(need_to_skip):
- current = current.Dereference()
- obj = current.GetChildMemberWithName('__value_')
- obj_data = obj.GetData()
- self.get_value_offset(current) # make sure we have a valid offset for the next items
- # we do not return __value_ because then we would end up with a child named
- # __value_ instead of [0]
- return self.valobj.CreateValueFromData('[' + str(index) + ']',obj_data,self.data_type)
- else:
- # FIXME we need to have accessed item 0 before accessing any other item!
- if self.skip_size == None:
- logger >> "You asked for item > 0 before asking for item == 0, I will fetch 0 now then retry"
- if self.get_child_at_index(0):
- return self.get_child_at_index(index)
- else:
- logger >> "item == 0 could not be found. sorry, nothing can be done here."
- return None
- return current.CreateChildAtOffset('[' + str(index) + ']',self.skip_size,self.data_type)
- else:
- logger >> "Unable to infer data-type - returning None (should mark tree as garbage here?)"
- return None
- except Exception as err:
- logger >> "Hit an exception: " + str(err)
- return None
-
-# Just an example: the actual summary is produced by a summary string: size=${svar%#}
-def stdmap_SummaryProvider(valobj,dict):
- prov = stdmap_SynthProvider(valobj,None)
- return 'size=' + str(prov.num_children())
+ def __init__(self, valobj, dict):
+ logger = lldb.formatters.Logger.Logger()
+ self.valobj = valobj
+ self.pointer_size = self.valobj.GetProcess().GetAddressByteSize()
+ self.count = None
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.count = None
+ try:
+ # we will set this to True if we find out that discovering a node in the map takes more steps than the overall size of the RB tree
+ # if this gets set to True, then we will merrily return None for
+ # any child from that moment on
+ self.garbage = False
+ self.tree = self.valobj.GetChildMemberWithName('__tree_')
+ self.root_node = self.tree.GetChildMemberWithName('__begin_node_')
+ # this data is either lazily-calculated, or cannot be inferred at this moment
+ # we still need to mark it as None, meaning "please set me ASAP"
+ self.data_type = None
+ self.data_size = None
+ self.skip_size = None
+ except:
+ pass
+
+ def num_children(self):
+ global _map_capping_size
+ logger = lldb.formatters.Logger.Logger()
+ if self.count is None:
+ self.count = self.num_children_impl()
+ if self.count > _map_capping_size:
+ self.count = _map_capping_size
+ return self.count
+
+ def num_children_impl(self):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ return self.valobj.GetChildMemberWithName('__tree_').GetChildMemberWithName(
+ '__pair3_').GetChildMemberWithName('__first_').GetValueAsUnsigned()
+ except:
+ return 0
+
+ def has_children(self):
+ return True
+
+ def get_data_type(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.data_type is None or self.data_size is None:
+ if self.num_children() == 0:
+ return False
+ deref = self.root_node.Dereference()
+ if not(deref.IsValid()):
+ return False
+ value = deref.GetChildMemberWithName('__value_')
+ if not(value.IsValid()):
+ return False
+ self.data_type = value.GetType()
+ self.data_size = self.data_type.GetByteSize()
+ self.skip_size = None
+ return True
+ else:
+ return True
+
+ def get_value_offset(self, node):
+ logger = lldb.formatters.Logger.Logger()
+ if self.skip_size is None:
+ node_type = node.GetType()
+ fields_count = node_type.GetNumberOfFields()
+ for i in range(fields_count):
+ field = node_type.GetFieldAtIndex(i)
+ if field.GetName() == '__value_':
+ self.skip_size = field.GetOffsetInBytes()
+ break
+ return (self.skip_size is not None)
+
+ def get_child_index(self, name):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Retrieving child " + str(index)
+ if index < 0:
+ return None
+ if index >= self.num_children():
+ return None
+ if self.garbage:
+ logger >> "Returning None since this tree is garbage"
+ return None
+ try:
+ iterator = stdmap_iterator(
+ self.root_node, max_count=self.num_children())
+ # the debug info for libc++ std::map is such that __begin_node_ has a very nice and useful type
+ # out of which we can grab the information we need - every other node has a less informative
+ # type which omits all value information and only contains housekeeping information for the RB tree
+ # hence, we need to know if we are at a node != 0, so that we can
+ # still get at the data
+ need_to_skip = (index > 0)
+ current = iterator.advance(index)
+ if current is None:
+ logger >> "Tree is garbage - returning None"
+ self.garbage = True
+ return None
+ if self.get_data_type():
+ if not(need_to_skip):
+ current = current.Dereference()
+ obj = current.GetChildMemberWithName('__value_')
+ obj_data = obj.GetData()
+ # make sure we have a valid offset for the next items
+ self.get_value_offset(current)
+ # we do not return __value_ because then we would end up with a child named
+ # __value_ instead of [0]
+ return self.valobj.CreateValueFromData(
+ '[' + str(index) + ']', obj_data, self.data_type)
+ else:
+ # FIXME we need to have accessed item 0 before accessing
+ # any other item!
+ if self.skip_size is None:
+ logger >> "You asked for item > 0 before asking for item == 0, I will fetch 0 now then retry"
+ if self.get_child_at_index(0):
+ return self.get_child_at_index(index)
+ else:
+ logger >> "item == 0 could not be found. sorry, nothing can be done here."
+ return None
+ return current.CreateChildAtOffset(
+ '[' + str(index) + ']', self.skip_size, self.data_type)
+ else:
+ logger >> "Unable to infer data-type - returning None (should mark tree as garbage here?)"
+ return None
+ except Exception as err:
+ logger >> "Hit an exception: " + str(err)
+ return None
+
+# Just an example: the actual summary is produced by a summary string:
+# size=${svar%#}
+
+
+def stdmap_SummaryProvider(valobj, dict):
+ prov = stdmap_SynthProvider(valobj, None)
+ return 'size=' + str(prov.num_children())
+
class stddeque_SynthProvider:
+
def __init__(self, valobj, d):
logger = lldb.formatters.Logger.Logger()
logger.write("init")
@@ -592,7 +642,9 @@ class stddeque_SynthProvider:
except:
self.block_size = -1
self.element_size = -1
- logger.write("block_size=%d, element_size=%d" % (self.block_size, self.element_size))
+ logger.write(
+ "block_size=%d, element_size=%d" %
+ (self.block_size, self.element_size))
def find_block_size(self):
# in order to use the deque we must have the block size, or else
@@ -605,7 +657,7 @@ class stddeque_SynthProvider:
# static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
# }
if self.element_size < 256:
- self.block_size = 4096 / self.element_size
+ self.block_size = 4096 / self.element_size
else:
self.block_size = 16
@@ -619,24 +671,25 @@ class stddeque_SynthProvider:
def has_children(self):
return True
- def get_child_index(self,name):
+ def get_child_index(self, name):
logger = lldb.formatters.Logger.Logger()
try:
return int(name.lstrip('[').rstrip(']'))
except:
return -1
- def get_child_at_index(self,index):
+ def get_child_at_index(self, index):
logger = lldb.formatters.Logger.Logger()
logger.write("Fetching child " + str(index))
if index < 0 or self.count is None:
- return None;
+ return None
if index >= self.num_children():
- return None;
+ return None
try:
- i, j = divmod(self.start+index, self.block_size)
- return self.first.CreateValueFromExpression('[' + str(index) + ']',
- '*(*(%s + %d) + %d)' % (self.first.get_expr_path(), i, j))
+ i, j = divmod(self.start + index, self.block_size)
+ return self.first.CreateValueFromExpression(
+ '[' + str(index) + ']', '*(*(%s + %d) + %d)' %
+ (self.first.get_expr_path(), i, j))
except:
return None
@@ -656,23 +709,29 @@ class stddeque_SynthProvider:
# variable tells which element in this NxM array is the 0th
# one, and the 'size' element gives the number of elements
# in the deque.
- count = self.valobj.GetChildMemberWithName('__size_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ count = self.valobj.GetChildMemberWithName(
+ '__size_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
# give up now if we cant access memory reliably
if self.block_size < 0:
logger.write("block_size < 0")
return
map_ = self.valobj.GetChildMemberWithName('__map_')
- start = self.valobj.GetChildMemberWithName('__start_').GetValueAsUnsigned(0)
+ start = self.valobj.GetChildMemberWithName(
+ '__start_').GetValueAsUnsigned(0)
first = map_.GetChildMemberWithName('__first_')
map_first = first.GetValueAsUnsigned(0)
- map_begin = map_.GetChildMemberWithName('__begin_').GetValueAsUnsigned(0)
- map_end = map_.GetChildMemberWithName('__end_').GetValueAsUnsigned(0)
- map_endcap= map_.GetChildMemberWithName('__end_cap_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ map_begin = map_.GetChildMemberWithName(
+ '__begin_').GetValueAsUnsigned(0)
+ map_end = map_.GetChildMemberWithName(
+ '__end_').GetValueAsUnsigned(0)
+ map_endcap = map_.GetChildMemberWithName(
+ '__end_cap_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
# check consistency
if not map_first <= map_begin <= map_end <= map_endcap:
logger.write("map pointers are not monotonic")
return
- total_rows, junk = divmod(map_endcap - map_first, self.pointer_size)
+ total_rows, junk = divmod(
+ map_endcap - map_first, self.pointer_size)
if junk:
logger.write("endcap-first doesnt align correctly")
return
@@ -684,18 +743,21 @@ class stddeque_SynthProvider:
if junk:
logger.write("begin-first doesnt align correctly")
return
- if not start_row*self.block_size <= start < (start_row+1)*self.block_size:
+ if not start_row * \
+ self.block_size <= start < (start_row + 1) * self.block_size:
logger.write("0th element must be in the 'begin' row")
return
end_row = start_row + active_rows
if not count:
if active_rows:
logger.write("empty deque but begin!=end")
- return
- elif not (end_row-1)*self.block_size <= start+count < end_row*self.block_size:
+ return
+ elif not (end_row - 1) * self.block_size <= start + count < end_row * self.block_size:
logger.write("nth element must be before the 'end' row")
return
- logger.write("update success: count=%r, start=%r, first=%r" % (count,start,first))
+ logger.write(
+ "update success: count=%r, start=%r, first=%r" %
+ (count, start, first))
# if consistent, save all we really need:
self.count = count
self.start = start
@@ -706,7 +768,9 @@ class stddeque_SynthProvider:
self.map_first = None
self.map_begin = None
+
class stdsharedptr_SynthProvider:
+
def __init__(self, valobj, d):
logger = lldb.formatters.Logger.Logger()
logger.write("init")
@@ -725,39 +789,42 @@ class stdsharedptr_SynthProvider:
def has_children(self):
return True
- def get_child_index(self,name):
- if name=="__ptr_":
+ def get_child_index(self, name):
+ if name == "__ptr_":
return 0
- if name=="count":
+ if name == "count":
return 1
- if name=="weak_count":
+ if name == "weak_count":
return 2
return -1
- def get_child_at_index(self,index):
+ def get_child_at_index(self, index):
if index == 0:
return self.ptr
if index == 1:
- if self.cntrl == None:
+ if self.cntrl is None:
count = 0
else:
- count = 1 + self.cntrl.GetChildMemberWithName('__shared_owners_').GetValueAsSigned()
- return self.valobj.CreateValueFromData("count",
- lldb.SBData.CreateDataFromUInt64Array(self.endianness, self.pointer_size, [count]),
- self.count_type)
+ count = 1 + \
+ self.cntrl.GetChildMemberWithName('__shared_owners_').GetValueAsSigned()
+ return self.valobj.CreateValueFromData(
+ "count", lldb.SBData.CreateDataFromUInt64Array(
+ self.endianness, self.pointer_size, [count]), self.count_type)
if index == 2:
- if self.cntrl == None:
+ if self.cntrl is None:
count = 0
else:
- count = 1 + self.cntrl.GetChildMemberWithName('__shared_weak_owners_').GetValueAsSigned()
- return self.valobj.CreateValueFromData("weak_count",
- lldb.SBData.CreateDataFromUInt64Array(self.endianness, self.pointer_size, [count]),
- self.count_type)
+ count = 1 + \
+ self.cntrl.GetChildMemberWithName('__shared_weak_owners_').GetValueAsSigned()
+ return self.valobj.CreateValueFromData(
+ "weak_count", lldb.SBData.CreateDataFromUInt64Array(
+ self.endianness, self.pointer_size, [count]), self.count_type)
return None
def update(self):
logger = lldb.formatters.Logger.Logger()
- self.ptr = self.valobj.GetChildMemberWithName('__ptr_')#.Cast(self.element_ptr_type)
+ self.ptr = self.valobj.GetChildMemberWithName(
+ '__ptr_') # .Cast(self.element_ptr_type)
cntrl = self.valobj.GetChildMemberWithName('__cntrl_')
if cntrl.GetValueAsUnsigned(0):
self.cntrl = cntrl.Dereference()
@@ -765,21 +832,36 @@ class stdsharedptr_SynthProvider:
self.cntrl = None
# we can use two different categories for old and new formatters - type names are different enough that we should make no confusion
-# talking with libc++ developer: "std::__1::class_name is set in stone until we decide to change the ABI. That shouldn't happen within a 5 year time frame"
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand('type summary add -F libcxx.stdstring_SummaryProvider "std::__1::string" -w libcxx')
- debugger.HandleCommand('type summary add -F libcxx.stdstring_SummaryProvider "std::__1::basic_string<char, class std::__1::char_traits<char>, class std::__1::allocator<char> >" -w libcxx')
- debugger.HandleCommand('type synthetic add -l libcxx.stdvector_SynthProvider -x "^(std::__1::)vector<.+>$" -w libcxx')
- debugger.HandleCommand('type summary add -F libcxx.stdvector_SummaryProvider -e -x "^(std::__1::)vector<.+>$" -w libcxx')
- debugger.HandleCommand('type synthetic add -l libcxx.stdlist_SynthProvider -x "^(std::__1::)list<.+>$" -w libcxx')
- debugger.HandleCommand('type summary add -F libcxx.stdlist_SummaryProvider -e -x "^(std::__1::)list<.+>$" -w libcxx')
- debugger.HandleCommand('type synthetic add -l libcxx.stdmap_SynthProvider -x "^(std::__1::)map<.+> >$" -w libcxx')
- debugger.HandleCommand('type summary add -F libcxx.stdmap_SummaryProvider -e -x "^(std::__1::)map<.+> >$" -w libcxx')
- debugger.HandleCommand("type category enable libcxx")
- debugger.HandleCommand('type synthetic add -l libcxx.stddeque_SynthProvider -x "^(std::__1::)deque<.+>$" -w libcxx')
- debugger.HandleCommand('type synthetic add -l libcxx.stdsharedptr_SynthProvider -x "^(std::__1::)shared_ptr<.+>$" -w libcxx')
- # turns out the structs look the same, so weak_ptr can be handled the same!
- debugger.HandleCommand('type synthetic add -l libcxx.stdsharedptr_SynthProvider -x "^(std::__1::)weak_ptr<.+>$" -w libcxx')
+# talking with libc++ developer: "std::__1::class_name is set in stone
+# until we decide to change the ABI. That shouldn't happen within a 5 year
+# time frame"
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ 'type summary add -F libcxx.stdstring_SummaryProvider "std::__1::string" -w libcxx')
+ debugger.HandleCommand(
+ 'type summary add -F libcxx.stdstring_SummaryProvider "std::__1::basic_string<char, class std::__1::char_traits<char>, class std::__1::allocator<char> >" -w libcxx')
+ debugger.HandleCommand(
+ 'type synthetic add -l libcxx.stdvector_SynthProvider -x "^(std::__1::)vector<.+>$" -w libcxx')
+ debugger.HandleCommand(
+ 'type summary add -F libcxx.stdvector_SummaryProvider -e -x "^(std::__1::)vector<.+>$" -w libcxx')
+ debugger.HandleCommand(
+ 'type synthetic add -l libcxx.stdlist_SynthProvider -x "^(std::__1::)list<.+>$" -w libcxx')
+ debugger.HandleCommand(
+ 'type summary add -F libcxx.stdlist_SummaryProvider -e -x "^(std::__1::)list<.+>$" -w libcxx')
+ debugger.HandleCommand(
+ 'type synthetic add -l libcxx.stdmap_SynthProvider -x "^(std::__1::)map<.+> >$" -w libcxx')
+ debugger.HandleCommand(
+ 'type summary add -F libcxx.stdmap_SummaryProvider -e -x "^(std::__1::)map<.+> >$" -w libcxx')
+ debugger.HandleCommand("type category enable libcxx")
+ debugger.HandleCommand(
+ 'type synthetic add -l libcxx.stddeque_SynthProvider -x "^(std::__1::)deque<.+>$" -w libcxx')
+ debugger.HandleCommand(
+ 'type synthetic add -l libcxx.stdsharedptr_SynthProvider -x "^(std::__1::)shared_ptr<.+>$" -w libcxx')
+ # turns out the structs look the same, so weak_ptr can be handled the same!
+ debugger.HandleCommand(
+ 'type synthetic add -l libcxx.stdsharedptr_SynthProvider -x "^(std::__1::)weak_ptr<.+>$" -w libcxx')
_map_capping_size = 255
_list_capping_size = 255
Modified: lldb/trunk/examples/synthetic/unordered_multi.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/unordered_multi.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/unordered_multi.py (original)
+++ lldb/trunk/examples/synthetic/unordered_multi.py Tue Sep 6 15:57:50 2016
@@ -2,109 +2,123 @@ import lldb
_map_capping_size = 255
-class libcxx_hash_table_SynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj
- self.num_elements = None
- self.next_element = None
- self.bucket_count = None
-
- def update(self):
- logger = lldb.formatters.Logger.Logger()
- self.num_elements = None
- self.next_element = None
- self.bucket_count = None
- try:
- # unordered_map is made up of a hash_map, which has 4 pieces in it:
- # bucket list :
- # array of buckets
- # p1 (pair):
- # first - pointer to first loaded element
- # p2 (pair):
- # first - number of elements
- # second - hash function
- # p3 (pair):
- # first - max_load_factor
- # second - equality operator function
- #
- # For display, we actually don't need to go inside the buckets, since 'p1' has a way to iterate over all
- # the elements directly.
- #
- # We will calculate other values about the map because they will be useful for the summary.
- #
- table = self.valobj.GetChildMemberWithName('__table_')
-
- bl_ptr = table.GetChildMemberWithName('__bucket_list_').GetChildMemberWithName('__ptr_')
- self.bucket_array_ptr = bl_ptr.GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
- self.bucket_count = bl_ptr.GetChildMemberWithName('__second_').GetChildMemberWithName('__data_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
- logger >> "Bucket count = %r" % self.bucket_count
-
- self.begin_ptr = table.GetChildMemberWithName('__p1_').GetChildMemberWithName('__first_').GetChildMemberWithName('__next_')
-
- self.num_elements = table.GetChildMemberWithName('__p2_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
- self.max_load_factor = table.GetChildMemberWithName('__p3_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
- logger >> "Num elements = %r" % self.num_elements
-
- # save the pointers as we get them
- # -- don't access this first element if num_element==0!
- self.elements_cache = []
- if self.num_elements:
- self.next_element = self.begin_ptr
- else:
- self.next_element = None
- except Exception as e:
- logger >> "Caught exception: %r" % e
- pass
-
- def num_children(self):
- global _map_capping_size
- num_elements = self.num_elements
- if num_elements is not None:
- if num_elements > _map_capping_size:
- num_elements = _map_capping_size
- return num_elements
-
- def has_children(self):
- return True
-
- def get_child_index(self,name):
- logger = lldb.formatters.Logger.Logger()
- try:
- return int(name.lstrip('[').rstrip(']'))
- except:
- return -1
-
- def get_child_at_index(self,index):
- logger = lldb.formatters.Logger.Logger()
- logger >> "Retrieving child " + str(index)
- if index < 0:
- return None
- if index >= self.num_children():
- return None
-
- # extend
- logger >> " : cache size starts with %d elements" % len(self.elements_cache)
- while index >= len(self.elements_cache):
- # if we hit the end before we get the index, give up:
- if not self.next_element:
- logger >> " : hit end of list"
- return None
-
- node = self.next_element.Dereference()
-
- value = node.GetChildMemberWithName('__value_')
- hash_value = node.GetChildMemberWithName('__hash_').GetValueAsUnsigned()
- self.elements_cache.append((value, hash_value))
-
- self.next_element = node.GetChildMemberWithName('__next_')
- if not self.next_element.GetValueAsUnsigned(0):
- self.next_element = None
-
- # hit the index! so we have the value
- logger >> " : cache size ends with %d elements" % len(self.elements_cache)
- value, hash_value = self.elements_cache[index]
- return self.valobj.CreateValueFromData('[%d] <hash %d>'%(index,hash_value), value.GetData(), value.GetType())
+class libcxx_hash_table_SynthProvider:
-def __lldb_init_module(debugger,dict):
- debugger.HandleCommand('type synthetic add -l unordered_multi.libcxx_hash_table_SynthProvider -x "^(std::__1::)unordered_(multi)?(map|set)<.+> >$" -w libcxx')
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+ self.num_elements = None
+ self.next_element = None
+ self.bucket_count = None
+
+ def update(self):
+ logger = lldb.formatters.Logger.Logger()
+ self.num_elements = None
+ self.next_element = None
+ self.bucket_count = None
+ try:
+ # unordered_map is made up of a hash_map, which has 4 pieces in it:
+ # bucket list :
+ # array of buckets
+ # p1 (pair):
+ # first - pointer to first loaded element
+ # p2 (pair):
+ # first - number of elements
+ # second - hash function
+ # p3 (pair):
+ # first - max_load_factor
+ # second - equality operator function
+ #
+ # For display, we actually don't need to go inside the buckets, since 'p1' has a way to iterate over all
+ # the elements directly.
+ #
+ # We will calculate other values about the map because they will be useful for the summary.
+ #
+ table = self.valobj.GetChildMemberWithName('__table_')
+
+ bl_ptr = table.GetChildMemberWithName(
+ '__bucket_list_').GetChildMemberWithName('__ptr_')
+ self.bucket_array_ptr = bl_ptr.GetChildMemberWithName(
+ '__first_').GetValueAsUnsigned(0)
+ self.bucket_count = bl_ptr.GetChildMemberWithName('__second_').GetChildMemberWithName(
+ '__data_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ logger >> "Bucket count = %r" % self.bucket_count
+
+ self.begin_ptr = table.GetChildMemberWithName('__p1_').GetChildMemberWithName(
+ '__first_').GetChildMemberWithName('__next_')
+
+ self.num_elements = table.GetChildMemberWithName(
+ '__p2_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ self.max_load_factor = table.GetChildMemberWithName(
+ '__p3_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ logger >> "Num elements = %r" % self.num_elements
+
+ # save the pointers as we get them
+ # -- don't access this first element if num_element==0!
+ self.elements_cache = []
+ if self.num_elements:
+ self.next_element = self.begin_ptr
+ else:
+ self.next_element = None
+ except Exception as e:
+ logger >> "Caught exception: %r" % e
+ pass
+
+ def num_children(self):
+ global _map_capping_size
+ num_elements = self.num_elements
+ if num_elements is not None:
+ if num_elements > _map_capping_size:
+ num_elements = _map_capping_size
+ return num_elements
+
+ def has_children(self):
+ return True
+
+ def get_child_index(self, name):
+ logger = lldb.formatters.Logger.Logger()
+ try:
+ return int(name.lstrip('[').rstrip(']'))
+ except:
+ return -1
+
+ def get_child_at_index(self, index):
+ logger = lldb.formatters.Logger.Logger()
+ logger >> "Retrieving child " + str(index)
+ if index < 0:
+ return None
+ if index >= self.num_children():
+ return None
+
+ # extend
+ logger >> " : cache size starts with %d elements" % len(
+ self.elements_cache)
+ while index >= len(self.elements_cache):
+ # if we hit the end before we get the index, give up:
+ if not self.next_element:
+ logger >> " : hit end of list"
+ return None
+
+ node = self.next_element.Dereference()
+
+ value = node.GetChildMemberWithName('__value_')
+ hash_value = node.GetChildMemberWithName(
+ '__hash_').GetValueAsUnsigned()
+ self.elements_cache.append((value, hash_value))
+
+ self.next_element = node.GetChildMemberWithName('__next_')
+ if not self.next_element.GetValueAsUnsigned(0):
+ self.next_element = None
+
+ # hit the index! so we have the value
+ logger >> " : cache size ends with %d elements" % len(
+ self.elements_cache)
+ value, hash_value = self.elements_cache[index]
+ return self.valobj.CreateValueFromData(
+ '[%d] <hash %d>' %
+ (index, hash_value), value.GetData(), value.GetType())
+
+
+def __lldb_init_module(debugger, dict):
+ debugger.HandleCommand(
+ 'type synthetic add -l unordered_multi.libcxx_hash_table_SynthProvider -x "^(std::__1::)unordered_(multi)?(map|set)<.+> >$" -w libcxx')
Modified: lldb/trunk/include/lldb/API/LLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/LLDB.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/LLDB.h (original)
+++ lldb/trunk/include/lldb/API/LLDB.h Tue Sep 6 15:57:50 2016
@@ -14,7 +14,6 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBlock.h"
@@ -28,6 +27,7 @@
#include "lldb/API/SBData.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBDeclaration.h"
+#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBExecutionContext.h"
@@ -77,4 +77,4 @@
#include "lldb/API/SBVariablesOptions.h"
#include "lldb/API/SBWatchpoint.h"
-#endif // LLDB_LLDB_h_
+#endif // LLDB_LLDB_h_
Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Tue Sep 6 15:57:50 2016
@@ -15,138 +15,108 @@
namespace lldb {
-class LLDB_API SBAddress
-{
+class LLDB_API SBAddress {
public:
+ SBAddress();
- SBAddress ();
+ SBAddress(const lldb::SBAddress &rhs);
- SBAddress (const lldb::SBAddress &rhs);
+ SBAddress(lldb::SBSection section, lldb::addr_t offset);
- SBAddress (lldb::SBSection section, lldb::addr_t offset);
+ // Create an address by resolving a load address using the supplied target
+ SBAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
- // Create an address by resolving a load address using the supplied target
- SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);
+ ~SBAddress();
- ~SBAddress ();
+ const lldb::SBAddress &operator=(const lldb::SBAddress &rhs);
- const lldb::SBAddress &
- operator = (const lldb::SBAddress &rhs);
+ bool IsValid() const;
- bool
- IsValid () const;
+ void Clear();
- void
- Clear ();
+ addr_t GetFileAddress() const;
- addr_t
- GetFileAddress () const;
+ addr_t GetLoadAddress(const lldb::SBTarget &target) const;
- addr_t
- GetLoadAddress (const lldb::SBTarget &target) const;
+ void SetAddress(lldb::SBSection section, lldb::addr_t offset);
- void
- SetAddress (lldb::SBSection section, lldb::addr_t offset);
+ void SetLoadAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
+ bool OffsetAddress(addr_t offset);
- void
- SetLoadAddress (lldb::addr_t load_addr,
- lldb::SBTarget &target);
- bool
- OffsetAddress (addr_t offset);
+ bool GetDescription(lldb::SBStream &description);
- bool
- GetDescription (lldb::SBStream &description);
+ // The following queries can lookup symbol information for a given address.
+ // An address might refer to code or data from an existing module, or it
+ // might refer to something on the stack or heap. The following functions
+ // will only return valid values if the address has been resolved to a code
+ // or data address using "void SBAddress::SetLoadAddress(...)" or
+ // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
+ lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);
- // The following queries can lookup symbol information for a given address.
- // An address might refer to code or data from an existing module, or it
- // might refer to something on the stack or heap. The following functions
- // will only return valid values if the address has been resolved to a code
- // or data address using "void SBAddress::SetLoadAddress(...)" or
- // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
- lldb::SBSymbolContext
- GetSymbolContext (uint32_t resolve_scope);
+ // The following functions grab individual objects for a given address and
+ // are less efficient if you want more than one symbol related objects.
+ // Use one of the following when you want multiple debug symbol related
+ // objects for an address:
+ // lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t
+ // resolve_scope);
+ // lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const
+ // SBAddress &addr, uint32_t resolve_scope);
+ // One or more bits from the SymbolContextItem enumerations can be logically
+ // OR'ed together to more efficiently retrieve multiple symbol objects.
-
- // The following functions grab individual objects for a given address and
- // are less efficient if you want more than one symbol related objects.
- // Use one of the following when you want multiple debug symbol related
- // objects for an address:
- // lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope);
- // lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope);
- // One or more bits from the SymbolContextItem enumerations can be logically
- // OR'ed together to more efficiently retrieve multiple symbol objects.
+ lldb::SBSection GetSection();
- lldb::SBSection
- GetSection ();
+ lldb::addr_t GetOffset();
- lldb::addr_t
- GetOffset ();
+ lldb::SBModule GetModule();
- lldb::SBModule
- GetModule ();
-
- lldb::SBCompileUnit
- GetCompileUnit ();
+ lldb::SBCompileUnit GetCompileUnit();
- lldb::SBFunction
- GetFunction ();
+ lldb::SBFunction GetFunction();
- lldb::SBBlock
- GetBlock ();
+ lldb::SBBlock GetBlock();
- lldb::SBSymbol
- GetSymbol ();
+ lldb::SBSymbol GetSymbol();
- lldb::SBLineEntry
- GetLineEntry ();
-
- lldb::AddressClass
- GetAddressClass ();
+ lldb::SBLineEntry GetLineEntry();
+
+ lldb::AddressClass GetAddressClass();
protected:
+ friend class SBBlock;
+ friend class SBBreakpointLocation;
+ friend class SBFrame;
+ friend class SBFunction;
+ friend class SBLineEntry;
+ friend class SBInstruction;
+ friend class SBModule;
+ friend class SBSection;
+ friend class SBSymbol;
+ friend class SBSymbolContext;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBThreadPlan;
+ friend class SBValue;
+ friend class SBQueueItem;
+
+ lldb_private::Address *operator->();
+
+ const lldb_private::Address *operator->() const;
+
+ lldb_private::Address *get();
- friend class SBBlock;
- friend class SBBreakpointLocation;
- friend class SBFrame;
- friend class SBFunction;
- friend class SBLineEntry;
- friend class SBInstruction;
- friend class SBModule;
- friend class SBSection;
- friend class SBSymbol;
- friend class SBSymbolContext;
- friend class SBTarget;
- friend class SBThread;
- friend class SBThreadPlan;
- friend class SBValue;
- friend class SBQueueItem;
-
- lldb_private::Address *
- operator->();
-
- const lldb_private::Address *
- operator->() const;
-
- lldb_private::Address *
- get ();
-
- lldb_private::Address &
- ref();
+ lldb_private::Address &ref();
- const lldb_private::Address &
- ref() const;
+ const lldb_private::Address &ref() const;
- SBAddress (const lldb_private::Address *lldb_object_ptr);
+ SBAddress(const lldb_private::Address *lldb_object_ptr);
- void
- SetAddress (const lldb_private::Address *lldb_object_ptr);
+ void SetAddress(const lldb_private::Address *lldb_object_ptr);
private:
-
- std::unique_ptr<lldb_private::Address> m_opaque_ap;
+ std::unique_ptr<lldb_private::Address> m_opaque_ap;
};
-
} // namespace lldb
#endif // LLDB_SBAddress_h_
Modified: lldb/trunk/include/lldb/API/SBAttachInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAttachInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBAttachInfo.h (original)
+++ lldb/trunk/include/lldb/API/SBAttachInfo.h Tue Sep 6 15:57:50 2016
@@ -16,209 +16,175 @@ namespace lldb {
class SBTarget;
-class LLDB_API SBAttachInfo
-{
+class LLDB_API SBAttachInfo {
public:
- SBAttachInfo ();
+ SBAttachInfo();
- SBAttachInfo (lldb::pid_t pid);
-
- //------------------------------------------------------------------
- /// Attach to a process by name.
- ///
- /// This function implies that a future call to SBTarget::Attach(...)
- /// will be synchronous.
- ///
- /// @param[in] path
- /// A full or partial name for the process to attach to.
- ///
- /// @param[in] wait_for
- /// If \b false, attach to an existing process whose name matches.
- /// If \b true, then wait for the next process whose name matches.
- //------------------------------------------------------------------
- SBAttachInfo (const char *path, bool wait_for);
-
- //------------------------------------------------------------------
- /// Attach to a process by name.
- ///
- /// Future calls to SBTarget::Attach(...) will be synchronous or
- /// asynchronous depending on the \a async argument.
- ///
- /// @param[in] path
- /// A full or partial name for the process to attach to.
- ///
- /// @param[in] wait_for
- /// If \b false, attach to an existing process whose name matches.
- /// If \b true, then wait for the next process whose name matches.
- ///
- /// @param[in] async
- /// If \b false, then the SBTarget::Attach(...) call will be a
- /// synchronous call with no way to cancel the attach in
- /// progress.
- /// If \b true, then the SBTarget::Attach(...) function will
- /// return immediately and clients are expected to wait for a
- /// process eStateStopped event if a suitable process is
- /// eventually found. If the client wants to cancel the event,
- /// SBProcess::Stop() can be called and an eStateExited process
- /// event will be delivered.
- //------------------------------------------------------------------
- SBAttachInfo (const char *path, bool wait_for, bool async);
-
- SBAttachInfo (const SBAttachInfo &rhs);
-
- ~SBAttachInfo();
-
- SBAttachInfo &
- operator = (const SBAttachInfo &rhs);
-
- lldb::pid_t
- GetProcessID ();
-
- void
- SetProcessID (lldb::pid_t pid);
-
- void
- SetExecutable (const char *path);
-
- void
- SetExecutable (lldb::SBFileSpec exe_file);
-
- bool
- GetWaitForLaunch ();
-
- //------------------------------------------------------------------
- /// Set attach by process name settings.
- ///
- /// Designed to be used after a call to SBAttachInfo::SetExecutable().
- /// This function implies that a call to SBTarget::Attach(...) will
- /// be synchronous.
- ///
- /// @param[in] wait_for
- /// If \b false, attach to an existing process whose name matches.
- /// If \b true, then wait for the next process whose name matches.
- //------------------------------------------------------------------
- void
- SetWaitForLaunch (bool b);
-
- //------------------------------------------------------------------
- /// Set attach by process name settings.
- ///
- /// Designed to be used after a call to SBAttachInfo::SetExecutable().
- /// Future calls to SBTarget::Attach(...) will be synchronous or
- /// asynchronous depending on the \a async argument.
- ///
- /// @param[in] wait_for
- /// If \b false, attach to an existing process whose name matches.
- /// If \b true, then wait for the next process whose name matches.
- ///
- /// @param[in] async
- /// If \b false, then the SBTarget::Attach(...) call will be a
- /// synchronous call with no way to cancel the attach in
- /// progress.
- /// If \b true, then the SBTarget::Attach(...) function will
- /// return immediately and clients are expected to wait for a
- /// process eStateStopped event if a suitable process is
- /// eventually found. If the client wants to cancel the event,
- /// SBProcess::Stop() can be called and an eStateExited process
- /// event will be delivered.
- //------------------------------------------------------------------
- void
- SetWaitForLaunch (bool b, bool async);
-
- bool
- GetIgnoreExisting ();
-
- void
- SetIgnoreExisting (bool b);
-
- uint32_t
- GetResumeCount ();
-
- void
- SetResumeCount (uint32_t c);
-
- const char *
- GetProcessPluginName ();
-
- void
- SetProcessPluginName (const char *plugin_name);
-
- uint32_t
- GetUserID();
-
- uint32_t
- GetGroupID();
-
- bool
- UserIDIsValid ();
-
- bool
- GroupIDIsValid ();
-
- void
- SetUserID (uint32_t uid);
-
- void
- SetGroupID (uint32_t gid);
-
- uint32_t
- GetEffectiveUserID();
-
- uint32_t
- GetEffectiveGroupID();
-
- bool
- EffectiveUserIDIsValid ();
-
- bool
- EffectiveGroupIDIsValid ();
-
- void
- SetEffectiveUserID (uint32_t uid);
-
- void
- SetEffectiveGroupID (uint32_t gid);
-
- lldb::pid_t
- GetParentProcessID ();
-
- void
- SetParentProcessID (lldb::pid_t pid);
-
- bool
- ParentProcessIDIsValid();
-
- //----------------------------------------------------------------------
- /// Get the listener that will be used to receive process events.
- ///
- /// If no listener has been set via a call to
- /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
- /// returned (SBListener::IsValid() will return false). If a listener
- /// has been set, then the valid listener object will be returned.
- //----------------------------------------------------------------------
- SBListener
- GetListener ();
-
- //----------------------------------------------------------------------
- /// Set the listener that will be used to receive process events.
- ///
- /// By default the SBDebugger, which has a listener, that the SBTarget
- /// belongs to will listen for the process events. Calling this function
- /// allows a different listener to be used to listen for process events.
- //----------------------------------------------------------------------
- void
- SetListener (SBListener &listener);
+ SBAttachInfo(lldb::pid_t pid);
+ //------------------------------------------------------------------
+ /// Attach to a process by name.
+ ///
+ /// This function implies that a future call to SBTarget::Attach(...)
+ /// will be synchronous.
+ ///
+ /// @param[in] path
+ /// A full or partial name for the process to attach to.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ //------------------------------------------------------------------
+ SBAttachInfo(const char *path, bool wait_for);
+
+ //------------------------------------------------------------------
+ /// Attach to a process by name.
+ ///
+ /// Future calls to SBTarget::Attach(...) will be synchronous or
+ /// asynchronous depending on the \a async argument.
+ ///
+ /// @param[in] path
+ /// A full or partial name for the process to attach to.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ ///
+ /// @param[in] async
+ /// If \b false, then the SBTarget::Attach(...) call will be a
+ /// synchronous call with no way to cancel the attach in
+ /// progress.
+ /// If \b true, then the SBTarget::Attach(...) function will
+ /// return immediately and clients are expected to wait for a
+ /// process eStateStopped event if a suitable process is
+ /// eventually found. If the client wants to cancel the event,
+ /// SBProcess::Stop() can be called and an eStateExited process
+ /// event will be delivered.
+ //------------------------------------------------------------------
+ SBAttachInfo(const char *path, bool wait_for, bool async);
+
+ SBAttachInfo(const SBAttachInfo &rhs);
+
+ ~SBAttachInfo();
+
+ SBAttachInfo &operator=(const SBAttachInfo &rhs);
+
+ lldb::pid_t GetProcessID();
+
+ void SetProcessID(lldb::pid_t pid);
+
+ void SetExecutable(const char *path);
+
+ void SetExecutable(lldb::SBFileSpec exe_file);
+
+ bool GetWaitForLaunch();
+
+ //------------------------------------------------------------------
+ /// Set attach by process name settings.
+ ///
+ /// Designed to be used after a call to SBAttachInfo::SetExecutable().
+ /// This function implies that a call to SBTarget::Attach(...) will
+ /// be synchronous.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ //------------------------------------------------------------------
+ void SetWaitForLaunch(bool b);
+
+ //------------------------------------------------------------------
+ /// Set attach by process name settings.
+ ///
+ /// Designed to be used after a call to SBAttachInfo::SetExecutable().
+ /// Future calls to SBTarget::Attach(...) will be synchronous or
+ /// asynchronous depending on the \a async argument.
+ ///
+ /// @param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ ///
+ /// @param[in] async
+ /// If \b false, then the SBTarget::Attach(...) call will be a
+ /// synchronous call with no way to cancel the attach in
+ /// progress.
+ /// If \b true, then the SBTarget::Attach(...) function will
+ /// return immediately and clients are expected to wait for a
+ /// process eStateStopped event if a suitable process is
+ /// eventually found. If the client wants to cancel the event,
+ /// SBProcess::Stop() can be called and an eStateExited process
+ /// event will be delivered.
+ //------------------------------------------------------------------
+ void SetWaitForLaunch(bool b, bool async);
+
+ bool GetIgnoreExisting();
+
+ void SetIgnoreExisting(bool b);
+
+ uint32_t GetResumeCount();
+
+ void SetResumeCount(uint32_t c);
+
+ const char *GetProcessPluginName();
+
+ void SetProcessPluginName(const char *plugin_name);
+
+ uint32_t GetUserID();
+
+ uint32_t GetGroupID();
+
+ bool UserIDIsValid();
+
+ bool GroupIDIsValid();
+
+ void SetUserID(uint32_t uid);
+
+ void SetGroupID(uint32_t gid);
+
+ uint32_t GetEffectiveUserID();
+
+ uint32_t GetEffectiveGroupID();
+
+ bool EffectiveUserIDIsValid();
+
+ bool EffectiveGroupIDIsValid();
+
+ void SetEffectiveUserID(uint32_t uid);
+
+ void SetEffectiveGroupID(uint32_t gid);
+
+ lldb::pid_t GetParentProcessID();
+
+ void SetParentProcessID(lldb::pid_t pid);
+
+ bool ParentProcessIDIsValid();
+
+ //----------------------------------------------------------------------
+ /// Get the listener that will be used to receive process events.
+ ///
+ /// If no listener has been set via a call to
+ /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
+ /// returned (SBListener::IsValid() will return false). If a listener
+ /// has been set, then the valid listener object will be returned.
+ //----------------------------------------------------------------------
+ SBListener GetListener();
+
+ //----------------------------------------------------------------------
+ /// Set the listener that will be used to receive process events.
+ ///
+ /// By default the SBDebugger, which has a listener, that the SBTarget
+ /// belongs to will listen for the process events. Calling this function
+ /// allows a different listener to be used to listen for process events.
+ //----------------------------------------------------------------------
+ void SetListener(SBListener &listener);
protected:
- friend class SBTarget;
+ friend class SBTarget;
- lldb_private::ProcessAttachInfo &
- ref ();
+ lldb_private::ProcessAttachInfo &ref();
- ProcessAttachInfoSP m_opaque_sp;
+ ProcessAttachInfoSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBAttachInfo_h_
+#endif // LLDB_SBAttachInfo_h_
Modified: lldb/trunk/include/lldb/API/SBBlock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBlock.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBlock.h (original)
+++ lldb/trunk/include/lldb/API/SBBlock.h Tue Sep 6 15:57:50 2016
@@ -17,107 +17,80 @@
namespace lldb {
-class LLDB_API SBBlock
-{
+class LLDB_API SBBlock {
public:
+ SBBlock();
- SBBlock ();
+ SBBlock(const lldb::SBBlock &rhs);
- SBBlock (const lldb::SBBlock &rhs);
+ ~SBBlock();
- ~SBBlock ();
+ const lldb::SBBlock &operator=(const lldb::SBBlock &rhs);
- const lldb::SBBlock &
- operator = (const lldb::SBBlock &rhs);
+ bool IsInlined() const;
- bool
- IsInlined () const;
-
- bool
- IsValid () const;
-
- const char *
- GetInlinedName () const;
-
- lldb::SBFileSpec
- GetInlinedCallSiteFile () const;
-
- uint32_t
- GetInlinedCallSiteLine () const;
-
- uint32_t
- GetInlinedCallSiteColumn () const;
-
- lldb::SBBlock
- GetParent ();
-
- lldb::SBBlock
- GetSibling ();
-
- lldb::SBBlock
- GetFirstChild ();
-
- uint32_t
- GetNumRanges ();
-
- lldb::SBAddress
- GetRangeStartAddress (uint32_t idx);
-
- lldb::SBAddress
- GetRangeEndAddress (uint32_t idx);
-
- uint32_t
- GetRangeIndexForBlockAddress (lldb::SBAddress block_addr);
-
- lldb::SBValueList
- GetVariables (lldb::SBFrame& frame,
- bool arguments,
- bool locals,
- bool statics,
- lldb::DynamicValueType use_dynamic);
-
- lldb::SBValueList
- GetVariables (lldb::SBTarget& target,
- bool arguments,
- bool locals,
- bool statics);
- //------------------------------------------------------------------
- /// Get the inlined block that contains this block.
- ///
- /// @return
- /// If this block is inlined, it will return this block, else
- /// parent blocks will be searched to see if any contain this
- /// block and are themselves inlined. An invalid SBBlock will
- /// be returned if this block nor any parent blocks are inlined
- /// function blocks.
- //------------------------------------------------------------------
- lldb::SBBlock
- GetContainingInlinedBlock ();
+ bool IsValid() const;
- bool
- GetDescription (lldb::SBStream &description);
+ const char *GetInlinedName() const;
+
+ lldb::SBFileSpec GetInlinedCallSiteFile() const;
+
+ uint32_t GetInlinedCallSiteLine() const;
+
+ uint32_t GetInlinedCallSiteColumn() const;
+
+ lldb::SBBlock GetParent();
+
+ lldb::SBBlock GetSibling();
+
+ lldb::SBBlock GetFirstChild();
+
+ uint32_t GetNumRanges();
+
+ lldb::SBAddress GetRangeStartAddress(uint32_t idx);
+
+ lldb::SBAddress GetRangeEndAddress(uint32_t idx);
+
+ uint32_t GetRangeIndexForBlockAddress(lldb::SBAddress block_addr);
+
+ lldb::SBValueList GetVariables(lldb::SBFrame &frame, bool arguments,
+ bool locals, bool statics,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValueList GetVariables(lldb::SBTarget &target, bool arguments,
+ bool locals, bool statics);
+ //------------------------------------------------------------------
+ /// Get the inlined block that contains this block.
+ ///
+ /// @return
+ /// If this block is inlined, it will return this block, else
+ /// parent blocks will be searched to see if any contain this
+ /// block and are themselves inlined. An invalid SBBlock will
+ /// be returned if this block nor any parent blocks are inlined
+ /// function blocks.
+ //------------------------------------------------------------------
+ lldb::SBBlock GetContainingInlinedBlock();
+
+ bool GetDescription(lldb::SBStream &description);
private:
- friend class SBAddress;
- friend class SBFrame;
- friend class SBFunction;
- friend class SBSymbolContext;
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBFunction;
+ friend class SBSymbolContext;
- lldb_private::Block *
- GetPtr ();
+ lldb_private::Block *GetPtr();
- void
- SetPtr (lldb_private::Block *lldb_object_ptr);
+ void SetPtr(lldb_private::Block *lldb_object_ptr);
- SBBlock (lldb_private::Block *lldb_object_ptr);
+ SBBlock(lldb_private::Block *lldb_object_ptr);
- void
- AppendVariables (bool can_create, bool get_parent_variables, lldb_private::VariableList *var_list);
+ void AppendVariables(bool can_create, bool get_parent_variables,
+ lldb_private::VariableList *var_list);
- lldb_private::Block *m_opaque_ptr;
+ lldb_private::Block *m_opaque_ptr;
};
-
} // namespace lldb
#endif // LLDB_SBBlock_h_
Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Tue Sep 6 15:57:50 2016
@@ -14,180 +14,131 @@
namespace lldb {
-class LLDB_API SBBreakpoint
-{
+class LLDB_API SBBreakpoint {
public:
+ typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
+ SBThread &thread,
+ lldb::SBBreakpointLocation &location);
- typedef bool (*BreakpointHitCallback) (void *baton,
- SBProcess &process,
- SBThread &thread,
- lldb::SBBreakpointLocation &location);
-
- SBBreakpoint ();
-
- SBBreakpoint (const lldb::SBBreakpoint& rhs);
-
- ~SBBreakpoint();
-
- const lldb::SBBreakpoint &
- operator = (const lldb::SBBreakpoint& rhs);
-
- // Tests to see if the opaque breakpoint object in this object matches the
- // opaque breakpoint object in "rhs".
- bool
- operator == (const lldb::SBBreakpoint& rhs);
-
- bool
- operator != (const lldb::SBBreakpoint& rhs);
-
- break_id_t
- GetID () const;
-
- bool
- IsValid() const;
-
- void
- ClearAllBreakpointSites ();
-
- lldb::SBBreakpointLocation
- FindLocationByAddress (lldb::addr_t vm_addr);
-
- lldb::break_id_t
- FindLocationIDByAddress (lldb::addr_t vm_addr);
-
- lldb::SBBreakpointLocation
- FindLocationByID (lldb::break_id_t bp_loc_id);
-
- lldb::SBBreakpointLocation
- GetLocationAtIndex (uint32_t index);
-
- void
- SetEnabled (bool enable);
-
- bool
- IsEnabled ();
-
- void
- SetOneShot (bool one_shot);
-
- bool
- IsOneShot () const;
-
- bool
- IsInternal ();
-
- uint32_t
- GetHitCount () const;
-
- void
- SetIgnoreCount (uint32_t count);
-
- uint32_t
- GetIgnoreCount () const;
-
- void
- SetCondition (const char *condition);
-
- const char *
- GetCondition ();
-
- void
- SetThreadID (lldb::tid_t sb_thread_id);
-
- lldb::tid_t
- GetThreadID ();
-
- void
- SetThreadIndex (uint32_t index);
-
- uint32_t
- GetThreadIndex() const;
-
- void
- SetThreadName (const char *thread_name);
-
- const char *
- GetThreadName () const;
-
- void
- SetQueueName (const char *queue_name);
-
- const char *
- GetQueueName () const;
-
- void
- SetCallback (BreakpointHitCallback callback, void *baton);
-
- void
- SetScriptCallbackFunction (const char *callback_function_name);
-
- SBError
- SetScriptCallbackBody (const char *script_body_text);
-
- bool
- AddName (const char *new_name);
-
- void
- RemoveName (const char *name_to_remove);
-
- bool
- MatchesName (const char *name);
-
- void
- GetNames (SBStringList &names);
-
- size_t
- GetNumResolvedLocations() const;
-
- size_t
- GetNumLocations() const;
-
- bool
- GetDescription (lldb::SBStream &description);
-
- static bool
- EventIsBreakpointEvent (const lldb::SBEvent &event);
-
- static lldb::BreakpointEventType
- GetBreakpointEventTypeFromEvent (const lldb::SBEvent& event);
-
- static lldb::SBBreakpoint
- GetBreakpointFromEvent (const lldb::SBEvent& event);
-
- static lldb::SBBreakpointLocation
- GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx);
-
- static uint32_t
- GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp);
+ SBBreakpoint();
+ SBBreakpoint(const lldb::SBBreakpoint &rhs);
+
+ ~SBBreakpoint();
+
+ const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
+
+ // Tests to see if the opaque breakpoint object in this object matches the
+ // opaque breakpoint object in "rhs".
+ bool operator==(const lldb::SBBreakpoint &rhs);
+
+ bool operator!=(const lldb::SBBreakpoint &rhs);
+
+ break_id_t GetID() const;
+
+ bool IsValid() const;
+
+ void ClearAllBreakpointSites();
+
+ lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
+
+ lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
+
+ lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);
+
+ lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);
+
+ void SetEnabled(bool enable);
+
+ bool IsEnabled();
+
+ void SetOneShot(bool one_shot);
+
+ bool IsOneShot() const;
+
+ bool IsInternal();
+
+ uint32_t GetHitCount() const;
+
+ void SetIgnoreCount(uint32_t count);
+
+ uint32_t GetIgnoreCount() const;
+
+ void SetCondition(const char *condition);
+
+ const char *GetCondition();
+
+ void SetThreadID(lldb::tid_t sb_thread_id);
+
+ lldb::tid_t GetThreadID();
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ void SetCallback(BreakpointHitCallback callback, void *baton);
+
+ void SetScriptCallbackFunction(const char *callback_function_name);
+
+ SBError SetScriptCallbackBody(const char *script_body_text);
+
+ bool AddName(const char *new_name);
+
+ void RemoveName(const char *name_to_remove);
+
+ bool MatchesName(const char *name);
+
+ void GetNames(SBStringList &names);
+
+ size_t GetNumResolvedLocations() const;
+
+ size_t GetNumLocations() const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+ static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
+
+ static lldb::BreakpointEventType
+ GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBBreakpointLocation
+ GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
+ uint32_t loc_idx);
+
+ static uint32_t
+ GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
private:
- friend class SBBreakpointLocation;
- friend class SBTarget;
+ friend class SBBreakpointLocation;
+ friend class SBTarget;
+
+ SBBreakpoint(const lldb::BreakpointSP &bp_sp);
+
+ lldb_private::Breakpoint *operator->() const;
+
+ lldb_private::Breakpoint *get() const;
+
+ lldb::BreakpointSP &operator*();
- SBBreakpoint (const lldb::BreakpointSP &bp_sp);
+ const lldb::BreakpointSP &operator*() const;
- lldb_private::Breakpoint *
- operator->() const;
+ static bool PrivateBreakpointHitCallback(
+ void *baton, lldb_private::StoppointCallbackContext *context,
+ lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
- lldb_private::Breakpoint *
- get() const;
-
- lldb::BreakpointSP &
- operator *();
-
- const lldb::BreakpointSP &
- operator *() const;
-
- static bool
- PrivateBreakpointHitCallback (void *baton,
- lldb_private::StoppointCallbackContext *context,
- lldb::user_id_t break_id,
- lldb::user_id_t break_loc_id);
-
- lldb::BreakpointSP m_opaque_sp;
+ lldb::BreakpointSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBBreakpoint_h_
+#endif // LLDB_SBBreakpoint_h_
Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Tue Sep 6 15:57:50 2016
@@ -10,105 +10,78 @@
#ifndef LLDB_SBBreakpointLocation_h_
#define LLDB_SBBreakpointLocation_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBDefines.h"
namespace lldb {
-class LLDB_API SBBreakpointLocation
-{
+class LLDB_API SBBreakpointLocation {
public:
+ SBBreakpointLocation();
- SBBreakpointLocation ();
+ SBBreakpointLocation(const lldb::SBBreakpointLocation &rhs);
- SBBreakpointLocation (const lldb::SBBreakpointLocation &rhs);
+ ~SBBreakpointLocation();
- ~SBBreakpointLocation ();
+ const lldb::SBBreakpointLocation &
+ operator=(const lldb::SBBreakpointLocation &rhs);
- const lldb::SBBreakpointLocation &
- operator = (const lldb::SBBreakpointLocation &rhs);
+ break_id_t GetID();
- break_id_t
- GetID ();
-
- bool
- IsValid() const;
-
- lldb::SBAddress
- GetAddress ();
-
- lldb::addr_t
- GetLoadAddress ();
-
- void
- SetEnabled(bool enabled);
-
- bool
- IsEnabled ();
-
- uint32_t
- GetIgnoreCount ();
-
- void
- SetIgnoreCount (uint32_t n);
-
- void
- SetCondition (const char *condition);
-
- const char *
- GetCondition ();
-
- void
- SetScriptCallbackFunction (const char *callback_function_name);
-
- SBError
- SetScriptCallbackBody (const char *script_body_text);
-
- void
- SetThreadID (lldb::tid_t sb_thread_id);
-
- lldb::tid_t
- GetThreadID ();
-
- void
- SetThreadIndex (uint32_t index);
-
- uint32_t
- GetThreadIndex() const;
-
- void
- SetThreadName (const char *thread_name);
-
- const char *
- GetThreadName () const;
-
- void
- SetQueueName (const char *queue_name);
-
- const char *
- GetQueueName () const;
-
- bool
- IsResolved ();
+ bool IsValid() const;
- bool
- GetDescription (lldb::SBStream &description, DescriptionLevel level);
+ lldb::SBAddress GetAddress();
- SBBreakpoint
- GetBreakpoint ();
+ lldb::addr_t GetLoadAddress();
- SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp);
+ void SetEnabled(bool enabled);
-private:
- friend class SBBreakpoint;
+ bool IsEnabled();
+
+ uint32_t GetIgnoreCount();
+
+ void SetIgnoreCount(uint32_t n);
+
+ void SetCondition(const char *condition);
+
+ const char *GetCondition();
+
+ void SetScriptCallbackFunction(const char *callback_function_name);
+
+ SBError SetScriptCallbackBody(const char *script_body_text);
+
+ void SetThreadID(lldb::tid_t sb_thread_id);
+
+ lldb::tid_t GetThreadID();
- void
- SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ bool IsResolved();
+
+ bool GetDescription(lldb::SBStream &description, DescriptionLevel level);
+
+ SBBreakpoint GetBreakpoint();
+
+ SBBreakpointLocation(const lldb::BreakpointLocationSP &break_loc_sp);
+
+private:
+ friend class SBBreakpoint;
- lldb::BreakpointLocationSP m_opaque_sp;
+ void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp);
+ lldb::BreakpointLocationSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBBreakpointLocation_h_
+#endif // LLDB_SBBreakpointLocation_h_
Modified: lldb/trunk/include/lldb/API/SBBroadcaster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBroadcaster.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBroadcaster.h (original)
+++ lldb/trunk/include/lldb/API/SBBroadcaster.h Tue Sep 6 15:57:50 2016
@@ -14,84 +14,70 @@
namespace lldb {
-class LLDB_API SBBroadcaster
-{
+class LLDB_API SBBroadcaster {
public:
- SBBroadcaster ();
+ SBBroadcaster();
- SBBroadcaster (const char *name);
+ SBBroadcaster(const char *name);
- SBBroadcaster (const SBBroadcaster &rhs);
-
- const SBBroadcaster &
- operator = (const SBBroadcaster &rhs);
+ SBBroadcaster(const SBBroadcaster &rhs);
- ~SBBroadcaster();
+ const SBBroadcaster &operator=(const SBBroadcaster &rhs);
- bool
- IsValid () const;
+ ~SBBroadcaster();
- void
- Clear ();
+ bool IsValid() const;
- void
- BroadcastEventByType (uint32_t event_type, bool unique = false);
+ void Clear();
- void
- BroadcastEvent (const lldb::SBEvent &event, bool unique = false);
+ void BroadcastEventByType(uint32_t event_type, bool unique = false);
- void
- AddInitialEventsToListener (const lldb::SBListener &listener, uint32_t requested_events);
+ void BroadcastEvent(const lldb::SBEvent &event, bool unique = false);
- uint32_t
- AddListener (const lldb::SBListener &listener, uint32_t event_mask);
+ void AddInitialEventsToListener(const lldb::SBListener &listener,
+ uint32_t requested_events);
- const char *
- GetName () const;
+ uint32_t AddListener(const lldb::SBListener &listener, uint32_t event_mask);
- bool
- EventTypeHasListeners (uint32_t event_type);
+ const char *GetName() const;
- bool
- RemoveListener (const lldb::SBListener &listener, uint32_t event_mask = UINT32_MAX);
+ bool EventTypeHasListeners(uint32_t event_type);
- // This comparison is checking if the internal opaque pointer value
- // is equal to that in "rhs".
- bool
- operator == (const lldb::SBBroadcaster &rhs) const;
+ bool RemoveListener(const lldb::SBListener &listener,
+ uint32_t event_mask = UINT32_MAX);
- // This comparison is checking if the internal opaque pointer value
- // is not equal to that in "rhs".
- bool
- operator != (const lldb::SBBroadcaster &rhs) const;
+ // This comparison is checking if the internal opaque pointer value
+ // is equal to that in "rhs".
+ bool operator==(const lldb::SBBroadcaster &rhs) const;
- // This comparison is checking if the internal opaque pointer value
- // is less than that in "rhs" so SBBroadcaster objects can be contained
- // in ordered containers.
- bool
- operator < (const lldb::SBBroadcaster &rhs) const;
+ // This comparison is checking if the internal opaque pointer value
+ // is not equal to that in "rhs".
+ bool operator!=(const lldb::SBBroadcaster &rhs) const;
+
+ // This comparison is checking if the internal opaque pointer value
+ // is less than that in "rhs" so SBBroadcaster objects can be contained
+ // in ordered containers.
+ bool operator<(const lldb::SBBroadcaster &rhs) const;
protected:
- friend class SBCommandInterpreter;
- friend class SBCommunication;
- friend class SBEvent;
- friend class SBListener;
- friend class SBProcess;
- friend class SBTarget;
+ friend class SBCommandInterpreter;
+ friend class SBCommunication;
+ friend class SBEvent;
+ friend class SBListener;
+ friend class SBProcess;
+ friend class SBTarget;
- SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns);
+ SBBroadcaster(lldb_private::Broadcaster *broadcaster, bool owns);
- lldb_private::Broadcaster *
- get () const;
+ lldb_private::Broadcaster *get() const;
- void
- reset (lldb_private::Broadcaster *broadcaster, bool owns);
+ void reset(lldb_private::Broadcaster *broadcaster, bool owns);
private:
- lldb::BroadcasterSP m_opaque_sp;
- lldb_private::Broadcaster *m_opaque_ptr;
+ lldb::BroadcasterSP m_opaque_sp;
+ lldb_private::Broadcaster *m_opaque_ptr;
};
} // namespace lldb
-#endif // LLDB_SBBroadcaster_h_
+#endif // LLDB_SBBroadcaster_h_
Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Tue Sep 6 15:57:50 2016
@@ -16,311 +16,267 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBDefines.h"
namespace lldb {
-class LLDB_API SBCommandInterpreterRunOptions
-{
-friend class SBDebugger;
-friend class SBCommandInterpreter;
+class LLDB_API SBCommandInterpreterRunOptions {
+ friend class SBDebugger;
+ friend class SBCommandInterpreter;
public:
- SBCommandInterpreterRunOptions();
- ~SBCommandInterpreterRunOptions();
+ SBCommandInterpreterRunOptions();
+ ~SBCommandInterpreterRunOptions();
- bool
- GetStopOnContinue () const;
+ bool GetStopOnContinue() const;
- void
- SetStopOnContinue (bool);
+ void SetStopOnContinue(bool);
- bool
- GetStopOnError () const;
+ bool GetStopOnError() const;
- void
- SetStopOnError (bool);
+ void SetStopOnError(bool);
- bool
- GetStopOnCrash () const;
+ bool GetStopOnCrash() const;
- void
- SetStopOnCrash (bool);
+ void SetStopOnCrash(bool);
- bool
- GetEchoCommands () const;
+ bool GetEchoCommands() const;
- void
- SetEchoCommands (bool);
+ void SetEchoCommands(bool);
- bool
- GetPrintResults () const;
+ bool GetPrintResults() const;
- void
- SetPrintResults (bool);
+ void SetPrintResults(bool);
- bool
- GetAddToHistory () const;
+ bool GetAddToHistory() const;
- void
- SetAddToHistory (bool);
+ void SetAddToHistory(bool);
private:
- lldb_private::CommandInterpreterRunOptions *
- get () const;
+ lldb_private::CommandInterpreterRunOptions *get() const;
- lldb_private::CommandInterpreterRunOptions &
- ref () const;
+ lldb_private::CommandInterpreterRunOptions &ref() const;
- // This is set in the constructor and will always be valid.
- mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions> m_opaque_up;
+ // This is set in the constructor and will always be valid.
+ mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions>
+ m_opaque_up;
};
-class SBCommandInterpreter
-{
+class SBCommandInterpreter {
public:
- enum
- {
- eBroadcastBitThreadShouldExit = (1 << 0),
- eBroadcastBitResetPrompt = (1 << 1),
- eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
- eBroadcastBitAsynchronousOutputData = (1 << 3),
- eBroadcastBitAsynchronousErrorData = (1 << 4)
- };
-
- SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
-
- ~SBCommandInterpreter ();
-
- const lldb::SBCommandInterpreter &
- operator = (const lldb::SBCommandInterpreter &rhs);
-
- static const char *
- GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
-
- static const char *
- GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
-
- static bool
- EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
-
- bool
- IsValid() const;
-
- bool
- CommandExists (const char *cmd);
-
- bool
- AliasExists (const char *cmd);
-
- lldb::SBBroadcaster
- GetBroadcaster ();
-
- static const char *
- GetBroadcasterClass ();
-
- bool
- HasCommands ();
-
- bool
- HasAliases ();
-
- bool
- HasAliasOptions ();
-
- lldb::SBProcess
- GetProcess ();
-
- lldb::SBDebugger
- GetDebugger ();
-
- lldb::SBCommand
- AddMultiwordCommand (const char* name, const char* help);
-
- lldb::SBCommand
- AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* help);
-
- lldb::SBCommand
- AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* help, const char* syntax);
-
- void
- SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
-
- void
- SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result);
-
- lldb::ReturnStatus
- HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
-
- lldb::ReturnStatus
- HandleCommand (const char *command_line, SBExecutionContext &exe_ctx, SBCommandReturnObject &result, bool add_to_history = false);
-
- void
- HandleCommandsFromFile (lldb::SBFileSpec &file,
- lldb::SBExecutionContext &override_context,
- lldb::SBCommandInterpreterRunOptions &options,
- lldb::SBCommandReturnObject result);
-
- // The pointer based interface is not useful in SWIG, since the cursor & last_char arguments are string pointers INTO current_line
- // and you can't do that in a scripting language interface in general...
-
- // In either case, the way this works is that the you give it a line and cursor position in the line. The function
- // will return the number of completions. The matches list will contain number_of_completions + 1 elements. The first
- // element is the common substring after the cursor position for all the matches. The rest of the elements are the
- // matches. The first element is useful if you are emulating the common shell behavior where the tab completes
- // to the string that is common among all the matches, then you should first check if the first element is non-empty,
- // and if so just insert it and move the cursor to the end of the insertion. The next tab will return an empty
- // common substring, and a list of choices (if any), at which point you should display the choices and let the user
- // type further to disambiguate.
-
- int
- HandleCompletion (const char *current_line,
- const char *cursor,
- const char *last_char,
- int match_start_point,
- int max_return_elements,
- lldb::SBStringList &matches);
-
- int
- HandleCompletion (const char *current_line,
- uint32_t cursor_pos,
- int match_start_point,
- int max_return_elements,
- lldb::SBStringList &matches);
-
- // Catch commands before they execute by registering a callback that will
- // get called when the command gets executed. This allows GUI or command
- // line interfaces to intercept a command and stop it from happening
- bool
- SetCommandOverrideCallback (const char *command_name,
- lldb::CommandOverrideCallback callback,
- void *baton);
-
- SBCommandInterpreter(lldb_private::CommandInterpreter *interpreter_ptr = nullptr); // Access using SBDebugger::GetCommandInterpreter();
-
- //----------------------------------------------------------------------
- /// Return true if the command interpreter is the active IO handler.
- ///
- /// This indicates that any input coming into the debugger handles will
- /// go to the command interpreter and will result in LLDB command line
- /// commands being executed.
- //----------------------------------------------------------------------
- bool
- IsActive ();
-
- //----------------------------------------------------------------------
- /// Get the string that needs to be written to the debugger stdin file
- /// handle when a control character is typed.
- ///
- /// Some GUI programs will intercept "control + char" sequences and want
- /// to have them do what normally would happen when using a real
- /// terminal, so this function allows GUI programs to emulate this
- /// functionality.
- ///
- /// @param[in] ch
- /// The character that was typed along with the control key
- ///
- /// @return
- /// The string that should be written into the file handle that is
- /// feeding the input stream for the debugger, or nullptr if there is
- /// no string for this control key.
- //----------------------------------------------------------------------
- const char *
- GetIOHandlerControlSequence(char ch);
-
- bool
- GetPromptOnQuit();
-
- void
- SetPromptOnQuit(bool b);
-
- //----------------------------------------------------------------------
- /// Resolve the command just as HandleCommand would, expanding abbreviations
- /// and aliases. If successful, result->GetOutput has the full expansion.
- //----------------------------------------------------------------------
- void
- ResolveCommand(const char *command_line, SBCommandReturnObject &result);
+ enum {
+ eBroadcastBitThreadShouldExit = (1 << 0),
+ eBroadcastBitResetPrompt = (1 << 1),
+ eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
+ eBroadcastBitAsynchronousOutputData = (1 << 3),
+ eBroadcastBitAsynchronousErrorData = (1 << 4)
+ };
+
+ SBCommandInterpreter(const lldb::SBCommandInterpreter &rhs);
+
+ ~SBCommandInterpreter();
+
+ const lldb::SBCommandInterpreter &
+ operator=(const lldb::SBCommandInterpreter &rhs);
+
+ static const char *
+ GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);
+
+ static const char *
+ GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type);
+
+ static bool EventIsCommandInterpreterEvent(const lldb::SBEvent &event);
+
+ bool IsValid() const;
+
+ bool CommandExists(const char *cmd);
+
+ bool AliasExists(const char *cmd);
+
+ lldb::SBBroadcaster GetBroadcaster();
+
+ static const char *GetBroadcasterClass();
+
+ bool HasCommands();
+
+ bool HasAliases();
+
+ bool HasAliasOptions();
+
+ lldb::SBProcess GetProcess();
+
+ lldb::SBDebugger GetDebugger();
+
+ lldb::SBCommand AddMultiwordCommand(const char *name, const char *help);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help, const char *syntax);
+
+ void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result);
+
+ void
+ SourceInitFileInCurrentWorkingDirectory(lldb::SBCommandReturnObject &result);
+
+ lldb::ReturnStatus HandleCommand(const char *command_line,
+ lldb::SBCommandReturnObject &result,
+ bool add_to_history = false);
+
+ lldb::ReturnStatus HandleCommand(const char *command_line,
+ SBExecutionContext &exe_ctx,
+ SBCommandReturnObject &result,
+ bool add_to_history = false);
+
+ void HandleCommandsFromFile(lldb::SBFileSpec &file,
+ lldb::SBExecutionContext &override_context,
+ lldb::SBCommandInterpreterRunOptions &options,
+ lldb::SBCommandReturnObject result);
+
+ // The pointer based interface is not useful in SWIG, since the cursor &
+ // last_char arguments are string pointers INTO current_line
+ // and you can't do that in a scripting language interface in general...
+
+ // In either case, the way this works is that the you give it a line and
+ // cursor position in the line. The function
+ // will return the number of completions. The matches list will contain
+ // number_of_completions + 1 elements. The first
+ // element is the common substring after the cursor position for all the
+ // matches. The rest of the elements are the
+ // matches. The first element is useful if you are emulating the common shell
+ // behavior where the tab completes
+ // to the string that is common among all the matches, then you should first
+ // check if the first element is non-empty,
+ // and if so just insert it and move the cursor to the end of the insertion.
+ // The next tab will return an empty
+ // common substring, and a list of choices (if any), at which point you should
+ // display the choices and let the user
+ // type further to disambiguate.
+
+ int HandleCompletion(const char *current_line, const char *cursor,
+ const char *last_char, int match_start_point,
+ int max_return_elements, lldb::SBStringList &matches);
+
+ int HandleCompletion(const char *current_line, uint32_t cursor_pos,
+ int match_start_point, int max_return_elements,
+ lldb::SBStringList &matches);
+
+ // Catch commands before they execute by registering a callback that will
+ // get called when the command gets executed. This allows GUI or command
+ // line interfaces to intercept a command and stop it from happening
+ bool SetCommandOverrideCallback(const char *command_name,
+ lldb::CommandOverrideCallback callback,
+ void *baton);
+
+ SBCommandInterpreter(
+ lldb_private::CommandInterpreter *interpreter_ptr =
+ nullptr); // Access using SBDebugger::GetCommandInterpreter();
+
+ //----------------------------------------------------------------------
+ /// Return true if the command interpreter is the active IO handler.
+ ///
+ /// This indicates that any input coming into the debugger handles will
+ /// go to the command interpreter and will result in LLDB command line
+ /// commands being executed.
+ //----------------------------------------------------------------------
+ bool IsActive();
+
+ //----------------------------------------------------------------------
+ /// Get the string that needs to be written to the debugger stdin file
+ /// handle when a control character is typed.
+ ///
+ /// Some GUI programs will intercept "control + char" sequences and want
+ /// to have them do what normally would happen when using a real
+ /// terminal, so this function allows GUI programs to emulate this
+ /// functionality.
+ ///
+ /// @param[in] ch
+ /// The character that was typed along with the control key
+ ///
+ /// @return
+ /// The string that should be written into the file handle that is
+ /// feeding the input stream for the debugger, or nullptr if there is
+ /// no string for this control key.
+ //----------------------------------------------------------------------
+ const char *GetIOHandlerControlSequence(char ch);
+
+ bool GetPromptOnQuit();
+
+ void SetPromptOnQuit(bool b);
+
+ //----------------------------------------------------------------------
+ /// Resolve the command just as HandleCommand would, expanding abbreviations
+ /// and aliases. If successful, result->GetOutput has the full expansion.
+ //----------------------------------------------------------------------
+ void ResolveCommand(const char *command_line, SBCommandReturnObject &result);
protected:
- lldb_private::CommandInterpreter &
- ref ();
+ lldb_private::CommandInterpreter &ref();
- lldb_private::CommandInterpreter *
- get ();
+ lldb_private::CommandInterpreter *get();
- void
- reset (lldb_private::CommandInterpreter *);
+ void reset(lldb_private::CommandInterpreter *);
private:
- friend class SBDebugger;
+ friend class SBDebugger;
- static void
- InitializeSWIG ();
+ static void InitializeSWIG();
- lldb_private::CommandInterpreter *m_opaque_ptr;
+ lldb_private::CommandInterpreter *m_opaque_ptr;
};
-class SBCommandPluginInterface
-{
+class SBCommandPluginInterface {
public:
- virtual
- ~SBCommandPluginInterface() = default;
+ virtual ~SBCommandPluginInterface() = default;
- virtual bool
- DoExecute (lldb::SBDebugger /*debugger*/,
- char** /*command*/,
- lldb::SBCommandReturnObject & /*result*/)
- {
- return false;
- }
+ virtual bool DoExecute(lldb::SBDebugger /*debugger*/, char ** /*command*/,
+ lldb::SBCommandReturnObject & /*result*/) {
+ return false;
+ }
};
-
-class SBCommand
-{
+
+class SBCommand {
public:
- SBCommand ();
-
- bool
- IsValid ();
-
- const char*
- GetName ();
-
- const char*
- GetHelp ();
-
- const char*
- GetHelpLong ();
-
- void
- SetHelp (const char*);
-
- void
- SetHelpLong (const char*);
-
- uint32_t
- GetFlags ();
-
- void
- SetFlags (uint32_t flags);
-
- lldb::SBCommand
- AddMultiwordCommand(const char* name, const char* help = nullptr);
-
- lldb::SBCommand
- AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const char* help = nullptr);
-
- lldb::SBCommand
- AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const char* help, const char* syntax);
+ SBCommand();
+
+ bool IsValid();
+
+ const char *GetName();
+
+ const char *GetHelp();
+
+ const char *GetHelpLong();
+
+ void SetHelp(const char *);
+
+ void SetHelpLong(const char *);
+
+ uint32_t GetFlags();
+
+ void SetFlags(uint32_t flags);
+
+ lldb::SBCommand AddMultiwordCommand(const char *name,
+ const char *help = nullptr);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help = nullptr);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help, const char *syntax);
private:
- friend class SBDebugger;
- friend class SBCommandInterpreter;
-
- SBCommand (lldb::CommandObjectSP cmd_sp);
-
- lldb::CommandObjectSP m_opaque_sp;
+ friend class SBDebugger;
+ friend class SBCommandInterpreter;
+
+ SBCommand(lldb::CommandObjectSP cmd_sp);
+
+ lldb::CommandObjectSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBCommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandReturnObject.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandReturnObject.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandReturnObject.h Tue Sep 6 15:57:50 2016
@@ -22,122 +22,90 @@
namespace lldb {
-class LLDB_API SBCommandReturnObject
-{
+class LLDB_API SBCommandReturnObject {
public:
- SBCommandReturnObject ();
+ SBCommandReturnObject();
- SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
+ SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
- ~SBCommandReturnObject ();
+ ~SBCommandReturnObject();
- const lldb::SBCommandReturnObject &
- operator = (const lldb::SBCommandReturnObject &rhs);
+ const lldb::SBCommandReturnObject &
+ operator=(const lldb::SBCommandReturnObject &rhs);
+
+ SBCommandReturnObject(lldb_private::CommandReturnObject *ptr);
+
+ lldb_private::CommandReturnObject *Release();
+
+ bool IsValid() const;
+
+ const char *GetOutput();
+
+ const char *GetError();
+
+ size_t PutOutput(FILE *fh);
+
+ size_t GetOutputSize();
+
+ size_t GetErrorSize();
+
+ size_t PutError(FILE *fh);
+
+ void Clear();
+
+ lldb::ReturnStatus GetStatus();
+
+ void SetStatus(lldb::ReturnStatus status);
+
+ bool Succeeded();
+
+ bool HasResult();
+
+ void AppendMessage(const char *message);
+
+ void AppendWarning(const char *message);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ // deprecated, these two functions do not take
+ // ownership of file handle
+ void SetImmediateOutputFile(FILE *fh);
+
+ void SetImmediateErrorFile(FILE *fh);
+
+ void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
+
+ void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
+
+ void PutCString(const char *string, int len = -1);
+
+ size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+
+ const char *GetOutput(bool only_if_no_immediate);
+
+ const char *GetError(bool only_if_no_immediate);
+
+ void SetError(lldb::SBError &error,
+ const char *fallback_error_cstr = nullptr);
+
+ void SetError(const char *error_cstr);
- SBCommandReturnObject (lldb_private::CommandReturnObject *ptr);
-
- lldb_private::CommandReturnObject *
- Release ();
-
- bool
- IsValid() const;
-
- const char *
- GetOutput ();
-
- const char *
- GetError ();
-
- size_t
- PutOutput (FILE *fh);
-
- size_t
- GetOutputSize ();
-
- size_t
- GetErrorSize ();
-
- size_t
- PutError (FILE *fh);
-
- void
- Clear();
-
- lldb::ReturnStatus
- GetStatus();
-
- void
- SetStatus (lldb::ReturnStatus status);
-
- bool
- Succeeded ();
-
- bool
- HasResult ();
-
- void
- AppendMessage (const char *message);
-
- void
- AppendWarning (const char *message);
-
- bool
- GetDescription (lldb::SBStream &description);
-
- // deprecated, these two functions do not take
- // ownership of file handle
- void
- SetImmediateOutputFile (FILE *fh);
-
- void
- SetImmediateErrorFile (FILE *fh);
-
- void
- SetImmediateOutputFile (FILE *fh, bool transfer_ownership);
-
- void
- SetImmediateErrorFile (FILE *fh, bool transfer_ownership);
-
- void
- PutCString(const char* string, int len = -1);
-
- size_t
- Printf(const char* format, ...) __attribute__ ((format (printf, 2, 3)));
-
- const char *
- GetOutput (bool only_if_no_immediate);
-
- const char *
- GetError (bool only_if_no_immediate);
-
- void
- SetError(lldb::SBError &error,
- const char *fallback_error_cstr = nullptr);
-
- void
- SetError (const char* error_cstr);
-
protected:
- friend class SBCommandInterpreter;
- friend class SBOptions;
+ friend class SBCommandInterpreter;
+ friend class SBOptions;
- lldb_private::CommandReturnObject *
- operator->() const;
+ lldb_private::CommandReturnObject *operator->() const;
- lldb_private::CommandReturnObject *
- get() const;
+ lldb_private::CommandReturnObject *get() const;
- lldb_private::CommandReturnObject &
- operator*() const;
+ lldb_private::CommandReturnObject &operator*() const;
- lldb_private::CommandReturnObject &
- ref() const;
+ lldb_private::CommandReturnObject &ref() const;
- void
- SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
+ void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
private:
- std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
+ std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommunication.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommunication.h (original)
+++ lldb/trunk/include/lldb/API/SBCommunication.h Tue Sep 6 15:57:50 2016
@@ -15,86 +15,68 @@
namespace lldb {
-class LLDB_API SBCommunication
-{
+class LLDB_API SBCommunication {
public:
- FLAGS_ANONYMOUS_ENUM()
- {
- eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
- eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
- eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
- eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread.
- eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet.
- eAllEventBits = 0xffffffff
- };
+ FLAGS_ANONYMOUS_ENUM(){
+ eBroadcastBitDisconnected =
+ (1 << 0), ///< Sent when the communications connection is lost.
+ eBroadcastBitReadThreadGotBytes =
+ (1 << 1), ///< Sent by the read thread when bytes become available.
+ eBroadcastBitReadThreadDidExit =
+ (1
+ << 2), ///< Sent by the read thread when it exits to inform clients.
+ eBroadcastBitReadThreadShouldExit =
+ (1 << 3), ///< Sent by clients that need to cancel the read thread.
+ eBroadcastBitPacketAvailable =
+ (1 << 4), ///< Sent when data received makes a complete packet.
+ eAllEventBits = 0xffffffff};
- typedef void (*ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len);
+ typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
+ size_t src_len);
- SBCommunication ();
- SBCommunication (const char * broadcaster_name);
- ~SBCommunication ();
+ SBCommunication();
+ SBCommunication(const char *broadcaster_name);
+ ~SBCommunication();
+ bool IsValid() const;
- bool
- IsValid () const;
+ lldb::SBBroadcaster GetBroadcaster();
- lldb::SBBroadcaster
- GetBroadcaster ();
-
- static const char *GetBroadcasterClass();
+ static const char *GetBroadcasterClass();
- lldb::ConnectionStatus
- AdoptFileDesriptor (int fd, bool owns_fd);
+ lldb::ConnectionStatus AdoptFileDesriptor(int fd, bool owns_fd);
- lldb::ConnectionStatus
- Connect (const char *url);
+ lldb::ConnectionStatus Connect(const char *url);
- lldb::ConnectionStatus
- Disconnect ();
+ lldb::ConnectionStatus Disconnect();
- bool
- IsConnected () const;
+ bool IsConnected() const;
- bool
- GetCloseOnEOF ();
+ bool GetCloseOnEOF();
- void
- SetCloseOnEOF (bool b);
+ void SetCloseOnEOF(bool b);
- size_t
- Read (void *dst,
- size_t dst_len,
- uint32_t timeout_usec,
- lldb::ConnectionStatus &status);
+ size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
+ lldb::ConnectionStatus &status);
- size_t
- Write (const void *src,
- size_t src_len,
- lldb::ConnectionStatus &status);
+ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status);
- bool
- ReadThreadStart ();
+ bool ReadThreadStart();
- bool
- ReadThreadStop ();
+ bool ReadThreadStop();
- bool
- ReadThreadIsRunning ();
-
- bool
- SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
- void *callback_baton);
+ bool ReadThreadIsRunning();
+ bool SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
+ void *callback_baton);
private:
+ DISALLOW_COPY_AND_ASSIGN(SBCommunication);
- DISALLOW_COPY_AND_ASSIGN (SBCommunication);
-
- lldb_private::Communication *m_opaque;
- bool m_opaque_owned;
+ lldb_private::Communication *m_opaque;
+ bool m_opaque_owned;
};
-
} // namespace lldb
#endif // LLDB_SBCommunication_h_
Modified: lldb/trunk/include/lldb/API/SBCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCompileUnit.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCompileUnit.h (original)
+++ lldb/trunk/include/lldb/API/SBCompileUnit.h Tue Sep 6 15:57:50 2016
@@ -15,104 +15,81 @@
namespace lldb {
-class LLDB_API SBCompileUnit
-{
+class LLDB_API SBCompileUnit {
public:
+ SBCompileUnit();
- SBCompileUnit ();
+ SBCompileUnit(const lldb::SBCompileUnit &rhs);
- SBCompileUnit (const lldb::SBCompileUnit &rhs);
+ ~SBCompileUnit();
- ~SBCompileUnit ();
+ const lldb::SBCompileUnit &operator=(const lldb::SBCompileUnit &rhs);
- const lldb::SBCompileUnit &
- operator = (const lldb::SBCompileUnit &rhs);
+ bool IsValid() const;
- bool
- IsValid () const;
-
- lldb::SBFileSpec
- GetFileSpec () const;
-
- uint32_t
- GetNumLineEntries () const;
-
- lldb::SBLineEntry
- GetLineEntryAtIndex (uint32_t idx) const;
-
- uint32_t
- FindLineEntryIndex (uint32_t start_idx,
- uint32_t line,
- lldb::SBFileSpec *inline_file_spec) const;
-
- uint32_t
- FindLineEntryIndex (uint32_t start_idx,
- uint32_t line,
- lldb::SBFileSpec *inline_file_spec,
- bool exact) const;
-
- SBFileSpec
- GetSupportFileAtIndex (uint32_t idx) const;
-
- uint32_t
- GetNumSupportFiles () const;
-
- uint32_t
- FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
-
- //------------------------------------------------------------------
- /// Get all types matching \a type_mask from debug info in this
- /// compile unit.
- ///
- /// @param[in] type_mask
- /// A bitfield that consists of one or more bits logically OR'ed
- /// together from the lldb::TypeClass enumeration. This allows
- /// you to request only structure types, or only class, struct
- /// and union types. Passing in lldb::eTypeClassAny will return
- /// all types found in the debug information for this compile
- /// unit.
- ///
- /// @return
- /// A list of types in this compile unit that match \a type_mask
- //------------------------------------------------------------------
- lldb::SBTypeList
- GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
-
- lldb::LanguageType
- GetLanguage ();
-
- bool
- operator == (const lldb::SBCompileUnit &rhs) const;
+ lldb::SBFileSpec GetFileSpec() const;
- bool
- operator != (const lldb::SBCompileUnit &rhs) const;
+ uint32_t GetNumLineEntries() const;
- bool
- GetDescription (lldb::SBStream &description);
+ lldb::SBLineEntry GetLineEntryAtIndex(uint32_t idx) const;
+
+ uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
+ lldb::SBFileSpec *inline_file_spec) const;
+
+ uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
+ lldb::SBFileSpec *inline_file_spec,
+ bool exact) const;
+
+ SBFileSpec GetSupportFileAtIndex(uint32_t idx) const;
+
+ uint32_t GetNumSupportFiles() const;
+
+ uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file,
+ bool full);
+
+ //------------------------------------------------------------------
+ /// Get all types matching \a type_mask from debug info in this
+ /// compile unit.
+ ///
+ /// @param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this compile
+ /// unit.
+ ///
+ /// @return
+ /// A list of types in this compile unit that match \a type_mask
+ //------------------------------------------------------------------
+ lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
+
+ lldb::LanguageType GetLanguage();
+
+ bool operator==(const lldb::SBCompileUnit &rhs) const;
+
+ bool operator!=(const lldb::SBCompileUnit &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
private:
- friend class SBAddress;
- friend class SBFrame;
- friend class SBSymbolContext;
- friend class SBModule;
-
- SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr);
-
- const lldb_private::CompileUnit *
- operator->() const;
-
- const lldb_private::CompileUnit &
- operator*() const;
-
- lldb_private::CompileUnit *
- get ();
-
- void
- reset (lldb_private::CompileUnit *lldb_object_ptr);
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBSymbolContext;
+ friend class SBModule;
- lldb_private::CompileUnit *m_opaque_ptr;
-};
+ SBCompileUnit(lldb_private::CompileUnit *lldb_object_ptr);
+
+ const lldb_private::CompileUnit *operator->() const;
+ const lldb_private::CompileUnit &operator*() const;
+
+ lldb_private::CompileUnit *get();
+
+ void reset(lldb_private::CompileUnit *lldb_object_ptr);
+
+ lldb_private::CompileUnit *m_opaque_ptr;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBData.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBData.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBData.h (original)
+++ lldb/trunk/include/lldb/API/SBData.h Tue Sep 6 15:57:50 2016
@@ -14,168 +14,143 @@
namespace lldb {
-class LLDB_API SBData
-{
+class LLDB_API SBData {
public:
+ SBData();
- SBData ();
+ SBData(const SBData &rhs);
- SBData (const SBData &rhs);
-
- const SBData &
- operator = (const SBData &rhs);
-
- ~SBData ();
-
- uint8_t
- GetAddressByteSize ();
-
- void
- SetAddressByteSize (uint8_t addr_byte_size);
-
- void
- Clear ();
-
- bool
- IsValid();
-
- size_t
- GetByteSize ();
-
- lldb::ByteOrder
- GetByteOrder();
-
- void
- SetByteOrder (lldb::ByteOrder endian);
-
- float
- GetFloat (lldb::SBError& error, lldb::offset_t offset);
-
- double
- GetDouble (lldb::SBError& error, lldb::offset_t offset);
-
- long double
- GetLongDouble (lldb::SBError& error, lldb::offset_t offset);
-
- lldb::addr_t
- GetAddress (lldb::SBError& error, lldb::offset_t offset);
-
- uint8_t
- GetUnsignedInt8 (lldb::SBError& error, lldb::offset_t offset);
-
- uint16_t
- GetUnsignedInt16 (lldb::SBError& error, lldb::offset_t offset);
-
- uint32_t
- GetUnsignedInt32 (lldb::SBError& error, lldb::offset_t offset);
-
- uint64_t
- GetUnsignedInt64 (lldb::SBError& error, lldb::offset_t offset);
-
- int8_t
- GetSignedInt8 (lldb::SBError& error, lldb::offset_t offset);
-
- int16_t
- GetSignedInt16 (lldb::SBError& error, lldb::offset_t offset);
-
- int32_t
- GetSignedInt32 (lldb::SBError& error, lldb::offset_t offset);
-
- int64_t
- GetSignedInt64 (lldb::SBError& error, lldb::offset_t offset);
-
- const char*
- GetString (lldb::SBError& error, lldb::offset_t offset);
-
- size_t
- ReadRawData (lldb::SBError& error,
- lldb::offset_t offset,
- void *buf,
- size_t size);
-
- bool
- GetDescription (lldb::SBStream &description, lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);
-
- // it would be nice to have SetData(SBError, const void*, size_t) when endianness and address size can be
- // inferred from the existing DataExtractor, but having two SetData() signatures triggers a SWIG bug where
- // the typemap isn't applied before resolving the overload, and thus the right function never gets called
- void
- SetData (lldb::SBError& error, const void *buf, size_t size, lldb::ByteOrder endian, uint8_t addr_size);
-
- // see SetData() for why we don't have Append(const void* buf, size_t size)
- bool
- Append (const SBData& rhs);
-
- static lldb::SBData
- CreateDataFromCString (lldb::ByteOrder endian, uint32_t addr_byte_size, const char* data);
-
- // in the following CreateData*() and SetData*() prototypes, the two parameters array and array_len
- // should not be renamed or rearranged, because doing so will break the SWIG typemap
- static lldb::SBData
- CreateDataFromUInt64Array (lldb::ByteOrder endian, uint32_t addr_byte_size, uint64_t* array, size_t array_len);
-
- static lldb::SBData
- CreateDataFromUInt32Array (lldb::ByteOrder endian, uint32_t addr_byte_size, uint32_t* array, size_t array_len);
-
- static lldb::SBData
- CreateDataFromSInt64Array (lldb::ByteOrder endian, uint32_t addr_byte_size, int64_t* array, size_t array_len);
-
- static lldb::SBData
- CreateDataFromSInt32Array (lldb::ByteOrder endian, uint32_t addr_byte_size, int32_t* array, size_t array_len);
-
- static lldb::SBData
- CreateDataFromDoubleArray (lldb::ByteOrder endian, uint32_t addr_byte_size, double* array, size_t array_len);
-
- bool
- SetDataFromCString (const char* data);
-
- bool
- SetDataFromUInt64Array (uint64_t* array, size_t array_len);
-
- bool
- SetDataFromUInt32Array (uint32_t* array, size_t array_len);
-
- bool
- SetDataFromSInt64Array (int64_t* array, size_t array_len);
-
- bool
- SetDataFromSInt32Array (int32_t* array, size_t array_len);
-
- bool
- SetDataFromDoubleArray (double* array, size_t array_len);
+ const SBData &operator=(const SBData &rhs);
+
+ ~SBData();
+
+ uint8_t GetAddressByteSize();
+
+ void SetAddressByteSize(uint8_t addr_byte_size);
+
+ void Clear();
+
+ bool IsValid();
+
+ size_t GetByteSize();
+
+ lldb::ByteOrder GetByteOrder();
+
+ void SetByteOrder(lldb::ByteOrder endian);
+
+ float GetFloat(lldb::SBError &error, lldb::offset_t offset);
+
+ double GetDouble(lldb::SBError &error, lldb::offset_t offset);
+
+ long double GetLongDouble(lldb::SBError &error, lldb::offset_t offset);
+
+ lldb::addr_t GetAddress(lldb::SBError &error, lldb::offset_t offset);
+
+ uint8_t GetUnsignedInt8(lldb::SBError &error, lldb::offset_t offset);
+
+ uint16_t GetUnsignedInt16(lldb::SBError &error, lldb::offset_t offset);
+
+ uint32_t GetUnsignedInt32(lldb::SBError &error, lldb::offset_t offset);
+
+ uint64_t GetUnsignedInt64(lldb::SBError &error, lldb::offset_t offset);
+
+ int8_t GetSignedInt8(lldb::SBError &error, lldb::offset_t offset);
+
+ int16_t GetSignedInt16(lldb::SBError &error, lldb::offset_t offset);
+
+ int32_t GetSignedInt32(lldb::SBError &error, lldb::offset_t offset);
+
+ int64_t GetSignedInt64(lldb::SBError &error, lldb::offset_t offset);
+
+ const char *GetString(lldb::SBError &error, lldb::offset_t offset);
+
+ size_t ReadRawData(lldb::SBError &error, lldb::offset_t offset, void *buf,
+ size_t size);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);
+
+ // it would be nice to have SetData(SBError, const void*, size_t) when
+ // endianness and address size can be
+ // inferred from the existing DataExtractor, but having two SetData()
+ // signatures triggers a SWIG bug where
+ // the typemap isn't applied before resolving the overload, and thus the right
+ // function never gets called
+ void SetData(lldb::SBError &error, const void *buf, size_t size,
+ lldb::ByteOrder endian, uint8_t addr_size);
+
+ // see SetData() for why we don't have Append(const void* buf, size_t size)
+ bool Append(const SBData &rhs);
+
+ static lldb::SBData CreateDataFromCString(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ const char *data);
+
+ // in the following CreateData*() and SetData*() prototypes, the two
+ // parameters array and array_len
+ // should not be renamed or rearranged, because doing so will break the SWIG
+ // typemap
+ static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ uint64_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromUInt32Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ uint32_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromSInt64Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ int64_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromSInt32Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ int32_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromDoubleArray(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ double *array,
+ size_t array_len);
+
+ bool SetDataFromCString(const char *data);
+
+ bool SetDataFromUInt64Array(uint64_t *array, size_t array_len);
+
+ bool SetDataFromUInt32Array(uint32_t *array, size_t array_len);
+
+ bool SetDataFromSInt64Array(int64_t *array, size_t array_len);
+
+ bool SetDataFromSInt32Array(int32_t *array, size_t array_len);
+
+ bool SetDataFromDoubleArray(double *array, size_t array_len);
-
protected:
-
- // Mimic shared pointer...
- lldb_private::DataExtractor *
- get() const;
-
- lldb_private::DataExtractor *
- operator->() const;
-
- lldb::DataExtractorSP &
- operator*();
-
- const lldb::DataExtractorSP &
- operator*() const;
+ // Mimic shared pointer...
+ lldb_private::DataExtractor *get() const;
+
+ lldb_private::DataExtractor *operator->() const;
+
+ lldb::DataExtractorSP &operator*();
- SBData (const lldb::DataExtractorSP &data_sp);
+ const lldb::DataExtractorSP &operator*() const;
- void
- SetOpaque (const lldb::DataExtractorSP &data_sp);
+ SBData(const lldb::DataExtractorSP &data_sp);
+
+ void SetOpaque(const lldb::DataExtractorSP &data_sp);
private:
- friend class SBInstruction;
- friend class SBProcess;
- friend class SBSection;
- friend class SBTarget;
- friend class SBValue;
+ friend class SBInstruction;
+ friend class SBProcess;
+ friend class SBSection;
+ friend class SBTarget;
+ friend class SBValue;
- lldb::DataExtractorSP m_opaque_sp;
+ lldb::DataExtractorSP m_opaque_sp;
};
-
} // namespace lldb
#endif // LLDB_SBData_h_
Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Tue Sep 6 15:57:50 2016
@@ -16,349 +16,255 @@
#include "lldb/API/SBPlatform.h"
namespace lldb {
-
-class LLDB_API SBInputReader
-{
+
+class LLDB_API SBInputReader {
public:
- SBInputReader() = default;
- ~SBInputReader() = default;
+ SBInputReader() = default;
+ ~SBInputReader() = default;
- SBError Initialize(lldb::SBDebugger&, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool);
- void SetIsDone(bool);
- bool IsActive() const;
+ SBError Initialize(lldb::SBDebugger &,
+ unsigned long (*)(void *, lldb::SBInputReader *,
+ lldb::InputReaderAction, char const *,
+ unsigned long),
+ void *, lldb::InputReaderGranularity, char const *,
+ char const *, bool);
+ void SetIsDone(bool);
+ bool IsActive() const;
};
-class LLDB_API SBDebugger
-{
+class LLDB_API SBDebugger {
public:
- SBDebugger();
+ SBDebugger();
+
+ SBDebugger(const lldb::SBDebugger &rhs);
+
+ SBDebugger(const lldb::DebuggerSP &debugger_sp);
+
+ ~SBDebugger();
+
+ lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs);
+
+ static void Initialize();
+
+ static void Terminate();
+
+ // Deprecated, use the one that takes a source_init_files bool.
+ static lldb::SBDebugger Create();
+
+ static lldb::SBDebugger Create(bool source_init_files);
+
+ static lldb::SBDebugger Create(bool source_init_files,
+ lldb::LogOutputCallback log_callback,
+ void *baton);
+
+ static void Destroy(lldb::SBDebugger &debugger);
+
+ static void MemoryPressureDetected();
+
+ bool IsValid() const;
+
+ void Clear();
+
+ void SetAsync(bool b);
+
+ bool GetAsync();
+
+ void SkipLLDBInitFiles(bool b);
+
+ void SkipAppInitFiles(bool b);
+
+ void SetInputFileHandle(FILE *f, bool transfer_ownership);
+
+ void SetOutputFileHandle(FILE *f, bool transfer_ownership);
+
+ void SetErrorFileHandle(FILE *f, bool transfer_ownership);
+
+ FILE *GetInputFileHandle();
+
+ FILE *GetOutputFileHandle();
+
+ FILE *GetErrorFileHandle();
+
+ void SaveInputTerminalState();
+
+ void RestoreInputTerminalState();
+
+ lldb::SBCommandInterpreter GetCommandInterpreter();
+
+ void HandleCommand(const char *command);
+
+ lldb::SBListener GetListener();
+
+ void HandleProcessEvent(const lldb::SBProcess &process,
+ const lldb::SBEvent &event, FILE *out, FILE *err);
+
+ lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
+ const char *platform_name,
+ bool add_dependent_modules, lldb::SBError &error);
+
+ lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename,
+ const char *target_triple);
+
+ lldb::SBTarget CreateTargetWithFileAndArch(const char *filename,
+ const char *archname);
+
+ lldb::SBTarget CreateTarget(const char *filename);
+
+ // Return true if target is deleted from the target list of the debugger.
+ bool DeleteTarget(lldb::SBTarget &target);
+
+ lldb::SBTarget GetTargetAtIndex(uint32_t idx);
+
+ uint32_t GetIndexOfTarget(lldb::SBTarget target);
+
+ lldb::SBTarget FindTargetWithProcessID(pid_t pid);
+
+ lldb::SBTarget FindTargetWithFileAndArch(const char *filename,
+ const char *arch);
+
+ uint32_t GetNumTargets();
+
+ lldb::SBTarget GetSelectedTarget();
+
+ void SetSelectedTarget(SBTarget &target);
+
+ lldb::SBPlatform GetSelectedPlatform();
+
+ void SetSelectedPlatform(lldb::SBPlatform &platform);
+
+ lldb::SBSourceManager GetSourceManager();
+
+ // REMOVE: just for a quick fix, need to expose platforms through
+ // SBPlatform from this class.
+ lldb::SBError SetCurrentPlatform(const char *platform_name);
- SBDebugger(const lldb::SBDebugger &rhs);
+ bool SetCurrentPlatformSDKRoot(const char *sysroot);
- SBDebugger(const lldb::DebuggerSP &debugger_sp);
+ // FIXME: Once we get the set show stuff in place, the driver won't need
+ // an interface to the Set/Get UseExternalEditor.
+ bool SetUseExternalEditor(bool input);
- ~SBDebugger();
+ bool GetUseExternalEditor();
- lldb::SBDebugger &
- operator = (const lldb::SBDebugger &rhs);
-
- static void
- Initialize();
-
- static void
- Terminate();
-
- // Deprecated, use the one that takes a source_init_files bool.
- static lldb::SBDebugger
- Create();
-
- static lldb::SBDebugger
- Create(bool source_init_files);
-
- static lldb::SBDebugger
- Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton);
-
- static void
- Destroy (lldb::SBDebugger &debugger);
-
- static void
- MemoryPressureDetected ();
-
- bool
- IsValid() const;
-
- void
- Clear ();
-
- void
- SetAsync (bool b);
-
- bool
- GetAsync ();
-
- void
- SkipLLDBInitFiles (bool b);
-
- void
- SkipAppInitFiles (bool b);
-
- void
- SetInputFileHandle (FILE *f, bool transfer_ownership);
-
- void
- SetOutputFileHandle (FILE *f, bool transfer_ownership);
-
- void
- SetErrorFileHandle (FILE *f, bool transfer_ownership);
-
- FILE *
- GetInputFileHandle ();
-
- FILE *
- GetOutputFileHandle ();
-
- FILE *
- GetErrorFileHandle ();
-
- void
- SaveInputTerminalState();
-
- void
- RestoreInputTerminalState();
-
- lldb::SBCommandInterpreter
- GetCommandInterpreter ();
-
- void
- HandleCommand (const char *command);
-
- lldb::SBListener
- GetListener ();
-
- void
- HandleProcessEvent (const lldb::SBProcess &process,
- const lldb::SBEvent &event,
- FILE *out,
- FILE *err);
-
- lldb::SBTarget
- CreateTarget (const char *filename,
- const char *target_triple,
- const char *platform_name,
- bool add_dependent_modules,
- lldb::SBError& error);
-
- lldb::SBTarget
- CreateTargetWithFileAndTargetTriple (const char *filename,
- const char *target_triple);
-
- lldb::SBTarget
- CreateTargetWithFileAndArch (const char *filename,
- const char *archname);
-
- lldb::SBTarget
- CreateTarget (const char *filename);
-
- // Return true if target is deleted from the target list of the debugger.
- bool
- DeleteTarget (lldb::SBTarget &target);
-
- lldb::SBTarget
- GetTargetAtIndex (uint32_t idx);
-
- uint32_t
- GetIndexOfTarget (lldb::SBTarget target);
-
- lldb::SBTarget
- FindTargetWithProcessID (pid_t pid);
-
- lldb::SBTarget
- FindTargetWithFileAndArch (const char *filename,
- const char *arch);
-
- uint32_t
- GetNumTargets ();
-
- lldb::SBTarget
- GetSelectedTarget ();
-
- void
- SetSelectedTarget (SBTarget& target);
-
- lldb::SBPlatform
- GetSelectedPlatform();
-
- void
- SetSelectedPlatform(lldb::SBPlatform &platform);
-
- lldb::SBSourceManager
- GetSourceManager ();
-
- // REMOVE: just for a quick fix, need to expose platforms through
- // SBPlatform from this class.
- lldb::SBError
- SetCurrentPlatform (const char *platform_name);
-
- bool
- SetCurrentPlatformSDKRoot (const char *sysroot);
-
- // FIXME: Once we get the set show stuff in place, the driver won't need
- // an interface to the Set/Get UseExternalEditor.
- bool
- SetUseExternalEditor (bool input);
-
- bool
- GetUseExternalEditor ();
-
- bool
- SetUseColor (bool use_color);
-
- bool
- GetUseColor () const;
-
- static bool
- GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
-
- static bool
- SetDefaultArchitecture (const char *arch_name);
-
- lldb::ScriptLanguage
- GetScriptingLanguage (const char *script_language_name);
-
- static const char *
- GetVersionString ();
-
- static const char *
- StateAsCString (lldb::StateType state);
-
- static bool
- StateIsRunningState (lldb::StateType state);
-
- static bool
- StateIsStoppedState (lldb::StateType state);
-
- bool
- EnableLog (const char *channel, const char **categories);
-
- void
- SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
-
- // DEPRECATED
- void
- DispatchInput (void* baton,
- const void* data,
- size_t data_len);
-
- void
- DispatchInput (const void *data, size_t data_len);
-
- void
- DispatchInputInterrupt ();
-
- void
- DispatchInputEndOfFile ();
-
- void
- PushInputReader (lldb::SBInputReader &reader);
-
- const char *
- GetInstanceName ();
-
- static SBDebugger
- FindDebuggerWithID (int id);
-
- static lldb::SBError
- SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
-
- static lldb::SBStringList
- GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
-
- bool
- GetDescription (lldb::SBStream &description);
-
- uint32_t
- GetTerminalWidth () const;
-
- void
- SetTerminalWidth (uint32_t term_width);
-
- lldb::user_id_t
- GetID ();
-
- const char *
- GetPrompt() const;
-
- void
- SetPrompt (const char *prompt);
-
- lldb::ScriptLanguage
- GetScriptLanguage() const;
-
- void
- SetScriptLanguage (lldb::ScriptLanguage script_lang);
-
- bool
- GetCloseInputOnEOF () const;
-
- void
- SetCloseInputOnEOF (bool b);
-
- SBTypeCategory
- GetCategory (const char* category_name);
-
- SBTypeCategory
- GetCategory (lldb::LanguageType lang_type);
-
- SBTypeCategory
- CreateCategory (const char* category_name);
-
- bool
- DeleteCategory (const char* category_name);
-
- uint32_t
- GetNumCategories ();
-
- SBTypeCategory
- GetCategoryAtIndex (uint32_t);
-
- SBTypeCategory
- GetDefaultCategory();
-
- SBTypeFormat
- GetFormatForType (SBTypeNameSpecifier);
+ bool SetUseColor(bool use_color);
+
+ bool GetUseColor() const;
+
+ static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
+
+ static bool SetDefaultArchitecture(const char *arch_name);
+
+ lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name);
+
+ static const char *GetVersionString();
+
+ static const char *StateAsCString(lldb::StateType state);
+
+ static bool StateIsRunningState(lldb::StateType state);
+
+ static bool StateIsStoppedState(lldb::StateType state);
+
+ bool EnableLog(const char *channel, const char **categories);
+
+ void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
+
+ // DEPRECATED
+ void DispatchInput(void *baton, const void *data, size_t data_len);
+
+ void DispatchInput(const void *data, size_t data_len);
+
+ void DispatchInputInterrupt();
+
+ void DispatchInputEndOfFile();
+
+ void PushInputReader(lldb::SBInputReader &reader);
+
+ const char *GetInstanceName();
+
+ static SBDebugger FindDebuggerWithID(int id);
+
+ static lldb::SBError SetInternalVariable(const char *var_name,
+ const char *value,
+ const char *debugger_instance_name);
+
+ static lldb::SBStringList
+ GetInternalVariableValue(const char *var_name,
+ const char *debugger_instance_name);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ uint32_t GetTerminalWidth() const;
+
+ void SetTerminalWidth(uint32_t term_width);
+
+ lldb::user_id_t GetID();
+
+ const char *GetPrompt() const;
+
+ void SetPrompt(const char *prompt);
+
+ lldb::ScriptLanguage GetScriptLanguage() const;
+
+ void SetScriptLanguage(lldb::ScriptLanguage script_lang);
+
+ bool GetCloseInputOnEOF() const;
+
+ void SetCloseInputOnEOF(bool b);
+
+ SBTypeCategory GetCategory(const char *category_name);
+
+ SBTypeCategory GetCategory(lldb::LanguageType lang_type);
+
+ SBTypeCategory CreateCategory(const char *category_name);
+
+ bool DeleteCategory(const char *category_name);
+
+ uint32_t GetNumCategories();
+
+ SBTypeCategory GetCategoryAtIndex(uint32_t);
+
+ SBTypeCategory GetDefaultCategory();
+
+ SBTypeFormat GetFormatForType(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
- SBTypeSummary
- GetSummaryForType (SBTypeNameSpecifier);
+ SBTypeSummary GetSummaryForType(SBTypeNameSpecifier);
#endif
- SBTypeFilter
- GetFilterForType (SBTypeNameSpecifier);
+ SBTypeFilter GetFilterForType(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
- SBTypeSynthetic
- GetSyntheticForType (SBTypeNameSpecifier);
+ SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier);
#endif
- void
- RunCommandInterpreter (bool auto_handle_events,
- bool spawn_thread);
-
- void
- RunCommandInterpreter (bool auto_handle_events,
- bool spawn_thread,
- SBCommandInterpreterRunOptions &options,
- int &num_errors,
- bool &quit_requested,
- bool &stopped_for_crash);
-
- SBError
- RunREPL (lldb::LanguageType language, const char *repl_options);
+ void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
+
+ void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
+ SBCommandInterpreterRunOptions &options,
+ int &num_errors, bool &quit_requested,
+ bool &stopped_for_crash);
+
+ SBError RunREPL(lldb::LanguageType language, const char *repl_options);
private:
- friend class SBCommandInterpreter;
- friend class SBInputReader;
- friend class SBListener;
- friend class SBProcess;
- friend class SBSourceManager;
- friend class SBTarget;
-
- lldb::SBTarget
- FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
-
- void
- reset (const lldb::DebuggerSP &debugger_sp);
-
- lldb_private::Debugger *
- get () const;
-
- lldb_private::Debugger &
- ref () const;
-
- const lldb::DebuggerSP &
- get_sp () const;
-
- lldb::DebuggerSP m_opaque_sp;
+ friend class SBCommandInterpreter;
+ friend class SBInputReader;
+ friend class SBListener;
+ friend class SBProcess;
+ friend class SBSourceManager;
+ friend class SBTarget;
+
+ lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP);
+
+ void reset(const lldb::DebuggerSP &debugger_sp);
+
+ lldb_private::Debugger *get() const;
+
+ lldb_private::Debugger &ref() const;
+
+ const lldb::DebuggerSP &get_sp() const;
+
+ lldb::DebuggerSP m_opaque_sp;
}; // class SBDebugger
Modified: lldb/trunk/include/lldb/API/SBDeclaration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDeclaration.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDeclaration.h (original)
+++ lldb/trunk/include/lldb/API/SBDeclaration.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBDeclaration.h -------------------------------------------*- C++ -*-===//
+//===-- SBDeclaration.h -------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,76 +15,56 @@
#include "lldb/API/SBFileSpec.h"
namespace lldb {
-
- class LLDB_API SBDeclaration
- {
- public:
-
- SBDeclaration ();
-
- SBDeclaration (const lldb::SBDeclaration &rhs);
-
- ~SBDeclaration ();
-
- const lldb::SBDeclaration &
- operator = (const lldb::SBDeclaration &rhs);
-
- bool
- IsValid () const;
-
- lldb::SBFileSpec
- GetFileSpec () const;
-
- uint32_t
- GetLine () const;
-
- uint32_t
- GetColumn () const;
-
- void
- SetFileSpec (lldb::SBFileSpec filespec);
-
- void
- SetLine (uint32_t line);
-
- void
- SetColumn (uint32_t column);
-
- bool
- operator == (const lldb::SBDeclaration &rhs) const;
-
- bool
- operator != (const lldb::SBDeclaration &rhs) const;
-
- bool
- GetDescription (lldb::SBStream &description);
-
- protected:
-
- lldb_private::Declaration *
- get ();
-
- private:
- friend class SBValue;
-
- const lldb_private::Declaration *
- operator->() const;
-
- lldb_private::Declaration &
- ref();
-
- const lldb_private::Declaration &
- ref() const;
-
- SBDeclaration (const lldb_private::Declaration *lldb_object_ptr);
-
- void
- SetDeclaration (const lldb_private::Declaration &lldb_object_ref);
-
- std::unique_ptr<lldb_private::Declaration> m_opaque_ap;
- };
-
-
+
+class LLDB_API SBDeclaration {
+public:
+ SBDeclaration();
+
+ SBDeclaration(const lldb::SBDeclaration &rhs);
+
+ ~SBDeclaration();
+
+ const lldb::SBDeclaration &operator=(const lldb::SBDeclaration &rhs);
+
+ bool IsValid() const;
+
+ lldb::SBFileSpec GetFileSpec() const;
+
+ uint32_t GetLine() const;
+
+ uint32_t GetColumn() const;
+
+ void SetFileSpec(lldb::SBFileSpec filespec);
+
+ void SetLine(uint32_t line);
+
+ void SetColumn(uint32_t column);
+
+ bool operator==(const lldb::SBDeclaration &rhs) const;
+
+ bool operator!=(const lldb::SBDeclaration &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+protected:
+ lldb_private::Declaration *get();
+
+private:
+ friend class SBValue;
+
+ const lldb_private::Declaration *operator->() const;
+
+ lldb_private::Declaration &ref();
+
+ const lldb_private::Declaration &ref() const;
+
+ SBDeclaration(const lldb_private::Declaration *lldb_object_ptr);
+
+ void SetDeclaration(const lldb_private::Declaration &lldb_object_ref);
+
+ std::unique_ptr<lldb_private::Declaration> m_opaque_ap;
+};
+
} // namespace lldb
#endif // LLDB_SBDeclaration_h_
Modified: lldb/trunk/include/lldb/API/SBDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDefines.h (original)
+++ lldb/trunk/include/lldb/API/SBDefines.h Tue Sep 6 15:57:50 2016
@@ -96,7 +96,6 @@ class LLDB_API SBValueList;
class LLDB_API SBVariablesOptions;
class LLDB_API SBWatchpoint;
class LLDB_API SBUnixSignals;
-
}
-#endif // LLDB_SBDefines_h_
+#endif // LLDB_SBDefines_h_
Modified: lldb/trunk/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBError.h (original)
+++ lldb/trunk/include/lldb/API/SBError.h Tue Sep 6 15:57:50 2016
@@ -16,94 +16,73 @@ namespace lldb {
class LLDB_API SBError {
public:
- SBError ();
+ SBError();
- SBError (const lldb::SBError &rhs);
+ SBError(const lldb::SBError &rhs);
- ~SBError();
+ ~SBError();
- const SBError &
- operator =(const lldb::SBError &rhs);
+ const SBError &operator=(const lldb::SBError &rhs);
- const char *
- GetCString () const;
+ const char *GetCString() const;
- void
- Clear ();
+ void Clear();
- bool
- Fail () const;
+ bool Fail() const;
- bool
- Success () const;
+ bool Success() const;
- uint32_t
- GetError () const;
+ uint32_t GetError() const;
- lldb::ErrorType
- GetType () const;
+ lldb::ErrorType GetType() const;
- void
- SetError (uint32_t err, lldb::ErrorType type);
+ void SetError(uint32_t err, lldb::ErrorType type);
- void
- SetErrorToErrno ();
+ void SetErrorToErrno();
- void
- SetErrorToGenericError ();
+ void SetErrorToGenericError();
- void
- SetErrorString (const char *err_str);
+ void SetErrorString(const char *err_str);
- int
- SetErrorStringWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+ int SetErrorStringWithFormat(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
- bool
- IsValid () const;
+ bool IsValid() const;
- bool
- GetDescription (lldb::SBStream &description);
+ bool GetDescription(lldb::SBStream &description);
protected:
+ friend class SBCommandReturnObject;
+ friend class SBData;
+ friend class SBDebugger;
+ friend class SBCommunication;
+ friend class SBHostOS;
+ friend class SBPlatform;
+ friend class SBProcess;
+ friend class SBStructuredData;
+ friend class SBThread;
+ friend class SBTarget;
+ friend class SBValue;
+ friend class SBWatchpoint;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+
+ lldb_private::Error *get();
- friend class SBCommandReturnObject;
- friend class SBData;
- friend class SBDebugger;
- friend class SBCommunication;
- friend class SBHostOS;
- friend class SBPlatform;
- friend class SBProcess;
- friend class SBStructuredData;
- friend class SBThread;
- friend class SBTarget;
- friend class SBValue;
- friend class SBWatchpoint;
- friend class SBBreakpoint;
- friend class SBBreakpointLocation;
-
- lldb_private::Error *
- get();
-
- lldb_private::Error *
- operator->();
+ lldb_private::Error *operator->();
- const lldb_private::Error &
- operator*() const;
+ const lldb_private::Error &operator*() const;
- lldb_private::Error &
- ref();
+ lldb_private::Error &ref();
- void
- SetError (const lldb_private::Error &lldb_error);
+ void SetError(const lldb_private::Error &lldb_error);
private:
- std::unique_ptr<lldb_private::Error> m_opaque_ap;
+ std::unique_ptr<lldb_private::Error> m_opaque_ap;
- void
- CreateIfNeeded ();
+ void CreateIfNeeded();
};
-
} // namespace lldb
#endif // LLDB_SBError_h_
Modified: lldb/trunk/include/lldb/API/SBEvent.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBEvent.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBEvent.h (original)
+++ lldb/trunk/include/lldb/API/SBEvent.h Tue Sep 6 15:57:50 2016
@@ -15,91 +15,72 @@
#include <stdio.h>
#include <vector>
-
namespace lldb {
class SBBroadcaster;
-class LLDB_API SBEvent
-{
+class LLDB_API SBEvent {
public:
- SBEvent();
+ SBEvent();
+
+ SBEvent(const lldb::SBEvent &rhs);
- SBEvent (const lldb::SBEvent &rhs);
-
- // Make an event that contains a C string.
- SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len);
+ // Make an event that contains a C string.
+ SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len);
- SBEvent (lldb::EventSP &event_sp);
+ SBEvent(lldb::EventSP &event_sp);
- SBEvent (lldb_private::Event *event_sp);
+ SBEvent(lldb_private::Event *event_sp);
- ~SBEvent();
+ ~SBEvent();
- const SBEvent &
- operator = (const lldb::SBEvent &rhs);
+ const SBEvent &operator=(const lldb::SBEvent &rhs);
- bool
- IsValid() const;
+ bool IsValid() const;
- const char *
- GetDataFlavor ();
+ const char *GetDataFlavor();
- uint32_t
- GetType () const;
+ uint32_t GetType() const;
- lldb::SBBroadcaster
- GetBroadcaster () const;
+ lldb::SBBroadcaster GetBroadcaster() const;
- const char *
- GetBroadcasterClass () const;
+ const char *GetBroadcasterClass() const;
- bool
- BroadcasterMatchesPtr (const lldb::SBBroadcaster *broadcaster);
+ bool BroadcasterMatchesPtr(const lldb::SBBroadcaster *broadcaster);
- bool
- BroadcasterMatchesRef (const lldb::SBBroadcaster &broadcaster);
+ bool BroadcasterMatchesRef(const lldb::SBBroadcaster &broadcaster);
- void
- Clear();
+ void Clear();
- static const char *
- GetCStringFromEvent (const lldb::SBEvent &event);
+ static const char *GetCStringFromEvent(const lldb::SBEvent &event);
- bool
- GetDescription (lldb::SBStream &description);
+ bool GetDescription(lldb::SBStream &description);
- bool
- GetDescription (lldb::SBStream &description) const;
+ bool GetDescription(lldb::SBStream &description) const;
protected:
- friend class SBListener;
- friend class SBBroadcaster;
- friend class SBBreakpoint;
- friend class SBDebugger;
- friend class SBProcess;
- friend class SBTarget;
- friend class SBThread;
- friend class SBWatchpoint;
-
- lldb::EventSP &
- GetSP () const;
+ friend class SBListener;
+ friend class SBBroadcaster;
+ friend class SBBreakpoint;
+ friend class SBDebugger;
+ friend class SBProcess;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBWatchpoint;
- void
- reset (lldb::EventSP &event_sp);
+ lldb::EventSP &GetSP() const;
- void
- reset (lldb_private::Event* event);
+ void reset(lldb::EventSP &event_sp);
- lldb_private::Event *
- get () const;
+ void reset(lldb_private::Event *event);
-private:
+ lldb_private::Event *get() const;
- mutable lldb::EventSP m_event_sp;
- mutable lldb_private::Event *m_opaque_ptr;
+private:
+ mutable lldb::EventSP m_event_sp;
+ mutable lldb_private::Event *m_opaque_ptr;
};
} // namespace lldb
-#endif // LLDB_SBEvent_h_
+#endif // LLDB_SBEvent_h_
Modified: lldb/trunk/include/lldb/API/SBExecutionContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExecutionContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBExecutionContext.h (original)
+++ lldb/trunk/include/lldb/API/SBExecutionContext.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBExecutionContext.h -----------------------------------------*- C++ -*-===//
+//===-- SBExecutionContext.h -----------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,60 +16,51 @@
#include <stdio.h>
#include <vector>
-
namespace lldb {
-
-class LLDB_API SBExecutionContext
-{
-friend class SBCommandInterpreter;
+
+class LLDB_API SBExecutionContext {
+ friend class SBCommandInterpreter;
public:
- SBExecutionContext();
-
- SBExecutionContext (const lldb::SBExecutionContext &rhs);
-
- SBExecutionContext (lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-
- SBExecutionContext (const lldb::SBTarget &target);
-
- SBExecutionContext (const lldb::SBProcess &process);
-
- SBExecutionContext (lldb::SBThread thread); // can't be a const& because SBThread::get() isn't itself a const function
-
- SBExecutionContext (const lldb::SBFrame &frame);
-
- ~SBExecutionContext();
-
- const SBExecutionContext &
- operator = (const lldb::SBExecutionContext &rhs);
-
- SBTarget
- GetTarget () const;
-
- SBProcess
- GetProcess () const;
-
- SBThread
- GetThread () const;
-
- SBFrame
- GetFrame () const;
-
+ SBExecutionContext();
+
+ SBExecutionContext(const lldb::SBExecutionContext &rhs);
+
+ SBExecutionContext(lldb::ExecutionContextRefSP exe_ctx_ref_sp);
+
+ SBExecutionContext(const lldb::SBTarget &target);
+
+ SBExecutionContext(const lldb::SBProcess &process);
+
+ SBExecutionContext(lldb::SBThread thread); // can't be a const& because
+ // SBThread::get() isn't itself a
+ // const function
+
+ SBExecutionContext(const lldb::SBFrame &frame);
+
+ ~SBExecutionContext();
+
+ const SBExecutionContext &operator=(const lldb::SBExecutionContext &rhs);
+
+ SBTarget GetTarget() const;
+
+ SBProcess GetProcess() const;
+
+ SBThread GetThread() const;
+
+ SBFrame GetFrame() const;
+
protected:
- ExecutionContextRefSP &
- GetSP () const;
-
- void
- reset (lldb::ExecutionContextRefSP &event_sp);
-
- lldb_private::ExecutionContextRef *
- get () const;
-
+ ExecutionContextRefSP &GetSP() const;
+
+ void reset(lldb::ExecutionContextRefSP &event_sp);
+
+ lldb_private::ExecutionContextRef *get() const;
+
private:
-
- mutable lldb::ExecutionContextRefSP m_exe_ctx_sp;
+ mutable lldb::ExecutionContextRefSP m_exe_ctx_sp;
};
-
+
} // namespace lldb
-#endif // LLDB_SBExecutionContext_h_
+#endif // LLDB_SBExecutionContext_h_
Modified: lldb/trunk/include/lldb/API/SBExpressionOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExpressionOptions.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBExpressionOptions.h (original)
+++ lldb/trunk/include/lldb/API/SBExpressionOptions.h Tue Sep 6 15:57:50 2016
@@ -16,133 +16,100 @@
namespace lldb {
-
-class LLDB_API SBExpressionOptions
-{
+class LLDB_API SBExpressionOptions {
public:
- SBExpressionOptions();
+ SBExpressionOptions();
- SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
-
- ~SBExpressionOptions();
-
- const SBExpressionOptions &
- operator = (const lldb::SBExpressionOptions &rhs);
-
- bool
- GetCoerceResultToId () const;
-
- void
- SetCoerceResultToId (bool coerce = true);
-
- bool
- GetUnwindOnError () const;
-
- void
- SetUnwindOnError (bool unwind = true);
-
- bool
- GetIgnoreBreakpoints () const;
-
- void
- SetIgnoreBreakpoints (bool ignore = true);
-
- lldb::DynamicValueType
- GetFetchDynamicValue () const;
-
- void
- SetFetchDynamicValue (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
-
- uint32_t
- GetTimeoutInMicroSeconds () const;
-
- // Set the timeout for the expression, 0 means wait forever.
- void
- SetTimeoutInMicroSeconds (uint32_t timeout = 0);
-
- uint32_t
- GetOneThreadTimeoutInMicroSeconds () const;
-
- // Set the timeout for running on one thread, 0 means use the default behavior.
- // If you set this higher than the overall timeout, you'll get an error when you
- // try to run the expression.
- void
- SetOneThreadTimeoutInMicroSeconds (uint32_t timeout = 0);
-
- bool
- GetTryAllThreads () const;
-
- void
- SetTryAllThreads (bool run_others = true);
-
- bool
- GetStopOthers() const;
-
- void
- SetStopOthers(bool stop_others = true);
-
- bool
- GetTrapExceptions () const;
-
- void
- SetTrapExceptions (bool trap_exceptions = true);
-
- void
- SetLanguage (lldb::LanguageType language);
-
- void
- SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton);
-
- bool
- GetGenerateDebugInfo ();
-
- void
- SetGenerateDebugInfo (bool b = true);
-
- bool
- GetSuppressPersistentResult ();
-
- void
- SetSuppressPersistentResult (bool b = false);
-
- const char *
- GetPrefix () const;
-
- void
- SetPrefix (const char *prefix);
-
- void
- SetAutoApplyFixIts(bool b = true);
-
- bool
- GetAutoApplyFixIts();
-
- bool
- GetTopLevel ();
+ SBExpressionOptions(const lldb::SBExpressionOptions &rhs);
- void
- SetTopLevel (bool b = true);
+ ~SBExpressionOptions();
+ const SBExpressionOptions &operator=(const lldb::SBExpressionOptions &rhs);
-protected:
+ bool GetCoerceResultToId() const;
+
+ void SetCoerceResultToId(bool coerce = true);
+
+ bool GetUnwindOnError() const;
+
+ void SetUnwindOnError(bool unwind = true);
+
+ bool GetIgnoreBreakpoints() const;
+
+ void SetIgnoreBreakpoints(bool ignore = true);
+
+ lldb::DynamicValueType GetFetchDynamicValue() const;
+
+ void SetFetchDynamicValue(
+ lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
+
+ uint32_t GetTimeoutInMicroSeconds() const;
+
+ // Set the timeout for the expression, 0 means wait forever.
+ void SetTimeoutInMicroSeconds(uint32_t timeout = 0);
+
+ uint32_t GetOneThreadTimeoutInMicroSeconds() const;
+
+ // Set the timeout for running on one thread, 0 means use the default
+ // behavior.
+ // If you set this higher than the overall timeout, you'll get an error when
+ // you
+ // try to run the expression.
+ void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout = 0);
+
+ bool GetTryAllThreads() const;
+
+ void SetTryAllThreads(bool run_others = true);
+
+ bool GetStopOthers() const;
- SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
+ void SetStopOthers(bool stop_others = true);
+
+ bool GetTrapExceptions() const;
+
+ void SetTrapExceptions(bool trap_exceptions = true);
+
+ void SetLanguage(lldb::LanguageType language);
+
+ void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
+
+ bool GetGenerateDebugInfo();
+
+ void SetGenerateDebugInfo(bool b = true);
+
+ bool GetSuppressPersistentResult();
+
+ void SetSuppressPersistentResult(bool b = false);
+
+ const char *GetPrefix() const;
+
+ void SetPrefix(const char *prefix);
+
+ void SetAutoApplyFixIts(bool b = true);
+
+ bool GetAutoApplyFixIts();
+
+ bool GetTopLevel();
+
+ void SetTopLevel(bool b = true);
+
+protected:
+ SBExpressionOptions(
+ lldb_private::EvaluateExpressionOptions &expression_options);
- lldb_private::EvaluateExpressionOptions *
- get () const;
+ lldb_private::EvaluateExpressionOptions *get() const;
- lldb_private::EvaluateExpressionOptions &
- ref () const;
+ lldb_private::EvaluateExpressionOptions &ref() const;
- friend class SBFrame;
- friend class SBValue;
- friend class SBTarget;
+ friend class SBFrame;
+ friend class SBValue;
+ friend class SBTarget;
private:
- // This auto_pointer is made in the constructor and is always valid.
- mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
+ // This auto_pointer is made in the constructor and is always valid.
+ mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
};
} // namespace lldb
-#endif // LLDB_SBExpressionOptions_h_
+#endif // LLDB_SBExpressionOptions_h_
Modified: lldb/trunk/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFileSpec.h (original)
+++ lldb/trunk/include/lldb/API/SBFileSpec.h Tue Sep 6 15:57:50 2016
@@ -14,93 +14,75 @@
namespace lldb {
-class LLDB_API SBFileSpec
-{
+class LLDB_API SBFileSpec {
public:
- SBFileSpec ();
+ SBFileSpec();
- SBFileSpec (const lldb::SBFileSpec &rhs);
+ SBFileSpec(const lldb::SBFileSpec &rhs);
- SBFileSpec (const char *path);// Deprecated, use SBFileSpec (const char *path, bool resolve)
+ SBFileSpec(const char *path); // Deprecated, use SBFileSpec (const char *path,
+ // bool resolve)
- SBFileSpec (const char *path, bool resolve);
+ SBFileSpec(const char *path, bool resolve);
- ~SBFileSpec ();
+ ~SBFileSpec();
- const SBFileSpec &
- operator = (const lldb::SBFileSpec &rhs);
+ const SBFileSpec &operator=(const lldb::SBFileSpec &rhs);
- bool
- IsValid() const;
+ bool IsValid() const;
- bool
- Exists () const;
+ bool Exists() const;
- bool
- ResolveExecutableLocation ();
+ bool ResolveExecutableLocation();
- const char *
- GetFilename() const;
+ const char *GetFilename() const;
- const char *
- GetDirectory() const;
+ const char *GetDirectory() const;
- void
- SetFilename(const char *filename);
-
- void
- SetDirectory(const char *directory);
+ void SetFilename(const char *filename);
- uint32_t
- GetPath (char *dst_path, size_t dst_len) const;
+ void SetDirectory(const char *directory);
- static int
- ResolvePath (const char *src_path, char *dst_path, size_t dst_len);
+ uint32_t GetPath(char *dst_path, size_t dst_len) const;
- bool
- GetDescription (lldb::SBStream &description) const;
+ static int ResolvePath(const char *src_path, char *dst_path, size_t dst_len);
- void
- AppendPathComponent (const char *file_or_directory);
+ bool GetDescription(lldb::SBStream &description) const;
+
+ void AppendPathComponent(const char *file_or_directory);
private:
- friend class SBAttachInfo;
- friend class SBBlock;
- friend class SBCommandInterpreter;
- friend class SBCompileUnit;
- friend class SBDeclaration;
- friend class SBFileSpecList;
- friend class SBHostOS;
- friend class SBLaunchInfo;
- friend class SBLineEntry;
- friend class SBModule;
- friend class SBModuleSpec;
- friend class SBPlatform;
- friend class SBProcess;
- friend class SBSourceManager;
- friend class SBThread;
- friend class SBTarget;
-
- SBFileSpec (const lldb_private::FileSpec& fspec);
-
- void
- SetFileSpec (const lldb_private::FileSpec& fspec);
-
- const lldb_private::FileSpec *
- operator->() const;
-
- const lldb_private::FileSpec *
- get() const;
+ friend class SBAttachInfo;
+ friend class SBBlock;
+ friend class SBCommandInterpreter;
+ friend class SBCompileUnit;
+ friend class SBDeclaration;
+ friend class SBFileSpecList;
+ friend class SBHostOS;
+ friend class SBLaunchInfo;
+ friend class SBLineEntry;
+ friend class SBModule;
+ friend class SBModuleSpec;
+ friend class SBPlatform;
+ friend class SBProcess;
+ friend class SBSourceManager;
+ friend class SBThread;
+ friend class SBTarget;
+
+ SBFileSpec(const lldb_private::FileSpec &fspec);
+
+ void SetFileSpec(const lldb_private::FileSpec &fspec);
+
+ const lldb_private::FileSpec *operator->() const;
- const lldb_private::FileSpec &
- operator*() const;
+ const lldb_private::FileSpec *get() const;
- const lldb_private::FileSpec &
- ref() const;
+ const lldb_private::FileSpec &operator*() const;
- std::unique_ptr<lldb_private::FileSpec> m_opaque_ap;
-};
+ const lldb_private::FileSpec &ref() const;
+ std::unique_ptr<lldb_private::FileSpec> m_opaque_ap;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBFileSpecList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpecList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFileSpecList.h (original)
+++ lldb/trunk/include/lldb/API/SBFileSpecList.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBFileSpecList.h --------------------------------------------*- C++ -*-===//
+//===-- SBFileSpecList.h --------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,58 +15,43 @@
namespace lldb {
-class LLDB_API SBFileSpecList
-{
+class LLDB_API SBFileSpecList {
public:
- SBFileSpecList ();
+ SBFileSpecList();
- SBFileSpecList (const lldb::SBFileSpecList &rhs);
+ SBFileSpecList(const lldb::SBFileSpecList &rhs);
- ~SBFileSpecList ();
+ ~SBFileSpecList();
- const SBFileSpecList &
- operator = (const lldb::SBFileSpecList &rhs);
+ const SBFileSpecList &operator=(const lldb::SBFileSpecList &rhs);
- uint32_t
- GetSize () const;
-
- bool
- GetDescription (SBStream &description) const;
-
- void
- Append (const SBFileSpec &sb_file);
-
- bool
- AppendIfUnique (const SBFileSpec &sb_file);
-
- void
- Clear();
-
- uint32_t
- FindFileIndex (uint32_t idx, const SBFileSpec &sb_file, bool full);
-
- const SBFileSpec
- GetFileSpecAtIndex (uint32_t idx) const;
+ uint32_t GetSize() const;
-private:
+ bool GetDescription(SBStream &description) const;
-friend class SBTarget;
+ void Append(const SBFileSpec &sb_file);
- const lldb_private::FileSpecList *
- operator->() const;
+ bool AppendIfUnique(const SBFileSpec &sb_file);
- const lldb_private::FileSpecList *
- get() const;
+ void Clear();
- const lldb_private::FileSpecList &
- operator*() const;
+ uint32_t FindFileIndex(uint32_t idx, const SBFileSpec &sb_file, bool full);
- const lldb_private::FileSpecList &
- ref() const;
+ const SBFileSpec GetFileSpecAtIndex(uint32_t idx) const;
- std::unique_ptr<lldb_private::FileSpecList> m_opaque_ap;
-};
+private:
+ friend class SBTarget;
+
+ const lldb_private::FileSpecList *operator->() const;
+ const lldb_private::FileSpecList *get() const;
+
+ const lldb_private::FileSpecList &operator*() const;
+
+ const lldb_private::FileSpecList &ref() const;
+
+ std::unique_ptr<lldb_private::FileSpecList> m_opaque_ap;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFrame.h (original)
+++ lldb/trunk/include/lldb/API/SBFrame.h Tue Sep 6 15:57:50 2016
@@ -15,227 +15,182 @@
namespace lldb {
-class LLDB_API SBFrame
-{
+class LLDB_API SBFrame {
public:
- SBFrame ();
+ SBFrame();
- SBFrame (const lldb::SBFrame &rhs);
-
- const lldb::SBFrame &
- operator =(const lldb::SBFrame &rhs);
-
- ~SBFrame();
-
- bool
- IsEqual (const lldb::SBFrame &that) const;
-
- bool
- IsValid() const;
-
- uint32_t
- GetFrameID () const;
-
- lldb::addr_t
- GetCFA () const;
-
- lldb::addr_t
- GetPC () const;
-
- bool
- SetPC (lldb::addr_t new_pc);
-
- lldb::addr_t
- GetSP () const;
-
- lldb::addr_t
- GetFP () const;
-
- lldb::SBAddress
- GetPCAddress () const;
-
- lldb::SBSymbolContext
- GetSymbolContext (uint32_t resolve_scope) const;
-
- lldb::SBModule
- GetModule () const;
-
- lldb::SBCompileUnit
- GetCompileUnit () const;
-
- lldb::SBFunction
- GetFunction () const;
-
- lldb::SBSymbol
- GetSymbol () const;
-
- /// Gets the deepest block that contains the frame PC.
- ///
- /// See also GetFrameBlock().
- lldb::SBBlock
- GetBlock () const;
-
- /// Get the appropriate function name for this frame. Inlined functions in
- /// LLDB are represented by Blocks that have inlined function information, so
- /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
- /// This function will return the appropriate function, symbol or inlined
- /// function name for the frame.
- ///
- /// This function returns:
- /// - the name of the inlined function (if there is one)
- /// - the name of the concrete function (if there is one)
- /// - the name of the symbol (if there is one)
- /// - NULL
- ///
- /// See also IsInlined().
- const char *
- GetFunctionName();
-
- // Get an appropriate function name for this frame that is suitable for display to a user
- const char *
- GetDisplayFunctionName ();
-
- const char *
- GetFunctionName() const;
-
- /// Return true if this frame represents an inlined function.
- ///
- /// See also GetFunctionName().
- bool
- IsInlined();
-
- bool
- IsInlined() const;
-
- /// The version that doesn't supply a 'use_dynamic' value will use the
- /// target's default.
- lldb::SBValue
- EvaluateExpression (const char *expr);
-
- lldb::SBValue
- EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
-
- lldb::SBValue
- EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic, bool unwind_on_error);
-
- lldb::SBValue
- EvaluateExpression (const char *expr, const SBExpressionOptions &options);
-
- /// Gets the lexical block that defines the stack frame. Another way to think
- /// of this is it will return the block that contains all of the variables
- /// for a stack frame. Inlined functions are represented as SBBlock objects
- /// that have inlined function information: the name of the inlined function,
- /// where it was called from. The block that is returned will be the first
- /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
- /// the scope of the frame. When a function contains no inlined functions,
- /// this will be the top most lexical block that defines the function.
- /// When a function has inlined functions and the PC is currently
- /// in one of those inlined functions, this method will return the inlined
- /// block that defines this frame. If the PC isn't currently in an inlined
- /// function, the lexical block that defines the function is returned.
- lldb::SBBlock
- GetFrameBlock () const;
-
- lldb::SBLineEntry
- GetLineEntry () const;
-
- lldb::SBThread
- GetThread () const;
-
- const char *
- Disassemble () const;
-
- void
- Clear();
-
- bool
- operator == (const lldb::SBFrame &rhs) const;
-
- bool
- operator != (const lldb::SBFrame &rhs) const;
-
- /// The version that doesn't supply a 'use_dynamic' value will use the
- /// target's default.
- lldb::SBValueList
- GetVariables (bool arguments,
- bool locals,
- bool statics,
- bool in_scope_only);
-
- lldb::SBValueList
- GetVariables (bool arguments,
- bool locals,
- bool statics,
- bool in_scope_only,
- lldb::DynamicValueType use_dynamic);
-
- lldb::SBValueList
- GetVariables (const lldb::SBVariablesOptions& options);
-
- lldb::SBValueList
- GetRegisters ();
-
- lldb::SBValue
- FindRegister (const char *name);
-
- /// The version that doesn't supply a 'use_dynamic' value will use the
- /// target's default.
- lldb::SBValue
- FindVariable (const char *var_name);
-
- lldb::SBValue
- FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
-
- // Find a value for a variable expression path like "rect.origin.x" or
- // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_
- // and expression result and is not a constant object like
- // SBFrame::EvaluateExpression(...) returns, but a child object of
- // the variable value.
- lldb::SBValue
- GetValueForVariablePath (const char *var_expr_cstr,
- DynamicValueType use_dynamic);
-
- /// The version that doesn't supply a 'use_dynamic' value will use the
- /// target's default.
- lldb::SBValue
- GetValueForVariablePath (const char *var_path);
-
- /// Find variables, register sets, registers, or persistent variables using
- /// the frame as the scope.
- ///
- /// NB. This function does not look up ivars in the function object pointer.
- /// To do that use GetValueForVariablePath.
- ///
- /// The version that doesn't supply a 'use_dynamic' value will use the
- /// target's default.
- lldb::SBValue
- FindValue (const char *name, ValueType value_type);
+ SBFrame(const lldb::SBFrame &rhs);
- lldb::SBValue
- FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
+ const lldb::SBFrame &operator=(const lldb::SBFrame &rhs);
- bool
- GetDescription (lldb::SBStream &description);
+ ~SBFrame();
- SBFrame (const lldb::StackFrameSP &lldb_object_sp);
+ bool IsEqual(const lldb::SBFrame &that) const;
-protected:
+ bool IsValid() const;
+
+ uint32_t GetFrameID() const;
+
+ lldb::addr_t GetCFA() const;
+
+ lldb::addr_t GetPC() const;
+
+ bool SetPC(lldb::addr_t new_pc);
+
+ lldb::addr_t GetSP() const;
+
+ lldb::addr_t GetFP() const;
+
+ lldb::SBAddress GetPCAddress() const;
+
+ lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
+
+ lldb::SBModule GetModule() const;
+
+ lldb::SBCompileUnit GetCompileUnit() const;
+
+ lldb::SBFunction GetFunction() const;
+
+ lldb::SBSymbol GetSymbol() const;
+
+ /// Gets the deepest block that contains the frame PC.
+ ///
+ /// See also GetFrameBlock().
+ lldb::SBBlock GetBlock() const;
+
+ /// Get the appropriate function name for this frame. Inlined functions in
+ /// LLDB are represented by Blocks that have inlined function information, so
+ /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
+ /// This function will return the appropriate function, symbol or inlined
+ /// function name for the frame.
+ ///
+ /// This function returns:
+ /// - the name of the inlined function (if there is one)
+ /// - the name of the concrete function (if there is one)
+ /// - the name of the symbol (if there is one)
+ /// - NULL
+ ///
+ /// See also IsInlined().
+ const char *GetFunctionName();
+
+ // Get an appropriate function name for this frame that is suitable for
+ // display to a user
+ const char *GetDisplayFunctionName();
+
+ const char *GetFunctionName() const;
+
+ /// Return true if this frame represents an inlined function.
+ ///
+ /// See also GetFunctionName().
+ bool IsInlined();
+
+ bool IsInlined() const;
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue EvaluateExpression(const char *expr);
+
+ lldb::SBValue EvaluateExpression(const char *expr,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue EvaluateExpression(const char *expr,
+ lldb::DynamicValueType use_dynamic,
+ bool unwind_on_error);
- friend class SBBlock;
- friend class SBExecutionContext;
- friend class SBInstruction;
- friend class SBThread;
- friend class SBValue;
+ lldb::SBValue EvaluateExpression(const char *expr,
+ const SBExpressionOptions &options);
+
+ /// Gets the lexical block that defines the stack frame. Another way to think
+ /// of this is it will return the block that contains all of the variables
+ /// for a stack frame. Inlined functions are represented as SBBlock objects
+ /// that have inlined function information: the name of the inlined function,
+ /// where it was called from. The block that is returned will be the first
+ /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
+ /// the scope of the frame. When a function contains no inlined functions,
+ /// this will be the top most lexical block that defines the function.
+ /// When a function has inlined functions and the PC is currently
+ /// in one of those inlined functions, this method will return the inlined
+ /// block that defines this frame. If the PC isn't currently in an inlined
+ /// function, the lexical block that defines the function is returned.
+ lldb::SBBlock GetFrameBlock() const;
+
+ lldb::SBLineEntry GetLineEntry() const;
+
+ lldb::SBThread GetThread() const;
+
+ const char *Disassemble() const;
+
+ void Clear();
+
+ bool operator==(const lldb::SBFrame &rhs) const;
+
+ bool operator!=(const lldb::SBFrame &rhs) const;
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
+ bool in_scope_only);
+
+ lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
+ bool in_scope_only,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
+
+ lldb::SBValueList GetRegisters();
+
+ lldb::SBValue FindRegister(const char *name);
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue FindVariable(const char *var_name);
+
+ lldb::SBValue FindVariable(const char *var_name,
+ lldb::DynamicValueType use_dynamic);
+
+ // Find a value for a variable expression path like "rect.origin.x" or
+ // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_
+ // and expression result and is not a constant object like
+ // SBFrame::EvaluateExpression(...) returns, but a child object of
+ // the variable value.
+ lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
+ DynamicValueType use_dynamic);
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue GetValueForVariablePath(const char *var_path);
+
+ /// Find variables, register sets, registers, or persistent variables using
+ /// the frame as the scope.
+ ///
+ /// NB. This function does not look up ivars in the function object pointer.
+ /// To do that use GetValueForVariablePath.
+ ///
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue FindValue(const char *name, ValueType value_type);
+
+ lldb::SBValue FindValue(const char *name, ValueType value_type,
+ lldb::DynamicValueType use_dynamic);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ SBFrame(const lldb::StackFrameSP &lldb_object_sp);
+
+protected:
+ friend class SBBlock;
+ friend class SBExecutionContext;
+ friend class SBInstruction;
+ friend class SBThread;
+ friend class SBValue;
- lldb::StackFrameSP
- GetFrameSP() const;
+ lldb::StackFrameSP GetFrameSP() const;
- void
- SetFrameSP (const lldb::StackFrameSP &lldb_object_sp);
+ void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
- lldb::ExecutionContextRefSP m_opaque_sp;
+ lldb::ExecutionContextRefSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBFrame_h_
+#endif // LLDB_SBFrame_h_
Modified: lldb/trunk/include/lldb/API/SBFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFunction.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFunction.h (original)
+++ lldb/trunk/include/lldb/API/SBFunction.h Tue Sep 6 15:57:50 2016
@@ -10,96 +10,72 @@
#ifndef LLDB_SBFunction_h_
#define LLDB_SBFunction_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
#include "lldb/API/SBInstructionList.h"
namespace lldb {
-class LLDB_API SBFunction
-{
+class LLDB_API SBFunction {
public:
+ SBFunction();
- SBFunction ();
+ SBFunction(const lldb::SBFunction &rhs);
- SBFunction (const lldb::SBFunction &rhs);
+ const lldb::SBFunction &operator=(const lldb::SBFunction &rhs);
- const lldb::SBFunction &
- operator = (const lldb::SBFunction &rhs);
+ ~SBFunction();
- ~SBFunction ();
+ bool IsValid() const;
- bool
- IsValid () const;
+ const char *GetName() const;
- const char *
- GetName() const;
+ const char *GetDisplayName() const;
- const char *
- GetDisplayName() const;
-
- const char *
- GetMangledName () const;
+ const char *GetMangledName() const;
- lldb::SBInstructionList
- GetInstructions (lldb::SBTarget target);
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target);
- lldb::SBInstructionList
- GetInstructions (lldb::SBTarget target, const char *flavor);
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target,
+ const char *flavor);
- lldb::SBAddress
- GetStartAddress ();
+ lldb::SBAddress GetStartAddress();
- lldb::SBAddress
- GetEndAddress ();
+ lldb::SBAddress GetEndAddress();
- const char *
- GetArgumentName (uint32_t arg_idx);
+ const char *GetArgumentName(uint32_t arg_idx);
- uint32_t
- GetPrologueByteSize ();
+ uint32_t GetPrologueByteSize();
- lldb::SBType
- GetType ();
+ lldb::SBType GetType();
- lldb::SBBlock
- GetBlock ();
-
- lldb::LanguageType
- GetLanguage ();
+ lldb::SBBlock GetBlock();
- bool
- GetIsOptimized ();
+ lldb::LanguageType GetLanguage();
- bool
- operator == (const lldb::SBFunction &rhs) const;
+ bool GetIsOptimized();
- bool
- operator != (const lldb::SBFunction &rhs) const;
+ bool operator==(const lldb::SBFunction &rhs) const;
- bool
- GetDescription (lldb::SBStream &description);
+ bool operator!=(const lldb::SBFunction &rhs) const;
-protected:
+ bool GetDescription(lldb::SBStream &description);
- lldb_private::Function *
- get ();
+protected:
+ lldb_private::Function *get();
- void
- reset (lldb_private::Function *lldb_object_ptr);
+ void reset(lldb_private::Function *lldb_object_ptr);
private:
- friend class SBAddress;
- friend class SBFrame;
- friend class SBSymbolContext;
-
- SBFunction (lldb_private::Function *lldb_object_ptr);
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBSymbolContext;
+ SBFunction(lldb_private::Function *lldb_object_ptr);
- lldb_private::Function *m_opaque_ptr;
+ lldb_private::Function *m_opaque_ptr;
};
-
} // namespace lldb
#endif // LLDB_SBFunction_h_
Modified: lldb/trunk/include/lldb/API/SBHostOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBHostOS.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBHostOS.h (original)
+++ lldb/trunk/include/lldb/API/SBHostOS.h Tue Sep 6 15:57:50 2016
@@ -15,48 +15,30 @@
namespace lldb {
-class LLDB_API SBHostOS
-{
+class LLDB_API SBHostOS {
public:
+ static lldb::SBFileSpec GetProgramFileSpec();
- static lldb::SBFileSpec
- GetProgramFileSpec ();
-
- static lldb::SBFileSpec
- GetLLDBPythonPath ();
-
- static lldb::SBFileSpec
- GetLLDBPath (lldb::PathType path_type);
-
- static lldb::SBFileSpec
- GetUserHomeDirectory ();
-
- static void
- ThreadCreated (const char *name);
-
- static lldb::thread_t
- ThreadCreate (const char *name,
- lldb::thread_func_t thread_function,
- void *thread_arg,
- lldb::SBError *err);
-
- static bool
- ThreadCancel (lldb::thread_t thread,
- lldb::SBError *err);
-
- static bool
- ThreadDetach (lldb::thread_t thread,
- lldb::SBError *err);
- static bool
- ThreadJoin (lldb::thread_t thread,
- lldb::thread_result_t *result,
- lldb::SBError *err);
+ static lldb::SBFileSpec GetLLDBPythonPath();
+ static lldb::SBFileSpec GetLLDBPath(lldb::PathType path_type);
-private:
+ static lldb::SBFileSpec GetUserHomeDirectory();
-};
+ static void ThreadCreated(const char *name);
+
+ static lldb::thread_t ThreadCreate(const char *name,
+ lldb::thread_func_t thread_function,
+ void *thread_arg, lldb::SBError *err);
+
+ static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err);
+ static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err);
+ static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
+ lldb::SBError *err);
+
+private:
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBInstruction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstruction.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBInstruction.h (original)
+++ lldb/trunk/include/lldb/API/SBInstruction.h Tue Sep 6 15:57:50 2016
@@ -10,93 +10,76 @@
#ifndef LLDB_SBInstruction_h_
#define LLDB_SBInstruction_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBData.h"
+#include "lldb/API/SBDefines.h"
#include <stdio.h>
-// There's a lot to be fixed here, but need to wait for underlying insn implementation
+// There's a lot to be fixed here, but need to wait for underlying insn
+// implementation
// to be revised & settle down first.
class InstructionImpl;
namespace lldb {
-class LLDB_API SBInstruction
-{
+class LLDB_API SBInstruction {
public:
+ SBInstruction();
+
+ SBInstruction(const SBInstruction &rhs);
+
+ const SBInstruction &operator=(const SBInstruction &rhs);
+
+ ~SBInstruction();
+
+ bool IsValid();
+
+ SBAddress GetAddress();
+
+ lldb::AddressClass GetAddressClass();
+
+ const char *GetMnemonic(lldb::SBTarget target);
+
+ const char *GetOperands(lldb::SBTarget target);
- SBInstruction ();
+ const char *GetComment(lldb::SBTarget target);
- SBInstruction (const SBInstruction &rhs);
-
- const SBInstruction &
- operator = (const SBInstruction &rhs);
-
- ~SBInstruction ();
-
- bool
- IsValid();
-
- SBAddress
- GetAddress();
-
- lldb::AddressClass
- GetAddressClass ();
-
- const char *
- GetMnemonic (lldb::SBTarget target);
-
- const char *
- GetOperands (lldb::SBTarget target);
-
- const char *
- GetComment (lldb::SBTarget target);
-
- lldb::SBData
- GetData (lldb::SBTarget target);
-
- size_t
- GetByteSize ();
-
- bool
- DoesBranch ();
-
- bool
- HasDelaySlot ();
-
- void
- Print (FILE *out);
-
- bool
- GetDescription (lldb::SBStream &description);
-
- bool
- EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options);
-
- bool
- DumpEmulation (const char * triple); // triple is to specify the architecture, e.g. 'armv6' or 'armv7-apple-ios'
-
- bool
- TestEmulation (lldb::SBStream &output_stream, const char *test_file);
+ lldb::SBData GetData(lldb::SBTarget target);
+
+ size_t GetByteSize();
+
+ bool DoesBranch();
+
+ bool HasDelaySlot();
+
+ void Print(FILE *out);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
+
+ bool DumpEmulation(const char *triple); // triple is to specify the
+ // architecture, e.g. 'armv6' or
+ // 'armv7-apple-ios'
+
+ bool TestEmulation(lldb::SBStream &output_stream, const char *test_file);
protected:
- friend class SBInstructionList;
+ friend class SBInstructionList;
- SBInstruction(const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP &inst_sp);
+ SBInstruction(const lldb::DisassemblerSP &disasm_sp,
+ const lldb::InstructionSP &inst_sp);
- void
- SetOpaque(const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP& inst_sp);
+ void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
+ const lldb::InstructionSP &inst_sp);
- lldb::InstructionSP
- GetOpaque();
+ lldb::InstructionSP GetOpaque();
private:
-
- std::shared_ptr<InstructionImpl> m_opaque_sp;
+ std::shared_ptr<InstructionImpl> m_opaque_sp;
};
-
} // namespace lldb
#endif // LLDB_SBInstruction_h_
Modified: lldb/trunk/include/lldb/API/SBInstructionList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstructionList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBInstructionList.h (original)
+++ lldb/trunk/include/lldb/API/SBInstructionList.h Tue Sep 6 15:57:50 2016
@@ -16,55 +16,42 @@
namespace lldb {
-class LLDB_API SBInstructionList
-{
+class LLDB_API SBInstructionList {
public:
+ SBInstructionList();
- SBInstructionList ();
+ SBInstructionList(const SBInstructionList &rhs);
- SBInstructionList (const SBInstructionList &rhs);
-
- const SBInstructionList &
- operator = (const SBInstructionList &rhs);
+ const SBInstructionList &operator=(const SBInstructionList &rhs);
- ~SBInstructionList ();
+ ~SBInstructionList();
- bool
- IsValid () const;
+ bool IsValid() const;
- size_t
- GetSize ();
+ size_t GetSize();
- lldb::SBInstruction
- GetInstructionAtIndex (uint32_t idx);
+ lldb::SBInstruction GetInstructionAtIndex(uint32_t idx);
- void
- Clear ();
+ void Clear();
- void
- AppendInstruction (lldb::SBInstruction inst);
+ void AppendInstruction(lldb::SBInstruction inst);
- void
- Print (FILE *out);
+ void Print(FILE *out);
- bool
- GetDescription (lldb::SBStream &description);
-
- bool
- DumpEmulationForAllInstructions (const char *triple);
+ bool GetDescription(lldb::SBStream &description);
+
+ bool DumpEmulationForAllInstructions(const char *triple);
protected:
- friend class SBFunction;
- friend class SBSymbol;
- friend class SBTarget;
-
- void
- SetDisassembler (const lldb::DisassemblerSP &opaque_sp);
+ friend class SBFunction;
+ friend class SBSymbol;
+ friend class SBTarget;
-private:
- lldb::DisassemblerSP m_opaque_sp;
-};
+ void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
+private:
+ lldb::DisassemblerSP m_opaque_sp;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLanguageRuntime.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/API/SBLanguageRuntime.h Tue Sep 6 15:57:50 2016
@@ -14,14 +14,11 @@
namespace lldb {
-class SBLanguageRuntime
-{
+class SBLanguageRuntime {
public:
- static lldb::LanguageType
- GetLanguageTypeFromString (const char *string);
-
- static const char *
- GetNameForLanguageType (lldb::LanguageType language);
+ static lldb::LanguageType GetLanguageTypeFromString(const char *string);
+
+ static const char *GetNameForLanguageType(lldb::LanguageType language);
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBLaunchInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLaunchInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLaunchInfo.h (original)
+++ lldb/trunk/include/lldb/API/SBLaunchInfo.h Tue Sep 6 15:57:50 2016
@@ -17,179 +17,137 @@ namespace lldb {
class SBPlatform;
class SBTarget;
-class LLDB_API SBLaunchInfo
-{
+class LLDB_API SBLaunchInfo {
public:
- SBLaunchInfo (const char **argv);
+ SBLaunchInfo(const char **argv);
- ~SBLaunchInfo();
+ ~SBLaunchInfo();
- lldb::pid_t
- GetProcessID();
+ lldb::pid_t GetProcessID();
- uint32_t
- GetUserID();
-
- uint32_t
- GetGroupID();
-
- bool
- UserIDIsValid ();
-
- bool
- GroupIDIsValid ();
-
- void
- SetUserID (uint32_t uid);
-
- void
- SetGroupID (uint32_t gid);
-
- SBFileSpec
- GetExecutableFile ();
-
- //----------------------------------------------------------------------
- /// Set the executable file that will be used to launch the process and
- /// optionally set it as the first argument in the argument vector.
- ///
- /// This only needs to be specified if clients wish to carefully control
- /// the exact path will be used to launch a binary. If you create a
- /// target with a symlink, that symlink will get resolved in the target
- /// and the resolved path will get used to launch the process. Calling
- /// this function can help you still launch your process using the
- /// path of your choice.
- ///
- /// If this function is not called prior to launching with
- /// SBTarget::Launch(...), the target will use the resolved executable
- /// path that was used to create the target.
- ///
- /// @param[in] exe_file
- /// The override path to use when launching the executable.
- ///
- /// @param[in] add_as_first_arg
- /// If true, then the path will be inserted into the argument vector
- /// prior to launching. Otherwise the argument vector will be left
- /// alone.
- //----------------------------------------------------------------------
- void
- SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);
-
-
- //----------------------------------------------------------------------
- /// Get the listener that will be used to receive process events.
- ///
- /// If no listener has been set via a call to
- /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
- /// returned (SBListener::IsValid() will return false). If a listener
- /// has been set, then the valid listener object will be returned.
- //----------------------------------------------------------------------
- SBListener
- GetListener ();
-
- //----------------------------------------------------------------------
- /// Set the listener that will be used to receive process events.
- ///
- /// By default the SBDebugger, which has a listener, that the SBTarget
- /// belongs to will listen for the process events. Calling this function
- /// allows a different listener to be used to listen for process events.
- //----------------------------------------------------------------------
- void
- SetListener (SBListener &listener);
-
- uint32_t
- GetNumArguments ();
-
- const char *
- GetArgumentAtIndex (uint32_t idx);
-
- void
- SetArguments (const char **argv, bool append);
-
- uint32_t
- GetNumEnvironmentEntries ();
-
- const char *
- GetEnvironmentEntryAtIndex (uint32_t idx);
-
- void
- SetEnvironmentEntries (const char **envp, bool append);
-
- void
- Clear ();
-
- const char *
- GetWorkingDirectory () const;
-
- void
- SetWorkingDirectory (const char *working_dir);
-
- uint32_t
- GetLaunchFlags ();
-
- void
- SetLaunchFlags (uint32_t flags);
-
- const char *
- GetProcessPluginName ();
-
- void
- SetProcessPluginName (const char *plugin_name);
-
- const char *
- GetShell ();
-
- void
- SetShell (const char * path);
-
- bool
- GetShellExpandArguments ();
-
- void
- SetShellExpandArguments (bool expand);
-
- uint32_t
- GetResumeCount ();
-
- void
- SetResumeCount (uint32_t c);
-
- bool
- AddCloseFileAction (int fd);
-
- bool
- AddDuplicateFileAction (int fd, int dup_fd);
-
- bool
- AddOpenFileAction (int fd, const char *path, bool read, bool write);
-
- bool
- AddSuppressFileAction (int fd, bool read, bool write);
-
- void
- SetLaunchEventData (const char *data);
+ uint32_t GetUserID();
- const char *
- GetLaunchEventData () const;
+ uint32_t GetGroupID();
- bool
- GetDetachOnError() const;
+ bool UserIDIsValid();
- void
- SetDetachOnError(bool enable);
+ bool GroupIDIsValid();
+
+ void SetUserID(uint32_t uid);
+
+ void SetGroupID(uint32_t gid);
+
+ SBFileSpec GetExecutableFile();
+
+ //----------------------------------------------------------------------
+ /// Set the executable file that will be used to launch the process and
+ /// optionally set it as the first argument in the argument vector.
+ ///
+ /// This only needs to be specified if clients wish to carefully control
+ /// the exact path will be used to launch a binary. If you create a
+ /// target with a symlink, that symlink will get resolved in the target
+ /// and the resolved path will get used to launch the process. Calling
+ /// this function can help you still launch your process using the
+ /// path of your choice.
+ ///
+ /// If this function is not called prior to launching with
+ /// SBTarget::Launch(...), the target will use the resolved executable
+ /// path that was used to create the target.
+ ///
+ /// @param[in] exe_file
+ /// The override path to use when launching the executable.
+ ///
+ /// @param[in] add_as_first_arg
+ /// If true, then the path will be inserted into the argument vector
+ /// prior to launching. Otherwise the argument vector will be left
+ /// alone.
+ //----------------------------------------------------------------------
+ void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg);
+
+ //----------------------------------------------------------------------
+ /// Get the listener that will be used to receive process events.
+ ///
+ /// If no listener has been set via a call to
+ /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
+ /// returned (SBListener::IsValid() will return false). If a listener
+ /// has been set, then the valid listener object will be returned.
+ //----------------------------------------------------------------------
+ SBListener GetListener();
+
+ //----------------------------------------------------------------------
+ /// Set the listener that will be used to receive process events.
+ ///
+ /// By default the SBDebugger, which has a listener, that the SBTarget
+ /// belongs to will listen for the process events. Calling this function
+ /// allows a different listener to be used to listen for process events.
+ //----------------------------------------------------------------------
+ void SetListener(SBListener &listener);
+
+ uint32_t GetNumArguments();
+
+ const char *GetArgumentAtIndex(uint32_t idx);
+
+ void SetArguments(const char **argv, bool append);
+
+ uint32_t GetNumEnvironmentEntries();
+
+ const char *GetEnvironmentEntryAtIndex(uint32_t idx);
+
+ void SetEnvironmentEntries(const char **envp, bool append);
+
+ void Clear();
+
+ const char *GetWorkingDirectory() const;
+
+ void SetWorkingDirectory(const char *working_dir);
+
+ uint32_t GetLaunchFlags();
+
+ void SetLaunchFlags(uint32_t flags);
+
+ const char *GetProcessPluginName();
+
+ void SetProcessPluginName(const char *plugin_name);
+
+ const char *GetShell();
+
+ void SetShell(const char *path);
+
+ bool GetShellExpandArguments();
+
+ void SetShellExpandArguments(bool expand);
+
+ uint32_t GetResumeCount();
+
+ void SetResumeCount(uint32_t c);
+
+ bool AddCloseFileAction(int fd);
+
+ bool AddDuplicateFileAction(int fd, int dup_fd);
+
+ bool AddOpenFileAction(int fd, const char *path, bool read, bool write);
+
+ bool AddSuppressFileAction(int fd, bool read, bool write);
+
+ void SetLaunchEventData(const char *data);
+
+ const char *GetLaunchEventData() const;
+
+ bool GetDetachOnError() const;
+
+ void SetDetachOnError(bool enable);
protected:
- friend class SBPlatform;
- friend class SBTarget;
+ friend class SBPlatform;
+ friend class SBTarget;
- lldb_private::ProcessLaunchInfo &
- ref ();
+ lldb_private::ProcessLaunchInfo &ref();
- const lldb_private::ProcessLaunchInfo &
- ref () const;
+ const lldb_private::ProcessLaunchInfo &ref() const;
- ProcessLaunchInfoSP m_opaque_sp;
+ ProcessLaunchInfoSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBLaunchInfo_h_
+#endif // LLDB_SBLaunchInfo_h_
Modified: lldb/trunk/include/lldb/API/SBLineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLineEntry.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLineEntry.h (original)
+++ lldb/trunk/include/lldb/API/SBLineEntry.h Tue Sep 6 15:57:50 2016
@@ -10,90 +10,68 @@
#ifndef LLDB_SBLineEntry_h_
#define LLDB_SBLineEntry_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
namespace lldb {
-class LLDB_API SBLineEntry
-{
+class LLDB_API SBLineEntry {
public:
+ SBLineEntry();
- SBLineEntry ();
+ SBLineEntry(const lldb::SBLineEntry &rhs);
- SBLineEntry (const lldb::SBLineEntry &rhs);
+ ~SBLineEntry();
- ~SBLineEntry ();
+ const lldb::SBLineEntry &operator=(const lldb::SBLineEntry &rhs);
- const lldb::SBLineEntry &
- operator = (const lldb::SBLineEntry &rhs);
+ lldb::SBAddress GetStartAddress() const;
- lldb::SBAddress
- GetStartAddress () const;
+ lldb::SBAddress GetEndAddress() const;
- lldb::SBAddress
- GetEndAddress () const;
+ bool IsValid() const;
- bool
- IsValid () const;
+ lldb::SBFileSpec GetFileSpec() const;
- lldb::SBFileSpec
- GetFileSpec () const;
+ uint32_t GetLine() const;
- uint32_t
- GetLine () const;
+ uint32_t GetColumn() const;
- uint32_t
- GetColumn () const;
+ void SetFileSpec(lldb::SBFileSpec filespec);
- void
- SetFileSpec (lldb::SBFileSpec filespec);
-
- void
- SetLine (uint32_t line);
-
- void
- SetColumn (uint32_t column);
+ void SetLine(uint32_t line);
- bool
- operator == (const lldb::SBLineEntry &rhs) const;
+ void SetColumn(uint32_t column);
- bool
- operator != (const lldb::SBLineEntry &rhs) const;
+ bool operator==(const lldb::SBLineEntry &rhs) const;
- bool
- GetDescription (lldb::SBStream &description);
+ bool operator!=(const lldb::SBLineEntry &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
protected:
+ lldb_private::LineEntry *get();
- lldb_private::LineEntry *
- get ();
-
private:
- friend class SBAddress;
- friend class SBCompileUnit;
- friend class SBFrame;
- friend class SBSymbolContext;
+ friend class SBAddress;
+ friend class SBCompileUnit;
+ friend class SBFrame;
+ friend class SBSymbolContext;
- const lldb_private::LineEntry *
- operator->() const;
+ const lldb_private::LineEntry *operator->() const;
- lldb_private::LineEntry &
- ref();
+ lldb_private::LineEntry &ref();
- const lldb_private::LineEntry &
- ref() const;
+ const lldb_private::LineEntry &ref() const;
- SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr);
+ SBLineEntry(const lldb_private::LineEntry *lldb_object_ptr);
- void
- SetLineEntry (const lldb_private::LineEntry &lldb_object_ref);
+ void SetLineEntry(const lldb_private::LineEntry &lldb_object_ref);
- std::unique_ptr<lldb_private::LineEntry> m_opaque_ap;
+ std::unique_ptr<lldb_private::LineEntry> m_opaque_ap;
};
-
} // namespace lldb
#endif // LLDB_SBLineEntry_h_
Modified: lldb/trunk/include/lldb/API/SBListener.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBListener.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBListener.h (original)
+++ lldb/trunk/include/lldb/API/SBListener.h Tue Sep 6 15:57:50 2016
@@ -14,121 +14,94 @@
namespace lldb {
-class LLDB_API SBListener
-{
+class LLDB_API SBListener {
public:
- SBListener ();
+ SBListener();
- SBListener (const char *name);
+ SBListener(const char *name);
- SBListener (const SBListener &rhs);
+ SBListener(const SBListener &rhs);
- ~SBListener ();
+ ~SBListener();
- const lldb::SBListener &
- operator = (const lldb::SBListener &rhs);
-
- void
- AddEvent (const lldb::SBEvent &event);
-
- void
- Clear ();
-
- bool
- IsValid () const;
-
- uint32_t
- StartListeningForEventClass (SBDebugger &debugger,
- const char *broadcaster_class,
- uint32_t event_mask);
-
- bool
- StopListeningForEventClass (SBDebugger &debugger,
- const char *broadcaster_class,
- uint32_t event_mask);
-
- uint32_t
- StartListeningForEvents (const lldb::SBBroadcaster& broadcaster,
- uint32_t event_mask);
-
- bool
- StopListeningForEvents (const lldb::SBBroadcaster& broadcaster,
- uint32_t event_mask);
-
- // Returns true if an event was received, false if we timed out.
- bool
- WaitForEvent (uint32_t num_seconds,
- lldb::SBEvent &event);
-
- bool
- WaitForEventForBroadcaster (uint32_t num_seconds,
- const lldb::SBBroadcaster &broadcaster,
- lldb::SBEvent &sb_event);
-
- bool
- WaitForEventForBroadcasterWithType (uint32_t num_seconds,
- const lldb::SBBroadcaster &broadcaster,
- uint32_t event_type_mask,
- lldb::SBEvent &sb_event);
+ const lldb::SBListener &operator=(const lldb::SBListener &rhs);
+
+ void AddEvent(const lldb::SBEvent &event);
+
+ void Clear();
+
+ bool IsValid() const;
+
+ uint32_t StartListeningForEventClass(SBDebugger &debugger,
+ const char *broadcaster_class,
+ uint32_t event_mask);
+
+ bool StopListeningForEventClass(SBDebugger &debugger,
+ const char *broadcaster_class,
+ uint32_t event_mask);
+
+ uint32_t StartListeningForEvents(const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_mask);
+
+ bool StopListeningForEvents(const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_mask);
- bool
- PeekAtNextEvent (lldb::SBEvent &sb_event);
+ // Returns true if an event was received, false if we timed out.
+ bool WaitForEvent(uint32_t num_seconds, lldb::SBEvent &event);
- bool
- PeekAtNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
- lldb::SBEvent &sb_event);
-
- bool
- PeekAtNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
- uint32_t event_type_mask,
- lldb::SBEvent &sb_event);
-
- bool
- GetNextEvent (lldb::SBEvent &sb_event);
-
- bool
- GetNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
- lldb::SBEvent &sb_event);
+ bool WaitForEventForBroadcaster(uint32_t num_seconds,
+ const lldb::SBBroadcaster &broadcaster,
+ lldb::SBEvent &sb_event);
- bool
- GetNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
+ bool WaitForEventForBroadcasterWithType(
+ uint32_t num_seconds, const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_type_mask, lldb::SBEvent &sb_event);
+
+ bool PeekAtNextEvent(lldb::SBEvent &sb_event);
+
+ bool PeekAtNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
+ lldb::SBEvent &sb_event);
+
+ bool
+ PeekAtNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
uint32_t event_type_mask,
lldb::SBEvent &sb_event);
- bool
- HandleBroadcastEvent (const lldb::SBEvent &event);
+ bool GetNextEvent(lldb::SBEvent &sb_event);
+
+ bool GetNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
+ lldb::SBEvent &sb_event);
+
+ bool
+ GetNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_type_mask,
+ lldb::SBEvent &sb_event);
+
+ bool HandleBroadcastEvent(const lldb::SBEvent &event);
protected:
- friend class SBAttachInfo;
- friend class SBBroadcaster;
- friend class SBCommandInterpreter;
- friend class SBDebugger;
- friend class SBLaunchInfo;
- friend class SBTarget;
-
- SBListener (const lldb::ListenerSP &listener_sp);
-
- lldb::ListenerSP
- GetSP ()
- {
- return m_opaque_sp;
- }
+ friend class SBAttachInfo;
+ friend class SBBroadcaster;
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
+ friend class SBLaunchInfo;
+ friend class SBTarget;
-private:
+ SBListener(const lldb::ListenerSP &listener_sp);
- lldb_private::Listener *
- operator->() const;
+ lldb::ListenerSP GetSP() { return m_opaque_sp; }
+
+private:
+ lldb_private::Listener *operator->() const;
- lldb_private::Listener *
- get() const;
+ lldb_private::Listener *get() const;
- void
- reset(lldb::ListenerSP listener_sp);
+ void reset(lldb::ListenerSP listener_sp);
- lldb::ListenerSP m_opaque_sp;
- lldb_private::Listener *m_unused_ptr;
+ lldb::ListenerSP m_opaque_sp;
+ lldb_private::Listener *m_unused_ptr;
};
} // namespace lldb
-#endif // LLDB_SBListener_h_
+#endif // LLDB_SBListener_h_
Modified: lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h (original)
+++ lldb/trunk/include/lldb/API/SBMemoryRegionInfo.h Tue Sep 6 15:57:50 2016
@@ -10,121 +10,103 @@
#ifndef LLDB_SBMemoryRegionInfo_h_
#define LLDB_SBMemoryRegionInfo_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBData.h"
+#include "lldb/API/SBDefines.h"
namespace lldb {
-class LLDB_API SBMemoryRegionInfo
-{
+class LLDB_API SBMemoryRegionInfo {
public:
+ SBMemoryRegionInfo();
- SBMemoryRegionInfo ();
-
- SBMemoryRegionInfo (const lldb::SBMemoryRegionInfo &rhs);
+ SBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &rhs);
- ~SBMemoryRegionInfo ();
+ ~SBMemoryRegionInfo();
- const lldb::SBMemoryRegionInfo &
- operator = (const lldb::SBMemoryRegionInfo &rhs);
+ const lldb::SBMemoryRegionInfo &
+ operator=(const lldb::SBMemoryRegionInfo &rhs);
- void
- Clear();
-
- //------------------------------------------------------------------
- /// Get the base address of this memory range.
- ///
- /// @return
- /// The base address of this memory range.
- //------------------------------------------------------------------
- lldb::addr_t
- GetRegionBase ();
-
- //------------------------------------------------------------------
- /// Get the end address of this memory range.
- ///
- /// @return
- /// The base address of this memory range.
- //------------------------------------------------------------------
- lldb::addr_t
- GetRegionEnd ();
-
- //------------------------------------------------------------------
- /// Check if this memory address is marked readable to the process.
- ///
- /// @return
- /// true if this memory address is marked readable
- //------------------------------------------------------------------
- bool
- IsReadable ();
-
- //------------------------------------------------------------------
- /// Check if this memory address is marked writable to the process.
- ///
- /// @return
- /// true if this memory address is marked writable
- //------------------------------------------------------------------
- bool
- IsWritable ();
-
- //------------------------------------------------------------------
- /// Check if this memory address is marked executable to the process.
- ///
- /// @return
- /// true if this memory address is marked executable
- //------------------------------------------------------------------
- bool
- IsExecutable ();
-
- //------------------------------------------------------------------
- /// Check if this memory address is mapped into the process address
- /// space.
- ///
- /// @return
- /// true if this memory address is in the process address space.
- //------------------------------------------------------------------
- bool
- IsMapped ();
-
-
- //------------------------------------------------------------------
- /// Returns the name of the memory region mapped at the given
- /// address.
- ///
- /// @return
- /// In case of memory mapped files it is the absolute path of
- /// the file otherwise it is a name associated with the memory
- /// region. If no name can be determined the returns nullptr.
- //------------------------------------------------------------------
- const char *
- GetName();
+ void Clear();
+
+ //------------------------------------------------------------------
+ /// Get the base address of this memory range.
+ ///
+ /// @return
+ /// The base address of this memory range.
+ //------------------------------------------------------------------
+ lldb::addr_t GetRegionBase();
+
+ //------------------------------------------------------------------
+ /// Get the end address of this memory range.
+ ///
+ /// @return
+ /// The base address of this memory range.
+ //------------------------------------------------------------------
+ lldb::addr_t GetRegionEnd();
+
+ //------------------------------------------------------------------
+ /// Check if this memory address is marked readable to the process.
+ ///
+ /// @return
+ /// true if this memory address is marked readable
+ //------------------------------------------------------------------
+ bool IsReadable();
+
+ //------------------------------------------------------------------
+ /// Check if this memory address is marked writable to the process.
+ ///
+ /// @return
+ /// true if this memory address is marked writable
+ //------------------------------------------------------------------
+ bool IsWritable();
+
+ //------------------------------------------------------------------
+ /// Check if this memory address is marked executable to the process.
+ ///
+ /// @return
+ /// true if this memory address is marked executable
+ //------------------------------------------------------------------
+ bool IsExecutable();
+
+ //------------------------------------------------------------------
+ /// Check if this memory address is mapped into the process address
+ /// space.
+ ///
+ /// @return
+ /// true if this memory address is in the process address space.
+ //------------------------------------------------------------------
+ bool IsMapped();
+
+ //------------------------------------------------------------------
+ /// Returns the name of the memory region mapped at the given
+ /// address.
+ ///
+ /// @return
+ /// In case of memory mapped files it is the absolute path of
+ /// the file otherwise it is a name associated with the memory
+ /// region. If no name can be determined the returns nullptr.
+ //------------------------------------------------------------------
+ const char *GetName();
- bool
- operator == (const lldb::SBMemoryRegionInfo &rhs) const;
+ bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;
- bool
- operator != (const lldb::SBMemoryRegionInfo &rhs) const;
+ bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
- bool
- GetDescription (lldb::SBStream &description);
+ bool GetDescription(lldb::SBStream &description);
private:
+ friend class SBProcess;
+ friend class SBMemoryRegionInfoList;
- friend class SBProcess;
- friend class SBMemoryRegionInfoList;
+ lldb_private::MemoryRegionInfo &ref();
- lldb_private::MemoryRegionInfo &
- ref();
+ const lldb_private::MemoryRegionInfo &ref() const;
- const lldb_private::MemoryRegionInfo &
- ref() const;
+ SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
- SBMemoryRegionInfo (const lldb_private::MemoryRegionInfo *lldb_object_ptr);
-
- lldb::MemoryRegionInfoUP m_opaque_ap;
+ lldb::MemoryRegionInfoUP m_opaque_ap;
};
-
} // namespace lldb
#endif // LLDB_SBMemoryRegionInfo_h_
Modified: lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h (original)
+++ lldb/trunk/include/lldb/API/SBMemoryRegionInfoList.h Tue Sep 6 15:57:50 2016
@@ -16,46 +16,33 @@ class MemoryRegionInfoListImpl;
namespace lldb {
-class LLDB_API SBMemoryRegionInfoList
-{
+class LLDB_API SBMemoryRegionInfoList {
public:
+ SBMemoryRegionInfoList();
- SBMemoryRegionInfoList ();
+ SBMemoryRegionInfoList(const lldb::SBMemoryRegionInfoList &rhs);
- SBMemoryRegionInfoList (const lldb::SBMemoryRegionInfoList &rhs);
+ const SBMemoryRegionInfoList &operator=(const SBMemoryRegionInfoList &rhs);
- const SBMemoryRegionInfoList &
- operator = (const SBMemoryRegionInfoList &rhs);
+ ~SBMemoryRegionInfoList();
- ~SBMemoryRegionInfoList ();
+ uint32_t GetSize() const;
- uint32_t
- GetSize () const;
+ bool GetMemoryRegionAtIndex(uint32_t idx, SBMemoryRegionInfo ®ion_info);
- bool
- GetMemoryRegionAtIndex (uint32_t idx, SBMemoryRegionInfo ®ion_info);
+ void Append(lldb::SBMemoryRegionInfo ®ion);
- void
- Append (lldb::SBMemoryRegionInfo ®ion);
+ void Append(lldb::SBMemoryRegionInfoList ®ion_list);
- void
- Append (lldb::SBMemoryRegionInfoList ®ion_list);
-
- void
- Clear ();
+ void Clear();
protected:
+ const MemoryRegionInfoListImpl *operator->() const;
- const MemoryRegionInfoListImpl *
- operator->() const;
-
- const MemoryRegionInfoListImpl &
- operator*() const;
+ const MemoryRegionInfoListImpl &operator*() const;
private:
-
- std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_ap;
-
+ std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_ap;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Tue Sep 6 15:57:50 2016
@@ -18,341 +18,298 @@
namespace lldb {
-class LLDB_API SBModule
-{
+class LLDB_API SBModule {
public:
+ SBModule();
- SBModule ();
+ SBModule(const SBModule &rhs);
- SBModule (const SBModule &rhs);
+ SBModule(const SBModuleSpec &module_spec);
- SBModule (const SBModuleSpec &module_spec);
+ const SBModule &operator=(const SBModule &rhs);
- const SBModule &
- operator = (const SBModule &rhs);
+ SBModule(lldb::SBProcess &process, lldb::addr_t header_addr);
+
+ ~SBModule();
+
+ bool IsValid() const;
+
+ void Clear();
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the module file specification.
+ ///
+ /// This function returns the file for the module on the host system
+ /// that is running LLDB. This can differ from the path on the
+ /// platform since we might be doing remote debugging.
+ ///
+ /// @return
+ /// A const reference to the file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec GetFileSpec() const;
+
+ //------------------------------------------------------------------
+ /// Get accessor for the module platform file specification.
+ ///
+ /// Platform file refers to the path of the module as it is known on
+ /// the remote system on which it is being debugged. For local
+ /// debugging this is always the same as Module::GetFileSpec(). But
+ /// remote debugging might mention a file '/usr/lib/liba.dylib'
+ /// which might be locally downloaded and cached. In this case the
+ /// platform file could be something like:
+ /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
+ /// The file could also be cached in a local developer kit directory.
+ ///
+ /// @return
+ /// A const reference to the file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec GetPlatformFileSpec() const;
+
+ bool SetPlatformFileSpec(const lldb::SBFileSpec &platform_file);
+
+ //------------------------------------------------------------------
+ /// Get accessor for the remote install path for a module.
+ ///
+ /// When debugging to a remote platform by connecting to a remote
+ /// platform, the install path of the module can be set. If the
+ /// install path is set, every time the process is about to launch
+ /// the target will install this module on the remote platform prior
+ /// to launching.
+ ///
+ /// @return
+ /// A file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec GetRemoteInstallFileSpec();
+
+ //------------------------------------------------------------------
+ /// Set accessor for the remote install path for a module.
+ ///
+ /// When debugging to a remote platform by connecting to a remote
+ /// platform, the install path of the module can be set. If the
+ /// install path is set, every time the process is about to launch
+ /// the target will install this module on the remote platform prior
+ /// to launching.
+ ///
+ /// If \a file specifies a full path to an install location, the
+ /// module will be installed to this path. If the path is relative
+ /// (no directory specified, or the path is partial like "usr/lib"
+ /// or "./usr/lib", then the install path will be resolved using
+ /// the platform's current working directory as the base path.
+ ///
+ /// @param[in] file
+ /// A file specification object.
+ //------------------------------------------------------------------
+ bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file);
+
+ lldb::ByteOrder GetByteOrder();
+
+ uint32_t GetAddressByteSize();
+
+ const char *GetTriple();
+
+ const uint8_t *GetUUIDBytes() const;
+
+ const char *GetUUIDString() const;
+
+ bool operator==(const lldb::SBModule &rhs) const;
+
+ bool operator!=(const lldb::SBModule &rhs) const;
+
+ lldb::SBSection FindSection(const char *sect_name);
+
+ lldb::SBAddress ResolveFileAddress(lldb::addr_t vm_addr);
+
+ lldb::SBSymbolContext
+ ResolveSymbolContextForAddress(const lldb::SBAddress &addr,
+ uint32_t resolve_scope);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ uint32_t GetNumCompileUnits();
+
+ lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t);
+
+ size_t GetNumSymbols();
+
+ lldb::SBSymbol GetSymbolAtIndex(size_t idx);
+
+ lldb::SBSymbol FindSymbol(const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+ lldb::SBSymbolContextList FindSymbols(const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+ size_t GetNumSections();
+
+ lldb::SBSection GetSectionAtIndex(size_t idx);
+ //------------------------------------------------------------------
+ /// Find functions by name.
+ ///
+ /// @param[in] name
+ /// The name of the function we are looking for.
+ ///
+ /// @param[in] name_type_mask
+ /// A logical OR of one or more FunctionNameType enum bits that
+ /// indicate what kind of names should be used when doing the
+ /// lookup. Bits include fully qualified names, base names,
+ /// C++ methods, or ObjC selectors.
+ /// See FunctionNameType for more details.
+ ///
+ /// @return
+ /// A lldb::SBSymbolContextList that gets filled in with all of
+ /// the symbol contexts for all the matches.
+ //------------------------------------------------------------------
+ lldb::SBSymbolContextList
+ FindFunctions(const char *name,
+ uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
+
+ //------------------------------------------------------------------
+ /// Find global and static variables by name.
+ ///
+ /// @param[in] target
+ /// A valid SBTarget instance representing the debuggee.
+ ///
+ /// @param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// @param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// @return
+ /// A list of matched variables in an SBValueList.
+ //------------------------------------------------------------------
+ lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target,
+ const char *name, uint32_t max_matches);
+
+ //------------------------------------------------------------------
+ /// Find the first global (or static) variable by name.
+ ///
+ /// @param[in] target
+ /// A valid SBTarget instance representing the debuggee.
+ ///
+ /// @param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// @return
+ /// An SBValue that gets filled in with the found variable (if any).
+ //------------------------------------------------------------------
+ lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target,
+ const char *name);
+
+ lldb::SBType FindFirstType(const char *name);
+
+ lldb::SBTypeList FindTypes(const char *type);
+
+ //------------------------------------------------------------------
+ /// Get a type using its type ID.
+ ///
+ /// Each symbol file reader will assign different user IDs to their
+ /// types, but it is sometimes useful when debugging type issues to
+ /// be able to grab a type using its type ID.
+ ///
+ /// For DWARF debug info, the type ID is the DIE offset.
+ ///
+ /// @param[in] uid
+ /// The type user ID.
+ ///
+ /// @return
+ /// An SBType for the given type ID, or an empty SBType if the
+ /// type was not found.
+ //------------------------------------------------------------------
+ lldb::SBType GetTypeByID(lldb::user_id_t uid);
+
+ lldb::SBType GetBasicType(lldb::BasicType type);
+
+ //------------------------------------------------------------------
+ /// Get all types matching \a type_mask from debug info in this
+ /// module.
+ ///
+ /// @param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this module.
+ ///
+ /// @return
+ /// A list of types in this module that match \a type_mask
+ //------------------------------------------------------------------
+ lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
+
+ //------------------------------------------------------------------
+ /// Get the module version numbers.
+ ///
+ /// Many object files have a set of version numbers that describe
+ /// the version of the executable or shared library. Typically there
+ /// are major, minor and build, but there may be more. This function
+ /// will extract the versions from object files if they are available.
+ ///
+ /// If \a versions is NULL, or if \a num_versions is 0, the return
+ /// value will indicate how many version numbers are available in
+ /// this object file. Then a subsequent call can be made to this
+ /// function with a value of \a versions and \a num_versions that
+ /// has enough storage to store some or all version numbers.
+ ///
+ /// @param[out] versions
+ /// A pointer to an array of uint32_t types that is \a num_versions
+ /// long. If this value is NULL, the return value will indicate
+ /// how many version numbers are required for a subsequent call
+ /// to this function so that all versions can be retrieved. If
+ /// the value is non-NULL, then at most \a num_versions of the
+ /// existing versions numbers will be filled into \a versions.
+ /// If there is no version information available, \a versions
+ /// will be filled with \a num_versions UINT32_MAX values
+ /// and zero will be returned.
+ ///
+ /// @param[in] num_versions
+ /// The maximum number of entries to fill into \a versions. If
+ /// this value is zero, then the return value will indicate
+ /// how many version numbers there are in total so another call
+ /// to this function can be make with adequate storage in
+ /// \a versions to get all of the version numbers. If \a
+ /// num_versions is less than the actual number of version
+ /// numbers in this object file, only \a num_versions will be
+ /// filled into \a versions (if \a versions is non-NULL).
+ ///
+ /// @return
+ /// This function always returns the number of version numbers
+ /// that this object file has regardless of the number of
+ /// version numbers that were copied into \a versions.
+ //------------------------------------------------------------------
+ uint32_t GetVersion(uint32_t *versions, uint32_t num_versions);
+
+ //------------------------------------------------------------------
+ /// Get accessor for the symbol file specification.
+ ///
+ /// When debugging an object file an additional debug information can
+ /// be provided in separate file. Therefore if you debugging something
+ /// like '/usr/lib/liba.dylib' then debug information can be located
+ /// in folder like '/usr/lib/liba.dylib.dSYM/'.
+ ///
+ /// @return
+ /// A const reference to the file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec GetSymbolFileSpec() const;
- SBModule (lldb::SBProcess &process,
- lldb::addr_t header_addr);
-
- ~SBModule ();
-
- bool
- IsValid () const;
-
- void
- Clear();
-
- //------------------------------------------------------------------
- /// Get const accessor for the module file specification.
- ///
- /// This function returns the file for the module on the host system
- /// that is running LLDB. This can differ from the path on the
- /// platform since we might be doing remote debugging.
- ///
- /// @return
- /// A const reference to the file specification object.
- //------------------------------------------------------------------
- lldb::SBFileSpec
- GetFileSpec () const;
-
- //------------------------------------------------------------------
- /// Get accessor for the module platform file specification.
- ///
- /// Platform file refers to the path of the module as it is known on
- /// the remote system on which it is being debugged. For local
- /// debugging this is always the same as Module::GetFileSpec(). But
- /// remote debugging might mention a file '/usr/lib/liba.dylib'
- /// which might be locally downloaded and cached. In this case the
- /// platform file could be something like:
- /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
- /// The file could also be cached in a local developer kit directory.
- ///
- /// @return
- /// A const reference to the file specification object.
- //------------------------------------------------------------------
- lldb::SBFileSpec
- GetPlatformFileSpec () const;
-
- bool
- SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
-
- //------------------------------------------------------------------
- /// Get accessor for the remote install path for a module.
- ///
- /// When debugging to a remote platform by connecting to a remote
- /// platform, the install path of the module can be set. If the
- /// install path is set, every time the process is about to launch
- /// the target will install this module on the remote platform prior
- /// to launching.
- ///
- /// @return
- /// A file specification object.
- //------------------------------------------------------------------
- lldb::SBFileSpec
- GetRemoteInstallFileSpec ();
-
- //------------------------------------------------------------------
- /// Set accessor for the remote install path for a module.
- ///
- /// When debugging to a remote platform by connecting to a remote
- /// platform, the install path of the module can be set. If the
- /// install path is set, every time the process is about to launch
- /// the target will install this module on the remote platform prior
- /// to launching.
- ///
- /// If \a file specifies a full path to an install location, the
- /// module will be installed to this path. If the path is relative
- /// (no directory specified, or the path is partial like "usr/lib"
- /// or "./usr/lib", then the install path will be resolved using
- /// the platform's current working directory as the base path.
- ///
- /// @param[in] file
- /// A file specification object.
- //------------------------------------------------------------------
- bool
- SetRemoteInstallFileSpec (lldb::SBFileSpec &file);
-
- lldb::ByteOrder
- GetByteOrder ();
-
- uint32_t
- GetAddressByteSize();
-
- const char *
- GetTriple ();
-
- const uint8_t *
- GetUUIDBytes () const;
-
- const char *
- GetUUIDString () const;
-
- bool
- operator == (const lldb::SBModule &rhs) const;
-
- bool
- operator != (const lldb::SBModule &rhs) const;
-
- lldb::SBSection
- FindSection (const char *sect_name);
-
- lldb::SBAddress
- ResolveFileAddress (lldb::addr_t vm_addr);
-
- lldb::SBSymbolContext
- ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
- uint32_t resolve_scope);
-
- bool
- GetDescription (lldb::SBStream &description);
-
- uint32_t
- GetNumCompileUnits();
-
- lldb::SBCompileUnit
- GetCompileUnitAtIndex (uint32_t);
-
- size_t
- GetNumSymbols ();
-
- lldb::SBSymbol
- GetSymbolAtIndex (size_t idx);
-
- lldb::SBSymbol
- FindSymbol (const char *name,
- lldb::SymbolType type = eSymbolTypeAny);
-
- lldb::SBSymbolContextList
- FindSymbols (const char *name,
- lldb::SymbolType type = eSymbolTypeAny);
-
- size_t
- GetNumSections ();
-
- lldb::SBSection
- GetSectionAtIndex (size_t idx);
- //------------------------------------------------------------------
- /// Find functions by name.
- ///
- /// @param[in] name
- /// The name of the function we are looking for.
- ///
- /// @param[in] name_type_mask
- /// A logical OR of one or more FunctionNameType enum bits that
- /// indicate what kind of names should be used when doing the
- /// lookup. Bits include fully qualified names, base names,
- /// C++ methods, or ObjC selectors.
- /// See FunctionNameType for more details.
- ///
- /// @return
- /// A lldb::SBSymbolContextList that gets filled in with all of
- /// the symbol contexts for all the matches.
- //------------------------------------------------------------------
- lldb::SBSymbolContextList
- FindFunctions (const char *name,
- uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
-
- //------------------------------------------------------------------
- /// Find global and static variables by name.
- ///
- /// @param[in] target
- /// A valid SBTarget instance representing the debuggee.
- ///
- /// @param[in] name
- /// The name of the global or static variable we are looking
- /// for.
- ///
- /// @param[in] max_matches
- /// Allow the number of matches to be limited to \a max_matches.
- ///
- /// @return
- /// A list of matched variables in an SBValueList.
- //------------------------------------------------------------------
- lldb::SBValueList
- FindGlobalVariables (lldb::SBTarget &target,
- const char *name,
- uint32_t max_matches);
-
- //------------------------------------------------------------------
- /// Find the first global (or static) variable by name.
- ///
- /// @param[in] target
- /// A valid SBTarget instance representing the debuggee.
- ///
- /// @param[in] name
- /// The name of the global or static variable we are looking
- /// for.
- ///
- /// @return
- /// An SBValue that gets filled in with the found variable (if any).
- //------------------------------------------------------------------
- lldb::SBValue
- FindFirstGlobalVariable (lldb::SBTarget &target, const char *name);
-
- lldb::SBType
- FindFirstType (const char* name);
-
- lldb::SBTypeList
- FindTypes (const char* type);
-
- //------------------------------------------------------------------
- /// Get a type using its type ID.
- ///
- /// Each symbol file reader will assign different user IDs to their
- /// types, but it is sometimes useful when debugging type issues to
- /// be able to grab a type using its type ID.
- ///
- /// For DWARF debug info, the type ID is the DIE offset.
- ///
- /// @param[in] uid
- /// The type user ID.
- ///
- /// @return
- /// An SBType for the given type ID, or an empty SBType if the
- /// type was not found.
- //------------------------------------------------------------------
- lldb::SBType
- GetTypeByID (lldb::user_id_t uid);
-
- lldb::SBType
- GetBasicType(lldb::BasicType type);
-
- //------------------------------------------------------------------
- /// Get all types matching \a type_mask from debug info in this
- /// module.
- ///
- /// @param[in] type_mask
- /// A bitfield that consists of one or more bits logically OR'ed
- /// together from the lldb::TypeClass enumeration. This allows
- /// you to request only structure types, or only class, struct
- /// and union types. Passing in lldb::eTypeClassAny will return
- /// all types found in the debug information for this module.
- ///
- /// @return
- /// A list of types in this module that match \a type_mask
- //------------------------------------------------------------------
- lldb::SBTypeList
- GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
-
- //------------------------------------------------------------------
- /// Get the module version numbers.
- ///
- /// Many object files have a set of version numbers that describe
- /// the version of the executable or shared library. Typically there
- /// are major, minor and build, but there may be more. This function
- /// will extract the versions from object files if they are available.
- ///
- /// If \a versions is NULL, or if \a num_versions is 0, the return
- /// value will indicate how many version numbers are available in
- /// this object file. Then a subsequent call can be made to this
- /// function with a value of \a versions and \a num_versions that
- /// has enough storage to store some or all version numbers.
- ///
- /// @param[out] versions
- /// A pointer to an array of uint32_t types that is \a num_versions
- /// long. If this value is NULL, the return value will indicate
- /// how many version numbers are required for a subsequent call
- /// to this function so that all versions can be retrieved. If
- /// the value is non-NULL, then at most \a num_versions of the
- /// existing versions numbers will be filled into \a versions.
- /// If there is no version information available, \a versions
- /// will be filled with \a num_versions UINT32_MAX values
- /// and zero will be returned.
- ///
- /// @param[in] num_versions
- /// The maximum number of entries to fill into \a versions. If
- /// this value is zero, then the return value will indicate
- /// how many version numbers there are in total so another call
- /// to this function can be make with adequate storage in
- /// \a versions to get all of the version numbers. If \a
- /// num_versions is less than the actual number of version
- /// numbers in this object file, only \a num_versions will be
- /// filled into \a versions (if \a versions is non-NULL).
- ///
- /// @return
- /// This function always returns the number of version numbers
- /// that this object file has regardless of the number of
- /// version numbers that were copied into \a versions.
- //------------------------------------------------------------------
- uint32_t
- GetVersion (uint32_t *versions,
- uint32_t num_versions);
-
- //------------------------------------------------------------------
- /// Get accessor for the symbol file specification.
- ///
- /// When debugging an object file an additional debug information can
- /// be provided in separate file. Therefore if you debugging something
- /// like '/usr/lib/liba.dylib' then debug information can be located
- /// in folder like '/usr/lib/liba.dylib.dSYM/'.
- ///
- /// @return
- /// A const reference to the file specification object.
- //------------------------------------------------------------------
- lldb::SBFileSpec
- GetSymbolFileSpec() const;
-
- lldb::SBAddress
- GetObjectFileHeaderAddress() const;
+ lldb::SBAddress GetObjectFileHeaderAddress() const;
private:
- friend class SBAddress;
- friend class SBFrame;
- friend class SBSection;
- friend class SBSymbolContext;
- friend class SBTarget;
-
- explicit SBModule (const lldb::ModuleSP& module_sp);
-
- ModuleSP
- GetSP () const;
-
- void
- SetSP (const ModuleSP &module_sp);
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBSection;
+ friend class SBSymbolContext;
+ friend class SBTarget;
- lldb::ModuleSP m_opaque_sp;
-};
+ explicit SBModule(const lldb::ModuleSP &module_sp);
+
+ ModuleSP GetSP() const;
+ void SetSP(const ModuleSP &module_sp);
+
+ lldb::ModuleSP m_opaque_sp;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBModuleSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModuleSpec.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModuleSpec.h (original)
+++ lldb/trunk/include/lldb/API/SBModuleSpec.h Tue Sep 6 15:57:50 2016
@@ -15,138 +15,109 @@
namespace lldb {
-class LLDB_API SBModuleSpec
-{
+class LLDB_API SBModuleSpec {
public:
+ SBModuleSpec();
- SBModuleSpec ();
+ SBModuleSpec(const SBModuleSpec &rhs);
- SBModuleSpec (const SBModuleSpec &rhs);
+ ~SBModuleSpec();
- ~SBModuleSpec ();
+ const SBModuleSpec &operator=(const SBModuleSpec &rhs);
- const SBModuleSpec &
- operator = (const SBModuleSpec &rhs);
+ bool IsValid() const;
+
+ void Clear();
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the module file.
+ ///
+ /// This function returns the file for the module on the host system
+ /// that is running LLDB. This can differ from the path on the
+ /// platform since we might be doing remote debugging.
+ ///
+ /// @return
+ /// A const reference to the file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec GetFileSpec();
+
+ void SetFileSpec(const lldb::SBFileSpec &fspec);
+
+ //------------------------------------------------------------------
+ /// Get accessor for the module platform file.
+ ///
+ /// Platform file refers to the path of the module as it is known on
+ /// the remote system on which it is being debugged. For local
+ /// debugging this is always the same as Module::GetFileSpec(). But
+ /// remote debugging might mention a file '/usr/lib/liba.dylib'
+ /// which might be locally downloaded and cached. In this case the
+ /// platform file could be something like:
+ /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
+ /// The file could also be cached in a local developer kit directory.
+ ///
+ /// @return
+ /// A const reference to the file specification object.
+ //------------------------------------------------------------------
+ lldb::SBFileSpec GetPlatformFileSpec();
+
+ void SetPlatformFileSpec(const lldb::SBFileSpec &fspec);
+
+ lldb::SBFileSpec GetSymbolFileSpec();
+
+ void SetSymbolFileSpec(const lldb::SBFileSpec &fspec);
+
+ const char *GetObjectName();
+
+ void SetObjectName(const char *name);
+
+ const char *GetTriple();
+
+ void SetTriple(const char *triple);
+
+ const uint8_t *GetUUIDBytes();
+
+ size_t GetUUIDLength();
+
+ bool SetUUIDBytes(const uint8_t *uuid, size_t uuid_len);
+
+ bool GetDescription(lldb::SBStream &description);
- bool
- IsValid () const;
-
- void
- Clear();
-
- //------------------------------------------------------------------
- /// Get const accessor for the module file.
- ///
- /// This function returns the file for the module on the host system
- /// that is running LLDB. This can differ from the path on the
- /// platform since we might be doing remote debugging.
- ///
- /// @return
- /// A const reference to the file specification object.
- //------------------------------------------------------------------
- lldb::SBFileSpec
- GetFileSpec ();
-
- void
- SetFileSpec (const lldb::SBFileSpec &fspec);
-
- //------------------------------------------------------------------
- /// Get accessor for the module platform file.
- ///
- /// Platform file refers to the path of the module as it is known on
- /// the remote system on which it is being debugged. For local
- /// debugging this is always the same as Module::GetFileSpec(). But
- /// remote debugging might mention a file '/usr/lib/liba.dylib'
- /// which might be locally downloaded and cached. In this case the
- /// platform file could be something like:
- /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
- /// The file could also be cached in a local developer kit directory.
- ///
- /// @return
- /// A const reference to the file specification object.
- //------------------------------------------------------------------
- lldb::SBFileSpec
- GetPlatformFileSpec ();
-
- void
- SetPlatformFileSpec (const lldb::SBFileSpec &fspec);
-
- lldb::SBFileSpec
- GetSymbolFileSpec ();
-
- void
- SetSymbolFileSpec (const lldb::SBFileSpec &fspec);
-
- const char *
- GetObjectName ();
-
- void
- SetObjectName (const char *name);
-
- const char *
- GetTriple ();
-
- void
- SetTriple (const char *triple);
-
- const uint8_t *
- GetUUIDBytes ();
-
- size_t
- GetUUIDLength ();
-
- bool
- SetUUIDBytes (const uint8_t *uuid, size_t uuid_len);
-
- bool
- GetDescription (lldb::SBStream &description);
-
private:
- friend class SBModuleSpecList;
- friend class SBModule;
- friend class SBTarget;
+ friend class SBModuleSpecList;
+ friend class SBModule;
+ friend class SBTarget;
- std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap;
+ std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap;
};
-class SBModuleSpecList
-{
+class SBModuleSpecList {
public:
- SBModuleSpecList();
+ SBModuleSpecList();
+
+ SBModuleSpecList(const SBModuleSpecList &rhs);
+
+ ~SBModuleSpecList();
+
+ SBModuleSpecList &operator=(const SBModuleSpecList &rhs);
+
+ static SBModuleSpecList GetModuleSpecifications(const char *path);
+
+ void Append(const SBModuleSpec &spec);
+
+ void Append(const SBModuleSpecList &spec_list);
+
+ SBModuleSpec FindFirstMatchingSpec(const SBModuleSpec &match_spec);
+
+ SBModuleSpecList FindMatchingSpecs(const SBModuleSpec &match_spec);
+
+ size_t GetSize();
- SBModuleSpecList (const SBModuleSpecList &rhs);
+ SBModuleSpec GetSpecAtIndex(size_t i);
- ~SBModuleSpecList();
+ bool GetDescription(lldb::SBStream &description);
- SBModuleSpecList &
- operator = (const SBModuleSpecList &rhs);
-
- static SBModuleSpecList
- GetModuleSpecifications (const char *path);
-
- void
- Append (const SBModuleSpec &spec);
-
- void
- Append (const SBModuleSpecList &spec_list);
-
- SBModuleSpec
- FindFirstMatchingSpec (const SBModuleSpec &match_spec);
-
- SBModuleSpecList
- FindMatchingSpecs (const SBModuleSpec &match_spec);
-
- size_t
- GetSize();
-
- SBModuleSpec
- GetSpecAtIndex (size_t i);
-
- bool
- GetDescription (lldb::SBStream &description);
-
private:
- std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap;
+ std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBPlatform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBPlatform.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBPlatform.h (original)
+++ lldb/trunk/include/lldb/API/SBPlatform.h Tue Sep 6 15:57:50 2016
@@ -19,195 +19,147 @@ struct PlatformShellCommand;
namespace lldb {
- class SBLaunchInfo;
+class SBLaunchInfo;
- class LLDB_API SBPlatformConnectOptions
- {
- public:
- SBPlatformConnectOptions (const char *url);
-
- SBPlatformConnectOptions (const SBPlatformConnectOptions &rhs);
-
- ~SBPlatformConnectOptions ();
-
- void
- operator=(const SBPlatformConnectOptions &rhs);
-
- const char *
- GetURL();
-
- void
- SetURL(const char *url);
-
- bool
- GetRsyncEnabled();
-
- void
- EnableRsync (const char *options,
- const char *remote_path_prefix,
- bool omit_remote_hostname);
-
- void
- DisableRsync ();
-
- const char *
- GetLocalCacheDirectory();
-
- void
- SetLocalCacheDirectory(const char *path);
- protected:
- PlatformConnectOptions *m_opaque_ptr;
- };
-
- class LLDB_API SBPlatformShellCommand
- {
- public:
- SBPlatformShellCommand (const char *shell_command);
-
- SBPlatformShellCommand (const SBPlatformShellCommand &rhs);
-
- ~SBPlatformShellCommand();
-
- void
- Clear();
-
- const char *
- GetCommand();
-
- void
- SetCommand(const char *shell_command);
-
- const char *
- GetWorkingDirectory ();
-
- void
- SetWorkingDirectory (const char *path);
-
- uint32_t
- GetTimeoutSeconds ();
-
- void
- SetTimeoutSeconds (uint32_t sec);
-
- int
- GetSignal ();
-
- int
- GetStatus ();
-
- const char *
- GetOutput ();
-
- protected:
- friend class SBPlatform;
-
- PlatformShellCommand *m_opaque_ptr;
- };
-
- class LLDB_API SBPlatform
- {
- public:
-
- SBPlatform ();
-
- SBPlatform (const char *platform_name);
-
- ~SBPlatform();
-
- bool
- IsValid () const;
-
- void
- Clear ();
-
- const char *
- GetWorkingDirectory();
-
- bool
- SetWorkingDirectory(const char *path);
-
- const char *
- GetName ();
-
- SBError
- ConnectRemote (SBPlatformConnectOptions &connect_options);
-
- void
- DisconnectRemote ();
-
- bool
- IsConnected();
-
- //----------------------------------------------------------------------
- // The following functions will work if the platform is connected
- //----------------------------------------------------------------------
- const char *
- GetTriple();
-
- const char *
- GetHostname ();
-
- const char *
- GetOSBuild ();
-
- const char *
- GetOSDescription ();
-
- uint32_t
- GetOSMajorVersion ();
-
- uint32_t
- GetOSMinorVersion ();
-
- uint32_t
- GetOSUpdateVersion ();
-
- SBError
- Put (SBFileSpec &src, SBFileSpec &dst);
-
- SBError
- Get (SBFileSpec &src, SBFileSpec &dst);
-
- SBError
- Install (SBFileSpec& src, SBFileSpec& dst);
-
- SBError
- Run (SBPlatformShellCommand &shell_command);
-
- SBError
- Launch (SBLaunchInfo &launch_info);
-
- SBError
- Kill (const lldb::pid_t pid);
-
- SBError
- MakeDirectory (const char *path, uint32_t file_permissions = eFilePermissionsDirectoryDefault);
-
- uint32_t
- GetFilePermissions (const char *path);
-
- SBError
- SetFilePermissions (const char *path, uint32_t file_permissions);
-
- SBUnixSignals
- GetUnixSignals() const;
-
- protected:
-
- friend class SBDebugger;
- friend class SBTarget;
-
- lldb::PlatformSP
- GetSP () const;
-
- void
- SetSP (const lldb::PlatformSP& platform_sp);
+class LLDB_API SBPlatformConnectOptions {
+public:
+ SBPlatformConnectOptions(const char *url);
- SBError
- ExecuteConnected (const std::function<lldb_private::Error(const lldb::PlatformSP&)>& func);
+ SBPlatformConnectOptions(const SBPlatformConnectOptions &rhs);
- lldb::PlatformSP m_opaque_sp;
- };
+ ~SBPlatformConnectOptions();
+
+ void operator=(const SBPlatformConnectOptions &rhs);
+
+ const char *GetURL();
+
+ void SetURL(const char *url);
+
+ bool GetRsyncEnabled();
+
+ void EnableRsync(const char *options, const char *remote_path_prefix,
+ bool omit_remote_hostname);
+
+ void DisableRsync();
+
+ const char *GetLocalCacheDirectory();
+
+ void SetLocalCacheDirectory(const char *path);
+
+protected:
+ PlatformConnectOptions *m_opaque_ptr;
+};
+
+class LLDB_API SBPlatformShellCommand {
+public:
+ SBPlatformShellCommand(const char *shell_command);
+
+ SBPlatformShellCommand(const SBPlatformShellCommand &rhs);
+
+ ~SBPlatformShellCommand();
+
+ void Clear();
+
+ const char *GetCommand();
+
+ void SetCommand(const char *shell_command);
+
+ const char *GetWorkingDirectory();
+
+ void SetWorkingDirectory(const char *path);
+
+ uint32_t GetTimeoutSeconds();
+
+ void SetTimeoutSeconds(uint32_t sec);
+
+ int GetSignal();
+
+ int GetStatus();
+
+ const char *GetOutput();
+
+protected:
+ friend class SBPlatform;
+
+ PlatformShellCommand *m_opaque_ptr;
+};
+
+class LLDB_API SBPlatform {
+public:
+ SBPlatform();
+
+ SBPlatform(const char *platform_name);
+
+ ~SBPlatform();
+
+ bool IsValid() const;
+
+ void Clear();
+
+ const char *GetWorkingDirectory();
+
+ bool SetWorkingDirectory(const char *path);
+
+ const char *GetName();
+
+ SBError ConnectRemote(SBPlatformConnectOptions &connect_options);
+
+ void DisconnectRemote();
+
+ bool IsConnected();
+
+ //----------------------------------------------------------------------
+ // The following functions will work if the platform is connected
+ //----------------------------------------------------------------------
+ const char *GetTriple();
+
+ const char *GetHostname();
+
+ const char *GetOSBuild();
+
+ const char *GetOSDescription();
+
+ uint32_t GetOSMajorVersion();
+
+ uint32_t GetOSMinorVersion();
+
+ uint32_t GetOSUpdateVersion();
+
+ SBError Put(SBFileSpec &src, SBFileSpec &dst);
+
+ SBError Get(SBFileSpec &src, SBFileSpec &dst);
+
+ SBError Install(SBFileSpec &src, SBFileSpec &dst);
+
+ SBError Run(SBPlatformShellCommand &shell_command);
+
+ SBError Launch(SBLaunchInfo &launch_info);
+
+ SBError Kill(const lldb::pid_t pid);
+
+ SBError
+ MakeDirectory(const char *path,
+ uint32_t file_permissions = eFilePermissionsDirectoryDefault);
+
+ uint32_t GetFilePermissions(const char *path);
+
+ SBError SetFilePermissions(const char *path, uint32_t file_permissions);
+
+ SBUnixSignals GetUnixSignals() const;
+
+protected:
+ friend class SBDebugger;
+ friend class SBTarget;
+
+ lldb::PlatformSP GetSP() const;
+
+ void SetSP(const lldb::PlatformSP &platform_sp);
+
+ SBError ExecuteConnected(
+ const std::function<lldb_private::Error(const lldb::PlatformSP &)> &func);
+
+ lldb::PlatformSP m_opaque_sp;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Tue Sep 6 15:57:50 2016
@@ -12,445 +12,368 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
-#include "lldb/API/SBTarget.h"
#include "lldb/API/SBQueue.h"
+#include "lldb/API/SBTarget.h"
#include <stdio.h>
namespace lldb {
class SBEvent;
-class LLDB_API SBProcess
-{
+class LLDB_API SBProcess {
public:
- //------------------------------------------------------------------
- /// Broadcaster event bits definitions.
- //------------------------------------------------------------------
- FLAGS_ANONYMOUS_ENUM()
- {
- eBroadcastBitStateChanged = (1 << 0),
- eBroadcastBitInterrupt = (1 << 1),
- eBroadcastBitSTDOUT = (1 << 2),
- eBroadcastBitSTDERR = (1 << 3),
- eBroadcastBitProfileData = (1 << 4),
- eBroadcastBitStructuredData = (1 << 5)
- };
-
- SBProcess ();
-
- SBProcess (const lldb::SBProcess& rhs);
-
- const lldb::SBProcess&
- operator = (const lldb::SBProcess& rhs);
-
- SBProcess (const lldb::ProcessSP &process_sp);
-
- ~SBProcess();
-
- static const char *
- GetBroadcasterClassName ();
-
- const char *
- GetPluginName ();
-
- // DEPRECATED: use GetPluginName()
- const char *
- GetShortPluginName ();
-
- void
- Clear ();
-
- bool
- IsValid() const;
-
- lldb::SBTarget
- GetTarget() const;
-
- lldb::ByteOrder
- GetByteOrder() const;
-
- size_t
- PutSTDIN (const char *src, size_t src_len);
-
- size_t
- GetSTDOUT (char *dst, size_t dst_len) const;
-
- size_t
- GetSTDERR (char *dst, size_t dst_len) const;
-
- size_t
- GetAsyncProfileData(char *dst, size_t dst_len) const;
-
- void
- ReportEventState (const lldb::SBEvent &event, FILE *out) const;
-
- void
- AppendEventStateReport (const lldb::SBEvent &event, lldb::SBCommandReturnObject &result);
-
- //------------------------------------------------------------------
- /// Remote connection related functions. These will fail if the
- /// process is not in eStateConnected. They are intended for use
- /// when connecting to an externally managed debugserver instance.
- //------------------------------------------------------------------
- bool
- RemoteAttachToProcessWithID (lldb::pid_t pid,
- lldb::SBError& error);
-
- bool
- RemoteLaunch (char const **argv,
- char const **envp,
- const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
- const char *working_directory,
- uint32_t launch_flags,
- bool stop_at_entry,
- lldb::SBError& error);
-
- //------------------------------------------------------------------
- // Thread related functions
- //------------------------------------------------------------------
- uint32_t
- GetNumThreads ();
-
- lldb::SBThread
- GetThreadAtIndex (size_t index);
-
- lldb::SBThread
- GetThreadByID (lldb::tid_t sb_thread_id);
-
- lldb::SBThread
- GetThreadByIndexID (uint32_t index_id);
-
- lldb::SBThread
- GetSelectedThread () const;
-
- //------------------------------------------------------------------
- // Function for lazily creating a thread using the current OS
- // plug-in. This function will be removed in the future when there
- // are APIs to create SBThread objects through the interface and add
- // them to the process through the SBProcess API.
- //------------------------------------------------------------------
- lldb::SBThread
- CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context);
-
- bool
- SetSelectedThread (const lldb::SBThread &thread);
-
- bool
- SetSelectedThreadByID (lldb::tid_t tid);
-
- bool
- SetSelectedThreadByIndexID (uint32_t index_id);
-
- //------------------------------------------------------------------
- // Queue related functions
- //------------------------------------------------------------------
- uint32_t
- GetNumQueues ();
-
- lldb::SBQueue
- GetQueueAtIndex (size_t index);
-
- //------------------------------------------------------------------
- // Stepping related functions
- //------------------------------------------------------------------
-
- lldb::StateType
- GetState ();
-
- int
- GetExitStatus ();
-
- const char *
- GetExitDescription ();
-
- //------------------------------------------------------------------
- /// Gets the process ID
- ///
- /// Returns the process identifier for the process as it is known
- /// on the system on which the process is running. For unix systems
- /// this is typically the same as if you called "getpid()" in the
- /// process.
- ///
- /// @return
- /// Returns LLDB_INVALID_PROCESS_ID if this object does not
- /// contain a valid process object, or if the process has not
- /// been launched. Returns a valid process ID if the process is
- /// valid.
- //------------------------------------------------------------------
- lldb::pid_t
- GetProcessID ();
-
- //------------------------------------------------------------------
- /// Gets the unique ID associated with this process object
- ///
- /// Unique IDs start at 1 and increment up with each new process
- /// instance. Since starting a process on a system might always
- /// create a process with the same process ID, there needs to be a
- /// way to tell two process instances apart.
- ///
- /// @return
- /// Returns a non-zero integer ID if this object contains a
- /// valid process object, zero if this object does not contain
- /// a valid process object.
- //------------------------------------------------------------------
- uint32_t
- GetUniqueID();
-
- uint32_t
- GetAddressByteSize() const;
-
- lldb::SBError
- Destroy ();
-
- lldb::SBError
- Continue ();
-
- lldb::SBError
- Stop ();
-
- lldb::SBError
- Kill ();
-
- lldb::SBError
- Detach ();
-
- lldb::SBError
- Detach (bool keep_stopped);
-
- lldb::SBError
- Signal (int signal);
-
- lldb::SBUnixSignals
- GetUnixSignals();
-
- void
- SendAsyncInterrupt();
-
- uint32_t
- GetStopID(bool include_expression_stops = false);
-
- //------------------------------------------------------------------
- /// Gets the stop event corresponding to stop ID.
- //
- /// Note that it wasn't fully implemented and tracks only the stop
- /// event for the last natural stop ID.
- ///
- /// @param [in] stop_id
- /// The ID of the stop event to return.
- ///
- /// @return
- /// The stop event corresponding to stop ID.
- //------------------------------------------------------------------
- lldb::SBEvent
- GetStopEventForStopID(uint32_t stop_id);
-
- size_t
- ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
-
- size_t
- WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
-
- size_t
- ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
-
- uint64_t
- ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
-
- lldb::addr_t
- ReadPointerFromMemory (addr_t addr, lldb::SBError &error);
-
- // Events
- static lldb::StateType
- GetStateFromEvent (const lldb::SBEvent &event);
-
- static bool
- GetRestartedFromEvent (const lldb::SBEvent &event);
-
- static size_t
- GetNumRestartedReasonsFromEvent (const lldb::SBEvent &event);
-
- static const char *
- GetRestartedReasonAtIndexFromEvent (const lldb::SBEvent &event, size_t idx);
-
- static lldb::SBProcess
- GetProcessFromEvent (const lldb::SBEvent &event);
-
- static bool
- GetInterruptedFromEvent (const lldb::SBEvent &event);
-
- static lldb::SBStructuredData
- GetStructuredDataFromEvent (const lldb::SBEvent &event);
-
- static bool
- EventIsProcessEvent (const lldb::SBEvent &event);
-
- static bool
- EventIsStructuredDataEvent (const lldb::SBEvent &event);
-
- lldb::SBBroadcaster
- GetBroadcaster () const;
-
- static const char *
- GetBroadcasterClass ();
-
- bool
- GetDescription (lldb::SBStream &description);
-
- uint32_t
- GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
-
- //------------------------------------------------------------------
- /// Load a shared library into this process.
- ///
- /// @param[in] remote_image_spec
- /// The path for the shared library on the target what you want
- /// to load.
- ///
- /// @param[out] error
- /// An error object that gets filled in with any errors that
- /// might occur when trying to load the shared library.
- ///
- /// @return
- /// A token that represents the shared library that can be
- /// later used to unload the shared library. A value of
- /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
- /// library can't be opened.
- //------------------------------------------------------------------
- uint32_t
- LoadImage (lldb::SBFileSpec &remote_image_spec, lldb::SBError &error);
-
- //------------------------------------------------------------------
- /// Load a shared library into this process.
- ///
- /// @param[in] local_image_spec
- /// The file spec that points to the shared library that you
- /// want to load if the library is located on the host. The
- /// library will be copied over to the location specified by
- /// remote_image_spec or into the current working directory with
- /// the same filename if the remote_image_spec isn't specified.
- ///
- /// @param[in] remote_image_spec
- /// If local_image_spec is specified then the location where the
- /// library should be copied over from the host. If
- /// local_image_spec isn't specified, then the path for the
- /// shared library on the target what you want to load.
- ///
- /// @param[out] error
- /// An error object that gets filled in with any errors that
- /// might occur when trying to load the shared library.
- ///
- /// @return
- /// A token that represents the shared library that can be
- /// later used to unload the shared library. A value of
- /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
- /// library can't be opened.
- //------------------------------------------------------------------
- uint32_t
- LoadImage (const lldb::SBFileSpec &local_image_spec,
- const lldb::SBFileSpec &remote_image_spec,
- lldb::SBError &error);
-
- lldb::SBError
- UnloadImage (uint32_t image_token);
-
- lldb::SBError
- SendEventData (const char *data);
-
- //------------------------------------------------------------------
- /// Return the number of different thread-origin extended backtraces
- /// this process can support.
- ///
- /// When the process is stopped and you have an SBThread, lldb may be
- /// able to show a backtrace of when that thread was originally created,
- /// or the work item was enqueued to it (in the case of a libdispatch
- /// queue).
- ///
- /// @return
- /// The number of thread-origin extended backtrace types that may be
- /// available.
- //------------------------------------------------------------------
- uint32_t
- GetNumExtendedBacktraceTypes ();
-
- //------------------------------------------------------------------
- /// Return the name of one of the thread-origin extended backtrace
- /// methods.
- ///
- /// @param [in] idx
- /// The index of the name to return. They will be returned in
- /// the order that the user will most likely want to see them.
- /// e.g. if the type at index 0 is not available for a thread,
- /// see if the type at index 1 provides an extended backtrace.
- ///
- /// @return
- /// The name at that index.
- //------------------------------------------------------------------
- const char *
- GetExtendedBacktraceTypeAtIndex (uint32_t idx);
-
- lldb::SBThreadCollection
- GetHistoryThreads (addr_t addr);
-
- bool
- IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
-
- // Save the state of the process in a core file (or mini dump on Windows).
- lldb::SBError
- SaveCore(const char *file_name);
-
- //------------------------------------------------------------------
- /// Query the address load_addr and store the details of the memory
- /// region that contains it in the supplied SBMemoryRegionInfo object.
- /// To iterate over all memory regions use GetMemoryRegionList.
- ///
- /// @param[in] load_addr
- /// The address to be queried.
- ///
- /// @param[out] region_info
- /// A reference to an SBMemoryRegionInfo object that will contain
- /// the details of the memory region containing load_addr.
- ///
- /// @return
- /// An error object describes any errors that occurred while
- /// querying load_addr.
- //------------------------------------------------------------------
- lldb::SBError
- GetMemoryRegionInfo (lldb::addr_t load_addr, lldb::SBMemoryRegionInfo ®ion_info);
-
- //------------------------------------------------------------------
- /// Return the list of memory regions within the process.
- ///
- /// @return
- /// A list of all witin the process memory regions.
- //------------------------------------------------------------------
- lldb::SBMemoryRegionInfoList
- GetMemoryRegions();
+ //------------------------------------------------------------------
+ /// Broadcaster event bits definitions.
+ //------------------------------------------------------------------
+ FLAGS_ANONYMOUS_ENUM(){eBroadcastBitStateChanged = (1 << 0),
+ eBroadcastBitInterrupt = (1 << 1),
+ eBroadcastBitSTDOUT = (1 << 2),
+ eBroadcastBitSTDERR = (1 << 3),
+ eBroadcastBitProfileData = (1 << 4),
+ eBroadcastBitStructuredData = (1 << 5)};
+
+ SBProcess();
+
+ SBProcess(const lldb::SBProcess &rhs);
+
+ const lldb::SBProcess &operator=(const lldb::SBProcess &rhs);
+
+ SBProcess(const lldb::ProcessSP &process_sp);
+
+ ~SBProcess();
+
+ static const char *GetBroadcasterClassName();
+
+ const char *GetPluginName();
+
+ // DEPRECATED: use GetPluginName()
+ const char *GetShortPluginName();
+
+ void Clear();
+
+ bool IsValid() const;
+
+ lldb::SBTarget GetTarget() const;
+
+ lldb::ByteOrder GetByteOrder() const;
+
+ size_t PutSTDIN(const char *src, size_t src_len);
+
+ size_t GetSTDOUT(char *dst, size_t dst_len) const;
+
+ size_t GetSTDERR(char *dst, size_t dst_len) const;
+
+ size_t GetAsyncProfileData(char *dst, size_t dst_len) const;
+
+ void ReportEventState(const lldb::SBEvent &event, FILE *out) const;
+
+ void AppendEventStateReport(const lldb::SBEvent &event,
+ lldb::SBCommandReturnObject &result);
+
+ //------------------------------------------------------------------
+ /// Remote connection related functions. These will fail if the
+ /// process is not in eStateConnected. They are intended for use
+ /// when connecting to an externally managed debugserver instance.
+ //------------------------------------------------------------------
+ bool RemoteAttachToProcessWithID(lldb::pid_t pid, lldb::SBError &error);
+
+ bool RemoteLaunch(char const **argv, char const **envp,
+ const char *stdin_path, const char *stdout_path,
+ const char *stderr_path, const char *working_directory,
+ uint32_t launch_flags, bool stop_at_entry,
+ lldb::SBError &error);
+
+ //------------------------------------------------------------------
+ // Thread related functions
+ //------------------------------------------------------------------
+ uint32_t GetNumThreads();
+
+ lldb::SBThread GetThreadAtIndex(size_t index);
+
+ lldb::SBThread GetThreadByID(lldb::tid_t sb_thread_id);
+
+ lldb::SBThread GetThreadByIndexID(uint32_t index_id);
+
+ lldb::SBThread GetSelectedThread() const;
+
+ //------------------------------------------------------------------
+ // Function for lazily creating a thread using the current OS
+ // plug-in. This function will be removed in the future when there
+ // are APIs to create SBThread objects through the interface and add
+ // them to the process through the SBProcess API.
+ //------------------------------------------------------------------
+ lldb::SBThread CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context);
+
+ bool SetSelectedThread(const lldb::SBThread &thread);
+
+ bool SetSelectedThreadByID(lldb::tid_t tid);
+
+ bool SetSelectedThreadByIndexID(uint32_t index_id);
+
+ //------------------------------------------------------------------
+ // Queue related functions
+ //------------------------------------------------------------------
+ uint32_t GetNumQueues();
+
+ lldb::SBQueue GetQueueAtIndex(size_t index);
+
+ //------------------------------------------------------------------
+ // Stepping related functions
+ //------------------------------------------------------------------
+
+ lldb::StateType GetState();
+
+ int GetExitStatus();
+
+ const char *GetExitDescription();
+
+ //------------------------------------------------------------------
+ /// Gets the process ID
+ ///
+ /// Returns the process identifier for the process as it is known
+ /// on the system on which the process is running. For unix systems
+ /// this is typically the same as if you called "getpid()" in the
+ /// process.
+ ///
+ /// @return
+ /// Returns LLDB_INVALID_PROCESS_ID if this object does not
+ /// contain a valid process object, or if the process has not
+ /// been launched. Returns a valid process ID if the process is
+ /// valid.
+ //------------------------------------------------------------------
+ lldb::pid_t GetProcessID();
+
+ //------------------------------------------------------------------
+ /// Gets the unique ID associated with this process object
+ ///
+ /// Unique IDs start at 1 and increment up with each new process
+ /// instance. Since starting a process on a system might always
+ /// create a process with the same process ID, there needs to be a
+ /// way to tell two process instances apart.
+ ///
+ /// @return
+ /// Returns a non-zero integer ID if this object contains a
+ /// valid process object, zero if this object does not contain
+ /// a valid process object.
+ //------------------------------------------------------------------
+ uint32_t GetUniqueID();
+
+ uint32_t GetAddressByteSize() const;
+
+ lldb::SBError Destroy();
+
+ lldb::SBError Continue();
+
+ lldb::SBError Stop();
+
+ lldb::SBError Kill();
+
+ lldb::SBError Detach();
+
+ lldb::SBError Detach(bool keep_stopped);
+
+ lldb::SBError Signal(int signal);
+
+ lldb::SBUnixSignals GetUnixSignals();
+
+ void SendAsyncInterrupt();
+
+ uint32_t GetStopID(bool include_expression_stops = false);
+
+ //------------------------------------------------------------------
+ /// Gets the stop event corresponding to stop ID.
+ //
+ /// Note that it wasn't fully implemented and tracks only the stop
+ /// event for the last natural stop ID.
+ ///
+ /// @param [in] stop_id
+ /// The ID of the stop event to return.
+ ///
+ /// @return
+ /// The stop event corresponding to stop ID.
+ //------------------------------------------------------------------
+ lldb::SBEvent GetStopEventForStopID(uint32_t stop_id);
+
+ size_t ReadMemory(addr_t addr, void *buf, size_t size, lldb::SBError &error);
+
+ size_t WriteMemory(addr_t addr, const void *buf, size_t size,
+ lldb::SBError &error);
+
+ size_t ReadCStringFromMemory(addr_t addr, void *buf, size_t size,
+ lldb::SBError &error);
+
+ uint64_t ReadUnsignedFromMemory(addr_t addr, uint32_t byte_size,
+ lldb::SBError &error);
+
+ lldb::addr_t ReadPointerFromMemory(addr_t addr, lldb::SBError &error);
+
+ // Events
+ static lldb::StateType GetStateFromEvent(const lldb::SBEvent &event);
+
+ static bool GetRestartedFromEvent(const lldb::SBEvent &event);
+
+ static size_t GetNumRestartedReasonsFromEvent(const lldb::SBEvent &event);
+
+ static const char *
+ GetRestartedReasonAtIndexFromEvent(const lldb::SBEvent &event, size_t idx);
+
+ static lldb::SBProcess GetProcessFromEvent(const lldb::SBEvent &event);
+
+ static bool GetInterruptedFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBStructuredData
+ GetStructuredDataFromEvent(const lldb::SBEvent &event);
+
+ static bool EventIsProcessEvent(const lldb::SBEvent &event);
+
+ static bool EventIsStructuredDataEvent(const lldb::SBEvent &event);
+
+ lldb::SBBroadcaster GetBroadcaster() const;
+
+ static const char *GetBroadcasterClass();
+
+ bool GetDescription(lldb::SBStream &description);
+
+ uint32_t GetNumSupportedHardwareWatchpoints(lldb::SBError &error) const;
+
+ //------------------------------------------------------------------
+ /// Load a shared library into this process.
+ ///
+ /// @param[in] remote_image_spec
+ /// The path for the shared library on the target what you want
+ /// to load.
+ ///
+ /// @param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// @return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ //------------------------------------------------------------------
+ uint32_t LoadImage(lldb::SBFileSpec &remote_image_spec, lldb::SBError &error);
+
+ //------------------------------------------------------------------
+ /// Load a shared library into this process.
+ ///
+ /// @param[in] local_image_spec
+ /// The file spec that points to the shared library that you
+ /// want to load if the library is located on the host. The
+ /// library will be copied over to the location specified by
+ /// remote_image_spec or into the current working directory with
+ /// the same filename if the remote_image_spec isn't specified.
+ ///
+ /// @param[in] remote_image_spec
+ /// If local_image_spec is specified then the location where the
+ /// library should be copied over from the host. If
+ /// local_image_spec isn't specified, then the path for the
+ /// shared library on the target what you want to load.
+ ///
+ /// @param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// @return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ //------------------------------------------------------------------
+ uint32_t LoadImage(const lldb::SBFileSpec &local_image_spec,
+ const lldb::SBFileSpec &remote_image_spec,
+ lldb::SBError &error);
+
+ lldb::SBError UnloadImage(uint32_t image_token);
+
+ lldb::SBError SendEventData(const char *data);
+
+ //------------------------------------------------------------------
+ /// Return the number of different thread-origin extended backtraces
+ /// this process can support.
+ ///
+ /// When the process is stopped and you have an SBThread, lldb may be
+ /// able to show a backtrace of when that thread was originally created,
+ /// or the work item was enqueued to it (in the case of a libdispatch
+ /// queue).
+ ///
+ /// @return
+ /// The number of thread-origin extended backtrace types that may be
+ /// available.
+ //------------------------------------------------------------------
+ uint32_t GetNumExtendedBacktraceTypes();
+
+ //------------------------------------------------------------------
+ /// Return the name of one of the thread-origin extended backtrace
+ /// methods.
+ ///
+ /// @param [in] idx
+ /// The index of the name to return. They will be returned in
+ /// the order that the user will most likely want to see them.
+ /// e.g. if the type at index 0 is not available for a thread,
+ /// see if the type at index 1 provides an extended backtrace.
+ ///
+ /// @return
+ /// The name at that index.
+ //------------------------------------------------------------------
+ const char *GetExtendedBacktraceTypeAtIndex(uint32_t idx);
+
+ lldb::SBThreadCollection GetHistoryThreads(addr_t addr);
+
+ bool IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
+
+ // Save the state of the process in a core file (or mini dump on Windows).
+ lldb::SBError SaveCore(const char *file_name);
+
+ //------------------------------------------------------------------
+ /// Query the address load_addr and store the details of the memory
+ /// region that contains it in the supplied SBMemoryRegionInfo object.
+ /// To iterate over all memory regions use GetMemoryRegionList.
+ ///
+ /// @param[in] load_addr
+ /// The address to be queried.
+ ///
+ /// @param[out] region_info
+ /// A reference to an SBMemoryRegionInfo object that will contain
+ /// the details of the memory region containing load_addr.
+ ///
+ /// @return
+ /// An error object describes any errors that occurred while
+ /// querying load_addr.
+ //------------------------------------------------------------------
+ lldb::SBError GetMemoryRegionInfo(lldb::addr_t load_addr,
+ lldb::SBMemoryRegionInfo ®ion_info);
+
+ //------------------------------------------------------------------
+ /// Return the list of memory regions within the process.
+ ///
+ /// @return
+ /// A list of all witin the process memory regions.
+ //------------------------------------------------------------------
+ lldb::SBMemoryRegionInfoList GetMemoryRegions();
protected:
- friend class SBAddress;
- friend class SBBreakpoint;
- friend class SBBreakpointLocation;
- friend class SBCommandInterpreter;
- friend class SBDebugger;
- friend class SBExecutionContext;
- friend class SBFunction;
- friend class SBModule;
- friend class SBTarget;
- friend class SBThread;
- friend class SBValue;
- friend class lldb_private::QueueImpl;
-
- lldb::ProcessSP
- GetSP() const;
-
- void
- SetSP (const lldb::ProcessSP &process_sp);
+ friend class SBAddress;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
+ friend class SBExecutionContext;
+ friend class SBFunction;
+ friend class SBModule;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBValue;
+ friend class lldb_private::QueueImpl;
+
+ lldb::ProcessSP GetSP() const;
+
+ void SetSP(const lldb::ProcessSP &process_sp);
- lldb::ProcessWP m_opaque_wp;
+ lldb::ProcessWP m_opaque_wp;
};
-} // namespace lldb
+} // namespace lldb
-#endif // LLDB_SBProcess_h_
+#endif // LLDB_SBProcess_h_
Modified: lldb/trunk/include/lldb/API/SBQueue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBQueue.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBQueue.h (original)
+++ lldb/trunk/include/lldb/API/SBQueue.h Tue Sep 6 15:57:50 2016
@@ -12,78 +12,61 @@
#include <vector>
-#include "lldb/lldb-forward.h"
#include "lldb/API/SBDefines.h"
+#include "lldb/lldb-forward.h"
namespace lldb {
-class LLDB_API SBQueue
-{
+class LLDB_API SBQueue {
public:
- SBQueue ();
+ SBQueue();
+
+ SBQueue(const QueueSP &queue_sp);
- SBQueue (const QueueSP& queue_sp);
-
- SBQueue (const SBQueue& rhs);
+ SBQueue(const SBQueue &rhs);
- const SBQueue &
- operator= (const lldb::SBQueue& rhs);
+ const SBQueue &operator=(const lldb::SBQueue &rhs);
- ~SBQueue();
+ ~SBQueue();
- bool
- IsValid() const;
+ bool IsValid() const;
- void
- Clear ();
+ void Clear();
- lldb::SBProcess
- GetProcess ();
+ lldb::SBProcess GetProcess();
- lldb::queue_id_t
- GetQueueID () const;
+ lldb::queue_id_t GetQueueID() const;
- const char *
- GetName () const;
+ const char *GetName() const;
- uint32_t
- GetIndexID () const;
+ uint32_t GetIndexID() const;
- uint32_t
- GetNumThreads ();
+ uint32_t GetNumThreads();
- lldb::SBThread
- GetThreadAtIndex (uint32_t);
+ lldb::SBThread GetThreadAtIndex(uint32_t);
- uint32_t
- GetNumPendingItems ();
+ uint32_t GetNumPendingItems();
- lldb::SBQueueItem
- GetPendingItemAtIndex (uint32_t);
+ lldb::SBQueueItem GetPendingItemAtIndex(uint32_t);
- uint32_t
- GetNumRunningItems ();
+ uint32_t GetNumRunningItems();
- lldb::QueueKind
- GetKind ();
+ lldb::QueueKind GetKind();
protected:
- friend class SBProcess;
- friend class SBThread;
+ friend class SBProcess;
+ friend class SBThread;
- void
- SetQueue (const lldb::QueueSP& queue_sp);
+ void SetQueue(const lldb::QueueSP &queue_sp);
- void
- FetchThreads ();
+ void FetchThreads();
- void
- FetchItems ();
+ void FetchItems();
private:
- std::shared_ptr<lldb_private::QueueImpl> m_opaque_sp;
+ std::shared_ptr<lldb_private::QueueImpl> m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBQueue_h_
+#endif // LLDB_SBQueue_h_
Modified: lldb/trunk/include/lldb/API/SBQueueItem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBQueueItem.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBQueueItem.h (original)
+++ lldb/trunk/include/lldb/API/SBQueueItem.h Tue Sep 6 15:57:50 2016
@@ -10,48 +10,39 @@
#ifndef LLDB_SBQueueItem_h_
#define LLDB_SBQueueItem_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
namespace lldb {
-class LLDB_API SBQueueItem
-{
+class LLDB_API SBQueueItem {
public:
- SBQueueItem ();
+ SBQueueItem();
+
+ SBQueueItem(const lldb::QueueItemSP &queue_item_sp);
- SBQueueItem (const lldb::QueueItemSP& queue_item_sp);
-
- ~SBQueueItem();
+ ~SBQueueItem();
- bool
- IsValid() const;
+ bool IsValid() const;
- void
- Clear ();
+ void Clear();
- lldb::QueueItemKind
- GetKind () const;
+ lldb::QueueItemKind GetKind() const;
- void
- SetKind (lldb::QueueItemKind kind);
+ void SetKind(lldb::QueueItemKind kind);
- lldb::SBAddress
- GetAddress () const;
+ lldb::SBAddress GetAddress() const;
- void
- SetAddress (lldb::SBAddress addr);
+ void SetAddress(lldb::SBAddress addr);
- void
- SetQueueItem (const lldb::QueueItemSP& queue_item_sp);
+ void SetQueueItem(const lldb::QueueItemSP &queue_item_sp);
- SBThread
- GetExtendedBacktraceThread (const char *type);
+ SBThread GetExtendedBacktraceThread(const char *type);
private:
- lldb::QueueItemSP m_queue_item_sp;
+ lldb::QueueItemSP m_queue_item_sp;
};
} // namespace lldb
-#endif // LLDB_SBQueueItem_h_
+#endif // LLDB_SBQueueItem_h_
Modified: lldb/trunk/include/lldb/API/SBSection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSection.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSection.h (original)
+++ lldb/trunk/include/lldb/API/SBSection.h Tue Sep 6 15:57:50 2016
@@ -10,106 +10,79 @@
#ifndef LLDB_SBSection_h_
#define LLDB_SBSection_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBData.h"
+#include "lldb/API/SBDefines.h"
namespace lldb {
-class LLDB_API SBSection
-{
+class LLDB_API SBSection {
public:
+ SBSection();
+
+ SBSection(const lldb::SBSection &rhs);
+
+ ~SBSection();
+
+ const lldb::SBSection &operator=(const lldb::SBSection &rhs);
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ lldb::SBSection GetParent();
+
+ lldb::SBSection FindSubSection(const char *sect_name);
+
+ size_t GetNumSubSections();
+
+ lldb::SBSection GetSubSectionAtIndex(size_t idx);
- SBSection ();
+ lldb::addr_t GetFileAddress();
- SBSection (const lldb::SBSection &rhs);
+ lldb::addr_t GetLoadAddress(lldb::SBTarget &target);
- ~SBSection ();
+ lldb::addr_t GetByteSize();
- const lldb::SBSection &
- operator = (const lldb::SBSection &rhs);
+ uint64_t GetFileOffset();
- bool
- IsValid () const;
-
- const char *
- GetName ();
-
- lldb::SBSection
- GetParent();
-
- lldb::SBSection
- FindSubSection (const char *sect_name);
-
- size_t
- GetNumSubSections ();
-
- lldb::SBSection
- GetSubSectionAtIndex (size_t idx);
-
- lldb::addr_t
- GetFileAddress ();
-
- lldb::addr_t
- GetLoadAddress (lldb::SBTarget &target);
-
- lldb::addr_t
- GetByteSize ();
-
- uint64_t
- GetFileOffset ();
-
- uint64_t
- GetFileByteSize ();
-
- lldb::SBData
- GetSectionData ();
-
- lldb::SBData
- GetSectionData (uint64_t offset,
- uint64_t size);
-
- SectionType
- GetSectionType ();
-
- //------------------------------------------------------------------
- /// Return the size of a target's byte represented by this section
- /// in numbers of host bytes. Note that certain architectures have
- /// varying minimum addressable unit (i.e. byte) size for their
- /// CODE or DATA buses.
- ///
- /// @return
- /// The number of host (8-bit) bytes needed to hold a target byte
- //------------------------------------------------------------------
- uint32_t
- GetTargetByteSize ();
-
- bool
- operator == (const lldb::SBSection &rhs);
-
- bool
- operator != (const lldb::SBSection &rhs);
-
- bool
- GetDescription (lldb::SBStream &description);
-
+ uint64_t GetFileByteSize();
+
+ lldb::SBData GetSectionData();
+
+ lldb::SBData GetSectionData(uint64_t offset, uint64_t size);
+
+ SectionType GetSectionType();
+
+ //------------------------------------------------------------------
+ /// Return the size of a target's byte represented by this section
+ /// in numbers of host bytes. Note that certain architectures have
+ /// varying minimum addressable unit (i.e. byte) size for their
+ /// CODE or DATA buses.
+ ///
+ /// @return
+ /// The number of host (8-bit) bytes needed to hold a target byte
+ //------------------------------------------------------------------
+ uint32_t GetTargetByteSize();
+
+ bool operator==(const lldb::SBSection &rhs);
+
+ bool operator!=(const lldb::SBSection &rhs);
+
+ bool GetDescription(lldb::SBStream &description);
private:
+ friend class SBAddress;
+ friend class SBModule;
+ friend class SBTarget;
- friend class SBAddress;
- friend class SBModule;
- friend class SBTarget;
-
- SBSection (const lldb::SectionSP §ion_sp);
-
- lldb::SectionSP
- GetSP() const;
-
- void
- SetSP(const lldb::SectionSP §ion_sp);
-
- lldb::SectionWP m_opaque_wp;
-};
+ SBSection(const lldb::SectionSP §ion_sp);
+
+ lldb::SectionSP GetSP() const;
+ void SetSP(const lldb::SectionSP §ion_sp);
+
+ lldb::SectionWP m_opaque_wp;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBSourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSourceManager.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSourceManager.h (original)
+++ lldb/trunk/include/lldb/API/SBSourceManager.h Tue Sep 6 15:57:50 2016
@@ -16,38 +16,30 @@
namespace lldb {
-class LLDB_API SBSourceManager
-{
+class LLDB_API SBSourceManager {
public:
- SBSourceManager (const SBDebugger &debugger);
- SBSourceManager (const SBTarget &target);
- SBSourceManager (const SBSourceManager &rhs);
-
- ~SBSourceManager();
-
- const lldb::SBSourceManager &
- operator = (const lldb::SBSourceManager &rhs);
-
- size_t
- DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file,
- uint32_t line,
- uint32_t context_before,
- uint32_t context_after,
- const char* current_line_cstr,
- lldb::SBStream &s);
+ SBSourceManager(const SBDebugger &debugger);
+ SBSourceManager(const SBTarget &target);
+ SBSourceManager(const SBSourceManager &rhs);
+ ~SBSourceManager();
+
+ const lldb::SBSourceManager &operator=(const lldb::SBSourceManager &rhs);
+
+ size_t DisplaySourceLinesWithLineNumbers(
+ const lldb::SBFileSpec &file, uint32_t line, uint32_t context_before,
+ uint32_t context_after, const char *current_line_cstr, lldb::SBStream &s);
protected:
- friend class SBCommandInterpreter;
- friend class SBDebugger;
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
- SBSourceManager(lldb_private::SourceManager *source_manager);
+ SBSourceManager(lldb_private::SourceManager *source_manager);
private:
-
- std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_ap;
+ std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_ap;
};
} // namespace lldb
-#endif // LLDB_SBSourceManager_h_
+#endif // LLDB_SBSourceManager_h_
Modified: lldb/trunk/include/lldb/API/SBStream.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStream.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBStream.h (original)
+++ lldb/trunk/include/lldb/API/SBStream.h Tue Sep 6 15:57:50 2016
@@ -16,101 +16,87 @@
namespace lldb {
-class LLDB_API SBStream
-{
+class LLDB_API SBStream {
public:
+ SBStream();
- SBStream ();
+ SBStream(SBStream &&rhs);
- SBStream (SBStream &&rhs);
+ ~SBStream();
- ~SBStream ();
+ bool IsValid() const;
- bool
- IsValid() const;
+ // If this stream is not redirected to a file, it will maintain a local
+ // cache for the stream data which can be accessed using this accessor.
+ const char *GetData();
- // If this stream is not redirected to a file, it will maintain a local
- // cache for the stream data which can be accessed using this accessor.
- const char *
- GetData ();
+ // If this stream is not redirected to a file, it will maintain a local
+ // cache for the stream output whose length can be accessed using this
+ // accessor.
+ size_t GetSize();
- // If this stream is not redirected to a file, it will maintain a local
- // cache for the stream output whose length can be accessed using this
- // accessor.
- size_t
- GetSize();
+ void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
- void
- Printf (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+ void RedirectToFile(const char *path, bool append);
- void
- RedirectToFile (const char *path, bool append);
+ void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
- void
- RedirectToFileHandle (FILE *fh, bool transfer_fh_ownership);
+ void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
- void
- RedirectToFileDescriptor (int fd, bool transfer_fh_ownership);
-
- // If the stream is redirected to a file, forget about the file and if
- // ownership of the file was transferred to this object, close the file.
- // If the stream is backed by a local cache, clear this cache.
- void
- Clear ();
+ // If the stream is redirected to a file, forget about the file and if
+ // ownership of the file was transferred to this object, close the file.
+ // If the stream is backed by a local cache, clear this cache.
+ void Clear();
protected:
- friend class SBAddress;
- friend class SBBlock;
- friend class SBBreakpoint;
- friend class SBBreakpointLocation;
- friend class SBCommandReturnObject;
- friend class SBCompileUnit;
- friend class SBData;
- friend class SBDebugger;
- friend class SBDeclaration;
- friend class SBEvent;
- friend class SBFileSpec;
- friend class SBFileSpecList;
- friend class SBFrame;
- friend class SBFunction;
- friend class SBInstruction;
- friend class SBInstructionList;
- friend class SBLineEntry;
- friend class SBMemoryRegionInfo;
- friend class SBModule;
- friend class SBModuleSpec;
- friend class SBModuleSpecList;
- friend class SBProcess;
- friend class SBSection;
- friend class SBSourceManager;
- friend class SBStructuredData;
- friend class SBSymbol;
- friend class SBSymbolContext;
- friend class SBSymbolContextList;
- friend class SBTarget;
- friend class SBThread;
- friend class SBThreadPlan;
- friend class SBType;
- friend class SBTypeEnumMember;
- friend class SBTypeMemberFunction;
- friend class SBTypeMember;
- friend class SBValue;
- friend class SBWatchpoint;
+ friend class SBAddress;
+ friend class SBBlock;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBCommandReturnObject;
+ friend class SBCompileUnit;
+ friend class SBData;
+ friend class SBDebugger;
+ friend class SBDeclaration;
+ friend class SBEvent;
+ friend class SBFileSpec;
+ friend class SBFileSpecList;
+ friend class SBFrame;
+ friend class SBFunction;
+ friend class SBInstruction;
+ friend class SBInstructionList;
+ friend class SBLineEntry;
+ friend class SBMemoryRegionInfo;
+ friend class SBModule;
+ friend class SBModuleSpec;
+ friend class SBModuleSpecList;
+ friend class SBProcess;
+ friend class SBSection;
+ friend class SBSourceManager;
+ friend class SBStructuredData;
+ friend class SBSymbol;
+ friend class SBSymbolContext;
+ friend class SBSymbolContextList;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBThreadPlan;
+ friend class SBType;
+ friend class SBTypeEnumMember;
+ friend class SBTypeMemberFunction;
+ friend class SBTypeMember;
+ friend class SBValue;
+ friend class SBWatchpoint;
- lldb_private::Stream *
- operator->();
+ lldb_private::Stream *operator->();
- lldb_private::Stream *
- get();
+ lldb_private::Stream *get();
- lldb_private::Stream &
- ref();
+ lldb_private::Stream &ref();
private:
-
- DISALLOW_COPY_AND_ASSIGN (SBStream);
- std::unique_ptr<lldb_private::Stream> m_opaque_ap;
- bool m_is_file;
+ DISALLOW_COPY_AND_ASSIGN(SBStream);
+ std::unique_ptr<lldb_private::Stream> m_opaque_ap;
+ bool m_is_file;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBStringList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStringList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBStringList.h (original)
+++ lldb/trunk/include/lldb/API/SBStringList.h Tue Sep 6 15:57:50 2016
@@ -14,59 +14,44 @@
namespace lldb {
-class LLDB_API SBStringList
-{
+class LLDB_API SBStringList {
public:
+ SBStringList();
- SBStringList ();
+ SBStringList(const lldb::SBStringList &rhs);
- SBStringList (const lldb::SBStringList &rhs);
-
- const SBStringList &
- operator = (const SBStringList &rhs);
+ const SBStringList &operator=(const SBStringList &rhs);
- ~SBStringList ();
+ ~SBStringList();
- bool
- IsValid() const;
+ bool IsValid() const;
- void
- AppendString (const char *str);
+ void AppendString(const char *str);
- void
- AppendList (const char **strv, int strc);
+ void AppendList(const char **strv, int strc);
- void
- AppendList (const lldb::SBStringList &strings);
+ void AppendList(const lldb::SBStringList &strings);
- uint32_t
- GetSize () const;
+ uint32_t GetSize() const;
- const char *
- GetStringAtIndex (size_t idx);
+ const char *GetStringAtIndex(size_t idx);
- const char *
- GetStringAtIndex (size_t idx) const;
+ const char *GetStringAtIndex(size_t idx) const;
- void
- Clear ();
+ void Clear();
protected:
- friend class SBCommandInterpreter;
- friend class SBDebugger;
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
- SBStringList (const lldb_private::StringList *lldb_strings);
+ SBStringList(const lldb_private::StringList *lldb_strings);
- const lldb_private::StringList *
- operator->() const;
+ const lldb_private::StringList *operator->() const;
- const lldb_private::StringList &
- operator*() const;
+ const lldb_private::StringList &operator*() const;
private:
-
- std::unique_ptr<lldb_private::StringList> m_opaque_ap;
-
+ std::unique_ptr<lldb_private::StringList> m_opaque_ap;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBStructuredData.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStructuredData.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBStructuredData.h (original)
+++ lldb/trunk/include/lldb/API/SBStructuredData.h Tue Sep 6 15:57:50 2016
@@ -15,38 +15,30 @@
namespace lldb {
- class SBStructuredData
- {
- public:
+class SBStructuredData {
+public:
+ SBStructuredData();
- SBStructuredData();
+ SBStructuredData(const lldb::SBStructuredData &rhs);
- SBStructuredData(const lldb::SBStructuredData &rhs);
+ SBStructuredData(const lldb::EventSP &event_sp);
- SBStructuredData(const lldb::EventSP &event_sp);
+ ~SBStructuredData();
- ~SBStructuredData();
+ lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
- lldb::SBStructuredData &
- operator =(const lldb::SBStructuredData &rhs);
+ bool IsValid() const;
- bool
- IsValid() const;
+ void Clear();
- void
- Clear();
+ lldb::SBError GetAsJSON(lldb::SBStream &stream) const;
- lldb::SBError
- GetAsJSON(lldb::SBStream &stream) const;
+ lldb::SBError GetDescription(lldb::SBStream &stream) const;
- lldb::SBError
- GetDescription(lldb::SBStream &stream) const;
-
- private:
-
- class Impl;
- std::unique_ptr<Impl> m_impl_up;
- };
+private:
+ class Impl;
+ std::unique_ptr<Impl> m_impl_up;
+};
}
#endif /* SBStructuredData_h */
Modified: lldb/trunk/include/lldb/API/SBSymbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbol.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbol.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbol.h Tue Sep 6 15:57:50 2016
@@ -10,102 +10,79 @@
#ifndef LLDB_SBSymbol_h_
#define LLDB_SBSymbol_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
#include "lldb/API/SBInstructionList.h"
#include "lldb/API/SBTarget.h"
namespace lldb {
-class LLDB_API SBSymbol
-{
+class LLDB_API SBSymbol {
public:
+ SBSymbol();
+
+ ~SBSymbol();
- SBSymbol ();
+ SBSymbol(const lldb::SBSymbol &rhs);
- ~SBSymbol ();
+ const lldb::SBSymbol &operator=(const lldb::SBSymbol &rhs);
- SBSymbol (const lldb::SBSymbol &rhs);
+ bool IsValid() const;
- const lldb::SBSymbol &
- operator = (const lldb::SBSymbol &rhs);
+ const char *GetName() const;
- bool
- IsValid () const;
+ const char *GetDisplayName() const;
+ const char *GetMangledName() const;
- const char *
- GetName() const;
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target);
- const char *
- GetDisplayName() const;
-
- const char *
- GetMangledName () const;
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target,
+ const char *flavor_string);
- lldb::SBInstructionList
- GetInstructions (lldb::SBTarget target);
+ SBAddress GetStartAddress();
- lldb::SBInstructionList
- GetInstructions (lldb::SBTarget target, const char *flavor_string);
+ SBAddress GetEndAddress();
- SBAddress
- GetStartAddress ();
-
- SBAddress
- GetEndAddress ();
-
- uint32_t
- GetPrologueByteSize ();
+ uint32_t GetPrologueByteSize();
- SymbolType
- GetType ();
+ SymbolType GetType();
- bool
- operator == (const lldb::SBSymbol &rhs) const;
+ bool operator==(const lldb::SBSymbol &rhs) const;
- bool
- operator != (const lldb::SBSymbol &rhs) const;
+ bool operator!=(const lldb::SBSymbol &rhs) const;
- bool
- GetDescription (lldb::SBStream &description);
+ bool GetDescription(lldb::SBStream &description);
- //----------------------------------------------------------------------
- // Returns true if the symbol is externally visible in the module that
- // it is defined in
- //----------------------------------------------------------------------
- bool
- IsExternal();
+ //----------------------------------------------------------------------
+ // Returns true if the symbol is externally visible in the module that
+ // it is defined in
+ //----------------------------------------------------------------------
+ bool IsExternal();
- //----------------------------------------------------------------------
- // Returns true if the symbol was synthetically generated from something
- // other than the actual symbol table itself in the object file.
- //----------------------------------------------------------------------
- bool
- IsSynthetic();
+ //----------------------------------------------------------------------
+ // Returns true if the symbol was synthetically generated from something
+ // other than the actual symbol table itself in the object file.
+ //----------------------------------------------------------------------
+ bool IsSynthetic();
protected:
+ lldb_private::Symbol *get();
- lldb_private::Symbol *
- get ();
+ void reset(lldb_private::Symbol *);
- void
- reset (lldb_private::Symbol *);
-
private:
- friend class SBAddress;
- friend class SBFrame;
- friend class SBModule;
- friend class SBSymbolContext;
-
- SBSymbol (lldb_private::Symbol *lldb_object_ptr);
-
- void
- SetSymbol (lldb_private::Symbol *lldb_object_ptr);
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBModule;
+ friend class SBSymbolContext;
- lldb_private::Symbol *m_opaque_ptr;
-};
+ SBSymbol(lldb_private::Symbol *lldb_object_ptr);
+
+ void SetSymbol(lldb_private::Symbol *lldb_object_ptr);
+ lldb_private::Symbol *m_opaque_ptr;
+};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBSymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbolContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbolContext.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbolContext.h Tue Sep 6 15:57:50 2016
@@ -10,9 +10,9 @@
#ifndef LLDB_SBSymbolContext_h_
#define LLDB_SBSymbolContext_h_
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBCompileUnit.h"
+#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFunction.h"
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBModule.h"
@@ -20,75 +20,63 @@
namespace lldb {
-class LLDB_API SBSymbolContext
-{
+class LLDB_API SBSymbolContext {
public:
- SBSymbolContext ();
+ SBSymbolContext();
+
+ SBSymbolContext(const lldb::SBSymbolContext &rhs);
- SBSymbolContext (const lldb::SBSymbolContext& rhs);
+ ~SBSymbolContext();
- ~SBSymbolContext ();
+ bool IsValid() const;
- bool
- IsValid () const;
+ const lldb::SBSymbolContext &operator=(const lldb::SBSymbolContext &rhs);
- const lldb::SBSymbolContext &
- operator = (const lldb::SBSymbolContext &rhs);
-
- lldb::SBModule GetModule ();
- lldb::SBCompileUnit GetCompileUnit ();
- lldb::SBFunction GetFunction ();
- lldb::SBBlock GetBlock ();
- lldb::SBLineEntry GetLineEntry ();
- lldb::SBSymbol GetSymbol ();
-
- void SetModule (lldb::SBModule module);
- void SetCompileUnit (lldb::SBCompileUnit compile_unit);
- void SetFunction (lldb::SBFunction function);
- void SetBlock (lldb::SBBlock block);
- void SetLineEntry (lldb::SBLineEntry line_entry);
- void SetSymbol (lldb::SBSymbol symbol);
-
- SBSymbolContext
- GetParentOfInlinedScope (const SBAddress &curr_frame_pc,
- SBAddress &parent_frame_addr) const;
+ lldb::SBModule GetModule();
+ lldb::SBCompileUnit GetCompileUnit();
+ lldb::SBFunction GetFunction();
+ lldb::SBBlock GetBlock();
+ lldb::SBLineEntry GetLineEntry();
+ lldb::SBSymbol GetSymbol();
- bool
- GetDescription (lldb::SBStream &description);
+ void SetModule(lldb::SBModule module);
+ void SetCompileUnit(lldb::SBCompileUnit compile_unit);
+ void SetFunction(lldb::SBFunction function);
+ void SetBlock(lldb::SBBlock block);
+ void SetLineEntry(lldb::SBLineEntry line_entry);
+ void SetSymbol(lldb::SBSymbol symbol);
+
+ SBSymbolContext GetParentOfInlinedScope(const SBAddress &curr_frame_pc,
+ SBAddress &parent_frame_addr) const;
+
+ bool GetDescription(lldb::SBStream &description);
protected:
- friend class SBAddress;
- friend class SBFrame;
- friend class SBModule;
- friend class SBThread;
- friend class SBTarget;
- friend class SBSymbolContextList;
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBModule;
+ friend class SBThread;
+ friend class SBTarget;
+ friend class SBSymbolContextList;
- lldb_private::SymbolContext*
- operator->() const;
+ lldb_private::SymbolContext *operator->() const;
- lldb_private::SymbolContext&
- operator*();
+ lldb_private::SymbolContext &operator*();
- lldb_private::SymbolContext&
- ref();
+ lldb_private::SymbolContext &ref();
- const lldb_private::SymbolContext&
- operator*() const;
+ const lldb_private::SymbolContext &operator*() const;
- lldb_private::SymbolContext *
- get() const;
+ lldb_private::SymbolContext *get() const;
- SBSymbolContext (const lldb_private::SymbolContext *sc_ptr);
+ SBSymbolContext(const lldb_private::SymbolContext *sc_ptr);
- void
- SetSymbolContext (const lldb_private::SymbolContext *sc_ptr);
+ void SetSymbolContext(const lldb_private::SymbolContext *sc_ptr);
private:
- std::unique_ptr<lldb_private::SymbolContext> m_opaque_ap;
+ std::unique_ptr<lldb_private::SymbolContext> m_opaque_ap;
};
-
} // namespace lldb
#endif // LLDB_SBSymbolContext_h_
Modified: lldb/trunk/include/lldb/API/SBSymbolContextList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbolContextList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbolContextList.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbolContextList.h Tue Sep 6 15:57:50 2016
@@ -15,55 +15,43 @@
namespace lldb {
-class LLDB_API SBSymbolContextList
-{
+class LLDB_API SBSymbolContextList {
public:
- SBSymbolContextList ();
+ SBSymbolContextList();
- SBSymbolContextList (const lldb::SBSymbolContextList& rhs);
+ SBSymbolContextList(const lldb::SBSymbolContextList &rhs);
- ~SBSymbolContextList ();
+ ~SBSymbolContextList();
- const lldb::SBSymbolContextList &
- operator = (const lldb::SBSymbolContextList &rhs);
+ const lldb::SBSymbolContextList &
+ operator=(const lldb::SBSymbolContextList &rhs);
- bool
- IsValid () const;
-
- uint32_t
- GetSize() const;
-
- lldb::SBSymbolContext
- GetContextAtIndex (uint32_t idx);
-
- bool
- GetDescription (lldb::SBStream &description);
-
- void
- Append (lldb::SBSymbolContext &sc);
-
- void
- Append (lldb::SBSymbolContextList &sc_list);
-
- void
- Clear();
+ bool IsValid() const;
-protected:
+ uint32_t GetSize() const;
+
+ lldb::SBSymbolContext GetContextAtIndex(uint32_t idx);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ void Append(lldb::SBSymbolContext &sc);
- friend class SBModule;
- friend class SBTarget;
+ void Append(lldb::SBSymbolContextList &sc_list);
- lldb_private::SymbolContextList*
- operator->() const;
+ void Clear();
- lldb_private::SymbolContextList&
- operator*() const;
+protected:
+ friend class SBModule;
+ friend class SBTarget;
+
+ lldb_private::SymbolContextList *operator->() const;
+
+ lldb_private::SymbolContextList &operator*() const;
private:
- std::unique_ptr<lldb_private::SymbolContextList> m_opaque_ap;
+ std::unique_ptr<lldb_private::SymbolContextList> m_opaque_ap;
};
-
} // namespace lldb
#endif // LLDB_SBSymbolContextList_h_
Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Tue Sep 6 15:57:50 2016
@@ -14,10 +14,10 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBroadcaster.h"
+#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBLaunchInfo.h"
@@ -30,831 +30,739 @@ namespace lldb {
class SBPlatform;
-class LLDB_API SBTarget
-{
+class LLDB_API SBTarget {
public:
- //------------------------------------------------------------------
- // Broadcaster bits.
- //------------------------------------------------------------------
- enum
- {
- eBroadcastBitBreakpointChanged = (1 << 0),
- eBroadcastBitModulesLoaded = (1 << 1),
- eBroadcastBitModulesUnloaded = (1 << 2),
- eBroadcastBitWatchpointChanged = (1 << 3),
- eBroadcastBitSymbolsLoaded = (1 << 4)
- };
-
- //------------------------------------------------------------------
- // Constructors
- //------------------------------------------------------------------
- SBTarget ();
-
- SBTarget (const lldb::SBTarget& rhs);
-
- SBTarget (const lldb::TargetSP& target_sp);
-
- //------------------------------------------------------------------
- // Destructor
- //------------------------------------------------------------------
- ~SBTarget();
-
- const lldb::SBTarget&
- operator = (const lldb::SBTarget& rhs);
-
- bool
- IsValid() const;
-
- static bool
- EventIsTargetEvent (const lldb::SBEvent &event);
-
- static lldb::SBTarget
- GetTargetFromEvent (const lldb::SBEvent &event);
-
- static uint32_t
- GetNumModulesFromEvent (const lldb::SBEvent &event);
-
- static lldb::SBModule
- GetModuleAtIndexFromEvent (const uint32_t idx, const lldb::SBEvent &event);
-
- static const char *
- GetBroadcasterClassName ();
-
- lldb::SBProcess
- GetProcess ();
-
- //------------------------------------------------------------------
- /// Return the platform object associated with the target.
- ///
- /// After return, the platform object should be checked for
- /// validity.
- ///
- /// @return
- /// A platform object.
- //------------------------------------------------------------------
- lldb::SBPlatform
- GetPlatform ();
-
- //------------------------------------------------------------------
- /// Install any binaries that need to be installed.
- ///
- /// This function does nothing when debugging on the host system.
- /// When connected to remote platforms, the target's main executable
- /// and any modules that have their remote install path set will be
- /// installed on the remote platform. If the main executable doesn't
- /// have an install location set, it will be installed in the remote
- /// platform's working directory.
- ///
- /// @return
- /// An error describing anything that went wrong during
- /// installation.
- //------------------------------------------------------------------
- SBError
- Install();
-
- //------------------------------------------------------------------
- /// Launch a new process.
- ///
- /// Launch a new process by spawning a new process using the
- /// target object's executable module's file as the file to launch.
- /// Arguments are given in \a argv, and the environment variables
- /// are in \a envp. Standard input and output files can be
- /// optionally re-directed to \a stdin_path, \a stdout_path, and
- /// \a stderr_path.
- ///
- /// @param[in] listener
- /// An optional listener that will receive all process events.
- /// If \a listener is valid then \a listener will listen to all
- /// process events. If not valid, then this target's debugger
- /// (SBTarget::GetDebugger()) will listen to all process events.
- ///
- /// @param[in] argv
- /// The argument array.
- ///
- /// @param[in] envp
- /// The environment array.
- ///
- /// @param[in] launch_flags
- /// Flags to modify the launch (@see lldb::LaunchFlags)
- ///
- /// @param[in] stdin_path
- /// The path to use when re-directing the STDIN of the new
- /// process. If all stdXX_path arguments are nullptr, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] stdout_path
- /// The path to use when re-directing the STDOUT of the new
- /// process. If all stdXX_path arguments are nullptr, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] stderr_path
- /// The path to use when re-directing the STDERR of the new
- /// process. If all stdXX_path arguments are nullptr, a pseudo
- /// terminal will be used.
- ///
- /// @param[in] working_directory
- /// The working directory to have the child process run in
- ///
- /// @param[in] launch_flags
- /// Some launch options specified by logical OR'ing
- /// lldb::LaunchFlags enumeration values together.
- ///
- /// @param[in] stop_at_entry
- /// If false do not stop the inferior at the entry point.
- ///
- /// @param[out] error
- /// An error object. Contains the reason if there is some failure.
- ///
- /// @return
- /// A process object for the newly created process.
- //------------------------------------------------------------------
- lldb::SBProcess
- Launch (SBListener &listener,
- char const **argv,
- char const **envp,
- const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
- const char *working_directory,
- uint32_t launch_flags, // See LaunchFlags
- bool stop_at_entry,
- lldb::SBError& error);
-
- SBProcess
- LoadCore (const char *core_file);
-
- //------------------------------------------------------------------
- /// Launch a new process with sensible defaults.
- ///
- /// @param[in] argv
- /// The argument array.
- ///
- /// @param[in] envp
- /// The environment array.
- ///
- /// @param[in] working_directory
- /// The working directory to have the child process run in
- ///
- /// Default: listener
- /// Set to the target's debugger (SBTarget::GetDebugger())
- ///
- /// Default: launch_flags
- /// Empty launch flags
- ///
- /// Default: stdin_path
- /// Default: stdout_path
- /// Default: stderr_path
- /// A pseudo terminal will be used.
- ///
- /// @return
- /// A process object for the newly created process.
- //------------------------------------------------------------------
- SBProcess
- LaunchSimple (const char **argv,
- const char **envp,
- const char *working_directory);
-
- SBProcess
- Launch (SBLaunchInfo &launch_info, SBError& error);
-
- SBProcess
- Attach (SBAttachInfo &attach_info, SBError& error);
-
- //------------------------------------------------------------------
- /// Attach to process with pid.
- ///
- /// @param[in] listener
- /// An optional listener that will receive all process events.
- /// If \a listener is valid then \a listener will listen to all
- /// process events. If not valid, then this target's debugger
- /// (SBTarget::GetDebugger()) will listen to all process events.
- ///
- /// @param[in] pid
- /// The process ID to attach to.
- ///
- /// @param[out] error
- /// An error explaining what went wrong if attach fails.
- ///
- /// @return
- /// A process object for the attached process.
- //------------------------------------------------------------------
- lldb::SBProcess
- AttachToProcessWithID (SBListener &listener,
- lldb::pid_t pid,
- lldb::SBError& error);
+ //------------------------------------------------------------------
+ // Broadcaster bits.
+ //------------------------------------------------------------------
+ enum {
+ eBroadcastBitBreakpointChanged = (1 << 0),
+ eBroadcastBitModulesLoaded = (1 << 1),
+ eBroadcastBitModulesUnloaded = (1 << 2),
+ eBroadcastBitWatchpointChanged = (1 << 3),
+ eBroadcastBitSymbolsLoaded = (1 << 4)
+ };
+
+ //------------------------------------------------------------------
+ // Constructors
+ //------------------------------------------------------------------
+ SBTarget();
+
+ SBTarget(const lldb::SBTarget &rhs);
+
+ SBTarget(const lldb::TargetSP &target_sp);
+
+ //------------------------------------------------------------------
+ // Destructor
+ //------------------------------------------------------------------
+ ~SBTarget();
+
+ const lldb::SBTarget &operator=(const lldb::SBTarget &rhs);
+
+ bool IsValid() const;
+
+ static bool EventIsTargetEvent(const lldb::SBEvent &event);
+
+ static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event);
+
+ static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx,
+ const lldb::SBEvent &event);
+
+ static const char *GetBroadcasterClassName();
+
+ lldb::SBProcess GetProcess();
+
+ //------------------------------------------------------------------
+ /// Return the platform object associated with the target.
+ ///
+ /// After return, the platform object should be checked for
+ /// validity.
+ ///
+ /// @return
+ /// A platform object.
+ //------------------------------------------------------------------
+ lldb::SBPlatform GetPlatform();
+
+ //------------------------------------------------------------------
+ /// Install any binaries that need to be installed.
+ ///
+ /// This function does nothing when debugging on the host system.
+ /// When connected to remote platforms, the target's main executable
+ /// and any modules that have their remote install path set will be
+ /// installed on the remote platform. If the main executable doesn't
+ /// have an install location set, it will be installed in the remote
+ /// platform's working directory.
+ ///
+ /// @return
+ /// An error describing anything that went wrong during
+ /// installation.
+ //------------------------------------------------------------------
+ SBError Install();
+
+ //------------------------------------------------------------------
+ /// Launch a new process.
+ ///
+ /// Launch a new process by spawning a new process using the
+ /// target object's executable module's file as the file to launch.
+ /// Arguments are given in \a argv, and the environment variables
+ /// are in \a envp. Standard input and output files can be
+ /// optionally re-directed to \a stdin_path, \a stdout_path, and
+ /// \a stderr_path.
+ ///
+ /// @param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// @param[in] argv
+ /// The argument array.
+ ///
+ /// @param[in] envp
+ /// The environment array.
+ ///
+ /// @param[in] launch_flags
+ /// Flags to modify the launch (@see lldb::LaunchFlags)
+ ///
+ /// @param[in] stdin_path
+ /// The path to use when re-directing the STDIN of the new
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
+ /// terminal will be used.
+ ///
+ /// @param[in] stdout_path
+ /// The path to use when re-directing the STDOUT of the new
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
+ /// terminal will be used.
+ ///
+ /// @param[in] stderr_path
+ /// The path to use when re-directing the STDERR of the new
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
+ /// terminal will be used.
+ ///
+ /// @param[in] working_directory
+ /// The working directory to have the child process run in
+ ///
+ /// @param[in] launch_flags
+ /// Some launch options specified by logical OR'ing
+ /// lldb::LaunchFlags enumeration values together.
+ ///
+ /// @param[in] stop_at_entry
+ /// If false do not stop the inferior at the entry point.
+ ///
+ /// @param[out] error
+ /// An error object. Contains the reason if there is some failure.
+ ///
+ /// @return
+ /// A process object for the newly created process.
+ //------------------------------------------------------------------
+ lldb::SBProcess Launch(SBListener &listener, char const **argv,
+ char const **envp, const char *stdin_path,
+ const char *stdout_path, const char *stderr_path,
+ const char *working_directory,
+ uint32_t launch_flags, // See LaunchFlags
+ bool stop_at_entry, lldb::SBError &error);
+
+ SBProcess LoadCore(const char *core_file);
+
+ //------------------------------------------------------------------
+ /// Launch a new process with sensible defaults.
+ ///
+ /// @param[in] argv
+ /// The argument array.
+ ///
+ /// @param[in] envp
+ /// The environment array.
+ ///
+ /// @param[in] working_directory
+ /// The working directory to have the child process run in
+ ///
+ /// Default: listener
+ /// Set to the target's debugger (SBTarget::GetDebugger())
+ ///
+ /// Default: launch_flags
+ /// Empty launch flags
+ ///
+ /// Default: stdin_path
+ /// Default: stdout_path
+ /// Default: stderr_path
+ /// A pseudo terminal will be used.
+ ///
+ /// @return
+ /// A process object for the newly created process.
+ //------------------------------------------------------------------
+ SBProcess LaunchSimple(const char **argv, const char **envp,
+ const char *working_directory);
+
+ SBProcess Launch(SBLaunchInfo &launch_info, SBError &error);
+
+ SBProcess Attach(SBAttachInfo &attach_info, SBError &error);
+
+ //------------------------------------------------------------------
+ /// Attach to process with pid.
+ ///
+ /// @param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// @param[in] pid
+ /// The process ID to attach to.
+ ///
+ /// @param[out] error
+ /// An error explaining what went wrong if attach fails.
+ ///
+ /// @return
+ /// A process object for the attached process.
+ //------------------------------------------------------------------
+ lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
+ lldb::SBError &error);
#if defined(__APPLE__)
- // We need to keep this around for a build or two since Xcode links
- // to the 32 bit version of this function. We will take it out soon.
- lldb::SBProcess
- AttachToProcessWithID (SBListener &listener,
- ::pid_t pid, // 32 bit int process ID
- lldb::SBError& error); // DEPRECATED
+ // We need to keep this around for a build or two since Xcode links
+ // to the 32 bit version of this function. We will take it out soon.
+ lldb::SBProcess AttachToProcessWithID(SBListener &listener,
+ ::pid_t pid, // 32 bit int process ID
+ lldb::SBError &error); // DEPRECATED
#endif
- //------------------------------------------------------------------
- /// Attach to process with name.
- ///
- /// @param[in] listener
- /// An optional listener that will receive all process events.
- /// If \a listener is valid then \a listener will listen to all
- /// process events. If not valid, then this target's debugger
- /// (SBTarget::GetDebugger()) will listen to all process events.
- ///
- /// @param[in] name
- /// Basename of process to attach to.
- ///
- /// @param[in] wait_for
- /// If true wait for a new instance of 'name' to be launched.
- ///
- /// @param[out] error
- /// An error explaining what went wrong if attach fails.
- ///
- /// @return
- /// A process object for the attached process.
- //------------------------------------------------------------------
- lldb::SBProcess
- AttachToProcessWithName (SBListener &listener,
- const char *name,
- bool wait_for,
- lldb::SBError& error);
-
- //------------------------------------------------------------------
- /// Connect to a remote debug server with url.
- ///
- /// @param[in] listener
- /// An optional listener that will receive all process events.
- /// If \a listener is valid then \a listener will listen to all
- /// process events. If not valid, then this target's debugger
- /// (SBTarget::GetDebugger()) will listen to all process events.
- ///
- /// @param[in] url
- /// The url to connect to, e.g., 'connect://localhost:12345'.
- ///
- /// @param[in] plugin_name
- /// The plugin name to be used; can be nullptr.
- ///
- /// @param[out] error
- /// An error explaining what went wrong if the connect fails.
- ///
- /// @return
- /// A process object for the connected process.
- //------------------------------------------------------------------
- lldb::SBProcess
- ConnectRemote (SBListener &listener,
- const char *url,
- const char *plugin_name,
- SBError& error);
-
- lldb::SBFileSpec
- GetExecutable ();
-
- bool
- AddModule (lldb::SBModule &module);
-
- lldb::SBModule
- AddModule (const char *path,
- const char *triple,
- const char *uuid);
-
- lldb::SBModule
- AddModule (const char *path,
- const char *triple,
- const char *uuid_cstr,
- const char *symfile);
-
- lldb::SBModule
- AddModule (const SBModuleSpec &module_spec);
-
- uint32_t
- GetNumModules () const;
-
- lldb::SBModule
- GetModuleAtIndex (uint32_t idx);
-
- bool
- RemoveModule (lldb::SBModule module);
-
- lldb::SBDebugger
- GetDebugger() const;
-
- lldb::SBModule
- FindModule (const lldb::SBFileSpec &file_spec);
-
- lldb::ByteOrder
- GetByteOrder ();
-
- uint32_t
- GetAddressByteSize();
-
- const char *
- GetTriple ();
-
- //------------------------------------------------------------------
- /// Architecture data byte width accessor
- ///
- /// @return
- /// The size in 8-bit (host) bytes of a minimum addressable
- /// unit from the Architecture's data bus
- //------------------------------------------------------------------
- uint32_t
- GetDataByteSize ();
-
- //------------------------------------------------------------------
- /// Architecture code byte width accessor
- ///
- /// @return
- /// The size in 8-bit (host) bytes of a minimum addressable
- /// unit from the Architecture's code bus
- //------------------------------------------------------------------
- uint32_t
- GetCodeByteSize ();
-
- //------------------------------------------------------------------
- /// Set the base load address for a module section.
- ///
- /// @param[in] section
- /// The section whose base load address will be set within this
- /// target.
- ///
- /// @param[in] section_base_addr
- /// The base address for the section.
- ///
- /// @return
- /// An error to indicate success, fail, and any reason for
- /// failure.
- //------------------------------------------------------------------
- lldb::SBError
- SetSectionLoadAddress (lldb::SBSection section,
- lldb::addr_t section_base_addr);
-
- //------------------------------------------------------------------
- /// Clear the base load address for a module section.
- ///
- /// @param[in] section
- /// The section whose base load address will be cleared within
- /// this target.
- ///
- /// @return
- /// An error to indicate success, fail, and any reason for
- /// failure.
- //------------------------------------------------------------------
- lldb::SBError
- ClearSectionLoadAddress (lldb::SBSection section);
-
- //------------------------------------------------------------------
- /// Slide all file addresses for all module sections so that \a module
- /// appears to loaded at these slide addresses.
- ///
- /// When you need all sections within a module to be loaded at a
- /// rigid slide from the addresses found in the module object file,
- /// this function will allow you to easily and quickly slide all
- /// module sections.
- ///
- /// @param[in] module
- /// The module to load.
- ///
- /// @param[in] sections_offset
- /// An offset that will be applied to all section file addresses
- /// (the virtual addresses found in the object file itself).
- ///
- /// @return
- /// An error to indicate success, fail, and any reason for
- /// failure.
- //------------------------------------------------------------------
- lldb::SBError
- SetModuleLoadAddress (lldb::SBModule module,
- int64_t sections_offset);
-
- //------------------------------------------------------------------
- /// Clear the section base load addresses for all sections in a module.
- ///
- /// @param[in] module
- /// The module to unload.
- ///
- /// @return
- /// An error to indicate success, fail, and any reason for
- /// failure.
- //------------------------------------------------------------------
- lldb::SBError
- ClearModuleLoadAddress (lldb::SBModule module);
-
- //------------------------------------------------------------------
- /// Find functions by name.
- ///
- /// @param[in] name
- /// The name of the function we are looking for.
- ///
- /// @param[in] name_type_mask
- /// A logical OR of one or more FunctionNameType enum bits that
- /// indicate what kind of names should be used when doing the
- /// lookup. Bits include fully qualified names, base names,
- /// C++ methods, or ObjC selectors.
- /// See FunctionNameType for more details.
- ///
- /// @return
- /// A lldb::SBSymbolContextList that gets filled in with all of
- /// the symbol contexts for all the matches.
- //------------------------------------------------------------------
- lldb::SBSymbolContextList
- FindFunctions (const char *name,
- uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
-
- //------------------------------------------------------------------
- /// Find global and static variables by name.
- ///
- /// @param[in] name
- /// The name of the global or static variable we are looking
- /// for.
- ///
- /// @param[in] max_matches
- /// Allow the number of matches to be limited to \a max_matches.
- ///
- /// @return
- /// A list of matched variables in an SBValueList.
- //------------------------------------------------------------------
- lldb::SBValueList
- FindGlobalVariables (const char *name,
- uint32_t max_matches);
-
- //------------------------------------------------------------------
- /// Find the first global (or static) variable by name.
- ///
- /// @param[in] name
- /// The name of the global or static variable we are looking
- /// for.
- ///
- /// @return
- /// An SBValue that gets filled in with the found variable (if any).
- //------------------------------------------------------------------
- lldb::SBValue
- FindFirstGlobalVariable (const char* name);
-
- //------------------------------------------------------------------
- /// Find global and static variables by pattern.
- ///
- /// @param[in] name
- /// The pattern to search for global or static variables
- ///
- /// @param[in] max_matches
- /// Allow the number of matches to be limited to \a max_matches.
- ///
- /// @param[in] matchtype
- /// The match type to use.
- ///
- /// @return
- /// A list of matched variables in an SBValueList.
- //------------------------------------------------------------------
- lldb::SBValueList
- FindGlobalVariables(const char *name,
- uint32_t max_matches,
- MatchType matchtype);
-
- //------------------------------------------------------------------
- /// Find global functions by their name with pattern matching.
- ///
- /// @param[in] name
- /// The pattern to search for global or static variables
- ///
- /// @param[in] max_matches
- /// Allow the number of matches to be limited to \a max_matches.
- ///
- /// @param[in] matchtype
- /// The match type to use.
- ///
- /// @return
- /// A list of matched variables in an SBValueList.
- //------------------------------------------------------------------
- lldb::SBSymbolContextList
- FindGlobalFunctions(const char *name,
- uint32_t max_matches,
- MatchType matchtype);
-
- void
- Clear ();
-
- //------------------------------------------------------------------
- /// Resolve a current file address into a section offset address.
- ///
- /// @param[in] file_addr
- ///
- /// @return
- /// An SBAddress which will be valid if...
- //------------------------------------------------------------------
- lldb::SBAddress
- ResolveFileAddress (lldb::addr_t file_addr);
-
- //------------------------------------------------------------------
- /// Resolve a current load address into a section offset address.
- ///
- /// @param[in] vm_addr
- /// A virtual address from the current process state that is to
- /// be translated into a section offset address.
- ///
- /// @return
- /// An SBAddress which will be valid if \a vm_addr was
- /// successfully resolved into a section offset address, or an
- /// invalid SBAddress if \a vm_addr doesn't resolve to a section
- /// in a module.
- //------------------------------------------------------------------
- lldb::SBAddress
- ResolveLoadAddress (lldb::addr_t vm_addr);
-
- //------------------------------------------------------------------
- /// Resolve a current load address into a section offset address
- /// using the process stop ID to identify a time in the past.
- ///
- /// @param[in] stop_id
- /// Each time a process stops, the process stop ID integer gets
- /// incremented. These stop IDs are used to identify past times
- /// and can be used in history objects as a cheap way to store
- /// the time at which the sample was taken. Specifying
- /// UINT32_MAX will always resolve the address using the
- /// currently loaded sections.
- ///
- /// @param[in] vm_addr
- /// A virtual address from the current process state that is to
- /// be translated into a section offset address.
- ///
- /// @return
- /// An SBAddress which will be valid if \a vm_addr was
- /// successfully resolved into a section offset address, or an
- /// invalid SBAddress if \a vm_addr doesn't resolve to a section
- /// in a module.
- //------------------------------------------------------------------
- lldb::SBAddress
- ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);
-
- SBSymbolContext
- ResolveSymbolContextForAddress (const SBAddress& addr,
- uint32_t resolve_scope);
-
- //------------------------------------------------------------------
- /// Read target memory. If a target process is running then memory
- /// is read from here. Otherwise the memory is read from the object
- /// files. For a target whose bytes are sized as a multiple of host
- /// bytes, the data read back will preserve the target's byte order.
- ///
- /// @param[in] addr
- /// A target address to read from.
- ///
- /// @param[out] buf
- /// The buffer to read memory into.
- ///
- /// @param[in] size
- /// The maximum number of host bytes to read in the buffer passed
- /// into this call
- ///
- /// @param[out] error
- /// Error information is written here if the memory read fails.
- ///
- /// @return
- /// The amount of data read in host bytes.
- //------------------------------------------------------------------
- size_t
- ReadMemory (const SBAddress addr, void *buf, size_t size, lldb::SBError &error);
-
- lldb::SBBreakpoint
- BreakpointCreateByLocation (const char *file, uint32_t line);
-
- lldb::SBBreakpoint
- BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
-
- lldb::SBBreakpoint
- BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line, lldb::addr_t offset);
-
- lldb::SBBreakpoint
- BreakpointCreateByName(const char *symbol_name, const char *module_name = nullptr);
-
- // This version uses name_type_mask = eFunctionNameTypeAuto
- lldb::SBBreakpoint
- BreakpointCreateByName (const char *symbol_name,
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateByName (const char *symbol_name,
- uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateByName (const char *symbol_name,
- uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
- lldb::LanguageType symbol_language,
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateByNames (const char *symbol_name[],
- uint32_t num_names,
- uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateByNames (const char *symbol_name[],
- uint32_t num_names,
- uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
- lldb::LanguageType symbol_language,
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateByNames (const char *symbol_name[],
- uint32_t num_names,
- uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
- lldb::LanguageType symbol_language,
- lldb::addr_t offset,
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = nullptr);
-
- lldb::SBBreakpoint
- BreakpointCreateByRegex (const char *symbol_name_regex,
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateByRegex (const char *symbol_name_regex,
- lldb::LanguageType symbol_language,
- const SBFileSpecList &module_list,
- const SBFileSpecList &comp_unit_list);
-
- lldb::SBBreakpoint
- BreakpointCreateBySourceRegex(const char *source_regex,
- const SBFileSpec &source_file,
- const char *module_name = nullptr);
-
- lldb::SBBreakpoint
- BreakpointCreateBySourceRegex (const char *source_regex,
- const SBFileSpecList &module_list,
- const SBFileSpecList &source_file);
-
- lldb::SBBreakpoint
- BreakpointCreateBySourceRegex (const char *source_regex,
- const SBFileSpecList &module_list,
- const SBFileSpecList &source_file,
- const SBStringList &func_names);
-
- lldb::SBBreakpoint
- BreakpointCreateForException (lldb::LanguageType language,
- bool catch_bp,
- bool throw_bp);
-
- lldb::SBBreakpoint
- BreakpointCreateByAddress (addr_t address);
-
- lldb::SBBreakpoint
- BreakpointCreateBySBAddress (SBAddress &address);
-
- uint32_t
- GetNumBreakpoints () const;
-
- lldb::SBBreakpoint
- GetBreakpointAtIndex (uint32_t idx) const;
-
- bool
- BreakpointDelete (break_id_t break_id);
-
- lldb::SBBreakpoint
- FindBreakpointByID (break_id_t break_id);
-
- bool
- EnableAllBreakpoints ();
-
- bool
- DisableAllBreakpoints ();
-
- bool
- DeleteAllBreakpoints ();
-
- uint32_t
- GetNumWatchpoints () const;
-
- lldb::SBWatchpoint
- GetWatchpointAtIndex (uint32_t idx) const;
-
- bool
- DeleteWatchpoint (lldb::watch_id_t watch_id);
-
- lldb::SBWatchpoint
- FindWatchpointByID (lldb::watch_id_t watch_id);
-
- lldb::SBWatchpoint
- WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError& error);
-
- bool
- EnableAllWatchpoints ();
-
- bool
- DisableAllWatchpoints ();
-
- bool
- DeleteAllWatchpoints ();
-
- lldb::SBBroadcaster
- GetBroadcaster () const;
-
- lldb::SBType
- FindFirstType (const char* type);
-
- lldb::SBTypeList
- FindTypes (const char* type);
-
- lldb::SBType
- GetBasicType(lldb::BasicType type);
-
- lldb::SBValue
- CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
-
- lldb::SBValue
- CreateValueFromData (const char *name, lldb::SBData data, lldb::SBType type);
-
- lldb::SBValue
- CreateValueFromExpression (const char *name, const char* expr);
-
- SBSourceManager
- GetSourceManager();
-
- lldb::SBInstructionList
- ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
-
- lldb::SBInstructionList
- ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
-
- lldb::SBInstructionList
- GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
-
- // The "WithFlavor" is necessary to keep SWIG from getting confused about overloaded arguments when
- // using the buf + size -> Python Object magic.
-
- lldb::SBInstructionList
- GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
-
- lldb::SBInstructionList
- GetInstructions (lldb::addr_t base_addr, const void *buf, size_t size);
-
- lldb::SBInstructionList
- GetInstructionsWithFlavor (lldb::addr_t base_addr, const char *flavor_string, const void *buf, size_t size);
-
- lldb::SBSymbolContextList
- FindSymbols (const char *name,
- lldb::SymbolType type = eSymbolTypeAny);
-
- bool
- operator == (const lldb::SBTarget &rhs) const;
-
- bool
- operator != (const lldb::SBTarget &rhs) const;
-
- bool
- GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
-
- lldb::SBValue
- EvaluateExpression (const char *expr);
-
- lldb::SBValue
- EvaluateExpression (const char *expr, const SBExpressionOptions &options);
-
- lldb::addr_t
- GetStackRedZoneSize();
-
- lldb::SBLaunchInfo
- GetLaunchInfo () const;
-
- void
- SetLaunchInfo (const lldb::SBLaunchInfo &launch_info);
-
+ //------------------------------------------------------------------
+ /// Attach to process with name.
+ ///
+ /// @param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// @param[in] name
+ /// Basename of process to attach to.
+ ///
+ /// @param[in] wait_for
+ /// If true wait for a new instance of 'name' to be launched.
+ ///
+ /// @param[out] error
+ /// An error explaining what went wrong if attach fails.
+ ///
+ /// @return
+ /// A process object for the attached process.
+ //------------------------------------------------------------------
+ lldb::SBProcess AttachToProcessWithName(SBListener &listener,
+ const char *name, bool wait_for,
+ lldb::SBError &error);
+
+ //------------------------------------------------------------------
+ /// Connect to a remote debug server with url.
+ ///
+ /// @param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// @param[in] url
+ /// The url to connect to, e.g., 'connect://localhost:12345'.
+ ///
+ /// @param[in] plugin_name
+ /// The plugin name to be used; can be nullptr.
+ ///
+ /// @param[out] error
+ /// An error explaining what went wrong if the connect fails.
+ ///
+ /// @return
+ /// A process object for the connected process.
+ //------------------------------------------------------------------
+ lldb::SBProcess ConnectRemote(SBListener &listener, const char *url,
+ const char *plugin_name, SBError &error);
+
+ lldb::SBFileSpec GetExecutable();
+
+ bool AddModule(lldb::SBModule &module);
+
+ lldb::SBModule AddModule(const char *path, const char *triple,
+ const char *uuid);
+
+ lldb::SBModule AddModule(const char *path, const char *triple,
+ const char *uuid_cstr, const char *symfile);
+
+ lldb::SBModule AddModule(const SBModuleSpec &module_spec);
+
+ uint32_t GetNumModules() const;
+
+ lldb::SBModule GetModuleAtIndex(uint32_t idx);
+
+ bool RemoveModule(lldb::SBModule module);
+
+ lldb::SBDebugger GetDebugger() const;
+
+ lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec);
+
+ lldb::ByteOrder GetByteOrder();
+
+ uint32_t GetAddressByteSize();
+
+ const char *GetTriple();
+
+ //------------------------------------------------------------------
+ /// Architecture data byte width accessor
+ ///
+ /// @return
+ /// The size in 8-bit (host) bytes of a minimum addressable
+ /// unit from the Architecture's data bus
+ //------------------------------------------------------------------
+ uint32_t GetDataByteSize();
+
+ //------------------------------------------------------------------
+ /// Architecture code byte width accessor
+ ///
+ /// @return
+ /// The size in 8-bit (host) bytes of a minimum addressable
+ /// unit from the Architecture's code bus
+ //------------------------------------------------------------------
+ uint32_t GetCodeByteSize();
+
+ //------------------------------------------------------------------
+ /// Set the base load address for a module section.
+ ///
+ /// @param[in] section
+ /// The section whose base load address will be set within this
+ /// target.
+ ///
+ /// @param[in] section_base_addr
+ /// The base address for the section.
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
+ lldb::addr_t section_base_addr);
+
+ //------------------------------------------------------------------
+ /// Clear the base load address for a module section.
+ ///
+ /// @param[in] section
+ /// The section whose base load address will be cleared within
+ /// this target.
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);
+
+ //------------------------------------------------------------------
+ /// Slide all file addresses for all module sections so that \a module
+ /// appears to loaded at these slide addresses.
+ ///
+ /// When you need all sections within a module to be loaded at a
+ /// rigid slide from the addresses found in the module object file,
+ /// this function will allow you to easily and quickly slide all
+ /// module sections.
+ ///
+ /// @param[in] module
+ /// The module to load.
+ ///
+ /// @param[in] sections_offset
+ /// An offset that will be applied to all section file addresses
+ /// (the virtual addresses found in the object file itself).
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
+ int64_t sections_offset);
+
+ //------------------------------------------------------------------
+ /// Clear the section base load addresses for all sections in a module.
+ ///
+ /// @param[in] module
+ /// The module to unload.
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);
+
+ //------------------------------------------------------------------
+ /// Find functions by name.
+ ///
+ /// @param[in] name
+ /// The name of the function we are looking for.
+ ///
+ /// @param[in] name_type_mask
+ /// A logical OR of one or more FunctionNameType enum bits that
+ /// indicate what kind of names should be used when doing the
+ /// lookup. Bits include fully qualified names, base names,
+ /// C++ methods, or ObjC selectors.
+ /// See FunctionNameType for more details.
+ ///
+ /// @return
+ /// A lldb::SBSymbolContextList that gets filled in with all of
+ /// the symbol contexts for all the matches.
+ //------------------------------------------------------------------
+ lldb::SBSymbolContextList
+ FindFunctions(const char *name,
+ uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
+
+ //------------------------------------------------------------------
+ /// Find global and static variables by name.
+ ///
+ /// @param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// @param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// @return
+ /// A list of matched variables in an SBValueList.
+ //------------------------------------------------------------------
+ lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);
+
+ //------------------------------------------------------------------
+ /// Find the first global (or static) variable by name.
+ ///
+ /// @param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// @return
+ /// An SBValue that gets filled in with the found variable (if any).
+ //------------------------------------------------------------------
+ lldb::SBValue FindFirstGlobalVariable(const char *name);
+
+ //------------------------------------------------------------------
+ /// Find global and static variables by pattern.
+ ///
+ /// @param[in] name
+ /// The pattern to search for global or static variables
+ ///
+ /// @param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// @param[in] matchtype
+ /// The match type to use.
+ ///
+ /// @return
+ /// A list of matched variables in an SBValueList.
+ //------------------------------------------------------------------
+ lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
+ MatchType matchtype);
+
+ //------------------------------------------------------------------
+ /// Find global functions by their name with pattern matching.
+ ///
+ /// @param[in] name
+ /// The pattern to search for global or static variables
+ ///
+ /// @param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// @param[in] matchtype
+ /// The match type to use.
+ ///
+ /// @return
+ /// A list of matched variables in an SBValueList.
+ //------------------------------------------------------------------
+ lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
+ uint32_t max_matches,
+ MatchType matchtype);
+
+ void Clear();
+
+ //------------------------------------------------------------------
+ /// Resolve a current file address into a section offset address.
+ ///
+ /// @param[in] file_addr
+ ///
+ /// @return
+ /// An SBAddress which will be valid if...
+ //------------------------------------------------------------------
+ lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);
+
+ //------------------------------------------------------------------
+ /// Resolve a current load address into a section offset address.
+ ///
+ /// @param[in] vm_addr
+ /// A virtual address from the current process state that is to
+ /// be translated into a section offset address.
+ ///
+ /// @return
+ /// An SBAddress which will be valid if \a vm_addr was
+ /// successfully resolved into a section offset address, or an
+ /// invalid SBAddress if \a vm_addr doesn't resolve to a section
+ /// in a module.
+ //------------------------------------------------------------------
+ lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr);
+
+ //------------------------------------------------------------------
+ /// Resolve a current load address into a section offset address
+ /// using the process stop ID to identify a time in the past.
+ ///
+ /// @param[in] stop_id
+ /// Each time a process stops, the process stop ID integer gets
+ /// incremented. These stop IDs are used to identify past times
+ /// and can be used in history objects as a cheap way to store
+ /// the time at which the sample was taken. Specifying
+ /// UINT32_MAX will always resolve the address using the
+ /// currently loaded sections.
+ ///
+ /// @param[in] vm_addr
+ /// A virtual address from the current process state that is to
+ /// be translated into a section offset address.
+ ///
+ /// @return
+ /// An SBAddress which will be valid if \a vm_addr was
+ /// successfully resolved into a section offset address, or an
+ /// invalid SBAddress if \a vm_addr doesn't resolve to a section
+ /// in a module.
+ //------------------------------------------------------------------
+ lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
+ lldb::addr_t vm_addr);
+
+ SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
+ uint32_t resolve_scope);
+
+ //------------------------------------------------------------------
+ /// Read target memory. If a target process is running then memory
+ /// is read from here. Otherwise the memory is read from the object
+ /// files. For a target whose bytes are sized as a multiple of host
+ /// bytes, the data read back will preserve the target's byte order.
+ ///
+ /// @param[in] addr
+ /// A target address to read from.
+ ///
+ /// @param[out] buf
+ /// The buffer to read memory into.
+ ///
+ /// @param[in] size
+ /// The maximum number of host bytes to read in the buffer passed
+ /// into this call
+ ///
+ /// @param[out] error
+ /// Error information is written here if the memory read fails.
+ ///
+ /// @return
+ /// The amount of data read in host bytes.
+ //------------------------------------------------------------------
+ size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
+ lldb::SBError &error);
+
+ lldb::SBBreakpoint BreakpointCreateByLocation(const char *file,
+ uint32_t line);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
+ lldb::addr_t offset);
+
+ lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
+ const char *module_name = nullptr);
+
+ // This version uses name_type_mask = eFunctionNameTypeAuto
+ lldb::SBBreakpoint
+ BreakpointCreateByName(const char *symbol_name,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByName(
+ const char *symbol_name,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByName(
+ const char *symbol_name,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByNames(
+ const char *symbol_name[], uint32_t num_names,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByNames(
+ const char *symbol_name[], uint32_t num_names,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByNames(
+ const char *symbol_name[], uint32_t num_names,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
+ lldb::addr_t offset, const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
+ const char *module_name = nullptr);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByRegex(const char *symbol_name_regex,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByRegex(
+ const char *symbol_name_regex, lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint
+ BreakpointCreateBySourceRegex(const char *source_regex,
+ const SBFileSpec &source_file,
+ const char *module_name = nullptr);
+
+ lldb::SBBreakpoint
+ BreakpointCreateBySourceRegex(const char *source_regex,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &source_file);
+
+ lldb::SBBreakpoint BreakpointCreateBySourceRegex(
+ const char *source_regex, const SBFileSpecList &module_list,
+ const SBFileSpecList &source_file, const SBStringList &func_names);
+
+ lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
+ bool catch_bp, bool throw_bp);
+
+ lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);
+
+ lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
+
+ uint32_t GetNumBreakpoints() const;
+
+ lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const;
+
+ bool BreakpointDelete(break_id_t break_id);
+
+ lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id);
+
+ bool EnableAllBreakpoints();
+
+ bool DisableAllBreakpoints();
+
+ bool DeleteAllBreakpoints();
+
+ uint32_t GetNumWatchpoints() const;
+
+ lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const;
+
+ bool DeleteWatchpoint(lldb::watch_id_t watch_id);
+
+ lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);
+
+ lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
+ bool write, SBError &error);
+
+ bool EnableAllWatchpoints();
+
+ bool DisableAllWatchpoints();
+
+ bool DeleteAllWatchpoints();
+
+ lldb::SBBroadcaster GetBroadcaster() const;
+
+ lldb::SBType FindFirstType(const char *type);
+
+ lldb::SBTypeList FindTypes(const char *type);
+
+ lldb::SBType GetBasicType(lldb::BasicType type);
+
+ lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr,
+ lldb::SBType type);
+
+ lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
+ lldb::SBType type);
+
+ lldb::SBValue CreateValueFromExpression(const char *name, const char *expr);
+
+ SBSourceManager GetSourceManager();
+
+ lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
+ uint32_t count);
+
+ lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
+ uint32_t count,
+ const char *flavor_string);
+
+ lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr,
+ const void *buf, size_t size);
+
+ // The "WithFlavor" is necessary to keep SWIG from getting confused about
+ // overloaded arguments when
+ // using the buf + size -> Python Object magic.
+
+ lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
+ const char *flavor_string,
+ const void *buf,
+ size_t size);
+
+ lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr,
+ const void *buf, size_t size);
+
+ lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr,
+ const char *flavor_string,
+ const void *buf,
+ size_t size);
+
+ lldb::SBSymbolContextList FindSymbols(const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+ bool operator==(const lldb::SBTarget &rhs) const;
+
+ bool operator!=(const lldb::SBTarget &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBValue EvaluateExpression(const char *expr);
+
+ lldb::SBValue EvaluateExpression(const char *expr,
+ const SBExpressionOptions &options);
+
+ lldb::addr_t GetStackRedZoneSize();
+
+ lldb::SBLaunchInfo GetLaunchInfo() const;
+
+ void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info);
+
protected:
- friend class SBAddress;
- friend class SBBlock;
- friend class SBDebugger;
- friend class SBExecutionContext;
- friend class SBFunction;
- friend class SBInstruction;
- friend class SBModule;
- friend class SBProcess;
- friend class SBSection;
- friend class SBSourceManager;
- friend class SBSymbol;
- friend class SBValue;
-
- //------------------------------------------------------------------
- // Constructors are private, use static Target::Create function to
- // create an instance of this class.
- //------------------------------------------------------------------
+ friend class SBAddress;
+ friend class SBBlock;
+ friend class SBDebugger;
+ friend class SBExecutionContext;
+ friend class SBFunction;
+ friend class SBInstruction;
+ friend class SBModule;
+ friend class SBProcess;
+ friend class SBSection;
+ friend class SBSourceManager;
+ friend class SBSymbol;
+ friend class SBValue;
+
+ //------------------------------------------------------------------
+ // Constructors are private, use static Target::Create function to
+ // create an instance of this class.
+ //------------------------------------------------------------------
- lldb::TargetSP
- GetSP () const;
+ lldb::TargetSP GetSP() const;
- void
- SetSP (const lldb::TargetSP& target_sp);
+ void SetSP(const lldb::TargetSP &target_sp);
private:
- lldb::TargetSP m_opaque_sp;
+ lldb::TargetSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Tue Sep 6 15:57:50 2016
@@ -18,257 +18,201 @@ namespace lldb {
class SBFrame;
-class LLDB_API SBThread
-{
+class LLDB_API SBThread {
public:
- enum
- {
- eBroadcastBitStackChanged = (1 << 0),
- eBroadcastBitThreadSuspended = (1 << 1),
- eBroadcastBitThreadResumed = (1 << 2),
- eBroadcastBitSelectedFrameChanged = (1 << 3),
- eBroadcastBitThreadSelected = (1 << 4)
- };
-
- static const char *
- GetBroadcasterClassName ();
-
- SBThread ();
-
- SBThread (const lldb::SBThread &thread);
-
- SBThread (const lldb::ThreadSP& lldb_object_sp);
-
- ~SBThread();
-
- lldb::SBQueue
- GetQueue () const;
-
- bool
- IsValid() const;
-
- void
- Clear ();
-
- lldb::StopReason
- GetStopReason();
-
- /// Get the number of words associated with the stop reason.
- /// See also GetStopReasonDataAtIndex().
- size_t
- GetStopReasonDataCount();
-
- //--------------------------------------------------------------------------
- /// Get information associated with a stop reason.
- ///
- /// Breakpoint stop reasons will have data that consists of pairs of
- /// breakpoint IDs followed by the breakpoint location IDs (they always come
- /// in pairs).
- ///
- /// Stop Reason Count Data Type
- /// ======================== ===== =========================================
- /// eStopReasonNone 0
- /// eStopReasonTrace 0
- /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
- /// eStopReasonWatchpoint 1 watchpoint id
- /// eStopReasonSignal 1 unix signal number
- /// eStopReasonException N exception data
- /// eStopReasonExec 0
- /// eStopReasonPlanComplete 0
- //--------------------------------------------------------------------------
- uint64_t
- GetStopReasonDataAtIndex(uint32_t idx);
-
- bool
- GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream);
-
- SBThreadCollection
- GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type);
-
- size_t
- GetStopDescription (char *dst, size_t dst_len);
-
- SBValue
- GetStopReturnValue ();
-
- lldb::tid_t
- GetThreadID () const;
-
- uint32_t
- GetIndexID () const;
-
- const char *
- GetName () const;
-
- const char *
- GetQueueName() const;
-
- lldb::queue_id_t
- GetQueueID() const;
-
- bool
- GetInfoItemByPathAsString ( const char *path, SBStream &strm);
-
- void
- StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
-
- void
- StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
-
- void
- StepInto (const char *target_name, lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
-
- void
- StepInto (const char *target_name,
- uint32_t end_line,
- SBError &error,
- lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
-
- void
- StepOut ();
-
- void
- StepOutOfFrame (lldb::SBFrame &frame);
-
- void
- StepInstruction(bool step_over);
-
- SBError
- StepOverUntil (lldb::SBFrame &frame,
- lldb::SBFileSpec &file_spec,
- uint32_t line);
-
- SBError
- StepUsingScriptedThreadPlan (const char *script_class_name);
-
- SBError
- StepUsingScriptedThreadPlan (const char *script_class_name, bool resume_immediately);
-
- SBError
- JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line);
-
- void
- RunToAddress (lldb::addr_t addr);
-
- SBError
- ReturnFromFrame (SBFrame &frame, SBValue &return_value);
-
- SBError
- UnwindInnermostExpression();
-
- //--------------------------------------------------------------------------
- /// LLDB currently supports process centric debugging which means when any
- /// thread in a process stops, all other threads are stopped. The Suspend()
- /// call here tells our process to suspend a thread and not let it run when
- /// the other threads in a process are allowed to run. So when
- /// SBProcess::Continue() is called, any threads that aren't suspended will
- /// be allowed to run. If any of the SBThread functions for stepping are
- /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddress), the
- /// thread will not be allowed to run and these functions will simply return.
- ///
- /// Eventually we plan to add support for thread centric debugging where
- /// each thread is controlled individually and each thread would broadcast
- /// its state, but we haven't implemented this yet.
- ///
- /// Likewise the SBThread::Resume() call will again allow the thread to run
- /// when the process is continued.
- ///
- /// Suspend() and Resume() functions are not currently reference counted, if
- /// anyone has the need for them to be reference counted, please let us
- /// know.
- //--------------------------------------------------------------------------
- bool
- Suspend();
-
- bool
- Resume ();
-
- bool
- IsSuspended();
-
- bool
- IsStopped();
-
- uint32_t
- GetNumFrames ();
-
- lldb::SBFrame
- GetFrameAtIndex (uint32_t idx);
-
- lldb::SBFrame
- GetSelectedFrame ();
-
- lldb::SBFrame
- SetSelectedFrame (uint32_t frame_idx);
-
- static bool
- EventIsThreadEvent (const SBEvent &event);
-
- static SBFrame
- GetStackFrameFromEvent (const SBEvent &event);
-
- static SBThread
- GetThreadFromEvent (const SBEvent &event);
-
- lldb::SBProcess
- GetProcess ();
-
- const lldb::SBThread &
- operator = (const lldb::SBThread &rhs);
-
- bool
- operator == (const lldb::SBThread &rhs) const;
-
- bool
- operator != (const lldb::SBThread &rhs) const;
-
- bool
- GetDescription (lldb::SBStream &description) const;
-
- bool
- GetStatus (lldb::SBStream &status) const;
+ enum {
+ eBroadcastBitStackChanged = (1 << 0),
+ eBroadcastBitThreadSuspended = (1 << 1),
+ eBroadcastBitThreadResumed = (1 << 2),
+ eBroadcastBitSelectedFrameChanged = (1 << 3),
+ eBroadcastBitThreadSelected = (1 << 4)
+ };
- SBThread
- GetExtendedBacktraceThread (const char *type);
+ static const char *GetBroadcasterClassName();
- uint32_t
- GetExtendedBacktraceOriginatingIndexID ();
+ SBThread();
- bool
- SafeToCallFunctions ();
+ SBThread(const lldb::SBThread &thread);
+
+ SBThread(const lldb::ThreadSP &lldb_object_sp);
+
+ ~SBThread();
+
+ lldb::SBQueue GetQueue() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ lldb::StopReason GetStopReason();
+
+ /// Get the number of words associated with the stop reason.
+ /// See also GetStopReasonDataAtIndex().
+ size_t GetStopReasonDataCount();
+
+ //--------------------------------------------------------------------------
+ /// Get information associated with a stop reason.
+ ///
+ /// Breakpoint stop reasons will have data that consists of pairs of
+ /// breakpoint IDs followed by the breakpoint location IDs (they always come
+ /// in pairs).
+ ///
+ /// Stop Reason Count Data Type
+ /// ======================== ===== =========================================
+ /// eStopReasonNone 0
+ /// eStopReasonTrace 0
+ /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
+ /// eStopReasonWatchpoint 1 watchpoint id
+ /// eStopReasonSignal 1 unix signal number
+ /// eStopReasonException N exception data
+ /// eStopReasonExec 0
+ /// eStopReasonPlanComplete 0
+ //--------------------------------------------------------------------------
+ uint64_t GetStopReasonDataAtIndex(uint32_t idx);
+
+ bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream);
+
+ SBThreadCollection
+ GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type);
+
+ size_t GetStopDescription(char *dst, size_t dst_len);
+
+ SBValue GetStopReturnValue();
+
+ lldb::tid_t GetThreadID() const;
+
+ uint32_t GetIndexID() const;
+
+ const char *GetName() const;
+
+ const char *GetQueueName() const;
+
+ lldb::queue_id_t GetQueueID() const;
+
+ bool GetInfoItemByPathAsString(const char *path, SBStream &strm);
+
+ void StepOver(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepInto(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepInto(const char *target_name,
+ lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepInto(const char *target_name, uint32_t end_line, SBError &error,
+ lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepOut();
+
+ void StepOutOfFrame(lldb::SBFrame &frame);
+
+ void StepInstruction(bool step_over);
+
+ SBError StepOverUntil(lldb::SBFrame &frame, lldb::SBFileSpec &file_spec,
+ uint32_t line);
+
+ SBError StepUsingScriptedThreadPlan(const char *script_class_name);
+
+ SBError StepUsingScriptedThreadPlan(const char *script_class_name,
+ bool resume_immediately);
+
+ SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line);
+
+ void RunToAddress(lldb::addr_t addr);
+
+ SBError ReturnFromFrame(SBFrame &frame, SBValue &return_value);
+
+ SBError UnwindInnermostExpression();
+
+ //--------------------------------------------------------------------------
+ /// LLDB currently supports process centric debugging which means when any
+ /// thread in a process stops, all other threads are stopped. The Suspend()
+ /// call here tells our process to suspend a thread and not let it run when
+ /// the other threads in a process are allowed to run. So when
+ /// SBProcess::Continue() is called, any threads that aren't suspended will
+ /// be allowed to run. If any of the SBThread functions for stepping are
+ /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddress), the
+ /// thread will not be allowed to run and these functions will simply return.
+ ///
+ /// Eventually we plan to add support for thread centric debugging where
+ /// each thread is controlled individually and each thread would broadcast
+ /// its state, but we haven't implemented this yet.
+ ///
+ /// Likewise the SBThread::Resume() call will again allow the thread to run
+ /// when the process is continued.
+ ///
+ /// Suspend() and Resume() functions are not currently reference counted, if
+ /// anyone has the need for them to be reference counted, please let us
+ /// know.
+ //--------------------------------------------------------------------------
+ bool Suspend();
+
+ bool Resume();
+
+ bool IsSuspended();
+
+ bool IsStopped();
+
+ uint32_t GetNumFrames();
+
+ lldb::SBFrame GetFrameAtIndex(uint32_t idx);
+
+ lldb::SBFrame GetSelectedFrame();
+
+ lldb::SBFrame SetSelectedFrame(uint32_t frame_idx);
+
+ static bool EventIsThreadEvent(const SBEvent &event);
+
+ static SBFrame GetStackFrameFromEvent(const SBEvent &event);
+
+ static SBThread GetThreadFromEvent(const SBEvent &event);
+
+ lldb::SBProcess GetProcess();
+
+ const lldb::SBThread &operator=(const lldb::SBThread &rhs);
+
+ bool operator==(const lldb::SBThread &rhs) const;
+
+ bool operator!=(const lldb::SBThread &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description) const;
+
+ bool GetStatus(lldb::SBStream &status) const;
+
+ SBThread GetExtendedBacktraceThread(const char *type);
+
+ uint32_t GetExtendedBacktraceOriginatingIndexID();
+
+ bool SafeToCallFunctions();
#ifndef SWIG
- lldb_private::Thread *
- operator->();
+ lldb_private::Thread *operator->();
- lldb_private::Thread *
- get();
+ lldb_private::Thread *get();
#endif
protected:
- friend class SBBreakpoint;
- friend class SBBreakpointLocation;
- friend class SBExecutionContext;
- friend class SBFrame;
- friend class SBProcess;
- friend class SBDebugger;
- friend class SBValue;
- friend class lldb_private::QueueImpl;
- friend class SBQueueItem;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBExecutionContext;
+ friend class SBFrame;
+ friend class SBProcess;
+ friend class SBDebugger;
+ friend class SBValue;
+ friend class lldb_private::QueueImpl;
+ friend class SBQueueItem;
- void
- SetThread (const lldb::ThreadSP& lldb_object_sp);
+ void SetThread(const lldb::ThreadSP &lldb_object_sp);
#ifndef SWIG
- SBError
- ResumeNewPlan (lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan);
+ SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx,
+ lldb_private::ThreadPlan *new_plan);
#endif
private:
- lldb::ExecutionContextRefSP m_opaque_sp;
+ lldb::ExecutionContextRefSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBThread_h_
+#endif // LLDB_SBThread_h_
Modified: lldb/trunk/include/lldb/API/SBThreadCollection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThreadCollection.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThreadCollection.h (original)
+++ lldb/trunk/include/lldb/API/SBThreadCollection.h Tue Sep 6 15:57:50 2016
@@ -13,57 +13,44 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
-
-class LLDB_API SBThreadCollection
-{
+
+class LLDB_API SBThreadCollection {
public:
-
- SBThreadCollection ();
-
- SBThreadCollection (const SBThreadCollection &rhs);
-
- const SBThreadCollection &
- operator = (const SBThreadCollection &rhs);
-
- ~SBThreadCollection ();
-
- bool
- IsValid () const;
-
- size_t
- GetSize ();
-
- lldb::SBThread
- GetThreadAtIndex (size_t idx);
-
+ SBThreadCollection();
+
+ SBThreadCollection(const SBThreadCollection &rhs);
+
+ const SBThreadCollection &operator=(const SBThreadCollection &rhs);
+
+ ~SBThreadCollection();
+
+ bool IsValid() const;
+
+ size_t GetSize();
+
+ lldb::SBThread GetThreadAtIndex(size_t idx);
+
protected:
-
- // Mimic shared pointer...
- lldb_private::ThreadCollection *
- get() const;
-
- lldb_private::ThreadCollection *
- operator->() const;
-
- lldb::ThreadCollectionSP &
- operator*();
-
- const lldb::ThreadCollectionSP &
- operator*() const;
-
- SBThreadCollection (const lldb::ThreadCollectionSP &threads);
-
- void
- SetOpaque (const lldb::ThreadCollectionSP &threads);
-
+ // Mimic shared pointer...
+ lldb_private::ThreadCollection *get() const;
+
+ lldb_private::ThreadCollection *operator->() const;
+
+ lldb::ThreadCollectionSP &operator*();
+
+ const lldb::ThreadCollectionSP &operator*() const;
+
+ SBThreadCollection(const lldb::ThreadCollectionSP &threads);
+
+ void SetOpaque(const lldb::ThreadCollectionSP &threads);
+
private:
- friend class SBProcess;
- friend class SBThread;
-
- lldb::ThreadCollectionSP m_opaque_sp;
+ friend class SBProcess;
+ friend class SBThread;
+
+ lldb::ThreadCollectionSP m_opaque_sp;
};
-
-
+
} // namespace lldb
#endif // LLDB_SBThreadCollection_h_
Modified: lldb/trunk/include/lldb/API/SBThreadPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThreadPlan.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThreadPlan.h (original)
+++ lldb/trunk/include/lldb/API/SBThreadPlan.h Tue Sep 6 15:57:50 2016
@@ -16,117 +16,100 @@
namespace lldb {
-class LLDB_API SBThreadPlan
-{
+class LLDB_API SBThreadPlan {
-friend class lldb_private::ThreadPlan;
+ friend class lldb_private::ThreadPlan;
public:
- SBThreadPlan ();
+ SBThreadPlan();
- SBThreadPlan (const lldb::SBThreadPlan &threadPlan);
-
- SBThreadPlan (const lldb::ThreadPlanSP& lldb_object_sp);
-
- SBThreadPlan (lldb::SBThread &thread, const char *class_name);
-
- ~SBThreadPlan ();
-
- bool
- IsValid() const;
-
- void
- Clear ();
-
- lldb::StopReason
- GetStopReason();
-
- /// Get the number of words associated with the stop reason.
- /// See also GetStopReasonDataAtIndex().
- size_t
- GetStopReasonDataCount();
-
- //--------------------------------------------------------------------------
- /// Get information associated with a stop reason.
- ///
- /// Breakpoint stop reasons will have data that consists of pairs of
- /// breakpoint IDs followed by the breakpoint location IDs (they always come
- /// in pairs).
- ///
- /// Stop Reason Count Data Type
- /// ======================== ===== =========================================
- /// eStopReasonNone 0
- /// eStopReasonTrace 0
- /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
- /// eStopReasonWatchpoint 1 watchpoint id
- /// eStopReasonSignal 1 unix signal number
- /// eStopReasonException N exception data
- /// eStopReasonExec 0
- /// eStopReasonPlanComplete 0
- //--------------------------------------------------------------------------
- uint64_t
- GetStopReasonDataAtIndex(uint32_t idx);
-
- SBThread
- GetThread () const;
-
- const lldb::SBThreadPlan &
- operator = (const lldb::SBThreadPlan &rhs);
-
- bool
- GetDescription (lldb::SBStream &description) const;
-
- void
- SetPlanComplete (bool success);
-
- bool
- IsPlanComplete();
-
- bool
- IsPlanStale();
-
- bool
- IsValid();
-
- // This section allows an SBThreadPlan to push another of the common types of plans...
- SBThreadPlan
- QueueThreadPlanForStepOverRange (SBAddress &start_address,
- lldb::addr_t range_size);
-
- SBThreadPlan
- QueueThreadPlanForStepInRange (SBAddress &start_address,
- lldb::addr_t range_size);
+ SBThreadPlan(const lldb::SBThreadPlan &threadPlan);
- SBThreadPlan
- QueueThreadPlanForStepOut (uint32_t frame_idx_to_step_to, bool first_insn = false);
+ SBThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
- SBThreadPlan
- QueueThreadPlanForRunToAddress (SBAddress address);
+ SBThreadPlan(lldb::SBThread &thread, const char *class_name);
+
+ ~SBThreadPlan();
+
+ bool IsValid() const;
+
+ void Clear();
+
+ lldb::StopReason GetStopReason();
+
+ /// Get the number of words associated with the stop reason.
+ /// See also GetStopReasonDataAtIndex().
+ size_t GetStopReasonDataCount();
+
+ //--------------------------------------------------------------------------
+ /// Get information associated with a stop reason.
+ ///
+ /// Breakpoint stop reasons will have data that consists of pairs of
+ /// breakpoint IDs followed by the breakpoint location IDs (they always come
+ /// in pairs).
+ ///
+ /// Stop Reason Count Data Type
+ /// ======================== ===== =========================================
+ /// eStopReasonNone 0
+ /// eStopReasonTrace 0
+ /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
+ /// eStopReasonWatchpoint 1 watchpoint id
+ /// eStopReasonSignal 1 unix signal number
+ /// eStopReasonException N exception data
+ /// eStopReasonExec 0
+ /// eStopReasonPlanComplete 0
+ //--------------------------------------------------------------------------
+ uint64_t GetStopReasonDataAtIndex(uint32_t idx);
+
+ SBThread GetThread() const;
+
+ const lldb::SBThreadPlan &operator=(const lldb::SBThreadPlan &rhs);
+
+ bool GetDescription(lldb::SBStream &description) const;
+
+ void SetPlanComplete(bool success);
+
+ bool IsPlanComplete();
+
+ bool IsPlanStale();
+
+ bool IsValid();
+
+ // This section allows an SBThreadPlan to push another of the common types of
+ // plans...
+ SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
+ lldb::addr_t range_size);
+
+ SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
+ lldb::addr_t range_size);
+
+ SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
+ bool first_insn = false);
+
+ SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address);
#ifndef SWIG
- lldb_private::ThreadPlan *
- get();
+ lldb_private::ThreadPlan *get();
#endif
protected:
- friend class SBBreakpoint;
- friend class SBBreakpointLocation;
- friend class SBFrame;
- friend class SBProcess;
- friend class SBDebugger;
- friend class SBValue;
- friend class lldb_private::QueueImpl;
- friend class SBQueueItem;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBFrame;
+ friend class SBProcess;
+ friend class SBDebugger;
+ friend class SBValue;
+ friend class lldb_private::QueueImpl;
+ friend class SBQueueItem;
#ifndef SWIG
- void
- SetThreadPlan (const lldb::ThreadPlanSP& lldb_object_sp);
+ void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
#endif
private:
- lldb::ThreadPlanSP m_opaque_sp;
+ lldb::ThreadPlanSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBThreadPlan_h_
+#endif // LLDB_SBThreadPlan_h_
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Tue Sep 6 15:57:50 2016
@@ -14,331 +14,241 @@
namespace lldb {
-class SBTypeList;
+class SBTypeList;
-class LLDB_API SBTypeMember
-{
+class LLDB_API SBTypeMember {
public:
- SBTypeMember ();
-
- SBTypeMember (const lldb::SBTypeMember& rhs);
-
- ~SBTypeMember();
-
- lldb::SBTypeMember&
- operator = (const lldb::SBTypeMember& rhs);
-
- bool
- IsValid() const;
-
- const char *
- GetName ();
-
- lldb::SBType
- GetType ();
-
- uint64_t
- GetOffsetInBytes();
-
- uint64_t
- GetOffsetInBits();
-
- bool
- IsBitfield();
-
- uint32_t
- GetBitfieldSizeInBits();
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
+ SBTypeMember();
+
+ SBTypeMember(const lldb::SBTypeMember &rhs);
+
+ ~SBTypeMember();
+
+ lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs);
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ lldb::SBType GetType();
+
+ uint64_t GetOffsetInBytes();
+
+ uint64_t GetOffsetInBits();
+
+ bool IsBitfield();
+
+ uint32_t GetBitfieldSizeInBits();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
protected:
- friend class SBType;
+ friend class SBType;
- void
- reset (lldb_private::TypeMemberImpl *);
+ void reset(lldb_private::TypeMemberImpl *);
- lldb_private::TypeMemberImpl &
- ref ();
+ lldb_private::TypeMemberImpl &ref();
- const lldb_private::TypeMemberImpl &
- ref () const;
+ const lldb_private::TypeMemberImpl &ref() const;
- std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
+ std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
};
-
-class SBTypeMemberFunction
-{
+
+class SBTypeMemberFunction {
public:
- SBTypeMemberFunction ();
-
- SBTypeMemberFunction (const lldb::SBTypeMemberFunction& rhs);
-
- ~SBTypeMemberFunction();
-
- lldb::SBTypeMemberFunction&
- operator = (const lldb::SBTypeMemberFunction& rhs);
-
- bool
- IsValid() const;
-
- const char *
- GetName ();
-
- const char *
- GetDemangledName ();
-
- const char *
- GetMangledName ();
-
- lldb::SBType
- GetType ();
-
- lldb::SBType
- GetReturnType ();
-
- uint32_t
- GetNumberOfArguments ();
-
- lldb::SBType
- GetArgumentTypeAtIndex (uint32_t);
-
- lldb::MemberFunctionKind
- GetKind();
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
+ SBTypeMemberFunction();
+
+ SBTypeMemberFunction(const lldb::SBTypeMemberFunction &rhs);
+
+ ~SBTypeMemberFunction();
+
+ lldb::SBTypeMemberFunction &operator=(const lldb::SBTypeMemberFunction &rhs);
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ const char *GetDemangledName();
+
+ const char *GetMangledName();
+
+ lldb::SBType GetType();
+
+ lldb::SBType GetReturnType();
+
+ uint32_t GetNumberOfArguments();
+
+ lldb::SBType GetArgumentTypeAtIndex(uint32_t);
+
+ lldb::MemberFunctionKind GetKind();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
protected:
- friend class SBType;
-
- void
- reset (lldb_private::TypeMemberFunctionImpl *);
-
- lldb_private::TypeMemberFunctionImpl &
- ref ();
-
- const lldb_private::TypeMemberFunctionImpl &
- ref () const;
-
- lldb::TypeMemberFunctionImplSP m_opaque_sp;
-};
+ friend class SBType;
+ void reset(lldb_private::TypeMemberFunctionImpl *);
-class SBType
-{
+ lldb_private::TypeMemberFunctionImpl &ref();
+
+ const lldb_private::TypeMemberFunctionImpl &ref() const;
+
+ lldb::TypeMemberFunctionImplSP m_opaque_sp;
+};
+
+class SBType {
public:
+ SBType();
+
+ SBType(const lldb::SBType &rhs);
+
+ ~SBType();
+
+ bool IsValid() const;
+
+ uint64_t GetByteSize();
+
+ bool IsPointerType();
+
+ bool IsReferenceType();
+
+ bool IsFunctionType();
+
+ bool IsPolymorphicClass();
+
+ bool IsArrayType();
+
+ bool IsVectorType();
+
+ bool IsTypedefType();
+
+ bool IsAnonymousType();
- SBType();
+ lldb::SBType GetPointerType();
- SBType (const lldb::SBType &rhs);
+ lldb::SBType GetPointeeType();
- ~SBType ();
+ lldb::SBType GetReferenceType();
+
+ lldb::SBType GetTypedefedType();
+
+ lldb::SBType GetDereferencedType();
+
+ lldb::SBType GetUnqualifiedType();
+
+ lldb::SBType GetArrayElementType();
+
+ lldb::SBType GetArrayType(uint64_t size);
+
+ lldb::SBType GetVectorElementType();
+
+ lldb::SBType GetCanonicalType();
+ // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
+ // type eBasicTypeInvalid will be returned
+ lldb::BasicType GetBasicType();
+
+ // The call below confusing and should really be renamed to "CreateBasicType"
+ lldb::SBType GetBasicType(lldb::BasicType type);
+
+ uint32_t GetNumberOfFields();
+
+ uint32_t GetNumberOfDirectBaseClasses();
+
+ uint32_t GetNumberOfVirtualBaseClasses();
+
+ lldb::SBTypeMember GetFieldAtIndex(uint32_t idx);
+
+ lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx);
+
+ lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx);
+
+ lldb::SBTypeEnumMemberList GetEnumMembers();
+
+ uint32_t GetNumberOfTemplateArguments();
+
+ lldb::SBType GetTemplateArgumentType(uint32_t idx);
+
+ lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx);
+
+ lldb::SBType GetFunctionReturnType();
+
+ lldb::SBTypeList GetFunctionArgumentTypes();
+
+ uint32_t GetNumberOfMemberFunctions();
+
+ lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx);
+
+ const char *GetName();
+
+ const char *GetDisplayTypeName();
+
+ lldb::TypeClass GetTypeClass();
+
+ bool IsTypeComplete();
+
+ uint32_t GetTypeFlags();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBType &operator=(const lldb::SBType &rhs);
+
+ bool operator==(lldb::SBType &rhs);
+
+ bool operator!=(lldb::SBType &rhs);
- bool
- IsValid() const;
-
- uint64_t
- GetByteSize();
-
- bool
- IsPointerType();
-
- bool
- IsReferenceType();
-
- bool
- IsFunctionType ();
-
- bool
- IsPolymorphicClass ();
-
- bool
- IsArrayType ();
-
- bool
- IsVectorType ();
-
- bool
- IsTypedefType ();
-
- bool
- IsAnonymousType ();
-
- lldb::SBType
- GetPointerType();
-
- lldb::SBType
- GetPointeeType();
-
- lldb::SBType
- GetReferenceType();
-
- lldb::SBType
- GetTypedefedType();
-
- lldb::SBType
- GetDereferencedType();
-
- lldb::SBType
- GetUnqualifiedType();
-
- lldb::SBType
- GetArrayElementType ();
-
- lldb::SBType
- GetArrayType (uint64_t size);
-
- lldb::SBType
- GetVectorElementType ();
-
- lldb::SBType
- GetCanonicalType();
- // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
- // type eBasicTypeInvalid will be returned
- lldb::BasicType
- GetBasicType();
-
- // The call below confusing and should really be renamed to "CreateBasicType"
- lldb::SBType
- GetBasicType(lldb::BasicType type);
-
- uint32_t
- GetNumberOfFields ();
-
- uint32_t
- GetNumberOfDirectBaseClasses ();
-
- uint32_t
- GetNumberOfVirtualBaseClasses ();
-
- lldb::SBTypeMember
- GetFieldAtIndex (uint32_t idx);
-
- lldb::SBTypeMember
- GetDirectBaseClassAtIndex (uint32_t idx);
-
- lldb::SBTypeMember
- GetVirtualBaseClassAtIndex (uint32_t idx);
-
- lldb::SBTypeEnumMemberList
- GetEnumMembers();
-
- uint32_t
- GetNumberOfTemplateArguments ();
-
- lldb::SBType
- GetTemplateArgumentType (uint32_t idx);
-
- lldb::TemplateArgumentKind
- GetTemplateArgumentKind (uint32_t idx);
-
- lldb::SBType
- GetFunctionReturnType ();
-
- lldb::SBTypeList
- GetFunctionArgumentTypes ();
-
- uint32_t
- GetNumberOfMemberFunctions ();
-
- lldb::SBTypeMemberFunction
- GetMemberFunctionAtIndex (uint32_t idx);
-
- const char*
- GetName();
-
- const char *
- GetDisplayTypeName ();
-
- lldb::TypeClass
- GetTypeClass ();
-
- bool
- IsTypeComplete ();
-
- uint32_t
- GetTypeFlags ();
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
- lldb::SBType &
- operator = (const lldb::SBType &rhs);
-
- bool
- operator == (lldb::SBType &rhs);
-
- bool
- operator != (lldb::SBType &rhs);
-
protected:
+ lldb_private::TypeImpl &ref();
+
+ const lldb_private::TypeImpl &ref() const;
+
+ lldb::TypeImplSP GetSP();
- lldb_private::TypeImpl &
- ref ();
-
- const lldb_private::TypeImpl &
- ref () const;
-
- lldb::TypeImplSP
- GetSP ();
-
- void
- SetSP (const lldb::TypeImplSP &type_impl_sp);
-
- lldb::TypeImplSP m_opaque_sp;
-
- friend class SBFunction;
- friend class SBModule;
- friend class SBTarget;
- friend class SBTypeEnumMember;
- friend class SBTypeEnumMemberList;
- friend class SBTypeNameSpecifier;
- friend class SBTypeMember;
- friend class SBTypeMemberFunction;
- friend class SBTypeList;
- friend class SBValue;
-
- SBType (const lldb_private::CompilerType &);
- SBType (const lldb::TypeSP &);
- SBType (const lldb::TypeImplSP &);
-
+ void SetSP(const lldb::TypeImplSP &type_impl_sp);
+
+ lldb::TypeImplSP m_opaque_sp;
+
+ friend class SBFunction;
+ friend class SBModule;
+ friend class SBTarget;
+ friend class SBTypeEnumMember;
+ friend class SBTypeEnumMemberList;
+ friend class SBTypeNameSpecifier;
+ friend class SBTypeMember;
+ friend class SBTypeMemberFunction;
+ friend class SBTypeList;
+ friend class SBValue;
+
+ SBType(const lldb_private::CompilerType &);
+ SBType(const lldb::TypeSP &);
+ SBType(const lldb::TypeImplSP &);
};
-
-class SBTypeList
-{
+
+class SBTypeList {
public:
- SBTypeList();
-
- SBTypeList(const lldb::SBTypeList& rhs);
-
- ~SBTypeList();
-
- lldb::SBTypeList&
- operator = (const lldb::SBTypeList& rhs);
-
- bool
- IsValid();
-
- void
- Append (lldb::SBType type);
-
- lldb::SBType
- GetTypeAtIndex (uint32_t index);
-
- uint32_t
- GetSize();
-
-
+ SBTypeList();
+
+ SBTypeList(const lldb::SBTypeList &rhs);
+
+ ~SBTypeList();
+
+ lldb::SBTypeList &operator=(const lldb::SBTypeList &rhs);
+
+ bool IsValid();
+
+ void Append(lldb::SBType type);
+
+ lldb::SBType GetTypeAtIndex(uint32_t index);
+
+ uint32_t GetSize();
+
private:
- std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
- friend class SBModule;
- friend class SBCompileUnit;
+ std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
+ friend class SBModule;
+ friend class SBCompileUnit;
};
-
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBTypeCategory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeCategory.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeCategory.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeCategory.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBTypeCategory.h --------------------------------------------*- C++ -*-===//
+//===-- SBTypeCategory.h --------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,165 +14,120 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
-
- class LLDB_API SBTypeCategory
- {
- public:
-
- SBTypeCategory();
-
- SBTypeCategory (const lldb::SBTypeCategory &rhs);
-
- ~SBTypeCategory ();
-
- bool
- IsValid() const;
-
- bool
- GetEnabled ();
-
- void
- SetEnabled (bool);
-
- const char*
- GetName();
-
- lldb::LanguageType
- GetLanguageAtIndex (uint32_t idx);
-
- uint32_t
- GetNumLanguages ();
-
- void
- AddLanguage (lldb::LanguageType language);
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
- uint32_t
- GetNumFormats ();
-
- uint32_t
- GetNumSummaries ();
-
- uint32_t
- GetNumFilters ();
-
-#ifndef LLDB_DISABLE_PYTHON
- uint32_t
- GetNumSynthetics ();
-#endif
-
- SBTypeNameSpecifier
- GetTypeNameSpecifierForFilterAtIndex (uint32_t);
-
- SBTypeNameSpecifier
- GetTypeNameSpecifierForFormatAtIndex (uint32_t);
-
- SBTypeNameSpecifier
- GetTypeNameSpecifierForSummaryAtIndex (uint32_t);
-
-#ifndef LLDB_DISABLE_PYTHON
- SBTypeNameSpecifier
- GetTypeNameSpecifierForSyntheticAtIndex (uint32_t);
-#endif
-
- SBTypeFilter
- GetFilterForType (SBTypeNameSpecifier);
-
- SBTypeFormat
- GetFormatForType (SBTypeNameSpecifier);
-
-#ifndef LLDB_DISABLE_PYTHON
- SBTypeSummary
- GetSummaryForType (SBTypeNameSpecifier);
-#endif
-
-#ifndef LLDB_DISABLE_PYTHON
- SBTypeSynthetic
- GetSyntheticForType (SBTypeNameSpecifier);
-#endif
-
-#ifndef LLDB_DISABLE_PYTHON
- SBTypeFilter
- GetFilterAtIndex (uint32_t);
-#endif
-
- SBTypeFormat
- GetFormatAtIndex (uint32_t);
-
-#ifndef LLDB_DISABLE_PYTHON
- SBTypeSummary
- GetSummaryAtIndex (uint32_t);
-#endif
-
-#ifndef LLDB_DISABLE_PYTHON
- SBTypeSynthetic
- GetSyntheticAtIndex (uint32_t);
-#endif
-
- bool
- AddTypeFormat (SBTypeNameSpecifier,
- SBTypeFormat);
-
- bool
- DeleteTypeFormat (SBTypeNameSpecifier);
-
-#ifndef LLDB_DISABLE_PYTHON
- bool
- AddTypeSummary (SBTypeNameSpecifier,
- SBTypeSummary);
-#endif
-
- bool
- DeleteTypeSummary (SBTypeNameSpecifier);
-
- bool
- AddTypeFilter (SBTypeNameSpecifier,
- SBTypeFilter);
-
- bool
- DeleteTypeFilter (SBTypeNameSpecifier);
-
-#ifndef LLDB_DISABLE_PYTHON
- bool
- AddTypeSynthetic (SBTypeNameSpecifier,
- SBTypeSynthetic);
-
- bool
- DeleteTypeSynthetic (SBTypeNameSpecifier);
-#endif
-
- lldb::SBTypeCategory &
- operator = (const lldb::SBTypeCategory &rhs);
-
- bool
- operator == (lldb::SBTypeCategory &rhs);
-
- bool
- operator != (lldb::SBTypeCategory &rhs);
-
- protected:
- friend class SBDebugger;
-
- lldb::TypeCategoryImplSP
- GetSP ();
-
- void
- SetSP (const lldb::TypeCategoryImplSP &typecategory_impl_sp);
-
- TypeCategoryImplSP m_opaque_sp;
-
- SBTypeCategory (const lldb::TypeCategoryImplSP &);
-
- SBTypeCategory (const char*);
-
- bool
- IsDefaultCategory();
-
- };
-
+
+class LLDB_API SBTypeCategory {
+public:
+ SBTypeCategory();
+
+ SBTypeCategory(const lldb::SBTypeCategory &rhs);
+
+ ~SBTypeCategory();
+
+ bool IsValid() const;
+
+ bool GetEnabled();
+
+ void SetEnabled(bool);
+
+ const char *GetName();
+
+ lldb::LanguageType GetLanguageAtIndex(uint32_t idx);
+
+ uint32_t GetNumLanguages();
+
+ void AddLanguage(lldb::LanguageType language);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ uint32_t GetNumFormats();
+
+ uint32_t GetNumSummaries();
+
+ uint32_t GetNumFilters();
+
+#ifndef LLDB_DISABLE_PYTHON
+ uint32_t GetNumSynthetics();
+#endif
+
+ SBTypeNameSpecifier GetTypeNameSpecifierForFilterAtIndex(uint32_t);
+
+ SBTypeNameSpecifier GetTypeNameSpecifierForFormatAtIndex(uint32_t);
+
+ SBTypeNameSpecifier GetTypeNameSpecifierForSummaryAtIndex(uint32_t);
+
+#ifndef LLDB_DISABLE_PYTHON
+ SBTypeNameSpecifier GetTypeNameSpecifierForSyntheticAtIndex(uint32_t);
+#endif
+
+ SBTypeFilter GetFilterForType(SBTypeNameSpecifier);
+
+ SBTypeFormat GetFormatForType(SBTypeNameSpecifier);
+
+#ifndef LLDB_DISABLE_PYTHON
+ SBTypeSummary GetSummaryForType(SBTypeNameSpecifier);
+#endif
+
+#ifndef LLDB_DISABLE_PYTHON
+ SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier);
+#endif
+
+#ifndef LLDB_DISABLE_PYTHON
+ SBTypeFilter GetFilterAtIndex(uint32_t);
+#endif
+
+ SBTypeFormat GetFormatAtIndex(uint32_t);
+
+#ifndef LLDB_DISABLE_PYTHON
+ SBTypeSummary GetSummaryAtIndex(uint32_t);
+#endif
+
+#ifndef LLDB_DISABLE_PYTHON
+ SBTypeSynthetic GetSyntheticAtIndex(uint32_t);
+#endif
+
+ bool AddTypeFormat(SBTypeNameSpecifier, SBTypeFormat);
+
+ bool DeleteTypeFormat(SBTypeNameSpecifier);
+
+#ifndef LLDB_DISABLE_PYTHON
+ bool AddTypeSummary(SBTypeNameSpecifier, SBTypeSummary);
+#endif
+
+ bool DeleteTypeSummary(SBTypeNameSpecifier);
+
+ bool AddTypeFilter(SBTypeNameSpecifier, SBTypeFilter);
+
+ bool DeleteTypeFilter(SBTypeNameSpecifier);
+
+#ifndef LLDB_DISABLE_PYTHON
+ bool AddTypeSynthetic(SBTypeNameSpecifier, SBTypeSynthetic);
+
+ bool DeleteTypeSynthetic(SBTypeNameSpecifier);
+#endif
+
+ lldb::SBTypeCategory &operator=(const lldb::SBTypeCategory &rhs);
+
+ bool operator==(lldb::SBTypeCategory &rhs);
+
+ bool operator!=(lldb::SBTypeCategory &rhs);
+
+protected:
+ friend class SBDebugger;
+
+ lldb::TypeCategoryImplSP GetSP();
+
+ void SetSP(const lldb::TypeCategoryImplSP &typecategory_impl_sp);
+
+ TypeCategoryImplSP m_opaque_sp;
+
+ SBTypeCategory(const lldb::TypeCategoryImplSP &);
+
+ SBTypeCategory(const char *);
+
+ bool IsDefaultCategory();
+};
+
} // namespace lldb
#endif // LLDB_SBTypeCategory_h_
Modified: lldb/trunk/include/lldb/API/SBTypeEnumMember.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeEnumMember.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeEnumMember.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeEnumMember.h Tue Sep 6 15:57:50 2016
@@ -15,82 +15,64 @@
namespace lldb {
-class LLDB_API SBTypeEnumMember
-{
+class LLDB_API SBTypeEnumMember {
public:
- SBTypeEnumMember ();
+ SBTypeEnumMember();
- SBTypeEnumMember (const SBTypeEnumMember& rhs);
+ SBTypeEnumMember(const SBTypeEnumMember &rhs);
- ~SBTypeEnumMember();
+ ~SBTypeEnumMember();
- SBTypeEnumMember&
- operator = (const SBTypeEnumMember& rhs);
+ SBTypeEnumMember &operator=(const SBTypeEnumMember &rhs);
- bool
- IsValid() const;
+ bool IsValid() const;
- int64_t
- GetValueAsSigned();
+ int64_t GetValueAsSigned();
- uint64_t
- GetValueAsUnsigned();
+ uint64_t GetValueAsUnsigned();
- const char *
- GetName ();
+ const char *GetName();
- lldb::SBType
- GetType ();
+ lldb::SBType GetType();
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
protected:
- friend class SBType;
- friend class SBTypeEnumMemberList;
+ friend class SBType;
+ friend class SBTypeEnumMemberList;
- void
- reset (lldb_private::TypeEnumMemberImpl *);
+ void reset(lldb_private::TypeEnumMemberImpl *);
- lldb_private::TypeEnumMemberImpl &
- ref ();
+ lldb_private::TypeEnumMemberImpl &ref();
- const lldb_private::TypeEnumMemberImpl &
- ref () const;
+ const lldb_private::TypeEnumMemberImpl &ref() const;
- lldb::TypeEnumMemberImplSP m_opaque_sp;
+ lldb::TypeEnumMemberImplSP m_opaque_sp;
- SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);
+ SBTypeEnumMember(const lldb::TypeEnumMemberImplSP &);
};
-class SBTypeEnumMemberList
-{
+class SBTypeEnumMemberList {
public:
- SBTypeEnumMemberList();
+ SBTypeEnumMemberList();
- SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);
+ SBTypeEnumMemberList(const SBTypeEnumMemberList &rhs);
- ~SBTypeEnumMemberList();
+ ~SBTypeEnumMemberList();
- SBTypeEnumMemberList&
- operator = (const SBTypeEnumMemberList& rhs);
+ SBTypeEnumMemberList &operator=(const SBTypeEnumMemberList &rhs);
- bool
- IsValid();
+ bool IsValid();
- void
- Append (SBTypeEnumMember entry);
+ void Append(SBTypeEnumMember entry);
- SBTypeEnumMember
- GetTypeEnumMemberAtIndex (uint32_t index);
-
- uint32_t
- GetSize();
+ SBTypeEnumMember GetTypeEnumMemberAtIndex(uint32_t index);
+ uint32_t GetSize();
private:
- std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;
+ std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBTypeFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeFilter.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeFilter.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeFilter.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBTypeFilter.h --------------------------------------------*- C++ -*-===//
+//===-- SBTypeFilter.h --------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,80 +14,60 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
-
- class LLDB_API SBTypeFilter
- {
- public:
-
- SBTypeFilter();
-
- SBTypeFilter (uint32_t options); // see lldb::eTypeOption values
-
- SBTypeFilter (const lldb::SBTypeFilter &rhs);
-
- ~SBTypeFilter ();
-
- bool
- IsValid() const;
-
- uint32_t
- GetNumberOfExpressionPaths ();
-
- const char*
- GetExpressionPathAtIndex (uint32_t i);
-
- bool
- ReplaceExpressionPathAtIndex (uint32_t i, const char* item);
-
- void
- AppendExpressionPath (const char* item);
-
- void
- Clear();
-
- uint32_t
- GetOptions();
-
- void
- SetOptions (uint32_t);
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
- lldb::SBTypeFilter &
- operator = (const lldb::SBTypeFilter &rhs);
-
- bool
- IsEqualTo (lldb::SBTypeFilter &rhs);
-
- bool
- operator == (lldb::SBTypeFilter &rhs);
-
- bool
- operator != (lldb::SBTypeFilter &rhs);
-
- protected:
- friend class SBDebugger;
- friend class SBTypeCategory;
- friend class SBValue;
-
- lldb::TypeFilterImplSP
- GetSP ();
-
- void
- SetSP (const lldb::TypeFilterImplSP &typefilter_impl_sp);
-
- lldb::TypeFilterImplSP m_opaque_sp;
-
- SBTypeFilter (const lldb::TypeFilterImplSP &);
-
- bool
- CopyOnWrite_Impl();
-
- };
-
-
+
+class LLDB_API SBTypeFilter {
+public:
+ SBTypeFilter();
+
+ SBTypeFilter(uint32_t options); // see lldb::eTypeOption values
+
+ SBTypeFilter(const lldb::SBTypeFilter &rhs);
+
+ ~SBTypeFilter();
+
+ bool IsValid() const;
+
+ uint32_t GetNumberOfExpressionPaths();
+
+ const char *GetExpressionPathAtIndex(uint32_t i);
+
+ bool ReplaceExpressionPathAtIndex(uint32_t i, const char *item);
+
+ void AppendExpressionPath(const char *item);
+
+ void Clear();
+
+ uint32_t GetOptions();
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeFilter &operator=(const lldb::SBTypeFilter &rhs);
+
+ bool IsEqualTo(lldb::SBTypeFilter &rhs);
+
+ bool operator==(lldb::SBTypeFilter &rhs);
+
+ bool operator!=(lldb::SBTypeFilter &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::TypeFilterImplSP GetSP();
+
+ void SetSP(const lldb::TypeFilterImplSP &typefilter_impl_sp);
+
+ lldb::TypeFilterImplSP m_opaque_sp;
+
+ SBTypeFilter(const lldb::TypeFilterImplSP &);
+
+ bool CopyOnWrite_Impl();
+};
+
} // namespace lldb
#endif // LLDB_SBTypeFilter_h_
Modified: lldb/trunk/include/lldb/API/SBTypeFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeFormat.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeFormat.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeFormat.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBTypeFormat.h --------------------------------------------*- C++ -*-===//
+//===-- SBTypeFormat.h --------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,87 +15,63 @@
namespace lldb {
-class LLDB_API SBTypeFormat
-{
+class LLDB_API SBTypeFormat {
public:
-
- SBTypeFormat();
-
- SBTypeFormat (lldb::Format format,
- uint32_t options = 0); // see lldb::eTypeOption values
-
- SBTypeFormat (const char* type,
- uint32_t options = 0); // see lldb::eTypeOption values
-
- SBTypeFormat (const lldb::SBTypeFormat &rhs);
-
- ~SBTypeFormat ();
-
- bool
- IsValid() const;
-
- lldb::Format
- GetFormat ();
-
- const char*
- GetTypeName ();
-
- uint32_t
- GetOptions();
-
- void
- SetFormat (lldb::Format);
-
- void
- SetTypeName (const char*);
-
- void
- SetOptions (uint32_t);
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
- lldb::SBTypeFormat &
- operator = (const lldb::SBTypeFormat &rhs);
-
- bool
- IsEqualTo (lldb::SBTypeFormat &rhs);
-
- bool
- operator == (lldb::SBTypeFormat &rhs);
-
- bool
- operator != (lldb::SBTypeFormat &rhs);
-
+ SBTypeFormat();
+
+ SBTypeFormat(lldb::Format format,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ SBTypeFormat(const char *type,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ SBTypeFormat(const lldb::SBTypeFormat &rhs);
+
+ ~SBTypeFormat();
+
+ bool IsValid() const;
+
+ lldb::Format GetFormat();
+
+ const char *GetTypeName();
+
+ uint32_t GetOptions();
+
+ void SetFormat(lldb::Format);
+
+ void SetTypeName(const char *);
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeFormat &operator=(const lldb::SBTypeFormat &rhs);
+
+ bool IsEqualTo(lldb::SBTypeFormat &rhs);
+
+ bool operator==(lldb::SBTypeFormat &rhs);
+
+ bool operator!=(lldb::SBTypeFormat &rhs);
+
protected:
- friend class SBDebugger;
- friend class SBTypeCategory;
- friend class SBValue;
-
- lldb::TypeFormatImplSP
- GetSP ();
-
- void
- SetSP (const lldb::TypeFormatImplSP &typeformat_impl_sp);
-
- lldb::TypeFormatImplSP m_opaque_sp;
-
- SBTypeFormat (const lldb::TypeFormatImplSP &);
-
- enum class Type
- {
- eTypeKeepSame,
- eTypeFormat,
- eTypeEnum
- };
-
- bool
- CopyOnWrite_Impl(Type);
-
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::TypeFormatImplSP GetSP();
+
+ void SetSP(const lldb::TypeFormatImplSP &typeformat_impl_sp);
+
+ lldb::TypeFormatImplSP m_opaque_sp;
+
+ SBTypeFormat(const lldb::TypeFormatImplSP &);
+
+ enum class Type { eTypeKeepSame, eTypeFormat, eTypeEnum };
+
+ bool CopyOnWrite_Impl(Type);
};
-
} // namespace lldb
#endif // LLDB_SBTypeFormat_h_
Modified: lldb/trunk/include/lldb/API/SBTypeNameSpecifier.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeNameSpecifier.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeNameSpecifier.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeNameSpecifier.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBTypeNameSpecifier.h --------------------------------------*- C++ -*-===//
+//===-- SBTypeNameSpecifier.h --------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,65 +14,51 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
-
- class LLDB_API SBTypeNameSpecifier
- {
- public:
-
- SBTypeNameSpecifier();
-
- SBTypeNameSpecifier (const char* name,
- bool is_regex = false);
-
- SBTypeNameSpecifier (SBType type);
-
- SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs);
-
- ~SBTypeNameSpecifier ();
-
- bool
- IsValid() const;
-
- const char*
- GetName();
-
- SBType
- GetType ();
-
- bool
- IsRegex();
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
- lldb::SBTypeNameSpecifier &
- operator = (const lldb::SBTypeNameSpecifier &rhs);
-
- bool
- IsEqualTo (lldb::SBTypeNameSpecifier &rhs);
-
- bool
- operator == (lldb::SBTypeNameSpecifier &rhs);
-
- bool
- operator != (lldb::SBTypeNameSpecifier &rhs);
-
- protected:
- friend class SBDebugger;
- friend class SBTypeCategory;
-
- lldb::TypeNameSpecifierImplSP
- GetSP ();
-
- void
- SetSP (const lldb::TypeNameSpecifierImplSP &type_namespec_sp);
-
- lldb::TypeNameSpecifierImplSP m_opaque_sp;
-
- SBTypeNameSpecifier (const lldb::TypeNameSpecifierImplSP &);
- };
-
+
+class LLDB_API SBTypeNameSpecifier {
+public:
+ SBTypeNameSpecifier();
+
+ SBTypeNameSpecifier(const char *name, bool is_regex = false);
+
+ SBTypeNameSpecifier(SBType type);
+
+ SBTypeNameSpecifier(const lldb::SBTypeNameSpecifier &rhs);
+
+ ~SBTypeNameSpecifier();
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ SBType GetType();
+
+ bool IsRegex();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeNameSpecifier &operator=(const lldb::SBTypeNameSpecifier &rhs);
+
+ bool IsEqualTo(lldb::SBTypeNameSpecifier &rhs);
+
+ bool operator==(lldb::SBTypeNameSpecifier &rhs);
+
+ bool operator!=(lldb::SBTypeNameSpecifier &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+
+ lldb::TypeNameSpecifierImplSP GetSP();
+
+ void SetSP(const lldb::TypeNameSpecifierImplSP &type_namespec_sp);
+
+ lldb::TypeNameSpecifierImplSP m_opaque_sp;
+
+ SBTypeNameSpecifier(const lldb::TypeNameSpecifierImplSP &);
+};
+
} // namespace lldb
#endif // LLDB_SBTypeNameSpecifier_h_
Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSummary.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeSummary.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeSummary.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBTypeSummary.h -------------------------------------------*- C++ -*-===//
+//===-- SBTypeSummary.h -------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,160 +14,123 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
- class LLDB_API SBTypeSummaryOptions
- {
- public:
- SBTypeSummaryOptions();
-
- SBTypeSummaryOptions (const lldb::SBTypeSummaryOptions &rhs);
-
- SBTypeSummaryOptions (const lldb_private::TypeSummaryOptions *lldb_object_ptr);
-
- ~SBTypeSummaryOptions ();
-
- bool
- IsValid ();
-
- lldb::LanguageType
- GetLanguage ();
-
- lldb::TypeSummaryCapping
- GetCapping ();
-
- void
- SetLanguage (lldb::LanguageType);
-
- void
- SetCapping (lldb::TypeSummaryCapping);
-
- protected:
- friend class SBValue;
-
- lldb_private::TypeSummaryOptions *
- operator->();
-
- const lldb_private::TypeSummaryOptions *
- operator->() const;
-
- lldb_private::TypeSummaryOptions *
- get ();
-
- lldb_private::TypeSummaryOptions &
- ref();
-
- const lldb_private::TypeSummaryOptions &
- ref() const;
-
- void
- SetOptions (const lldb_private::TypeSummaryOptions *lldb_object_ptr);
-
- private:
- std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_ap;
- };
-
- class SBTypeSummary
- {
- public:
-
- SBTypeSummary();
-
- // Native function summary formatter callback
- typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, SBStream&);
-
- static SBTypeSummary
- CreateWithSummaryString (const char* data,
- uint32_t options = 0); // see lldb::eTypeOption values
-
- static SBTypeSummary
- CreateWithFunctionName (const char* data,
- uint32_t options = 0); // see lldb::eTypeOption values
-
- static SBTypeSummary
- CreateWithScriptCode (const char* data,
- uint32_t options = 0); // see lldb::eTypeOption values
-
- static SBTypeSummary
- CreateWithCallback (FormatCallback cb,
- uint32_t options = 0,
- const char* description = nullptr);
-
- SBTypeSummary (const lldb::SBTypeSummary &rhs);
-
- ~SBTypeSummary ();
-
- bool
- IsValid() const;
-
- bool
- IsFunctionCode();
-
- bool
- IsFunctionName();
-
- bool
- IsSummaryString();
-
- const char*
- GetData ();
-
- void
- SetSummaryString (const char* data);
-
- void
- SetFunctionName (const char* data);
-
- void
- SetFunctionCode (const char* data);
-
- uint32_t
- GetOptions ();
-
- void
- SetOptions (uint32_t);
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
- lldb::SBTypeSummary &
- operator = (const lldb::SBTypeSummary &rhs);
-
- bool
- DoesPrintValue (lldb::SBValue value);
-
- bool
- IsEqualTo (lldb::SBTypeSummary &rhs);
-
- bool
- operator == (lldb::SBTypeSummary &rhs);
-
- bool
- operator != (lldb::SBTypeSummary &rhs);
-
- protected:
- friend class SBDebugger;
- friend class SBTypeCategory;
- friend class SBValue;
-
- lldb::TypeSummaryImplSP
- GetSP ();
-
- void
- SetSP (const lldb::TypeSummaryImplSP &typefilter_impl_sp);
-
- lldb::TypeSummaryImplSP m_opaque_sp;
-
- SBTypeSummary (const lldb::TypeSummaryImplSP &);
-
- bool
- CopyOnWrite_Impl();
-
- bool
- ChangeSummaryType (bool want_script);
-
- };
-
-
+class LLDB_API SBTypeSummaryOptions {
+public:
+ SBTypeSummaryOptions();
+
+ SBTypeSummaryOptions(const lldb::SBTypeSummaryOptions &rhs);
+
+ SBTypeSummaryOptions(const lldb_private::TypeSummaryOptions *lldb_object_ptr);
+
+ ~SBTypeSummaryOptions();
+
+ bool IsValid();
+
+ lldb::LanguageType GetLanguage();
+
+ lldb::TypeSummaryCapping GetCapping();
+
+ void SetLanguage(lldb::LanguageType);
+
+ void SetCapping(lldb::TypeSummaryCapping);
+
+protected:
+ friend class SBValue;
+
+ lldb_private::TypeSummaryOptions *operator->();
+
+ const lldb_private::TypeSummaryOptions *operator->() const;
+
+ lldb_private::TypeSummaryOptions *get();
+
+ lldb_private::TypeSummaryOptions &ref();
+
+ const lldb_private::TypeSummaryOptions &ref() const;
+
+ void SetOptions(const lldb_private::TypeSummaryOptions *lldb_object_ptr);
+
+private:
+ std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_ap;
+};
+
+class SBTypeSummary {
+public:
+ SBTypeSummary();
+
+ // Native function summary formatter callback
+ typedef bool (*FormatCallback)(SBValue, SBTypeSummaryOptions, SBStream &);
+
+ static SBTypeSummary
+ CreateWithSummaryString(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSummary
+ CreateWithFunctionName(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSummary
+ CreateWithScriptCode(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSummary CreateWithCallback(FormatCallback cb,
+ uint32_t options = 0,
+ const char *description = nullptr);
+
+ SBTypeSummary(const lldb::SBTypeSummary &rhs);
+
+ ~SBTypeSummary();
+
+ bool IsValid() const;
+
+ bool IsFunctionCode();
+
+ bool IsFunctionName();
+
+ bool IsSummaryString();
+
+ const char *GetData();
+
+ void SetSummaryString(const char *data);
+
+ void SetFunctionName(const char *data);
+
+ void SetFunctionCode(const char *data);
+
+ uint32_t GetOptions();
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeSummary &operator=(const lldb::SBTypeSummary &rhs);
+
+ bool DoesPrintValue(lldb::SBValue value);
+
+ bool IsEqualTo(lldb::SBTypeSummary &rhs);
+
+ bool operator==(lldb::SBTypeSummary &rhs);
+
+ bool operator!=(lldb::SBTypeSummary &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::TypeSummaryImplSP GetSP();
+
+ void SetSP(const lldb::TypeSummaryImplSP &typefilter_impl_sp);
+
+ lldb::TypeSummaryImplSP m_opaque_sp;
+
+ SBTypeSummary(const lldb::TypeSummaryImplSP &);
+
+ bool CopyOnWrite_Impl();
+
+ bool ChangeSummaryType(bool want_script);
+};
+
} // namespace lldb
#endif // LLDB_SBTypeSummary_h_
Modified: lldb/trunk/include/lldb/API/SBTypeSynthetic.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSynthetic.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeSynthetic.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeSynthetic.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBTypeSynthetic.h -----------------------------------------*- C++ -*-===//
+//===-- SBTypeSynthetic.h -----------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,86 +16,66 @@
#ifndef LLDB_DISABLE_PYTHON
namespace lldb {
-
- class LLDB_API SBTypeSynthetic
- {
- public:
-
- SBTypeSynthetic();
-
- static SBTypeSynthetic
- CreateWithClassName (const char* data,
- uint32_t options = 0); // see lldb::eTypeOption values
-
- static SBTypeSynthetic
- CreateWithScriptCode (const char* data,
- uint32_t options = 0); // see lldb::eTypeOption values
-
- SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs);
-
- ~SBTypeSynthetic ();
-
- bool
- IsValid() const;
-
- bool
- IsClassCode();
-
- bool
- IsClassName();
-
- const char*
- GetData ();
-
- void
- SetClassName (const char* data);
-
- void
- SetClassCode (const char* data);
-
- uint32_t
- GetOptions ();
-
- void
- SetOptions (uint32_t);
-
- bool
- GetDescription (lldb::SBStream &description,
- lldb::DescriptionLevel description_level);
-
- lldb::SBTypeSynthetic &
- operator = (const lldb::SBTypeSynthetic &rhs);
-
- bool
- IsEqualTo (lldb::SBTypeSynthetic &rhs);
-
- bool
- operator == (lldb::SBTypeSynthetic &rhs);
-
- bool
- operator != (lldb::SBTypeSynthetic &rhs);
-
- protected:
- friend class SBDebugger;
- friend class SBTypeCategory;
- friend class SBValue;
-
- lldb::ScriptedSyntheticChildrenSP
- GetSP ();
-
- void
- SetSP (const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp);
-
- lldb::ScriptedSyntheticChildrenSP m_opaque_sp;
-
- SBTypeSynthetic (const lldb::ScriptedSyntheticChildrenSP &);
-
- bool
- CopyOnWrite_Impl();
-
- };
-
-
+
+class LLDB_API SBTypeSynthetic {
+public:
+ SBTypeSynthetic();
+
+ static SBTypeSynthetic
+ CreateWithClassName(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSynthetic
+ CreateWithScriptCode(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ SBTypeSynthetic(const lldb::SBTypeSynthetic &rhs);
+
+ ~SBTypeSynthetic();
+
+ bool IsValid() const;
+
+ bool IsClassCode();
+
+ bool IsClassName();
+
+ const char *GetData();
+
+ void SetClassName(const char *data);
+
+ void SetClassCode(const char *data);
+
+ uint32_t GetOptions();
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeSynthetic &operator=(const lldb::SBTypeSynthetic &rhs);
+
+ bool IsEqualTo(lldb::SBTypeSynthetic &rhs);
+
+ bool operator==(lldb::SBTypeSynthetic &rhs);
+
+ bool operator!=(lldb::SBTypeSynthetic &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::ScriptedSyntheticChildrenSP GetSP();
+
+ void SetSP(const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp);
+
+ lldb::ScriptedSyntheticChildrenSP m_opaque_sp;
+
+ SBTypeSynthetic(const lldb::ScriptedSyntheticChildrenSP &);
+
+ bool CopyOnWrite_Impl();
+};
+
} // namespace lldb
#endif // LLDB_DISABLE_PYTHON
Modified: lldb/trunk/include/lldb/API/SBUnixSignals.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBUnixSignals.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBUnixSignals.h (original)
+++ lldb/trunk/include/lldb/API/SBUnixSignals.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBUnixSignals.h -----------------------------------------------*- C++ -*-===//
+//===-- SBUnixSignals.h -----------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -16,72 +17,54 @@ namespace lldb {
class LLDB_API SBUnixSignals {
public:
- SBUnixSignals ();
+ SBUnixSignals();
- SBUnixSignals (const lldb::SBUnixSignals &rhs);
+ SBUnixSignals(const lldb::SBUnixSignals &rhs);
- ~SBUnixSignals();
+ ~SBUnixSignals();
- const SBUnixSignals &
- operator =(const lldb::SBUnixSignals &rhs);
+ const SBUnixSignals &operator=(const lldb::SBUnixSignals &rhs);
- void
- Clear ();
+ void Clear();
- bool
- IsValid () const;
+ bool IsValid() const;
- const char *
- GetSignalAsCString (int32_t signo) const;
+ const char *GetSignalAsCString(int32_t signo) const;
- int32_t
- GetSignalNumberFromName (const char *name) const;
+ int32_t GetSignalNumberFromName(const char *name) const;
- bool
- GetShouldSuppress (int32_t signo) const;
+ bool GetShouldSuppress(int32_t signo) const;
- bool
- SetShouldSuppress (int32_t signo,
- bool value);
+ bool SetShouldSuppress(int32_t signo, bool value);
- bool
- GetShouldStop (int32_t signo) const;
+ bool GetShouldStop(int32_t signo) const;
- bool
- SetShouldStop (int32_t signo,
- bool value);
+ bool SetShouldStop(int32_t signo, bool value);
- bool
- GetShouldNotify (int32_t signo) const;
+ bool GetShouldNotify(int32_t signo) const;
- bool
- SetShouldNotify (int32_t signo, bool value);
+ bool SetShouldNotify(int32_t signo, bool value);
- int32_t
- GetNumSignals () const;
+ int32_t GetNumSignals() const;
- int32_t
- GetSignalAtIndex (int32_t index) const;
+ int32_t GetSignalAtIndex(int32_t index) const;
protected:
- friend class SBProcess;
- friend class SBPlatform;
+ friend class SBProcess;
+ friend class SBPlatform;
- SBUnixSignals(lldb::ProcessSP &process_sp);
+ SBUnixSignals(lldb::ProcessSP &process_sp);
- SBUnixSignals(lldb::PlatformSP &platform_sp);
+ SBUnixSignals(lldb::PlatformSP &platform_sp);
- lldb::UnixSignalsSP
- GetSP() const;
+ lldb::UnixSignalsSP GetSP() const;
- void
- SetSP(const lldb::UnixSignalsSP &signals_sp);
+ void SetSP(const lldb::UnixSignalsSP &signals_sp);
private:
- lldb::UnixSignalsWP m_opaque_wp;
+ lldb::UnixSignalsWP m_opaque_wp;
};
-
} // namespace lldb
#endif // LLDB_SBUnixSignals_h_
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Tue Sep 6 15:57:50 2016
@@ -19,498 +19,428 @@ class ValueLocker;
namespace lldb {
-class LLDB_API SBValue
-{
+class LLDB_API SBValue {
public:
- SBValue ();
+ SBValue();
- SBValue (const lldb::SBValue &rhs);
+ SBValue(const lldb::SBValue &rhs);
+
+ lldb::SBValue &operator=(const lldb::SBValue &rhs);
+
+ ~SBValue();
+
+ bool IsValid();
+
+ void Clear();
+
+ SBError GetError();
+
+ lldb::user_id_t GetID();
+
+ const char *GetName();
+
+ const char *GetTypeName();
+
+ const char *GetDisplayTypeName();
+
+ size_t GetByteSize();
+
+ bool IsInScope();
+
+ lldb::Format GetFormat();
+
+ void SetFormat(lldb::Format format);
+
+ const char *GetValue();
+
+ int64_t GetValueAsSigned(lldb::SBError &error, int64_t fail_value = 0);
+
+ uint64_t GetValueAsUnsigned(lldb::SBError &error, uint64_t fail_value = 0);
+
+ int64_t GetValueAsSigned(int64_t fail_value = 0);
+
+ uint64_t GetValueAsUnsigned(uint64_t fail_value = 0);
+
+ ValueType GetValueType();
+
+ // If you call this on a newly created ValueObject, it will always return
+ // false.
+ bool GetValueDidChange();
+
+ const char *GetSummary();
+
+ const char *GetSummary(lldb::SBStream &stream,
+ lldb::SBTypeSummaryOptions &options);
+
+ const char *GetObjectDescription();
+
+ const char *GetTypeValidatorResult();
+
+ lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue GetStaticValue();
+
+ lldb::SBValue GetNonSyntheticValue();
+
+ lldb::DynamicValueType GetPreferDynamicValue();
+
+ void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic);
+
+ bool GetPreferSyntheticValue();
+
+ void SetPreferSyntheticValue(bool use_synthetic);
+
+ bool IsDynamic();
+
+ bool IsSynthetic();
+
+ bool IsSyntheticChildrenGenerated();
+
+ void SetSyntheticChildrenGenerated(bool);
+
+ const char *GetLocation();
+
+ // Deprecated - use the one that takes SBError&
+ bool SetValueFromCString(const char *value_str);
+
+ bool SetValueFromCString(const char *value_str, lldb::SBError &error);
+
+ lldb::SBTypeFormat GetTypeFormat();
+
+ lldb::SBTypeSummary GetTypeSummary();
+
+ lldb::SBTypeFilter GetTypeFilter();
- lldb::SBValue &
- operator =(const lldb::SBValue &rhs);
-
- ~SBValue ();
-
- bool
- IsValid();
-
- void
- Clear();
-
- SBError
- GetError();
-
- lldb::user_id_t
- GetID ();
-
- const char *
- GetName();
-
- const char *
- GetTypeName ();
-
- const char *
- GetDisplayTypeName ();
-
- size_t
- GetByteSize ();
-
- bool
- IsInScope ();
-
- lldb::Format
- GetFormat ();
-
- void
- SetFormat (lldb::Format format);
-
- const char *
- GetValue ();
-
- int64_t
- GetValueAsSigned (lldb::SBError& error, int64_t fail_value=0);
-
- uint64_t
- GetValueAsUnsigned (lldb::SBError& error, uint64_t fail_value=0);
-
- int64_t
- GetValueAsSigned(int64_t fail_value=0);
-
- uint64_t
- GetValueAsUnsigned(uint64_t fail_value=0);
-
- ValueType
- GetValueType ();
-
- // If you call this on a newly created ValueObject, it will always return false.
- bool
- GetValueDidChange ();
-
- const char *
- GetSummary ();
-
- const char *
- GetSummary (lldb::SBStream& stream,
- lldb::SBTypeSummaryOptions& options);
-
- const char *
- GetObjectDescription ();
-
- const char *
- GetTypeValidatorResult ();
-
- lldb::SBValue
- GetDynamicValue (lldb::DynamicValueType use_dynamic);
-
- lldb::SBValue
- GetStaticValue ();
-
- lldb::SBValue
- GetNonSyntheticValue ();
-
- lldb::DynamicValueType
- GetPreferDynamicValue ();
-
- void
- SetPreferDynamicValue (lldb::DynamicValueType use_dynamic);
-
- bool
- GetPreferSyntheticValue ();
-
- void
- SetPreferSyntheticValue (bool use_synthetic);
-
- bool
- IsDynamic ();
-
- bool
- IsSynthetic ();
-
- bool
- IsSyntheticChildrenGenerated ();
-
- void
- SetSyntheticChildrenGenerated (bool);
-
- const char *
- GetLocation ();
-
- // Deprecated - use the one that takes SBError&
- bool
- SetValueFromCString (const char *value_str);
-
- bool
- SetValueFromCString (const char *value_str, lldb::SBError& error);
-
- lldb::SBTypeFormat
- GetTypeFormat ();
-
- lldb::SBTypeSummary
- GetTypeSummary ();
-
- lldb::SBTypeFilter
- GetTypeFilter ();
-
#ifndef LLDB_DISABLE_PYTHON
- lldb::SBTypeSynthetic
- GetTypeSynthetic ();
+ lldb::SBTypeSynthetic GetTypeSynthetic();
#endif
- lldb::SBValue
- GetChildAtIndex (uint32_t idx);
-
- lldb::SBValue
- CreateChildAtOffset (const char *name, uint32_t offset, lldb::SBType type);
-
- // Deprecated - use the expression evaluator to perform type casting
- lldb::SBValue
- Cast (lldb::SBType type);
-
- lldb::SBValue
- CreateValueFromExpression (const char *name, const char* expression);
-
- lldb::SBValue
- CreateValueFromExpression (const char *name, const char* expression, SBExpressionOptions &options);
-
- lldb::SBValue
- CreateValueFromAddress (const char* name,
- lldb::addr_t address,
- lldb::SBType type);
-
- // this has no address! GetAddress() and GetLoadAddress() as well as AddressOf()
- // on the return of this call all return invalid
- lldb::SBValue
- CreateValueFromData (const char* name,
- lldb::SBData data,
- lldb::SBType type);
-
- //------------------------------------------------------------------
- /// Get a child value by index from a value.
- ///
- /// Structs, unions, classes, arrays and pointers have child
- /// values that can be access by index.
- ///
- /// Structs and unions access child members using a zero based index
- /// for each child member. For
- ///
- /// Classes reserve the first indexes for base classes that have
- /// members (empty base classes are omitted), and all members of the
- /// current class will then follow the base classes.
- ///
- /// Pointers differ depending on what they point to. If the pointer
- /// points to a simple type, the child at index zero
- /// is the only child value available, unless \a synthetic_allowed
- /// is \b true, in which case the pointer will be used as an array
- /// and can create 'synthetic' child values using positive or
- /// negative indexes. If the pointer points to an aggregate type
- /// (an array, class, union, struct), then the pointee is
- /// transparently skipped and any children are going to be the indexes
- /// of the child values within the aggregate type. For example if
- /// we have a 'Point' type and we have a SBValue that contains a
- /// pointer to a 'Point' type, then the child at index zero will be
- /// the 'x' member, and the child at index 1 will be the 'y' member
- /// (the child at index zero won't be a 'Point' instance).
- ///
- /// If you actually need an SBValue that represents the type pointed
- /// to by a SBValue for which GetType().IsPointeeType() returns true,
- /// regardless of the pointee type, you can do that with SBValue::Dereference.
- ///
- /// Arrays have a preset number of children that can be accessed by
- /// index and will returns invalid child values for indexes that are
- /// out of bounds unless the \a synthetic_allowed is \b true. In this
- /// case the array can create 'synthetic' child values for indexes
- /// that aren't in the array bounds using positive or negative
- /// indexes.
- ///
- /// @param[in] idx
- /// The index of the child value to get
- ///
- /// @param[in] use_dynamic
- /// An enumeration that specifies whether to get dynamic values,
- /// and also if the target can be run to figure out the dynamic
- /// type of the child value.
- ///
- /// @param[in] can_create_synthetic
- /// If \b true, then allow child values to be created by index
- /// for pointers and arrays for indexes that normally wouldn't
- /// be allowed.
- ///
- /// @return
- /// A new SBValue object that represents the child member value.
- //------------------------------------------------------------------
- lldb::SBValue
- GetChildAtIndex (uint32_t idx,
- lldb::DynamicValueType use_dynamic,
- bool can_create_synthetic);
-
- // Matches children of this object only and will match base classes and
- // member names if this is a clang typed object.
- uint32_t
- GetIndexOfChildWithName (const char *name);
-
- // Matches child members of this object and child members of any base
- // classes.
- lldb::SBValue
- GetChildMemberWithName (const char *name);
-
- // Matches child members of this object and child members of any base
- // classes.
- lldb::SBValue
- GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic);
-
- // Expands nested expressions like .a->b[0].c[1]->d
- lldb::SBValue
- GetValueForExpressionPath(const char* expr_path);
-
- lldb::SBValue
- AddressOf();
-
- lldb::addr_t
- GetLoadAddress();
-
- lldb::SBAddress
- GetAddress();
-
- //------------------------------------------------------------------
- /// Get an SBData wrapping what this SBValue points to.
- ///
- /// This method will dereference the current SBValue, if its
- /// data type is a T* or T[], and extract item_count elements
- /// of type T from it, copying their contents in an SBData.
- ///
- /// @param[in] item_idx
- /// The index of the first item to retrieve. For an array
- /// this is equivalent to array[item_idx], for a pointer
- /// to *(pointer + item_idx). In either case, the measurement
- /// unit for item_idx is the sizeof(T) rather than the byte
- ///
- /// @param[in] item_count
- /// How many items should be copied into the output. By default
- /// only one item is copied, but more can be asked for.
- ///
- /// @return
- /// An SBData with the contents of the copied items, on success.
- /// An empty SBData otherwise.
- //------------------------------------------------------------------
- lldb::SBData
- GetPointeeData (uint32_t item_idx = 0,
- uint32_t item_count = 1);
-
- //------------------------------------------------------------------
- /// Get an SBData wrapping the contents of this SBValue.
- ///
- /// This method will read the contents of this object in memory
- /// and copy them into an SBData for future use.
- ///
- /// @return
- /// An SBData with the contents of this SBValue, on success.
- /// An empty SBData otherwise.
- //------------------------------------------------------------------
- lldb::SBData
- GetData ();
-
- bool
- SetData (lldb::SBData &data, lldb::SBError& error);
-
- lldb::SBDeclaration
- GetDeclaration ();
-
- //------------------------------------------------------------------
- /// Find out if a SBValue might have children.
- ///
- /// This call is much more efficient than GetNumChildren() as it
- /// doesn't need to complete the underlying type. This is designed
- /// to be used in a UI environment in order to detect if the
- /// disclosure triangle should be displayed or not.
- ///
- /// This function returns true for class, union, structure,
- /// pointers, references, arrays and more. Again, it does so without
- /// doing any expensive type completion.
- ///
- /// @return
- /// Returns \b true if the SBValue might have children, or \b
- /// false otherwise.
- //------------------------------------------------------------------
- bool
- MightHaveChildren ();
-
- bool
- IsRuntimeSupportValue ();
-
- uint32_t
- GetNumChildren ();
-
- uint32_t
- GetNumChildren (uint32_t max);
-
- void *
- GetOpaqueType();
-
- lldb::SBTarget
- GetTarget();
-
- lldb::SBProcess
- GetProcess();
-
- lldb::SBThread
- GetThread();
-
- lldb::SBFrame
- GetFrame();
-
- lldb::SBValue
- Dereference ();
-
- // Deprecated - please use GetType().IsPointerType() instead.
- bool
- TypeIsPointerType ();
-
- lldb::SBType
- GetType();
-
- lldb::SBValue
- Persist ();
-
- bool
- GetDescription (lldb::SBStream &description);
-
- bool
- GetExpressionPath (lldb::SBStream &description);
-
- bool
- GetExpressionPath (lldb::SBStream &description,
- bool qualify_cxx_base_classes);
-
- SBValue (const lldb::ValueObjectSP &value_sp);
-
- //------------------------------------------------------------------
- /// Watch this value if it resides in memory.
- ///
- /// Sets a watchpoint on the value.
- ///
- /// @param[in] resolve_location
- /// Resolve the location of this value once and watch its address.
- /// This value must currently be set to \b true as watching all
- /// locations of a variable or a variable path is not yet supported,
- /// though we plan to support it in the future.
- ///
- /// @param[in] read
- /// Stop when this value is accessed.
- ///
- /// @param[in] write
- /// Stop when this value is modified
- ///
- /// @param[out] error
- /// An error object. Contains the reason if there is some failure.
- ///
- /// @return
- /// An SBWatchpoint object. This object might not be valid upon
- /// return due to a value not being contained in memory, too
- /// large, or watchpoint resources are not available or all in
- /// use.
- //------------------------------------------------------------------
- lldb::SBWatchpoint
- Watch (bool resolve_location, bool read, bool write, SBError &error);
-
- // Backward compatibility fix in the interim.
- lldb::SBWatchpoint
- Watch (bool resolve_location, bool read, bool write);
-
- //------------------------------------------------------------------
- /// Watch this value that this value points to in memory
- ///
- /// Sets a watchpoint on the value.
- ///
- /// @param[in] resolve_location
- /// Resolve the location of this value once and watch its address.
- /// This value must currently be set to \b true as watching all
- /// locations of a variable or a variable path is not yet supported,
- /// though we plan to support it in the future.
- ///
- /// @param[in] read
- /// Stop when this value is accessed.
- ///
- /// @param[in] write
- /// Stop when this value is modified
- ///
- /// @param[out] error
- /// An error object. Contains the reason if there is some failure.
- ///
- /// @return
- /// An SBWatchpoint object. This object might not be valid upon
- /// return due to a value not being contained in memory, too
- /// large, or watchpoint resources are not available or all in
- /// use.
- //------------------------------------------------------------------
- lldb::SBWatchpoint
- WatchPointee (bool resolve_location, bool read, bool write, SBError &error);
-
- //------------------------------------------------------------------
- /// Same as the protected version of GetSP that takes a locker, except that we make the
- /// locker locally in the function. Since the Target API mutex is recursive, and the
- /// StopLocker is a read lock, you can call this function even if you are already
- /// holding the two above-mentioned locks.
- ///
- /// @return
- /// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
- /// can cons up, in accordance with the SBValue's settings.
- //------------------------------------------------------------------
- lldb::ValueObjectSP
- GetSP () const;
+ lldb::SBValue GetChildAtIndex(uint32_t idx);
+
+ lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset,
+ lldb::SBType type);
+
+ // Deprecated - use the expression evaluator to perform type casting
+ lldb::SBValue Cast(lldb::SBType type);
+
+ lldb::SBValue CreateValueFromExpression(const char *name,
+ const char *expression);
+
+ lldb::SBValue CreateValueFromExpression(const char *name,
+ const char *expression,
+ SBExpressionOptions &options);
+
+ lldb::SBValue CreateValueFromAddress(const char *name, lldb::addr_t address,
+ lldb::SBType type);
+
+ // this has no address! GetAddress() and GetLoadAddress() as well as
+ // AddressOf()
+ // on the return of this call all return invalid
+ lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
+ lldb::SBType type);
+
+ //------------------------------------------------------------------
+ /// Get a child value by index from a value.
+ ///
+ /// Structs, unions, classes, arrays and pointers have child
+ /// values that can be access by index.
+ ///
+ /// Structs and unions access child members using a zero based index
+ /// for each child member. For
+ ///
+ /// Classes reserve the first indexes for base classes that have
+ /// members (empty base classes are omitted), and all members of the
+ /// current class will then follow the base classes.
+ ///
+ /// Pointers differ depending on what they point to. If the pointer
+ /// points to a simple type, the child at index zero
+ /// is the only child value available, unless \a synthetic_allowed
+ /// is \b true, in which case the pointer will be used as an array
+ /// and can create 'synthetic' child values using positive or
+ /// negative indexes. If the pointer points to an aggregate type
+ /// (an array, class, union, struct), then the pointee is
+ /// transparently skipped and any children are going to be the indexes
+ /// of the child values within the aggregate type. For example if
+ /// we have a 'Point' type and we have a SBValue that contains a
+ /// pointer to a 'Point' type, then the child at index zero will be
+ /// the 'x' member, and the child at index 1 will be the 'y' member
+ /// (the child at index zero won't be a 'Point' instance).
+ ///
+ /// If you actually need an SBValue that represents the type pointed
+ /// to by a SBValue for which GetType().IsPointeeType() returns true,
+ /// regardless of the pointee type, you can do that with SBValue::Dereference.
+ ///
+ /// Arrays have a preset number of children that can be accessed by
+ /// index and will returns invalid child values for indexes that are
+ /// out of bounds unless the \a synthetic_allowed is \b true. In this
+ /// case the array can create 'synthetic' child values for indexes
+ /// that aren't in the array bounds using positive or negative
+ /// indexes.
+ ///
+ /// @param[in] idx
+ /// The index of the child value to get
+ ///
+ /// @param[in] use_dynamic
+ /// An enumeration that specifies whether to get dynamic values,
+ /// and also if the target can be run to figure out the dynamic
+ /// type of the child value.
+ ///
+ /// @param[in] can_create_synthetic
+ /// If \b true, then allow child values to be created by index
+ /// for pointers and arrays for indexes that normally wouldn't
+ /// be allowed.
+ ///
+ /// @return
+ /// A new SBValue object that represents the child member value.
+ //------------------------------------------------------------------
+ lldb::SBValue GetChildAtIndex(uint32_t idx,
+ lldb::DynamicValueType use_dynamic,
+ bool can_create_synthetic);
+
+ // Matches children of this object only and will match base classes and
+ // member names if this is a clang typed object.
+ uint32_t GetIndexOfChildWithName(const char *name);
+
+ // Matches child members of this object and child members of any base
+ // classes.
+ lldb::SBValue GetChildMemberWithName(const char *name);
+
+ // Matches child members of this object and child members of any base
+ // classes.
+ lldb::SBValue GetChildMemberWithName(const char *name,
+ lldb::DynamicValueType use_dynamic);
+
+ // Expands nested expressions like .a->b[0].c[1]->d
+ lldb::SBValue GetValueForExpressionPath(const char *expr_path);
+
+ lldb::SBValue AddressOf();
+
+ lldb::addr_t GetLoadAddress();
+
+ lldb::SBAddress GetAddress();
+
+ //------------------------------------------------------------------
+ /// Get an SBData wrapping what this SBValue points to.
+ ///
+ /// This method will dereference the current SBValue, if its
+ /// data type is a T* or T[], and extract item_count elements
+ /// of type T from it, copying their contents in an SBData.
+ ///
+ /// @param[in] item_idx
+ /// The index of the first item to retrieve. For an array
+ /// this is equivalent to array[item_idx], for a pointer
+ /// to *(pointer + item_idx). In either case, the measurement
+ /// unit for item_idx is the sizeof(T) rather than the byte
+ ///
+ /// @param[in] item_count
+ /// How many items should be copied into the output. By default
+ /// only one item is copied, but more can be asked for.
+ ///
+ /// @return
+ /// An SBData with the contents of the copied items, on success.
+ /// An empty SBData otherwise.
+ //------------------------------------------------------------------
+ lldb::SBData GetPointeeData(uint32_t item_idx = 0, uint32_t item_count = 1);
+
+ //------------------------------------------------------------------
+ /// Get an SBData wrapping the contents of this SBValue.
+ ///
+ /// This method will read the contents of this object in memory
+ /// and copy them into an SBData for future use.
+ ///
+ /// @return
+ /// An SBData with the contents of this SBValue, on success.
+ /// An empty SBData otherwise.
+ //------------------------------------------------------------------
+ lldb::SBData GetData();
+
+ bool SetData(lldb::SBData &data, lldb::SBError &error);
+
+ lldb::SBDeclaration GetDeclaration();
+
+ //------------------------------------------------------------------
+ /// Find out if a SBValue might have children.
+ ///
+ /// This call is much more efficient than GetNumChildren() as it
+ /// doesn't need to complete the underlying type. This is designed
+ /// to be used in a UI environment in order to detect if the
+ /// disclosure triangle should be displayed or not.
+ ///
+ /// This function returns true for class, union, structure,
+ /// pointers, references, arrays and more. Again, it does so without
+ /// doing any expensive type completion.
+ ///
+ /// @return
+ /// Returns \b true if the SBValue might have children, or \b
+ /// false otherwise.
+ //------------------------------------------------------------------
+ bool MightHaveChildren();
+
+ bool IsRuntimeSupportValue();
+
+ uint32_t GetNumChildren();
+
+ uint32_t GetNumChildren(uint32_t max);
+
+ void *GetOpaqueType();
+
+ lldb::SBTarget GetTarget();
+
+ lldb::SBProcess GetProcess();
+
+ lldb::SBThread GetThread();
+
+ lldb::SBFrame GetFrame();
+
+ lldb::SBValue Dereference();
+
+ // Deprecated - please use GetType().IsPointerType() instead.
+ bool TypeIsPointerType();
+
+ lldb::SBType GetType();
+
+ lldb::SBValue Persist();
+
+ bool GetDescription(lldb::SBStream &description);
+
+ bool GetExpressionPath(lldb::SBStream &description);
+
+ bool GetExpressionPath(lldb::SBStream &description,
+ bool qualify_cxx_base_classes);
+
+ SBValue(const lldb::ValueObjectSP &value_sp);
+
+ //------------------------------------------------------------------
+ /// Watch this value if it resides in memory.
+ ///
+ /// Sets a watchpoint on the value.
+ ///
+ /// @param[in] resolve_location
+ /// Resolve the location of this value once and watch its address.
+ /// This value must currently be set to \b true as watching all
+ /// locations of a variable or a variable path is not yet supported,
+ /// though we plan to support it in the future.
+ ///
+ /// @param[in] read
+ /// Stop when this value is accessed.
+ ///
+ /// @param[in] write
+ /// Stop when this value is modified
+ ///
+ /// @param[out] error
+ /// An error object. Contains the reason if there is some failure.
+ ///
+ /// @return
+ /// An SBWatchpoint object. This object might not be valid upon
+ /// return due to a value not being contained in memory, too
+ /// large, or watchpoint resources are not available or all in
+ /// use.
+ //------------------------------------------------------------------
+ lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write,
+ SBError &error);
+
+ // Backward compatibility fix in the interim.
+ lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write);
+
+ //------------------------------------------------------------------
+ /// Watch this value that this value points to in memory
+ ///
+ /// Sets a watchpoint on the value.
+ ///
+ /// @param[in] resolve_location
+ /// Resolve the location of this value once and watch its address.
+ /// This value must currently be set to \b true as watching all
+ /// locations of a variable or a variable path is not yet supported,
+ /// though we plan to support it in the future.
+ ///
+ /// @param[in] read
+ /// Stop when this value is accessed.
+ ///
+ /// @param[in] write
+ /// Stop when this value is modified
+ ///
+ /// @param[out] error
+ /// An error object. Contains the reason if there is some failure.
+ ///
+ /// @return
+ /// An SBWatchpoint object. This object might not be valid upon
+ /// return due to a value not being contained in memory, too
+ /// large, or watchpoint resources are not available or all in
+ /// use.
+ //------------------------------------------------------------------
+ lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write,
+ SBError &error);
+
+ //------------------------------------------------------------------
+ /// Same as the protected version of GetSP that takes a locker, except that we
+ /// make the
+ /// locker locally in the function. Since the Target API mutex is recursive,
+ /// and the
+ /// StopLocker is a read lock, you can call this function even if you are
+ /// already
+ /// holding the two above-mentioned locks.
+ ///
+ /// @return
+ /// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
+ /// can cons up, in accordance with the SBValue's settings.
+ //------------------------------------------------------------------
+ lldb::ValueObjectSP GetSP() const;
protected:
- friend class SBBlock;
- friend class SBFrame;
- friend class SBTarget;
- friend class SBThread;
- friend class SBValueList;
-
- //------------------------------------------------------------------
- /// Get the appropriate ValueObjectSP from this SBValue, consulting the
- /// use_dynamic and use_synthetic options passed in to SetSP when the
- /// SBValue's contents were set. Since this often requires examining memory,
- /// and maybe even running code, it needs to acquire the Target API and Process StopLock.
- /// Those are held in an opaque class ValueLocker which is currently local to SBValue.cpp.
- /// So you don't have to get these yourself just default construct a ValueLocker, and pass it into this.
- /// If we need to make a ValueLocker and use it in some other .cpp file, we'll have to move it to
- /// ValueObject.h/cpp or somewhere else convenient. We haven't needed to so far.
- ///
- /// @param[in] value_locker
- /// An object that will hold the Target API, and Process RunLocks, and
- /// auto-destroy them when it goes out of scope. Currently this is only useful in
- /// SBValue.cpp.
- ///
- /// @return
- /// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
- /// can cons up, in accordance with the SBValue's settings.
- //------------------------------------------------------------------
- lldb::ValueObjectSP
- GetSP (ValueLocker &value_locker) const;
-
- // these calls do the right thing WRT adjusting their settings according to the target's preferences
- void
- SetSP (const lldb::ValueObjectSP &sp);
-
- void
- SetSP (const lldb::ValueObjectSP &sp, bool use_synthetic);
-
- void
- SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic);
-
- void
- SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic);
-
- void
- SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, const char *name);
-
+ friend class SBBlock;
+ friend class SBFrame;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBValueList;
+
+ //------------------------------------------------------------------
+ /// Get the appropriate ValueObjectSP from this SBValue, consulting the
+ /// use_dynamic and use_synthetic options passed in to SetSP when the
+ /// SBValue's contents were set. Since this often requires examining memory,
+ /// and maybe even running code, it needs to acquire the Target API and
+ /// Process StopLock.
+ /// Those are held in an opaque class ValueLocker which is currently local to
+ /// SBValue.cpp.
+ /// So you don't have to get these yourself just default construct a
+ /// ValueLocker, and pass it into this.
+ /// If we need to make a ValueLocker and use it in some other .cpp file, we'll
+ /// have to move it to
+ /// ValueObject.h/cpp or somewhere else convenient. We haven't needed to so
+ /// far.
+ ///
+ /// @param[in] value_locker
+ /// An object that will hold the Target API, and Process RunLocks, and
+ /// auto-destroy them when it goes out of scope. Currently this is only
+ /// useful in
+ /// SBValue.cpp.
+ ///
+ /// @return
+ /// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
+ /// can cons up, in accordance with the SBValue's settings.
+ //------------------------------------------------------------------
+ lldb::ValueObjectSP GetSP(ValueLocker &value_locker) const;
+
+ // these calls do the right thing WRT adjusting their settings according to
+ // the target's preferences
+ void SetSP(const lldb::ValueObjectSP &sp);
+
+ void SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic);
+
+ void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic);
+
+ void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic,
+ bool use_synthetic);
+
+ void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic,
+ bool use_synthetic, const char *name);
+
private:
- typedef std::shared_ptr<ValueImpl> ValueImplSP;
- ValueImplSP m_opaque_sp;
-
- void
- SetSP (ValueImplSP impl_sp);
+ typedef std::shared_ptr<ValueImpl> ValueImplSP;
+ ValueImplSP m_opaque_sp;
+
+ void SetSP(ValueImplSP impl_sp);
};
} // namespace lldb
-#endif // LLDB_SBValue_h_
+#endif // LLDB_SBValue_h_
Modified: lldb/trunk/include/lldb/API/SBValueList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValueList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValueList.h (original)
+++ lldb/trunk/include/lldb/API/SBValueList.h Tue Sep 6 15:57:50 2016
@@ -16,81 +16,59 @@ class ValueListImpl;
namespace lldb {
-class LLDB_API SBValueList
-{
+class LLDB_API SBValueList {
public:
+ SBValueList();
- SBValueList ();
+ SBValueList(const lldb::SBValueList &rhs);
- SBValueList (const lldb::SBValueList &rhs);
+ ~SBValueList();
- ~SBValueList();
+ bool IsValid() const;
- bool
- IsValid() const;
-
- void
- Clear();
+ void Clear();
- void
- Append (const lldb::SBValue &val_obj);
+ void Append(const lldb::SBValue &val_obj);
- void
- Append (const lldb::SBValueList& value_list);
+ void Append(const lldb::SBValueList &value_list);
- uint32_t
- GetSize() const;
+ uint32_t GetSize() const;
- lldb::SBValue
- GetValueAtIndex (uint32_t idx) const;
-
- lldb::SBValue
- GetFirstValueByName (const char* name) const;
+ lldb::SBValue GetValueAtIndex(uint32_t idx) const;
- lldb::SBValue
- FindValueObjectByUID (lldb::user_id_t uid);
+ lldb::SBValue GetFirstValueByName(const char *name) const;
- const lldb::SBValueList &
- operator = (const lldb::SBValueList &rhs);
+ lldb::SBValue FindValueObjectByUID(lldb::user_id_t uid);
+
+ const lldb::SBValueList &operator=(const lldb::SBValueList &rhs);
protected:
-
- // only useful for visualizing the pointer or comparing two SBValueLists
- // to see if they are backed by the same underlying Impl.
- void *
- opaque_ptr ();
+ // only useful for visualizing the pointer or comparing two SBValueLists
+ // to see if they are backed by the same underlying Impl.
+ void *opaque_ptr();
private:
- friend class SBFrame;
-
- SBValueList (const ValueListImpl *lldb_object_ptr);
-
- void
- Append (lldb::ValueObjectSP& val_obj_sp);
-
- void
- CreateIfNeeded ();
-
- ValueListImpl *
- operator -> ();
-
- ValueListImpl &
- operator* ();
-
- const ValueListImpl *
- operator -> () const;
-
- const ValueListImpl &
- operator* () const;
-
-
- ValueListImpl &
- ref ();
-
- std::unique_ptr<ValueListImpl> m_opaque_ap;
-};
+ friend class SBFrame;
+
+ SBValueList(const ValueListImpl *lldb_object_ptr);
+
+ void Append(lldb::ValueObjectSP &val_obj_sp);
+
+ void CreateIfNeeded();
+
+ ValueListImpl *operator->();
+ ValueListImpl &operator*();
+
+ const ValueListImpl *operator->() const;
+
+ const ValueListImpl &operator*() const;
+
+ ValueListImpl &ref();
+
+ std::unique_ptr<ValueListImpl> m_opaque_ap;
+};
} // namespace lldb
-#endif // LLDB_SBValueList_h_
+#endif // LLDB_SBValueList_h_
Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original)
+++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- SBVariablesOptions.h ------------------------------------------*- C++ -*-===//
+//===-- SBVariablesOptions.h ------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -16,83 +17,61 @@ class VariablesOptionsImpl;
namespace lldb {
-class LLDB_API SBVariablesOptions
-{
+class LLDB_API SBVariablesOptions {
public:
- SBVariablesOptions ();
-
- SBVariablesOptions (const SBVariablesOptions& options);
-
- SBVariablesOptions&
- operator = (const SBVariablesOptions& options);
-
- ~SBVariablesOptions ();
-
- bool
- IsValid () const;
-
- bool
- GetIncludeArguments () const;
-
- void
- SetIncludeArguments (bool);
-
- bool
- GetIncludeLocals () const;
-
- void
- SetIncludeLocals (bool);
-
- bool
- GetIncludeStatics () const;
-
- void
- SetIncludeStatics (bool);
-
- bool
- GetInScopeOnly () const;
-
- void
- SetInScopeOnly (bool);
-
- bool
- GetIncludeRuntimeSupportValues () const;
-
- void
- SetIncludeRuntimeSupportValues (bool);
-
- lldb::DynamicValueType
- GetUseDynamic () const;
-
- void
- SetUseDynamic (lldb::DynamicValueType);
-
+ SBVariablesOptions();
+
+ SBVariablesOptions(const SBVariablesOptions &options);
+
+ SBVariablesOptions &operator=(const SBVariablesOptions &options);
+
+ ~SBVariablesOptions();
+
+ bool IsValid() const;
+
+ bool GetIncludeArguments() const;
+
+ void SetIncludeArguments(bool);
+
+ bool GetIncludeLocals() const;
+
+ void SetIncludeLocals(bool);
+
+ bool GetIncludeStatics() const;
+
+ void SetIncludeStatics(bool);
+
+ bool GetInScopeOnly() const;
+
+ void SetInScopeOnly(bool);
+
+ bool GetIncludeRuntimeSupportValues() const;
+
+ void SetIncludeRuntimeSupportValues(bool);
+
+ lldb::DynamicValueType GetUseDynamic() const;
+
+ void SetUseDynamic(lldb::DynamicValueType);
+
protected:
- VariablesOptionsImpl *
- operator->();
-
- const VariablesOptionsImpl *
- operator->() const;
-
- VariablesOptionsImpl *
- get ();
-
- VariablesOptionsImpl &
- ref();
-
- const VariablesOptionsImpl &
- ref() const;
-
- SBVariablesOptions (VariablesOptionsImpl *lldb_object_ptr);
-
- void
- SetOptions (VariablesOptionsImpl *lldb_object_ptr);
-
+ VariablesOptionsImpl *operator->();
+
+ const VariablesOptionsImpl *operator->() const;
+
+ VariablesOptionsImpl *get();
+
+ VariablesOptionsImpl &ref();
+
+ const VariablesOptionsImpl &ref() const;
+
+ SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr);
+
+ void SetOptions(VariablesOptionsImpl *lldb_object_ptr);
+
private:
-
- std::unique_ptr<VariablesOptionsImpl> m_opaque_ap;
+ std::unique_ptr<VariablesOptionsImpl> m_opaque_ap;
};
} // namespace lldb
-#endif // LLDB_SBValue_h_
+#endif // LLDB_SBValue_h_
Modified: lldb/trunk/include/lldb/API/SBWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpoint.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBWatchpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBWatchpoint.h Tue Sep 6 15:57:50 2016
@@ -14,91 +14,67 @@
namespace lldb {
-class LLDB_API SBWatchpoint
-{
+class LLDB_API SBWatchpoint {
public:
+ SBWatchpoint();
- SBWatchpoint ();
+ SBWatchpoint(const lldb::SBWatchpoint &rhs);
- SBWatchpoint (const lldb::SBWatchpoint &rhs);
+ SBWatchpoint(const lldb::WatchpointSP &wp_sp);
- SBWatchpoint (const lldb::WatchpointSP &wp_sp);
+ ~SBWatchpoint();
- ~SBWatchpoint ();
+ const lldb::SBWatchpoint &operator=(const lldb::SBWatchpoint &rhs);
- const lldb::SBWatchpoint &
- operator = (const lldb::SBWatchpoint &rhs);
+ bool IsValid() const;
- bool
- IsValid() const;
+ SBError GetError();
- SBError
- GetError();
+ watch_id_t GetID();
- watch_id_t
- GetID ();
+ /// With -1 representing an invalid hardware index.
+ int32_t GetHardwareIndex();
- /// With -1 representing an invalid hardware index.
- int32_t
- GetHardwareIndex ();
+ lldb::addr_t GetWatchAddress();
- lldb::addr_t
- GetWatchAddress ();
+ size_t GetWatchSize();
- size_t
- GetWatchSize();
+ void SetEnabled(bool enabled);
- void
- SetEnabled(bool enabled);
+ bool IsEnabled();
- bool
- IsEnabled ();
+ uint32_t GetHitCount();
- uint32_t
- GetHitCount ();
+ uint32_t GetIgnoreCount();
- uint32_t
- GetIgnoreCount ();
+ void SetIgnoreCount(uint32_t n);
- void
- SetIgnoreCount (uint32_t n);
+ const char *GetCondition();
- const char *
- GetCondition ();
+ void SetCondition(const char *condition);
- void
- SetCondition (const char *condition);
-
- bool
- GetDescription (lldb::SBStream &description, DescriptionLevel level);
+ bool GetDescription(lldb::SBStream &description, DescriptionLevel level);
- void
- Clear ();
+ void Clear();
- lldb::WatchpointSP
- GetSP () const;
+ lldb::WatchpointSP GetSP() const;
- void
- SetSP (const lldb::WatchpointSP &sp);
+ void SetSP(const lldb::WatchpointSP &sp);
- static bool
- EventIsWatchpointEvent (const lldb::SBEvent &event);
-
- static lldb::WatchpointEventType
- GetWatchpointEventTypeFromEvent (const lldb::SBEvent& event);
+ static bool EventIsWatchpointEvent(const lldb::SBEvent &event);
- static lldb::SBWatchpoint
- GetWatchpointFromEvent (const lldb::SBEvent& event);
+ static lldb::WatchpointEventType
+ GetWatchpointEventTypeFromEvent(const lldb::SBEvent &event);
-private:
- friend class SBTarget;
- friend class SBValue;
+ static lldb::SBWatchpoint GetWatchpointFromEvent(const lldb::SBEvent &event);
-
- lldb::WatchpointSP m_opaque_sp;
+private:
+ friend class SBTarget;
+ friend class SBValue;
+ lldb::WatchpointSP m_opaque_sp;
};
} // namespace lldb
-#endif // LLDB_SBWatchpoint_h_
+#endif // LLDB_SBWatchpoint_h_
Modified: lldb/trunk/include/lldb/API/SystemInitializerFull.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SystemInitializerFull.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SystemInitializerFull.h (original)
+++ lldb/trunk/include/lldb/API/SystemInitializerFull.h Tue Sep 6 15:57:50 2016
@@ -12,8 +12,7 @@
#include "lldb/Initialization/SystemInitializerCommon.h"
-namespace lldb_private
-{
+namespace lldb_private {
//------------------------------------------------------------------
/// Initializes lldb.
///
@@ -22,17 +21,16 @@ namespace lldb_private
/// not intended to be used externally, but is instead used
/// internally by SBDebugger to initialize the system.
//------------------------------------------------------------------
-class SystemInitializerFull : public SystemInitializerCommon
-{
- public:
- SystemInitializerFull();
- ~SystemInitializerFull() override;
+class SystemInitializerFull : public SystemInitializerCommon {
+public:
+ SystemInitializerFull();
+ ~SystemInitializerFull() override;
- void Initialize() override;
- void Terminate() override;
+ void Initialize() override;
+ void Terminate() override;
- private:
- void InitializeSWIG();
+private:
+ void InitializeSWIG();
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Tue Sep 6 15:57:50 2016
@@ -20,12 +20,12 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointID.h"
+#include "lldb/Breakpoint/BreakpointLocationCollection.h"
#include "lldb/Breakpoint/BreakpointLocationList.h"
#include "lldb/Breakpoint/BreakpointOptions.h"
-#include "lldb/Breakpoint/BreakpointLocationCollection.h"
#include "lldb/Breakpoint/Stoppoint.h"
-#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/Event.h"
+#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/StringList.h"
namespace lldb_private {
@@ -37,27 +37,35 @@ namespace lldb_private {
//----------------------------------------------------------------------
/// General Outline:
-/// A breakpoint has four main parts, a filter, a resolver, the list of breakpoint
-/// locations that have been determined for the filter/resolver pair, and finally
+/// A breakpoint has four main parts, a filter, a resolver, the list of
+/// breakpoint
+/// locations that have been determined for the filter/resolver pair, and
+/// finally
/// a set of options for the breakpoint.
///
/// \b Filter:
/// This is an object derived from SearchFilter. It manages the search
-/// for breakpoint location matches through the symbols in the module list of the target
-/// that owns it. It also filters out locations based on whatever logic it wants.
+/// for breakpoint location matches through the symbols in the module list of
+/// the target
+/// that owns it. It also filters out locations based on whatever logic it
+/// wants.
///
/// \b Resolver:
/// This is an object derived from BreakpointResolver. It provides a
-/// callback to the filter that will find breakpoint locations. How it does this is
+/// callback to the filter that will find breakpoint locations. How it does
+/// this is
/// determined by what kind of resolver it is.
///
-/// The Breakpoint class also provides constructors for the common breakpoint cases
+/// The Breakpoint class also provides constructors for the common breakpoint
+/// cases
/// which make the appropriate filter and resolver for you.
///
/// \b Location List:
/// This stores the breakpoint locations that have been determined
-/// to date. For a given breakpoint, there will be only one location with a given
-/// address. Adding a location at an already taken address will just return the location
+/// to date. For a given breakpoint, there will be only one location with a
+/// given
+/// address. Adding a location at an already taken address will just return the
+/// location
/// already at that address. Locations can be looked up by ID, or by address.
///
/// \b Options:
@@ -66,734 +74,664 @@ namespace lldb_private {
/// \b Ignore Count
/// \b Callback
/// \b Condition
-/// Note, these options can be set on the breakpoint, and they can also be set on the
-/// individual locations. The options set on the breakpoint take precedence over the
+/// Note, these options can be set on the breakpoint, and they can also be set
+/// on the
+/// individual locations. The options set on the breakpoint take precedence
+/// over the
/// options set on the individual location.
-/// So for instance disabling the breakpoint will cause NONE of the locations to get hit.
-/// But if the breakpoint is enabled, then the location's enabled state will be checked
+/// So for instance disabling the breakpoint will cause NONE of the locations to
+/// get hit.
+/// But if the breakpoint is enabled, then the location's enabled state will be
+/// checked
/// to determine whether to insert that breakpoint location.
-/// Similarly, if the breakpoint condition says "stop", we won't check the location's condition.
-/// But if the breakpoint condition says "continue", then we will check the location for whether
+/// Similarly, if the breakpoint condition says "stop", we won't check the
+/// location's condition.
+/// But if the breakpoint condition says "continue", then we will check the
+/// location for whether
/// to actually stop or not.
-/// One subtle point worth observing here is that you don't actually stop at a Breakpoint, you
-/// always stop at one of its locations. So the "should stop" tests are done by the location,
+/// One subtle point worth observing here is that you don't actually stop at a
+/// Breakpoint, you
+/// always stop at one of its locations. So the "should stop" tests are done by
+/// the location,
/// not by the breakpoint.
//----------------------------------------------------------------------
-class Breakpoint:
- public std::enable_shared_from_this<Breakpoint>,
- public Stoppoint
-{
+class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
+ public Stoppoint {
public:
- static const ConstString &
- GetEventIdentifier ();
+ static const ConstString &GetEventIdentifier();
- //------------------------------------------------------------------
- /// An enum specifying the match style for breakpoint settings. At
- /// present only used for function name style breakpoints.
- //------------------------------------------------------------------
- typedef enum
- {
- Exact,
- Regexp,
- Glob
- } MatchType;
-
- class BreakpointEventData :
- public EventData
- {
- public:
- BreakpointEventData (lldb::BreakpointEventType sub_type,
- const lldb::BreakpointSP &new_breakpoint_sp);
-
- ~BreakpointEventData() override;
-
- static const ConstString &
- GetFlavorString ();
-
- const ConstString &
- GetFlavor() const override;
-
- lldb::BreakpointEventType
- GetBreakpointEventType () const;
-
- lldb::BreakpointSP &
- GetBreakpoint ();
-
- BreakpointLocationCollection &
- GetBreakpointLocationCollection()
- {
- return m_locations;
- }
-
- void
- Dump(Stream *s) const override;
-
- static lldb::BreakpointEventType
- GetBreakpointEventTypeFromEvent (const lldb::EventSP &event_sp);
-
- static lldb::BreakpointSP
- GetBreakpointFromEvent (const lldb::EventSP &event_sp);
-
- static lldb::BreakpointLocationSP
- GetBreakpointLocationAtIndexFromEvent (const lldb::EventSP &event_sp, uint32_t loc_idx);
-
- static size_t
- GetNumBreakpointLocationsFromEvent (const lldb::EventSP &event_sp);
-
- static const BreakpointEventData *
- GetEventDataFromEvent (const Event *event_sp);
-
- private:
- lldb::BreakpointEventType m_breakpoint_event;
- lldb::BreakpointSP m_new_breakpoint_sp;
- BreakpointLocationCollection m_locations;
-
- DISALLOW_COPY_AND_ASSIGN (BreakpointEventData);
- };
-
- class BreakpointPrecondition
- {
- public:
- virtual ~BreakpointPrecondition() = default;
-
- virtual bool
- EvaluatePrecondition(StoppointCallbackContext &context);
-
- virtual Error
- ConfigurePrecondition(Args &options);
-
- virtual void
- GetDescription(Stream &stream, lldb::DescriptionLevel level);
- };
-
- typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP;
-
- //------------------------------------------------------------------
- /// Destructor.
- ///
- /// The destructor is not virtual since there should be no reason to subclass
- /// breakpoints. The varieties of breakpoints are specified instead by
- /// providing different resolvers & filters.
- //------------------------------------------------------------------
- ~Breakpoint() override;
-
- //------------------------------------------------------------------
- // Methods
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Tell whether this breakpoint is an "internal" breakpoint.
- /// @return
- /// Returns \b true if this is an internal breakpoint, \b false otherwise.
- //------------------------------------------------------------------
- bool
- IsInternal () const;
-
- //------------------------------------------------------------------
- /// Standard "Dump" method. At present it does nothing.
- //------------------------------------------------------------------
- void
- Dump(Stream *s) override;
-
- //------------------------------------------------------------------
- // The next set of methods provide ways to tell the breakpoint to update
- // it's location list - usually done when modules appear or disappear.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Tell this breakpoint to clear all its breakpoint sites. Done
- /// when the process holding the breakpoint sites is destroyed.
- //------------------------------------------------------------------
- void
- ClearAllBreakpointSites ();
-
- //------------------------------------------------------------------
- /// Tell this breakpoint to scan it's target's module list and resolve any
- /// new locations that match the breakpoint's specifications.
- //------------------------------------------------------------------
- void
- ResolveBreakpoint ();
-
- //------------------------------------------------------------------
- /// Tell this breakpoint to scan a given module list and resolve any
- /// new locations that match the breakpoint's specifications.
- ///
- /// @param[in] module_list
- /// The list of modules to look in for new locations.
- ///
- /// @param[in] send_event
- /// If \b true, send a breakpoint location added event for non-internal breakpoints.
- //------------------------------------------------------------------
- void
- ResolveBreakpointInModules (ModuleList &module_list, bool send_event = true);
-
- //------------------------------------------------------------------
- /// Tell this breakpoint to scan a given module list and resolve any
- /// new locations that match the breakpoint's specifications.
- ///
- /// @param[in] changed_modules
- /// The list of modules to look in for new locations.
- ///
- /// @param[in] new_locations
- /// Fills new_locations with the new locations that were made.
- //------------------------------------------------------------------
- void
- ResolveBreakpointInModules (ModuleList &module_list, BreakpointLocationCollection &new_locations);
-
- //------------------------------------------------------------------
- /// Like ResolveBreakpointInModules, but allows for "unload" events, in
- /// which case we will remove any locations that are in modules that got
- /// unloaded.
- ///
- /// @param[in] changedModules
- /// The list of modules to look in for new locations.
- /// @param[in] load_event
- /// If \b true then the modules were loaded, if \b false, unloaded.
- /// @param[in] delete_locations
- /// If \b true then the modules were unloaded delete any locations in the changed modules.
- //------------------------------------------------------------------
- void
- ModulesChanged (ModuleList &changed_modules,
- bool load_event,
- bool delete_locations = false);
-
- //------------------------------------------------------------------
- /// Tells the breakpoint the old module \a old_module_sp has been
- /// replaced by new_module_sp (usually because the underlying file has been
- /// rebuilt, and the old version is gone.)
- ///
- /// @param[in] old_module_sp
- /// The old module that is going away.
- /// @param[in] new_module_sp
- /// The new module that is replacing it.
- //------------------------------------------------------------------
- void
- ModuleReplaced (lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp);
-
- //------------------------------------------------------------------
- // The next set of methods provide access to the breakpoint locations
- // for this breakpoint.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Add a location to the breakpoint's location list. This is only meant
- /// to be called by the breakpoint's resolver. FIXME: how do I ensure that?
- ///
- /// @param[in] addr
- /// The Address specifying the new location.
- /// @param[out] new_location
- /// Set to \b true if a new location was created, to \b false if there
- /// already was a location at this Address.
- /// @return
- /// Returns a pointer to the new location.
- //------------------------------------------------------------------
- lldb::BreakpointLocationSP
- AddLocation(const Address &addr,
- bool *new_location = nullptr);
-
- //------------------------------------------------------------------
- /// Find a breakpoint location by Address.
- ///
- /// @param[in] addr
- /// The Address specifying the location.
- /// @return
- /// Returns a shared pointer to the location at \a addr. The pointer
- /// in the shared pointer will be nullptr if there is no location at that address.
- //------------------------------------------------------------------
- lldb::BreakpointLocationSP
- FindLocationByAddress (const Address &addr);
-
- //------------------------------------------------------------------
- /// Find a breakpoint location ID by Address.
- ///
- /// @param[in] addr
- /// The Address specifying the location.
- /// @return
- /// Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if
- /// there is no breakpoint location at that address.
- //------------------------------------------------------------------
- lldb::break_id_t
- FindLocationIDByAddress (const Address &addr);
-
- //------------------------------------------------------------------
- /// Find a breakpoint location for a given breakpoint location ID.
- ///
- /// @param[in] bp_loc_id
- /// The ID specifying the location.
- /// @return
- /// Returns a shared pointer to the location with ID \a bp_loc_id. The pointer
- /// in the shared pointer will be nullptr if there is no location with that ID.
- //------------------------------------------------------------------
- lldb::BreakpointLocationSP
- FindLocationByID (lldb::break_id_t bp_loc_id);
-
- //------------------------------------------------------------------
- /// Get breakpoint locations by index.
- ///
- /// @param[in] index
- /// The location index.
- ///
- /// @return
- /// Returns a shared pointer to the location with index \a
- /// index. The shared pointer might contain nullptr if \a index is
- /// greater than then number of actual locations.
- //------------------------------------------------------------------
- lldb::BreakpointLocationSP
- GetLocationAtIndex (size_t index);
-
- //------------------------------------------------------------------
- /// Removes all invalid breakpoint locations.
- ///
- /// Removes all breakpoint locations with architectures that aren't
- /// compatible with \a arch. Also remove any breakpoint locations
- /// with whose locations have address where the section has been
- /// deleted (module and object files no longer exist).
- ///
- /// This is typically used after the process calls exec, or anytime
- /// the architecture of the target changes.
- ///
- /// @param[in] arch
- /// If valid, check the module in each breakpoint to make sure
- /// they are compatible, otherwise, ignore architecture.
- //------------------------------------------------------------------
- void
- RemoveInvalidLocations (const ArchSpec &arch);
-
- //------------------------------------------------------------------
- // The next section deals with various breakpoint options.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
- //------------------------------------------------------------------
- void
- SetEnabled(bool enable) override;
-
- //------------------------------------------------------------------
- /// Check the Enable/Disable state.
- /// @return
- /// \b true if the breakpoint is enabled, \b false if disabled.
- //------------------------------------------------------------------
- bool
- IsEnabled() override;
-
- //------------------------------------------------------------------
- /// Set the breakpoint to ignore the next \a count breakpoint hits.
- /// @param[in] count
- /// The number of breakpoint hits to ignore.
- //------------------------------------------------------------------
- void
- SetIgnoreCount (uint32_t count);
-
- //------------------------------------------------------------------
- /// Return the current ignore count/
- /// @return
- /// The number of breakpoint hits to be ignored.
- //------------------------------------------------------------------
- uint32_t
- GetIgnoreCount () const;
-
- //------------------------------------------------------------------
- /// Return the current hit count for all locations.
- /// @return
- /// The current hit count for all locations.
- //------------------------------------------------------------------
- uint32_t
- GetHitCount () const;
-
- //------------------------------------------------------------------
- /// If \a one_shot is \b true, breakpoint will be deleted on first hit.
- //------------------------------------------------------------------
- void
- SetOneShot (bool one_shot);
-
- //------------------------------------------------------------------
- /// Check the OneShot state.
- /// @return
- /// \b true if the breakpoint is one shot, \b false otherwise.
- //------------------------------------------------------------------
- bool
- IsOneShot () const;
-
- //------------------------------------------------------------------
- /// Set the valid thread to be checked when the breakpoint is hit.
- /// @param[in] thread_id
- /// If this thread hits the breakpoint, we stop, otherwise not.
- //------------------------------------------------------------------
- void
- SetThreadID (lldb::tid_t thread_id);
-
- //------------------------------------------------------------------
- /// Return the current stop thread value.
- /// @return
- /// The thread id for which the breakpoint hit will stop, LLDB_INVALID_THREAD_ID for all threads.
- //------------------------------------------------------------------
- lldb::tid_t
- GetThreadID () const;
-
- void
- SetThreadIndex (uint32_t index);
-
- uint32_t
- GetThreadIndex() const;
-
- void
- SetThreadName (const char *thread_name);
-
- const char *
- GetThreadName () const;
-
- void
- SetQueueName (const char *queue_name);
-
- const char *
- GetQueueName () const;
-
- //------------------------------------------------------------------
- /// Set the callback action invoked when the breakpoint is hit.
- ///
- /// @param[in] callback
- /// The method that will get called when the breakpoint is hit.
- /// @param[in] baton
- /// A void * pointer that will get passed back to the callback function.
- /// @param[in] is_synchronous
- /// If \b true the callback will be run on the private event thread
- /// before the stop event gets reported. If false, the callback will get
- /// handled on the public event thread after the stop has been posted.
- ///
- /// @return
- /// \b true if the process should stop when you hit the breakpoint.
- /// \b false if it should continue.
- //------------------------------------------------------------------
- void
- SetCallback (BreakpointHitCallback callback,
- void *baton,
- bool is_synchronous = false);
-
- void
- SetCallback (BreakpointHitCallback callback,
- const lldb::BatonSP &callback_baton_sp,
- bool is_synchronous = false);
-
- void
- ClearCallback ();
-
- //------------------------------------------------------------------
- /// Set the breakpoint's condition.
- ///
- /// @param[in] condition
- /// The condition expression to evaluate when the breakpoint is hit.
- /// Pass in nullptr to clear the condition.
- //------------------------------------------------------------------
- void SetCondition (const char *condition);
-
- //------------------------------------------------------------------
- /// Return a pointer to the text of the condition expression.
- ///
- /// @return
- /// A pointer to the condition expression text, or nullptr if no
- // condition has been set.
- //------------------------------------------------------------------
- const char *GetConditionText () const;
-
- //------------------------------------------------------------------
- // The next section are various utility functions.
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Return the number of breakpoint locations that have resolved to
- /// actual breakpoint sites.
- ///
- /// @return
- /// The number locations resolved breakpoint sites.
- //------------------------------------------------------------------
- size_t
- GetNumResolvedLocations() const;
-
- //------------------------------------------------------------------
- /// Return the number of breakpoint locations.
- ///
- /// @return
- /// The number breakpoint locations.
- //------------------------------------------------------------------
- size_t
- GetNumLocations() const;
-
- //------------------------------------------------------------------
- /// Put a description of this breakpoint into the stream \a s.
- ///
- /// @param[in] s
- /// Stream into which to dump the description.
- ///
- /// @param[in] level
- /// The description level that indicates the detail level to
- /// provide.
- ///
- /// @see lldb::DescriptionLevel
- //------------------------------------------------------------------
- void
- GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations = false);
-
- //------------------------------------------------------------------
- /// Set the "kind" description for a breakpoint. If the breakpoint is hit
- /// the stop info will show this "kind" description instead of the breakpoint
- /// number. Mostly useful for internal breakpoints, where the breakpoint number
- /// doesn't have meaning to the user.
- ///
- /// @param[in] kind
- /// New "kind" description.
- //------------------------------------------------------------------
- void
- SetBreakpointKind (const char *kind)
- {
- m_kind_description.assign (kind);
- }
-
- //------------------------------------------------------------------
- /// Return the "kind" description for a breakpoint.
- ///
- /// @return
- /// The breakpoint kind, or nullptr if none is set.
- //------------------------------------------------------------------
- const char *GetBreakpointKind () const
- {
- return m_kind_description.c_str();
- }
-
- //------------------------------------------------------------------
- /// Accessor for the breakpoint Target.
- /// @return
- /// This breakpoint's Target.
- //------------------------------------------------------------------
- Target &
- GetTarget ()
- {
- return m_target;
- }
+ //------------------------------------------------------------------
+ /// An enum specifying the match style for breakpoint settings. At
+ /// present only used for function name style breakpoints.
+ //------------------------------------------------------------------
+ typedef enum { Exact, Regexp, Glob } MatchType;
+
+ class BreakpointEventData : public EventData {
+ public:
+ BreakpointEventData(lldb::BreakpointEventType sub_type,
+ const lldb::BreakpointSP &new_breakpoint_sp);
+
+ ~BreakpointEventData() override;
+
+ static const ConstString &GetFlavorString();
+
+ const ConstString &GetFlavor() const override;
+
+ lldb::BreakpointEventType GetBreakpointEventType() const;
+
+ lldb::BreakpointSP &GetBreakpoint();
+
+ BreakpointLocationCollection &GetBreakpointLocationCollection() {
+ return m_locations;
+ }
+
+ void Dump(Stream *s) const override;
+
+ static lldb::BreakpointEventType
+ GetBreakpointEventTypeFromEvent(const lldb::EventSP &event_sp);
+
+ static lldb::BreakpointSP
+ GetBreakpointFromEvent(const lldb::EventSP &event_sp);
+
+ static lldb::BreakpointLocationSP
+ GetBreakpointLocationAtIndexFromEvent(const lldb::EventSP &event_sp,
+ uint32_t loc_idx);
+
+ static size_t
+ GetNumBreakpointLocationsFromEvent(const lldb::EventSP &event_sp);
+
+ static const BreakpointEventData *
+ GetEventDataFromEvent(const Event *event_sp);
+
+ private:
+ lldb::BreakpointEventType m_breakpoint_event;
+ lldb::BreakpointSP m_new_breakpoint_sp;
+ BreakpointLocationCollection m_locations;
+
+ DISALLOW_COPY_AND_ASSIGN(BreakpointEventData);
+ };
+
+ class BreakpointPrecondition {
+ public:
+ virtual ~BreakpointPrecondition() = default;
+
+ virtual bool EvaluatePrecondition(StoppointCallbackContext &context);
+
+ virtual Error ConfigurePrecondition(Args &options);
+
+ virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level);
+ };
+
+ typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP;
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is not virtual since there should be no reason to subclass
+ /// breakpoints. The varieties of breakpoints are specified instead by
+ /// providing different resolvers & filters.
+ //------------------------------------------------------------------
+ ~Breakpoint() override;
+
+ //------------------------------------------------------------------
+ // Methods
+ //------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// Tell whether this breakpoint is an "internal" breakpoint.
+ /// @return
+ /// Returns \b true if this is an internal breakpoint, \b false otherwise.
+ //------------------------------------------------------------------
+ bool IsInternal() const;
+
+ //------------------------------------------------------------------
+ /// Standard "Dump" method. At present it does nothing.
+ //------------------------------------------------------------------
+ void Dump(Stream *s) override;
+
+ //------------------------------------------------------------------
+ // The next set of methods provide ways to tell the breakpoint to update
+ // it's location list - usually done when modules appear or disappear.
+ //------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// Tell this breakpoint to clear all its breakpoint sites. Done
+ /// when the process holding the breakpoint sites is destroyed.
+ //------------------------------------------------------------------
+ void ClearAllBreakpointSites();
+
+ //------------------------------------------------------------------
+ /// Tell this breakpoint to scan it's target's module list and resolve any
+ /// new locations that match the breakpoint's specifications.
+ //------------------------------------------------------------------
+ void ResolveBreakpoint();
+
+ //------------------------------------------------------------------
+ /// Tell this breakpoint to scan a given module list and resolve any
+ /// new locations that match the breakpoint's specifications.
+ ///
+ /// @param[in] module_list
+ /// The list of modules to look in for new locations.
+ ///
+ /// @param[in] send_event
+ /// If \b true, send a breakpoint location added event for non-internal
+ /// breakpoints.
+ //------------------------------------------------------------------
+ void ResolveBreakpointInModules(ModuleList &module_list,
+ bool send_event = true);
+
+ //------------------------------------------------------------------
+ /// Tell this breakpoint to scan a given module list and resolve any
+ /// new locations that match the breakpoint's specifications.
+ ///
+ /// @param[in] changed_modules
+ /// The list of modules to look in for new locations.
+ ///
+ /// @param[in] new_locations
+ /// Fills new_locations with the new locations that were made.
+ //------------------------------------------------------------------
+ void ResolveBreakpointInModules(ModuleList &module_list,
+ BreakpointLocationCollection &new_locations);
+
+ //------------------------------------------------------------------
+ /// Like ResolveBreakpointInModules, but allows for "unload" events, in
+ /// which case we will remove any locations that are in modules that got
+ /// unloaded.
+ ///
+ /// @param[in] changedModules
+ /// The list of modules to look in for new locations.
+ /// @param[in] load_event
+ /// If \b true then the modules were loaded, if \b false, unloaded.
+ /// @param[in] delete_locations
+ /// If \b true then the modules were unloaded delete any locations in the
+ /// changed modules.
+ //------------------------------------------------------------------
+ void ModulesChanged(ModuleList &changed_modules, bool load_event,
+ bool delete_locations = false);
+
+ //------------------------------------------------------------------
+ /// Tells the breakpoint the old module \a old_module_sp has been
+ /// replaced by new_module_sp (usually because the underlying file has been
+ /// rebuilt, and the old version is gone.)
+ ///
+ /// @param[in] old_module_sp
+ /// The old module that is going away.
+ /// @param[in] new_module_sp
+ /// The new module that is replacing it.
+ //------------------------------------------------------------------
+ void ModuleReplaced(lldb::ModuleSP old_module_sp,
+ lldb::ModuleSP new_module_sp);
+
+ //------------------------------------------------------------------
+ // The next set of methods provide access to the breakpoint locations
+ // for this breakpoint.
+ //------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// Add a location to the breakpoint's location list. This is only meant
+ /// to be called by the breakpoint's resolver. FIXME: how do I ensure that?
+ ///
+ /// @param[in] addr
+ /// The Address specifying the new location.
+ /// @param[out] new_location
+ /// Set to \b true if a new location was created, to \b false if there
+ /// already was a location at this Address.
+ /// @return
+ /// Returns a pointer to the new location.
+ //------------------------------------------------------------------
+ lldb::BreakpointLocationSP AddLocation(const Address &addr,
+ bool *new_location = nullptr);
+
+ //------------------------------------------------------------------
+ /// Find a breakpoint location by Address.
+ ///
+ /// @param[in] addr
+ /// The Address specifying the location.
+ /// @return
+ /// Returns a shared pointer to the location at \a addr. The pointer
+ /// in the shared pointer will be nullptr if there is no location at that
+ /// address.
+ //------------------------------------------------------------------
+ lldb::BreakpointLocationSP FindLocationByAddress(const Address &addr);
+
+ //------------------------------------------------------------------
+ /// Find a breakpoint location ID by Address.
+ ///
+ /// @param[in] addr
+ /// The Address specifying the location.
+ /// @return
+ /// Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if
+ /// there is no breakpoint location at that address.
+ //------------------------------------------------------------------
+ lldb::break_id_t FindLocationIDByAddress(const Address &addr);
+
+ //------------------------------------------------------------------
+ /// Find a breakpoint location for a given breakpoint location ID.
+ ///
+ /// @param[in] bp_loc_id
+ /// The ID specifying the location.
+ /// @return
+ /// Returns a shared pointer to the location with ID \a bp_loc_id. The
+ /// pointer
+ /// in the shared pointer will be nullptr if there is no location with that
+ /// ID.
+ //------------------------------------------------------------------
+ lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id);
+
+ //------------------------------------------------------------------
+ /// Get breakpoint locations by index.
+ ///
+ /// @param[in] index
+ /// The location index.
+ ///
+ /// @return
+ /// Returns a shared pointer to the location with index \a
+ /// index. The shared pointer might contain nullptr if \a index is
+ /// greater than then number of actual locations.
+ //------------------------------------------------------------------
+ lldb::BreakpointLocationSP GetLocationAtIndex(size_t index);
+
+ //------------------------------------------------------------------
+ /// Removes all invalid breakpoint locations.
+ ///
+ /// Removes all breakpoint locations with architectures that aren't
+ /// compatible with \a arch. Also remove any breakpoint locations
+ /// with whose locations have address where the section has been
+ /// deleted (module and object files no longer exist).
+ ///
+ /// This is typically used after the process calls exec, or anytime
+ /// the architecture of the target changes.
+ ///
+ /// @param[in] arch
+ /// If valid, check the module in each breakpoint to make sure
+ /// they are compatible, otherwise, ignore architecture.
+ //------------------------------------------------------------------
+ void RemoveInvalidLocations(const ArchSpec &arch);
+
+ //------------------------------------------------------------------
+ // The next section deals with various breakpoint options.
+ //------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+ //------------------------------------------------------------------
+ void SetEnabled(bool enable) override;
+
+ //------------------------------------------------------------------
+ /// Check the Enable/Disable state.
+ /// @return
+ /// \b true if the breakpoint is enabled, \b false if disabled.
+ //------------------------------------------------------------------
+ bool IsEnabled() override;
+
+ //------------------------------------------------------------------
+ /// Set the breakpoint to ignore the next \a count breakpoint hits.
+ /// @param[in] count
+ /// The number of breakpoint hits to ignore.
+ //------------------------------------------------------------------
+ void SetIgnoreCount(uint32_t count);
+
+ //------------------------------------------------------------------
+ /// Return the current ignore count/
+ /// @return
+ /// The number of breakpoint hits to be ignored.
+ //------------------------------------------------------------------
+ uint32_t GetIgnoreCount() const;
+
+ //------------------------------------------------------------------
+ /// Return the current hit count for all locations.
+ /// @return
+ /// The current hit count for all locations.
+ //------------------------------------------------------------------
+ uint32_t GetHitCount() const;
+
+ //------------------------------------------------------------------
+ /// If \a one_shot is \b true, breakpoint will be deleted on first hit.
+ //------------------------------------------------------------------
+ void SetOneShot(bool one_shot);
+
+ //------------------------------------------------------------------
+ /// Check the OneShot state.
+ /// @return
+ /// \b true if the breakpoint is one shot, \b false otherwise.
+ //------------------------------------------------------------------
+ bool IsOneShot() const;
+
+ //------------------------------------------------------------------
+ /// Set the valid thread to be checked when the breakpoint is hit.
+ /// @param[in] thread_id
+ /// If this thread hits the breakpoint, we stop, otherwise not.
+ //------------------------------------------------------------------
+ void SetThreadID(lldb::tid_t thread_id);
+
+ //------------------------------------------------------------------
+ /// Return the current stop thread value.
+ /// @return
+ /// The thread id for which the breakpoint hit will stop,
+ /// LLDB_INVALID_THREAD_ID for all threads.
+ //------------------------------------------------------------------
+ lldb::tid_t GetThreadID() const;
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ //------------------------------------------------------------------
+ /// Set the callback action invoked when the breakpoint is hit.
+ ///
+ /// @param[in] callback
+ /// The method that will get called when the breakpoint is hit.
+ /// @param[in] baton
+ /// A void * pointer that will get passed back to the callback function.
+ /// @param[in] is_synchronous
+ /// If \b true the callback will be run on the private event thread
+ /// before the stop event gets reported. If false, the callback will get
+ /// handled on the public event thread after the stop has been posted.
+ ///
+ /// @return
+ /// \b true if the process should stop when you hit the breakpoint.
+ /// \b false if it should continue.
+ //------------------------------------------------------------------
+ void SetCallback(BreakpointHitCallback callback, void *baton,
+ bool is_synchronous = false);
+
+ void SetCallback(BreakpointHitCallback callback,
+ const lldb::BatonSP &callback_baton_sp,
+ bool is_synchronous = false);
+
+ void ClearCallback();
+
+ //------------------------------------------------------------------
+ /// Set the breakpoint's condition.
+ ///
+ /// @param[in] condition
+ /// The condition expression to evaluate when the breakpoint is hit.
+ /// Pass in nullptr to clear the condition.
+ //------------------------------------------------------------------
+ void SetCondition(const char *condition);
+
+ //------------------------------------------------------------------
+ /// Return a pointer to the text of the condition expression.
+ ///
+ /// @return
+ /// A pointer to the condition expression text, or nullptr if no
+ // condition has been set.
+ //------------------------------------------------------------------
+ const char *GetConditionText() const;
+
+ //------------------------------------------------------------------
+ // The next section are various utility functions.
+ //------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// Return the number of breakpoint locations that have resolved to
+ /// actual breakpoint sites.
+ ///
+ /// @return
+ /// The number locations resolved breakpoint sites.
+ //------------------------------------------------------------------
+ size_t GetNumResolvedLocations() const;
+
+ //------------------------------------------------------------------
+ /// Return the number of breakpoint locations.
+ ///
+ /// @return
+ /// The number breakpoint locations.
+ //------------------------------------------------------------------
+ size_t GetNumLocations() const;
+
+ //------------------------------------------------------------------
+ /// Put a description of this breakpoint into the stream \a s.
+ ///
+ /// @param[in] s
+ /// Stream into which to dump the description.
+ ///
+ /// @param[in] level
+ /// The description level that indicates the detail level to
+ /// provide.
+ ///
+ /// @see lldb::DescriptionLevel
+ //------------------------------------------------------------------
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ bool show_locations = false);
+
+ //------------------------------------------------------------------
+ /// Set the "kind" description for a breakpoint. If the breakpoint is hit
+ /// the stop info will show this "kind" description instead of the breakpoint
+ /// number. Mostly useful for internal breakpoints, where the breakpoint
+ /// number
+ /// doesn't have meaning to the user.
+ ///
+ /// @param[in] kind
+ /// New "kind" description.
+ //------------------------------------------------------------------
+ void SetBreakpointKind(const char *kind) { m_kind_description.assign(kind); }
+
+ //------------------------------------------------------------------
+ /// Return the "kind" description for a breakpoint.
+ ///
+ /// @return
+ /// The breakpoint kind, or nullptr if none is set.
+ //------------------------------------------------------------------
+ const char *GetBreakpointKind() const { return m_kind_description.c_str(); }
+
+ //------------------------------------------------------------------
+ /// Accessor for the breakpoint Target.
+ /// @return
+ /// This breakpoint's Target.
+ //------------------------------------------------------------------
+ Target &GetTarget() { return m_target; }
+
+ const Target &GetTarget() const { return m_target; }
+
+ const lldb::TargetSP GetTargetSP();
+
+ void GetResolverDescription(Stream *s);
+
+ //------------------------------------------------------------------
+ /// Find breakpoint locations which match the (filename, line_number)
+ /// description.
+ /// The breakpoint location collection is to be filled with the matching
+ /// locations.
+ /// It should be initialized with 0 size by the API client.
+ ///
+ /// @return
+ /// True if there is a match
+ ///
+ /// The locations which match the filename and line_number in loc_coll.
+ /// If its
+ /// size is 0 and true is returned, it means the breakpoint fully matches
+ /// the
+ /// description.
+ //------------------------------------------------------------------
+ bool GetMatchingFileLine(const ConstString &filename, uint32_t line_number,
+ BreakpointLocationCollection &loc_coll);
+
+ void GetFilterDescription(Stream *s);
+
+ //------------------------------------------------------------------
+ /// Returns the BreakpointOptions structure set at the breakpoint level.
+ ///
+ /// Meant to be used by the BreakpointLocation class.
+ ///
+ /// @return
+ /// A pointer to this breakpoint's BreakpointOptions.
+ //------------------------------------------------------------------
+ BreakpointOptions *GetOptions();
+
+ //------------------------------------------------------------------
+ /// Invoke the callback action when the breakpoint is hit.
+ ///
+ /// Meant to be used by the BreakpointLocation class.
+ ///
+ /// @param[in] context
+ /// Described the breakpoint event.
+ ///
+ /// @param[in] bp_loc_id
+ /// Which breakpoint location hit this breakpoint.
+ ///
+ /// @return
+ /// \b true if the target should stop at this breakpoint and \b false not.
+ //------------------------------------------------------------------
+ bool InvokeCallback(StoppointCallbackContext *context,
+ lldb::break_id_t bp_loc_id);
+
+ bool IsHardware() const { return m_hardware; }
+
+ lldb::BreakpointResolverSP GetResolver() { return m_resolver_sp; }
+
+ lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; }
+
+ bool AddName(const char *new_name, Error &error);
+
+ void RemoveName(const char *name_to_remove) {
+ if (name_to_remove)
+ m_name_list.erase(name_to_remove);
+ }
+
+ bool MatchesName(const char *name) {
+ return m_name_list.find(name) != m_name_list.end();
+ }
+
+ void GetNames(std::vector<std::string> &names) {
+ names.clear();
+ for (auto name : m_name_list) {
+ names.push_back(name);
+ }
+ }
+
+ //------------------------------------------------------------------
+ /// Set a pre-condition filter that overrides all user provided
+ /// filters/callbacks etc.
+ ///
+ /// Used to define fancy breakpoints that can do dynamic hit detection without
+ /// taking up the condition slot -
+ /// which really belongs to the user anyway...
+ ///
+ /// The Precondition should not continue the target, it should return true if
+ /// the condition says to stop and
+ /// false otherwise.
+ ///
+ //------------------------------------------------------------------
+ void SetPrecondition(BreakpointPreconditionSP precondition_sp) {
+ m_precondition_sp = precondition_sp;
+ }
- const Target &
- GetTarget () const
- {
- return m_target;
- }
-
- const lldb::TargetSP
- GetTargetSP ();
-
- void
- GetResolverDescription (Stream *s);
-
- //------------------------------------------------------------------
- /// Find breakpoint locations which match the (filename, line_number) description.
- /// The breakpoint location collection is to be filled with the matching locations.
- /// It should be initialized with 0 size by the API client.
- ///
- /// @return
- /// True if there is a match
- ///
- /// The locations which match the filename and line_number in loc_coll. If its
- /// size is 0 and true is returned, it means the breakpoint fully matches the
- /// description.
- //------------------------------------------------------------------
- bool GetMatchingFileLine(const ConstString &filename, uint32_t line_number,
- BreakpointLocationCollection &loc_coll);
-
- void
- GetFilterDescription (Stream *s);
-
- //------------------------------------------------------------------
- /// Returns the BreakpointOptions structure set at the breakpoint level.
- ///
- /// Meant to be used by the BreakpointLocation class.
- ///
- /// @return
- /// A pointer to this breakpoint's BreakpointOptions.
- //------------------------------------------------------------------
- BreakpointOptions *
- GetOptions ();
-
- //------------------------------------------------------------------
- /// Invoke the callback action when the breakpoint is hit.
- ///
- /// Meant to be used by the BreakpointLocation class.
- ///
- /// @param[in] context
- /// Described the breakpoint event.
- ///
- /// @param[in] bp_loc_id
- /// Which breakpoint location hit this breakpoint.
- ///
- /// @return
- /// \b true if the target should stop at this breakpoint and \b false not.
- //------------------------------------------------------------------
- bool
- InvokeCallback (StoppointCallbackContext *context,
- lldb::break_id_t bp_loc_id);
-
- bool
- IsHardware() const
- {
- return m_hardware;
- }
-
- lldb::BreakpointResolverSP
- GetResolver()
- {
- return m_resolver_sp;
- }
-
- lldb::SearchFilterSP
- GetSearchFilter()
- {
- return m_filter_sp;
- }
+ bool EvaluatePrecondition(StoppointCallbackContext &context);
- bool
- AddName (const char *new_name, Error &error);
-
- void
- RemoveName (const char *name_to_remove)
- {
- if (name_to_remove)
- m_name_list.erase(name_to_remove);
- }
-
- bool
- MatchesName (const char *name)
- {
- return m_name_list.find(name) != m_name_list.end();
- }
-
- void
- GetNames (std::vector<std::string> &names)
- {
- names.clear();
- for (auto name : m_name_list)
- {
- names.push_back(name);
- }
- }
-
- //------------------------------------------------------------------
- /// Set a pre-condition filter that overrides all user provided filters/callbacks etc.
- ///
- /// Used to define fancy breakpoints that can do dynamic hit detection without taking up the condition slot -
- /// which really belongs to the user anyway...
- ///
- /// The Precondition should not continue the target, it should return true if the condition says to stop and
- /// false otherwise.
- ///
- //------------------------------------------------------------------
- void
- SetPrecondition(BreakpointPreconditionSP precondition_sp)
- {
- m_precondition_sp = precondition_sp;
- }
-
- bool
- EvaluatePrecondition (StoppointCallbackContext &context);
-
- BreakpointPreconditionSP
- GetPrecondition()
- {
- return m_precondition_sp;
- }
+ BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; }
protected:
- friend class Target;
- //------------------------------------------------------------------
- // Protected Methods
- //------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Constructors and Destructors
- /// Only the Target can make a breakpoint, and it owns the breakpoint lifespans.
- /// The constructor takes a filter and a resolver. Up in Target there are convenience
- /// variants that make breakpoints for some common cases.
- ///
- /// @param[in] target
- /// The target in which the breakpoint will be set.
- ///
- /// @param[in] filter_sp
- /// Shared pointer to the search filter that restricts the search domain of the breakpoint.
- ///
- /// @param[in] resolver_sp
- /// Shared pointer to the resolver object that will determine breakpoint matches.
- ///
- /// @param hardware
- /// If true, request a hardware breakpoint to be used to implement the breakpoint locations.
- ///
- /// @param resolve_indirect_symbols
- /// If true, and the address of a given breakpoint location in this breakpoint is set on an
- /// indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual breakpoint site will
- /// be set on the target of the indirect symbol.
- //------------------------------------------------------------------
- // This is the generic constructor
- Breakpoint(Target &target,
- lldb::SearchFilterSP &filter_sp,
- lldb::BreakpointResolverSP &resolver_sp,
- bool hardware,
- bool resolve_indirect_symbols = true);
-
- friend class BreakpointLocation; // To call the following two when determining whether to stop.
-
- void
- DecrementIgnoreCount();
-
- // BreakpointLocation::IgnoreCountShouldStop & Breakpoint::IgnoreCountShouldStop can only be called once per stop,
- // and BreakpointLocation::IgnoreCountShouldStop should be tested first, and if it returns false we should
- // continue, otherwise we should test Breakpoint::IgnoreCountShouldStop.
-
- bool
- IgnoreCountShouldStop ();
-
- void
- IncrementHitCount()
- {
- m_hit_count++;
- }
-
- void
- DecrementHitCount()
- {
- assert (m_hit_count > 0);
- m_hit_count--;
- }
+ friend class Target;
+ //------------------------------------------------------------------
+ // Protected Methods
+ //------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// Constructors and Destructors
+ /// Only the Target can make a breakpoint, and it owns the breakpoint
+ /// lifespans.
+ /// The constructor takes a filter and a resolver. Up in Target there are
+ /// convenience
+ /// variants that make breakpoints for some common cases.
+ ///
+ /// @param[in] target
+ /// The target in which the breakpoint will be set.
+ ///
+ /// @param[in] filter_sp
+ /// Shared pointer to the search filter that restricts the search domain of
+ /// the breakpoint.
+ ///
+ /// @param[in] resolver_sp
+ /// Shared pointer to the resolver object that will determine breakpoint
+ /// matches.
+ ///
+ /// @param hardware
+ /// If true, request a hardware breakpoint to be used to implement the
+ /// breakpoint locations.
+ ///
+ /// @param resolve_indirect_symbols
+ /// If true, and the address of a given breakpoint location in this
+ /// breakpoint is set on an
+ /// indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual
+ /// breakpoint site will
+ /// be set on the target of the indirect symbol.
+ //------------------------------------------------------------------
+ // This is the generic constructor
+ Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp,
+ lldb::BreakpointResolverSP &resolver_sp, bool hardware,
+ bool resolve_indirect_symbols = true);
+
+ friend class BreakpointLocation; // To call the following two when determining
+ // whether to stop.
+
+ void DecrementIgnoreCount();
+
+ // BreakpointLocation::IgnoreCountShouldStop &
+ // Breakpoint::IgnoreCountShouldStop can only be called once per stop,
+ // and BreakpointLocation::IgnoreCountShouldStop should be tested first, and
+ // if it returns false we should
+ // continue, otherwise we should test Breakpoint::IgnoreCountShouldStop.
+
+ bool IgnoreCountShouldStop();
+
+ void IncrementHitCount() { m_hit_count++; }
+
+ void DecrementHitCount() {
+ assert(m_hit_count > 0);
+ m_hit_count--;
+ }
private:
- // This one should only be used by Target to copy breakpoints from target to target - primarily from the dummy
- // target to prime new targets.
- Breakpoint (Target &new_target,
- Breakpoint &bp_to_copy_from);
-
- //------------------------------------------------------------------
- // For Breakpoint only
- //------------------------------------------------------------------
- bool m_being_created;
- bool m_hardware; // If this breakpoint is required to use a hardware breakpoint
- Target &m_target; // The target that holds this breakpoint.
- std::unordered_set<std::string> m_name_list; // If not empty, this is the name of this breakpoint (many breakpoints can share the same name.)
- lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain.
- lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint.
- BreakpointPreconditionSP m_precondition_sp; // The precondition is a breakpoint-level hit filter that can be used
- // to skip certain breakpoint hits. For instance, exception breakpoints
- // use this to limit the stop to certain exception classes, while leaving
- // the condition & callback free for user specification.
- BreakpointOptions m_options; // Settable breakpoint options
- BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint.
- std::string m_kind_description;
- bool m_resolve_indirect_symbols;
- uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit. This is kept
- // separately from the locations hit counts, since locations can go away when
- // their backing library gets unloaded, and we would lose hit counts.
-
- void
- SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind);
-
- void
- SendBreakpointChangedEvent (BreakpointEventData *data);
+ // This one should only be used by Target to copy breakpoints from target to
+ // target - primarily from the dummy
+ // target to prime new targets.
+ Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from);
+
+ //------------------------------------------------------------------
+ // For Breakpoint only
+ //------------------------------------------------------------------
+ bool m_being_created;
+ bool
+ m_hardware; // If this breakpoint is required to use a hardware breakpoint
+ Target &m_target; // The target that holds this breakpoint.
+ std::unordered_set<std::string> m_name_list; // If not empty, this is the name
+ // of this breakpoint (many
+ // breakpoints can share the same
+ // name.)
+ lldb::SearchFilterSP
+ m_filter_sp; // The filter that constrains the breakpoint's domain.
+ lldb::BreakpointResolverSP
+ m_resolver_sp; // The resolver that defines this breakpoint.
+ BreakpointPreconditionSP m_precondition_sp; // The precondition is a
+ // breakpoint-level hit filter
+ // that can be used
+ // to skip certain breakpoint hits. For instance, exception breakpoints
+ // use this to limit the stop to certain exception classes, while leaving
+ // the condition & callback free for user specification.
+ BreakpointOptions m_options; // Settable breakpoint options
+ BreakpointLocationList
+ m_locations; // The list of locations currently found for this breakpoint.
+ std::string m_kind_description;
+ bool m_resolve_indirect_symbols;
+ uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been
+ // hit. This is kept
+ // separately from the locations hit counts, since locations can go away when
+ // their backing library gets unloaded, and we would lose hit counts.
+
+ void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);
+
+ void SendBreakpointChangedEvent(BreakpointEventData *data);
- DISALLOW_COPY_AND_ASSIGN(Breakpoint);
+ DISALLOW_COPY_AND_ASSIGN(Breakpoint);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointID.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointID.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointID.h Tue Sep 6 15:57:50 2016
@@ -23,110 +23,92 @@ namespace lldb_private {
// class BreakpointID
//----------------------------------------------------------------------
-class BreakpointID
-{
+class BreakpointID {
public:
+ BreakpointID(lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
+ lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
- BreakpointID (lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
- lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
+ virtual ~BreakpointID();
- virtual
- ~BreakpointID ();
+ lldb::break_id_t GetBreakpointID() { return m_break_id; }
- lldb::break_id_t
- GetBreakpointID ()
- {
- return m_break_id;
- }
-
- lldb::break_id_t
- GetLocationID ()
- {
- return m_location_id;
- }
-
- void
- SetID (lldb::break_id_t bp_id, lldb::break_id_t loc_id)
- {
- m_break_id = bp_id;
- m_location_id = loc_id;
- }
-
- void
- SetBreakpointID (lldb::break_id_t bp_id)
- {
- m_break_id = bp_id;
- }
-
- void
- SetBreakpointLocationID (lldb::break_id_t loc_id)
- {
- m_location_id = loc_id;
- }
-
- void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
-
- static bool
- IsRangeIdentifier (const char *str);
-
- static bool
- IsValidIDExpression (const char *str);
-
- static const char *g_range_specifiers[];
-
- //------------------------------------------------------------------
- /// Takes an input string containing the description of a breakpoint or breakpoint and location
- /// and returns the breakpoint ID and the breakpoint location id.
- ///
- /// @param[in] input
- /// A string containing JUST the breakpoint description.
- /// @param[out] break_id
- /// This is the break id.
- /// @param[out] break_loc_id
- /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no location was specified.
- /// @return
- /// \b true if the call was able to extract a breakpoint location from the string. \b false otherwise.
- //------------------------------------------------------------------
- static bool
- ParseCanonicalReference (const char *input, lldb::break_id_t *break_id, lldb::break_id_t *break_loc_id);
-
-
- //------------------------------------------------------------------
- /// Takes an input string and checks to see whether it is a breakpoint name.
- /// If it is a mal-formed breakpoint name, error will be set to an appropriate
- /// error string.
- ///
- /// @param[in] input
- /// A string containing JUST the breakpoint description.
- /// @param[out] error
- /// If the name is a well-formed breakpoint name, set to success, otherwise set to an error.
- /// @return
- /// \b true if the name is a breakpoint name (as opposed to an ID or range) false otherwise.
- //------------------------------------------------------------------
- static bool
- StringIsBreakpointName (const char *name, Error &error);
-
- //------------------------------------------------------------------
- /// Takes a breakpoint ID and the breakpoint location id and returns
- /// a string containing the canonical description for the breakpoint
- /// or breakpoint location.
- ///
- /// @param[out] break_id
- /// This is the break id.
- ///
- /// @param[out] break_loc_id
- /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
- /// location is to be specified.
- //------------------------------------------------------------------
- static void
- GetCanonicalReference (Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
+ lldb::break_id_t GetLocationID() { return m_location_id; }
+
+ void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) {
+ m_break_id = bp_id;
+ m_location_id = loc_id;
+ }
+
+ void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; }
+
+ void SetBreakpointLocationID(lldb::break_id_t loc_id) {
+ m_location_id = loc_id;
+ }
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ static bool IsRangeIdentifier(const char *str);
+
+ static bool IsValidIDExpression(const char *str);
+
+ static const char *g_range_specifiers[];
+
+ //------------------------------------------------------------------
+ /// Takes an input string containing the description of a breakpoint or
+ /// breakpoint and location
+ /// and returns the breakpoint ID and the breakpoint location id.
+ ///
+ /// @param[in] input
+ /// A string containing JUST the breakpoint description.
+ /// @param[out] break_id
+ /// This is the break id.
+ /// @param[out] break_loc_id
+ /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
+ /// location was specified.
+ /// @return
+ /// \b true if the call was able to extract a breakpoint location from the
+ /// string. \b false otherwise.
+ //------------------------------------------------------------------
+ static bool ParseCanonicalReference(const char *input,
+ lldb::break_id_t *break_id,
+ lldb::break_id_t *break_loc_id);
+
+ //------------------------------------------------------------------
+ /// Takes an input string and checks to see whether it is a breakpoint name.
+ /// If it is a mal-formed breakpoint name, error will be set to an appropriate
+ /// error string.
+ ///
+ /// @param[in] input
+ /// A string containing JUST the breakpoint description.
+ /// @param[out] error
+ /// If the name is a well-formed breakpoint name, set to success,
+ /// otherwise set to an error.
+ /// @return
+ /// \b true if the name is a breakpoint name (as opposed to an ID or
+ /// range) false otherwise.
+ //------------------------------------------------------------------
+ static bool StringIsBreakpointName(const char *name, Error &error);
+
+ //------------------------------------------------------------------
+ /// Takes a breakpoint ID and the breakpoint location id and returns
+ /// a string containing the canonical description for the breakpoint
+ /// or breakpoint location.
+ ///
+ /// @param[out] break_id
+ /// This is the break id.
+ ///
+ /// @param[out] break_loc_id
+ /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
+ /// location is to be specified.
+ //------------------------------------------------------------------
+ static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id);
protected:
- lldb::break_id_t m_break_id;
- lldb::break_id_t m_location_id;
+ lldb::break_id_t m_break_id;
+ lldb::break_id_t m_location_id;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointID_h_
+#endif // liblldb_BreakpointID_h_
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h Tue Sep 6 15:57:50 2016
@@ -17,8 +17,8 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/BreakpointID.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -26,57 +26,49 @@ namespace lldb_private {
// class BreakpointIDList
//----------------------------------------------------------------------
-
-class BreakpointIDList
-{
+class BreakpointIDList {
public:
- typedef std::vector<BreakpointID> BreakpointIDArray;
+ typedef std::vector<BreakpointID> BreakpointIDArray;
- BreakpointIDList ();
+ BreakpointIDList();
- virtual
- ~BreakpointIDList ();
+ virtual ~BreakpointIDList();
- size_t
- GetSize();
+ size_t GetSize();
- BreakpointID &
- GetBreakpointIDAtIndex (size_t index);
+ BreakpointID &GetBreakpointIDAtIndex(size_t index);
- bool
- RemoveBreakpointIDAtIndex (size_t index);
+ bool RemoveBreakpointIDAtIndex(size_t index);
- void
- Clear();
+ void Clear();
- bool
- AddBreakpointID (BreakpointID bp_id);
+ bool AddBreakpointID(BreakpointID bp_id);
- bool
- AddBreakpointID (const char *bp_id);
+ bool AddBreakpointID(const char *bp_id);
- bool
- FindBreakpointID (BreakpointID &bp_id, size_t *position);
+ bool FindBreakpointID(BreakpointID &bp_id, size_t *position);
- bool
- FindBreakpointID (const char *bp_id, size_t *position);
+ bool FindBreakpointID(const char *bp_id, size_t *position);
- void
- InsertStringArray (const char **string_array, size_t array_size, CommandReturnObject &result);
+ void InsertStringArray(const char **string_array, size_t array_size,
+ CommandReturnObject &result);
- static bool
- StringContainsIDRangeExpression (const char *in_string, size_t *range_start_len, size_t *range_end_pos);
+ static bool StringContainsIDRangeExpression(const char *in_string,
+ size_t *range_start_len,
+ size_t *range_end_pos);
- static void
- FindAndReplaceIDRanges (Args &old_args, Target *target, bool allow_locations, CommandReturnObject &result, Args &new_args);
+ static void FindAndReplaceIDRanges(Args &old_args, Target *target,
+ bool allow_locations,
+ CommandReturnObject &result,
+ Args &new_args);
private:
- BreakpointIDArray m_breakpoint_ids;
- BreakpointID m_invalid_id;
+ BreakpointIDArray m_breakpoint_ids;
+ BreakpointID m_invalid_id;
- DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
+ DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
};
} // namespace lldb_private
-#endif // liblldb_BreakpointIDList_h_
+#endif // liblldb_BreakpointIDList_h_
More information about the lldb-commits
mailing list