MCPcopy Create free account
hub / github.com/axhlzy/FridaDebugger / logStackSlot

Function logStackSlot

agent/stack.ts:75–102  ·  view source on GitHub ↗
(
    index: number,
    slot: NativePointer,
    snapshot: StackSnapshot,
    previous?: StackSnapshot | null,
    markers?: StackMarkers,
)

Source from the content-addressed store, hash-verified

73}
74
75function logStackSlot(
76 index: number,
77 slot: NativePointer,
78 snapshot: StackSnapshot,
79 previous?: StackSnapshot | null,
80 markers?: StackMarkers,
81): void {
82 const offset = `+0x${(index * Process.pointerSize).toString(16).padStart(4, "0")}`;
83 try {
84 const value = slot.readPointer();
85 const valueText = value.toString();
86 snapshot[offset] = valueText;
87 const changed = previous !== undefined && previous !== null && previous[offset] !== valueText;
88 const symbol = resolveAddress(value);
89 const line = [
90 colorize("[stk]", "gray"),
91 colorize(padLeft(offset, 7), "yellow"),
92 colorize(padRight(slot, 14), "cyan"),
93 "=>",
94 colorize(padRight(value, 20), changed ? "red" : symbol.length > 0 ? "green" : "gray"),
95 symbol.length > 0 ? colorize(symbol, changed ? "red" : "magenta") : "",
96 markers === undefined ? "" : formatMarkers(slot, value, markers),
97 ].filter((part) => part.length > 0).join(" ");
98 log(line);
99 } catch (error) {
100 log(`[stk] ${offset} ${slot} => <read failed: ${String(error)}>`, "red");
101 }
102}
103
104interface StackMarkers {
105 sp: NativePointer;

Callers 1

logStackFunction · 0.85

Calls 6

resolveAddressFunction · 0.85
colorizeFunction · 0.85
padLeftFunction · 0.85
padRightFunction · 0.85
formatMarkersFunction · 0.85
logFunction · 0.85

Tested by

no test coverage detected