12
typedef struct _LIST_ENTRY {
13
struct _LIST_ENTRY *Flink;
14
struct _LIST_ENTRY *Blink;
17
typedef struct _StructArray {
25
class TypedVarTest( unittest.TestCase ):
28
tv = target.module.typedVar( "structTest", target.module.g_structTest )
29
tv = target.module.typedVar( "g_structTest" )
31
tv = pykd.typedVar( "structTest", target.module.g_structTest )
32
tv = pykd.typedVar( target.moduleName + "!structTest", target.module.g_structTest )
34
structTest = target.module.type( "structTest" )
35
tv = pykd.typedVar( structTest, target.module.g_structTest )
37
tv = pykd.typedVar( "g_structTest" )
38
tv = pykd.typedVar( target.moduleName + "!g_structTest" )
41
def testCompareWithNone(self):
42
tv = target.module.typedVar( "ucharVar" )
43
self.assertFalse(tv == None)
44
self.assertTrue(tv != None)
45
self.assertFalse(not tv)
48
def testBaseTypes(self):
49
self.assertEqual( 10, target.module.typedVar( "ucharVar" ) )
50
self.assertEqual( 1020, target.module.typedVar( "ushortVar" ) )
51
self.assertEqual( 10002000, target.module.typedVar( "ulongVar" ) )
52
self.assertEqual( 1234567890, target.module.typedVar( "ulonglongVar" ) )
53
self.assertEqual( -5, target.module.typedVar( "charVar" ) )
54
self.assertEqual( -1020, target.module.typedVar( "shortVar" ) )
55
self.assertEqual( -1002000, target.module.typedVar( "longVar" ) )
56
self.assertEqual( -1234567890, target.module.typedVar( "longlongVar" ) )
59
tvBaseType = pykd.typedVar( pykd.typeInfo("UInt8B").ptrTo(), target.module.offset("pbigValue") )
60
self.assertEqual( target.module.typedVar( "bigValue" ), tvBaseType.deref() )
62
tvDiaStruct = pykd.typedVar( target.module.type("structTest").ptrTo(), target.module.offset("g_structTestPtr") )
63
self.assertEqual( 500, tvDiaStruct.deref().m_field1 )
65
customStructTest = pykd.createStruct(name="customStructTest", align=4)
66
customStructTest.append("m_field0", pykd.baseTypes.UInt4B)
67
customStructTest.append("m_field1", pykd.baseTypes.UInt8B)
68
tvCustomStruct = pykd.typedVar( customStructTest.ptrTo(), target.module.offset("g_structTestPtr") )
69
self.assertEqual( 500, tvCustomStruct.deref().m_field1 )
71
def testArrayOf(self):
72
arrayType = pykd.typeInfo("UInt8B").arrayOf(5)
73
arrayVar = pykd.typedVar( arrayType, target.module.offset("ulonglongArray") )
74
self.assertEqual( 0xFF, arrayVar[1] )
75
self.assertEqual( 0xFFFFFFFFFFFFFFFF, arrayVar[4] )
77
arrayStructType = pykd.typeInfo("structTest").arrayOf(2)
78
arrayStructVar = pykd.typedVar( arrayStructType, target.module.offset("g_testArray") )
79
self.assertEqual( True, arrayStructVar[0].m_field2 )
80
self.assertEqual( 1, arrayStructVar[1].m_field3 )
83
self.assertEqual( True, target.module.typedVar( "boolConst" ) )
84
self.assertEqual( 0x5555, target.module.typedVar( "ulongConst" ) )
85
self.assertEqual( 0xffffff000000, target.module.typedVar( "ulonglongConst" ) )
86
self.assertEqual( 3, target.module.typedVar( "g_constEnumThree" ) )
88
def testGetAddress( self ):
89
tv = target.module.typedVar( "structTest", target.module.g_structTest )
90
self.assertEqual( tv.getAddress(), target.module.g_structTest )
92
def testGetSize( self ):
93
tv1 = target.module.typedVar( "structTest", target.module.g_structTest )
94
self.assertEqual( 16 + pykd.ptrSize(), tv1.sizeof() )
95
tv2 = target.module.typedVar( "structTest[2]", target.module.g_testArray )
96
self.assertEqual( tv1.sizeof()*2, tv2.sizeof() )
98
self.assertEqual( pykd.sizeof("g_structTest"), tv1.sizeof() )
99
self.assertEqual( pykd.sizeof("g_testArray"), tv2.sizeof() )
100
self.assertEqual( pykd.sizeof("ucharVar"), 1 )
102
def testByAddress( self ):
103
tv1 = target.module.typedVar( "structTest", target.module.g_structTest )
104
tv2 = target.module.typedVar( tv1.getAddress() )
105
self.assertEqual( tv2.getAddress(), tv1.getAddress() )
107
def testStruct(self):
108
tv1 = target.module.typedVar( "structTest", target.module.g_structTest )
109
self.assertEqual( 0, tv1.m_field0 )
110
self.assertEqual( 500, tv1.m_field1 )
111
self.assertEqual( True, tv1.m_field2 )
112
self.assertEqual( 1, tv1.m_field3 )
113
self.assertEqual( 1, tv1["m_field3"] )
114
self.assertRaises( AttributeError, lambda t: t.not_exists, tv1)
115
self.assertRaises( KeyError, lambda t: t["not_exists"], tv1)
117
def testPtrField(self):
118
tv = target.module.typedVar( "g_structTest" )
119
self.assertEqual( 0, tv.m_field4 )
120
tv1 = target.module.typedVar( "g_structTest1" )
121
self.assertEqual( tv.getAddress(), tv1.m_field4 )
123
def testFieldOffset(self):
124
tv = target.module.typedVar( "g_structTest" )
125
self.assertEqual( 0, tv.fieldOffset("m_field0") )
126
self.assertEqual( 4, tv.fieldOffset("m_field1") )
127
self.assertEqual( 16, tv.fieldOffset("m_field4") )
129
def testArrayField(self):
130
tv = target.module.typedVar( "g_structWithArray" )
131
self.assertEqual( tv + tv.fieldOffset("m_arrayField"),tv.m_arrayField)
132
self.assertEqual( 2, len(tv.m_arrayField) )
133
self.assertEqual( 0, tv.m_arrayField[0] )
134
self.assertEqual( 2, tv.m_arrayField[1] )
135
self.assertEqual( 3, tv.m_noArrayField )
136
self.assertNotEqual( -1, tv.m_arrayField[0] )
137
self.assertNotEqual( 0, tv.m_noArrayField )
138
tv.m_arrayField[len(tv.m_arrayField)]
140
def testArrayIteration(self):
141
tv = target.module.typedVar( "g_structWithArray" )
142
self.assertEqual([0, 2], [x for x in tv.m_arrayField])
144
def testGlobalVar(self):
145
self.assertEqual( 10002000, target.module.typedVar( "ulongVar" ) )
146
self.assertEqual( 0x80000000, target.module.typedVar( "ulongArray" )[3] )
147
self.assertEqual( 0x8000000000000000, target.module.typedVar( "ulonglongArray" )[3] )
148
self.assertEqual( 0x7FFFFFFF, target.module.typedVar( "longArray" )[3])
149
self.assertEqual( -1, target.module.typedVar( "longlongArray" )[4])
150
self.assertEqual( target.module.g_structTest, target.module.typedVar( "g_structTestPtr" ) )
152
def testContainingRecord(self):
153
off1 = target.module.type( "structTest" ).fieldOffset("m_field2")
154
off2 = target.module.offset( "g_structTest" )
155
tv = target.module.containingRecord( off2 + off1, "structTest", "m_field2" )
156
self.assertEqual( True, tv.m_field2 )
158
def testBitField(self):
159
tv = target.module.typedVar("g_structWithBits")
160
self.assertEqual( 4, tv.m_bit0_4 )
161
self.assertEqual( 1, tv.m_bit5 )
162
self.assertEqual( 5, tv.m_bit6_8 )
163
tv = target.module.typedVar("g_structWithSignBits")
164
self.assertEqual( 4, tv.m_bit0_4 )
165
self.assertEqual( -1, tv.m_bit5 )
166
self.assertEqual( -3, tv.m_bit6_8 )
168
def testTypedVarList(self):
169
tvl = target.module.typedVarList( target.module.g_listHead, "listStruct", "next.flink" )
170
self.assertEqual( 5, len( tvl ) )
171
self.assertEqual( [ i for i in range(5)], [ tv.num for tv in tvl ] )
173
tvl = pykd.typedVarList( target.module.g_listHead, target.module.type("listStruct"), "next.flink" )
174
self.assertEqual( 5, len( tvl ) )
175
self.assertEqual( [ i for i in range(5)], [ tv.num for tv in tvl ] )
177
tvl = pykd.typedVarList( target.module.g_listHead, target.module.type("listStruct"), "next.flink" )
178
self.assertEqual( 5, len( tvl ) )
179
self.assertEqual( [ i for i in range(5)], [ tv.num for tv in tvl ] )
198
def testTypedVarArray(self):
199
tvl = target.module.typedVarArray( target.module.g_testArray, "structTest", 2 )
200
self.assertEqual( 2, len( tvl ) )
201
self.assertEqual( 500, tvl[0].m_field1 )
202
self.assertEqual( False, tvl[1].m_field2 )
204
tvl = pykd.typedVarArray( target.module.g_testArray, target.module.type("structTest"), 2 )
205
self.assertEqual( 2, len( tvl ) )
206
self.assertEqual( 1, tvl[0].m_field3 )
207
self.assertEqual( 0, tvl[1].m_field4 )
209
tvl1 = target.module.typedVarArray( target.module.g_testArray, "structTest", 2 )
210
tvl2 = pykd.typedVarArray( target.module.g_testArray, target.moduleName + "!structTest", 2 )
211
self.assertEqual( tvl1, tvl2 )
214
tv1 = target.module.typedVar("g_structTest")
215
tv2 = target.module.typedVar("intMatrix")
216
self.assertEqual( tv1.m_field3, tv2[0][1] )
219
tv = target.module.typedVar("g_constEnumThree")
220
self.assertEqual( 3, tv )
221
self.assertEqual( target.module.type("enumType").THREE, tv )
224
ind = target.module.typedVar( "g_structTest" ).m_field3
225
self.assertEqual( 5, [0,5,10][ind] )
227
self.assertTrue( ind in [0,1,2] )
229
tv = target.module.typedVar( "g_structWithArray" )
230
self.assertEqual( 2, tv.m_arrayField[ind] )
232
self.assertTrue( ind in { 1 : "1", 4 : "2" } )
233
self.assertEqual( "1", { 1 : "1", 4 : "2" }[ind] )
236
tv = target.module.typedVar( "g_structTest1" )
237
self.assertEqual( target.module.g_structTest, tv.m_field4.deref().getAddress() )
239
tv = target.module.typedVar( "g_structTest" )
240
self.assertEqual( 0, tv.m_field4.deref().getAddress() )
244
self.assertTrue(False)
245
except pykd.TypeException:
248
def testSkipDeref(self):
249
tv = target.module.typedVar( "g_structTest1" )
250
self.assertEqual( tv.m_field4.deref().m_field1, tv.m_field4.m_field1 )
252
def testUnNamedStruct(self):
253
tv = target.module.typedVar( "g_unNamedStruct" )
254
self.assertEqual( 4, tv.m_fieldNestedStruct )
255
self.assertEqual( 5, tv.m_fieldOfUnNamed )
257
def testFunctionPtr(self):
258
funcptr = target.module.typedVar( "CdeclFuncPtr" )
261
self.assertEqual( funcptr.type().deref().name(), target.module.typedVar("CdeclFunc").type().name() )
262
self.assertEqual( funcptr.type().name(), target.module.typedVar("CdeclFunc").type().ptrTo().name() )
264
def testFunctionRange(self):
265
func1 = target.module.typedVar("CdeclFunc")
266
self.assertTrue( func1.getAddress() >= target.module.begin() )
267
self.assertTrue( func1.getAddress() + func1.sizeof() <= target.module.end() )
269
func2 = target.module.typedVar( target.module.StdcallFunc )
270
self.assertTrue( func2.getAddress() >= target.module.begin() )
271
self.assertTrue( func2.getAddress() + func2.sizeof() <= target.module.end() )
273
def testTypeVarArg(self):
274
tv1 = target.module.typedVar( "structTest", target.module.g_structTest )
275
tv2 = target.module.typedVar( "structTest", tv1 )
276
self.assertEqual( tv1, tv2 )
277
self.assertTrue( tv1 )
280
self.assertTrue( str(target.module.typedVar( "ucharVar" ) ) )
281
self.assertTrue( str(target.module.typedVar( "ushortVar" ) ) )
282
self.assertTrue( str(target.module.typedVar( "ulongVar" ) ) )
283
self.assertTrue( str(target.module.typedVar( "ulonglongVar" ) ) )
284
self.assertTrue( str(target.module.typedVar( "g_structWithBits" ) ) )
285
self.assertTrue( str(target.module.typedVar( "g_structTest" ) ) )
286
self.assertTrue( str(target.module.typedVar( "g_structTest1" ) ) )
287
self.assertTrue( str(target.module.typedVar( "g_testArray" ) ) )
288
self.assertTrue( str(target.module.typedVar( "g_structTestPtr" ) ) )
289
self.assertTrue( str(target.module.typedVar( "g_structTestPtrPtr" ) ) )
290
self.assertTrue( str(target.module.typedVar( "longlongArray" ) ) )
291
self.assertTrue( str(target.module.typedVar( "intMatrix4" ) ) )
292
self.assertTrue( str(target.module.typedVar( "ptrIntMatrix" ) ) )
293
self.assertTrue( str(target.module.typedVar( "g_classChild" ) ) )
295
self.assertTrue( str(target.module.typedVar( "g_listHead" ) ) )
296
self.assertTrue( str(target.module.typedVar( "voidPtr" ) ) )
300
def testNotValidPrint(self):
301
types = ("structTest", "ULong[100]", "ULong*" )
303
self.assertTrue( str(pykd.typedVar( target.module.type(ti), 0 ) ) )
305
def testStaticField(self):
306
tv = pykd.typedVar( "g_classChild" )
307
self.assertEqual( 200, tv.m_staticField )
308
self.assertEqual( 100, tv.m_staticConst )
310
def testAmbiguousFieldAccess(self):
313
self.assertEqual( 678, pykd.typedVar( "g_virtChild" ).m_member )
315
def testDiamondVirtualInherit(self):
316
tv = pykd.typedVar( "g_virtChild" )
317
self.assertEqual( -100, tv.m_baseField )
319
def testUdtSubscribe(self):
320
tv = pykd.typedVar( "g_virtChild" )
321
self.assertEqual( 6, len(tv) )
322
fieldName = tv.fieldName(3)
323
fieldVal = tv.field(3)
325
self.assertEqual( fieldName, "m_baseField" )
326
self.assertEqual( fieldVal, tv.m_baseField )
328
for field in tv.fields():
338
def testHresult(self):
339
tv = pykd.typedVar( "g_atlException" )
340
self.assertEqual( tv.m_hr, 0x8000FFFF )
342
def testFunctionDebugRange(self):
343
tv = pykd.typedVar( "startChildProcess" )
345
self.assertTrue( tv.getDebugStart() >= tv.getAddress() )
346
self.assertTrue( tv.getDebugEnd() <= tv.getAddress() + tv.sizeof() )
348
def testFields(self):
349
tv = pykd.typedVar( "g_classChild")
350
self.assertTrue( len(tv.fields())>0 )
353
tv = target.module.typedVar( "structTest", target.module.g_structTest )
354
self.assertEqual(5, len(dir(tv)))
355
self.assertTrue("m_field3" in dir(tv))
356
self.assertFalse("m_field33" in dir(tv))
358
def testMemoryException(self):
359
self.assertRaises(pykd.MemoryException,
361
pykd.typedVar(pykd.baseTypes.UInt4B, 0))
362
if pykd.getCPUType() == pykd.CPUType.I386:
363
self.assertRaises(pykd.MemoryException,
365
pykd.typedVar(pykd.baseTypes.UInt4B, 0xFFFFFFFF))
366
self.assertRaises(pykd.MemoryException,
368
pykd.typedVar(pykd.baseTypes.UInt4B, 0xFFFFFFFFFFFFFFFF))
370
def testLocation(self):
371
tv = target.module.typedVar( "structTest", target.module.g_structTest )
372
self.assertEqual( ( pykd.Location.Memory, tv.getAddress()), tv.getLocation() )
374
def testGetAddress(self):
375
if not pykd.is64bitSystem():
376
tv = target.module.typedVar( "structTest", 0x80000000 )
377
self.assertEqual( 0xFFFFFFFF80000000, tv.getAddress() )
378
self.assertEqual( 0xFFFFFFFF80000000, tv )
380
def testCompare(self):
381
self.assertTrue( 10002000 == target.module.typedVar( "ulongVar" ) )
382
self.assertTrue( 10002001 != target.module.typedVar( "ulongVar" ) )
383
self.assertTrue( 10002001 > target.module.typedVar( "ulongVar" ) )
384
self.assertTrue( 10001999 < target.module.typedVar( "ulongVar" ) )
385
self.assertTrue( 10002001 >= target.module.typedVar( "ulongVar" ) )
386
self.assertTrue( 10001999 <= target.module.typedVar( "ulongVar" ) )
387
self.assertTrue( True if target.module.typedVar( "ulongVar" ) else False )
388
self.assertTrue( False if not target.module.typedVar( "ulongVar" ) else True )
391
def testCompareWihNone(self):
392
tv = target.module.typedVar( "structTest", target.module.g_structTest )
393
self.assertFalse(tv==None)
394
self.assertTrue(tv!=None)
396
def testCastTo(self):
397
self.assertEqual(0xD2, target.module.typedVar( "ulonglongVar" ).castTo("UInt1B"))
398
self.assertEqual(0, target.module.typedVar( "g_structTest" ).castTo("UInt4B"))
400
def testCallFunction(self):
401
funcptr = target.module.typedVar("StdcallFuncRet");
402
self.assertEqual( 200000/10, pykd.callFunctionByPtr( funcptr, 10, 200000 ) )
404
funcptr = target.module.typedVar("CdeclFuncLong");
405
self.assertEqual( 0xffffff000000 + 5, pykd.callFunctionByPtr( funcptr, target.module.typedVar("ulonglongConst") ) )
406
self.assertEqual( 0x7777 + 5, funcptr.call(0x7777) )
407
self.assertEqual( 0x11223344556677 + 5, funcptr(0x11223344556677) );
409
functype = pykd.defineFunction( pykd.baseTypes.Int4B, pykd.callingConvention.NearStd)
410
functype.append("arg1", pykd.baseTypes.Int1B)
411
functype.append("arg2", pykd.baseTypes.Long)
412
self.assertEqual( 500 / 25, pykd.callFunctionByAddr(functype, target.module.offset("StdcallFuncRet"), 25, 500 ) )
414
self.assertTrue( target.module.typedVar("OverloadedFunc", "Bool(__cdecl)(Int4B,Int4B)").call(100,299) )
416
def testCallFunctionWithTypedVar(self):
417
funcptr = target.module.typedVar("StdcallFuncRet");
418
ucharVar = target.module.typedVar( "ucharVar" );
419
self.assertEqual( 10, ucharVar )
420
self.assertEqual( 200000/10, funcptr( ucharVar, 200000 ) )
422
def testCallWithWrongArgs(self):
423
self.assertRaises( pykd.TypeException, target.module.typedVar("StdcallFuncRet"), *(1,) )
424
self.assertRaises( pykd.TypeException, target.module.typedVar("StdcallFuncRet"), *(1,2,3) )
425
self.assertRaises( pykd.TypeException, target.module.typedVar("StdcallFuncRet"), *(10, target.module.typedVar("g_classChild") ))
427
def testCallMethod(self):
428
g_classChild = target.module.typedVar("g_classChild")
429
self.assertEqual( 1000*5, g_classChild.method("childMethod").call(10) )
430
self.assertEqual( 1000*5, g_classChild.childMethod(10) )
432
def testCallStdStr(self):
433
g_stdString = target.module.typedVar("g_stdString")
434
self.assertEqual( "testString".find('S'), g_stdString.find_first_of(ord('S'), 0) )
436
def testCallOverloadMethod(self):
437
g_classChild = target.module.typedVar("g_classChild")
438
self.assertEqual( 10*10, g_classChild.method("overloadMethod", "Int4B(__thiscall)(Int4B)").call(10))
439
self.assertEqual( 5*8, g_classChild.method("overloadMethod", "Int4B(__thiscall)(Int4B,Int4B)").call(5,8))
441
def testGetTypedVar(self):
442
addr = pykd.getOffset("g_structTest")
443
self.assertTrue( None != target.module.type( "structTest" ).getTypedVar(addr) )
445
def testByteSequence(self):
446
self.assertEqual( 0x44332211, pykd.typedVar("UInt4B", [0x11, 0x22, 0x33, 0x44]) )
447
self.assertEqual( -1, pykd.typedVar( pykd.baseTypes.Int4B, [0xFF, 0xFF, 0xFF, 0xFF] ) )
449
def testRawBytes(self):
450
self.assertEqual( [ 0x55, 0x55, 0, 0], target.module.typedVar( "ulongConst" ).rawBytes() )
452
def testSetField(self):
453
byteseq = [0x55] * 20
454
var = target.module.typedVar("structTest", byteseq)
455
var.setField("m_field1", 0xFF000000000000AA)
456
self.assertEqual( [0xAA, 0, 0, 0, 0, 0, 0, 0xFF], byteseq[4:12] )
457
var.m_field3 = 0xAAAA
458
self.assertEqual( 0xAAAA, var.m_field3)
459
self.assertEqual( 0xAAAA, var.field("m_field3") )
463
var = target.module.typedVar("structTest", [0x55] * 20 )
464
setattr(var, "m_field1", 11)
465
self.assertEqual(11, getattr(var, "m_field1"))
466
self.assertRaises(AttributeError, lambda x: getattr(x, "noexists"), var)
468
def testEvalPyScope(self):
469
var = target.module.typedVar("structTest", [0x55] * 20 )
470
self.assertEqual( var.m_field1 * 17, eval("m_field1 * 17", globals(), var) )
472
def testEvalExpr(self):
473
self.assertEqual( 2+2, pykd.evalExpr("2+2") )
474
self.assertEqual( target.module.typedVar("g_structTest").m_field1, pykd.evalExpr("g_structTest.m_field1") )
475
self.assertEqual( target.module.typedVar("g_testArray")[1].m_field3, pykd.evalExpr("(g_testArray + 1)->m_field3") )
477
def testEvalExprScope(self):
479
v1 = target.module.typedVar( "ulongVar" )
480
v2 = target.module.typedVar( "g_structTest" )
482
scope = { "v1" : v1, "v2" : v2 }
483
self.assertEqual( v1 + v2.m_field1, pykd.evalExpr("v1 + v2.m_field1", scope) )
485
def testEvalExprScopeLong(self):
488
scope = { "v1" : v1, "v2" : v2 }
489
self.assertEqual( v1 + v2, pykd.evalExpr("v1 + v2", scope))
490
self.assertEqual( v1 * v2, pykd.evalExpr("v1 * v2", locals()))
492
def testEvalExprScopeStruct(self):
493
var = pykd.typedVar("g_structTest1")
494
self.assertEqual(var.m_field1, pykd.evalExpr("m_field1", var))
495
self.assertEqual(var.m_field4.deref().m_field1, pykd.evalExpr("m_field4->m_field1", var))
497
def testEvalExprSizeof(self):
498
self.assertEqual(4, pykd.evalExpr("sizeof(int)"))
499
self.assertEqual(4, pykd.evalExpr("sizeof(int&)"))
500
self.assertEqual(pykd.ptrSize() * 10, pykd.evalExpr("sizeof(int*[10])"))
501
self.assertEqual(pykd.ptrSize(), pykd.evalExpr("sizeof(int(*)[10])"))
503
def testContain(self):
504
var = pykd.typedVar("g_structTest")
505
self.assertTrue("m_field1" in var)
506
self.assertFalse("NotExist" in var)
507
self.assertRaises(Exception, lambda var : 2 in var, var)
509
def testHasField(self):
510
var = pykd.typedVar("g_structTest")
511
self.assertTrue(var.hasField("m_field1"))
512
self.assertFalse(var.hasField("NotExist"))
514
def testHasMethod(self):
515
var = pykd.typedVar("g_classChild")
516
self.assertTrue(var.hasMethod("childMethod"))
517
self.assertTrue(var.hasMethod("staticMethod"))
518
self.assertTrue(var.hasMethod("virtMethod1"))
519
self.assertFalse(var.hasMethod("notExist"))
521
def testDumpAccessor(self):
522
typesProvider = pykd.getTypeInfoProviderFromSource (typesSourceCode)
523
ti = typesProvider.getTypeByName('_LIST_ENTRY')
524
a = pykd.typedVar (ti, 0, [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
526
self.assertEqual (a.Flink, 1)
527
self.assertEqual (a.Blink, 0)
528
self.assertEqual (b.Flink, 0)
529
self.assertEqual (b.Blink, 0)
530
self.assertEqual (b.Flink.Flink, 1)
531
self.assertEqual (b.Flink.Flink.Flink, 0)
532
self.assertEqual (b.Flink.Flink.Flink.Flink, 1)
534
dumpAccessor = pykd.dataAccessor ([0,1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,0,0], 0x0807060504030200, "list_entry_dump")
536
s = pykd.typedVar (typesProvider.getTypeByName('StructArray'), dumpAccessor.nestedCopy(1))
537
self.assertEqual (s.size, 0x04030201)
538
self.assertEqual (s.buf[0], 5)
539
self.assertEqual (s.buf[1], 6)
541
a = pykd.typedVar (typesProvider.getTypeByName('_LIST_ENTRY'), dumpAccessor.nestedCopy(1))
543
self.assertEqual (b, 0x0807060504030201)
544
self.assertEqual (b.Flink, 0x0807060504030201)
545
self.assertEqual (b.Flink.Flink, 0x0807060504030201)
546
self.assertEqual (b.Flink.Flink.Flink, 0x0807060504030201)