-/*-----------------------------------------------------------------*/
-/* fentryCB - callback function for function entry */
-/*-----------------------------------------------------------------*/
-BP_CALLBACK(fentryCB)
-{
- function *func;
-
- /* we save the value of SP
- which will be used to display the value of local variables
- and parameters on the stack */
- ctxt->func->stkaddr = simGetValue (0x81,'I',1);
-
- Dprintf(D_break, ("break: fentryCB: BP_CALLBACK entry %s sp=0x%02x %p\n",
- ctxt->func->sym->name,
- ctxt->func->stkaddr, p_callStack));
-
- /* and set laddr of calling function to return addr from stack */
- if ((func = STACK_PEEK(callStack)))
- {
- /* extern stack ?? 'A' */
- func->laddr = simGetValue (ctxt->func->stkaddr-1,'B',2);
- }
- /* add the current function into the call stack */
- STACK_PUSH(callStack,ctxt->func);
-
- return 0;
-}
-
-/*-----------------------------------------------------------------*/
-/* fexitCB - call back for function exit */
-/*-----------------------------------------------------------------*/
-BP_CALLBACK(fexitCB)
-{
- function *func;
- /* pop the top most from the call stack */
- func = STACK_POP(callStack);
-
- if (!func)
- {
- fprintf(stdout, "Stack underflow\n");
- return 1;
- }
-
- Dprintf(D_break, ("break: fexitCB: BP_CALLBACK entry %s %p\n", func->sym->name, p_callStack));
-
- /* check main function */
- if ( !strcmp(func->sym->name, "main"))
- {
- fprintf(stdout, "Program exited with code %lu.\n", simGetValue (0x82,'I',2));
- return 1;
- }
- return 0;
-}