diff --git a/components/Tracer/index.tsx b/components/Tracer/index.tsx index e8e3180..8eaa2a8 100644 --- a/components/Tracer/index.tsx +++ b/components/Tracer/index.tsx @@ -33,11 +33,19 @@ export interface TraceEntry { fp: number } +export interface CallstackEntry { + fp: number + call_pc: number | null + ret_pc: number | null + fn_name: string | null +} + export type SierraVariables = { [key: string]: Array } export interface TracerData { pcInstMap: { [key: string]: Instruction } trace: TraceEntry[] + callstack: CallstackEntry[][] memory: { [key: string]: string } pcToInstIndexesMap: { [key: string]: number } entryToSierraVarsMap: { [key: string]: SierraVariables } @@ -67,6 +75,7 @@ export const Tracer = ({ mainHeight }: TracerProps) => { const trace = tracerData?.trace const currentTraceEntry = tracerData?.trace[executionTraceStepNumber] const errorTraceEntry = tracerData?.trace.at(-1) + const currentCallstackEntry = tracerData?.callstack[executionTraceStepNumber] const [selectedConsoleTab, setSelectedConsoleTab] = useState( IConsoleTab.Console, @@ -245,6 +254,7 @@ export const Tracer = ({ mainHeight }: TracerProps) => { trace={trace} currentTraceEntry={currentTraceEntry} executionTraceStepNumber={executionTraceStepNumber} + currentCallstackEntry={currentCallstackEntry} handleRegisterPointerClick={handleRegisterPointerClick} /> )} @@ -257,11 +267,13 @@ export const Tracer = ({ mainHeight }: TracerProps) => { function DebugInfoTab({ trace, currentTraceEntry, + currentCallstackEntry, executionTraceStepNumber, handleRegisterPointerClick, }: { trace: TraceEntry[] | undefined currentTraceEntry: TraceEntry | undefined + currentCallstackEntry?: CallstackEntry[] executionTraceStepNumber: number handleRegisterPointerClick: (num: number) => void }) { @@ -317,6 +329,36 @@ function DebugInfoTab({ +
+
+ Callstack +
+
+ + + + + + + + + + + {currentCallstackEntry?.map((callstackEntry, index) => ( + + + + + + + ))} + +
FPCALL PCRET PCFN NAME
{callstackEntry.fp}{callstackEntry.call_pc}{callstackEntry.ret_pc}{callstackEntry.fn_name}
+
+
)} diff --git a/context/cairoVMApiContext.tsx b/context/cairoVMApiContext.tsx index a5a7c40..77208b9 100644 --- a/context/cairoVMApiContext.tsx +++ b/context/cairoVMApiContext.tsx @@ -188,6 +188,7 @@ export const CairoVMApiProvider: React.FC = ({ memory: data.tracer_data.memory, pcInstMap: data.tracer_data.pc_inst_map, trace: data.tracer_data.trace, + callstack: data.tracer_data.callstack, pcToInstIndexesMap: data.tracer_data.pc_to_inst_indexes_map, entryToSierraVarsMap: data.tracer_data.trace_entries_to_sierra_vars, })