Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit af6f726

Browse files
committed
Update the logic of how TWindbg shows the pointer chain
Update the code logic in smart_dereference(), chaining the pointer in a more reasonable way, so TWindbg will show the information of cyclic dereference more correctly.
1 parent bf55dc0 commit af6f726

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

TWindbg/context.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,15 @@ def smart_dereference(self, ptr):
217217
val = deref_ptr(ptr)
218218
if val == None: # no more dereference
219219
break
220-
elif val in ptr_values[:-1:]: # cyclic dereference
221-
ptr_values.append(val)
220+
221+
ptr_values.append(val)
222+
# Check if the newly pushed value is in ptr_values[:-1:]
223+
# If it does means there's a cyclic dereference in the current pointer chain
224+
# Otherwise the newly pushed value will become the new pointer to be dereferenced next
225+
if val in ptr_values[:-1:]:
222226
is_cyclic = True
223227
break
224228
else:
225-
ptr_values.append(val)
226229
ptr = val
227230

228231
return ptr_values, is_cyclic

0 commit comments

Comments
 (0)