#include "cmd.h"
#include "newalloc.h"
-static hTab *bptable = NULL;
+hTab *bptable = NULL;
char doingSteps = 0;
char userBpPresent = 0;
-
-/* call stack can be 1024 deep */
-STACK_DCL(callStack,function *,1024);
#ifdef SDCDB_DEBUG
char *debug_bp_type_strings[] =
int k;
breakp *bp;
for ( bp = hTabFirstItem(bptable,&k); bp ;
- bp = hTabNextItem(bptable,&k))
+ bp = hTabNextItem(bptable,&k))
{
bp->hitCnt = 0;
bp->ignoreCnt = 0;
if (bpType == USER || bpType == TMPUSER)
{
for ( bpl = hTabFirstItemWK(bptable,addr) ; bpl;
- bpl = hTabNextItemWK(bptable))
+ bpl = hTabNextItemWK(bptable))
{
/* if also a user break point then issue Note : */
userBpPresent++;
}
- if (bpType != STEP && bpType != NEXT)
- {
- /* if a break point does not already exist then
- send command to simulator to add one */
- if (!hTabSearch(bptable,addr))
- /* send the break command to the simulator */
- simSetBP (addr);
- }
+ /* if a break point does not already exist then
+ send command to simulator to add one */
+ if (!hTabSearch(bptable,addr))
+ /* send the break command to the simulator */
+ simSetBP (addr);
/* now add the break point to list */
hTabAddItem(&bptable,addr,bp);
Dprintf(D_break, ("break: Deleting all STEP BPs\n"));
/* for break points delete if they are STEP */
for ( bp = hTabFirstItem(bptable,&k); bp ;
- bp = hTabNextItem(bptable,&k))
+ bp = hTabNextItem(bptable,&k))
{
/* if this is a step then delete */
- if (bp->bpType == STEP)
+ if (bp->bpType == STEP)
{
+ simClearBP(bp->addr);
hTabDeleteItem(&bptable,bp->addr,bp,DELETE_ITEM,NULL);
Safe_free(bp);
}
/* for break points delete if they are NEXT */
for ( bp = hTabFirstItem(bptable,&k); bp ;
- bp = hTabNextItem(bptable,&k))
+ bp = hTabNextItem(bptable,&k))
{
/* if this is a step then delete */
- if (bp->bpType == NEXT)
+ if (bp->bpType == NEXT)
{
hTabDeleteItem(&bptable,bp->addr,bp,DELETE_ITEM,NULL);
Safe_free(bp);
point matches or bpnumber == -1 (meaning delete
all user break points */
if ((bp->bpType == USER || bp->bpType == TMPUSER )
- && ( bp->bpnum == bpnum || bpnum == -1))
+ && ( bp->bpnum == bpnum || bpnum == -1))
{
hTabDeleteItem(&bptable,bp->addr,bp,DELETE_ITEM,NULL);
bpnum, cmds));
for ( bp = hTabFirstItem(bptable,&k); bp ;
- bp = hTabNextItem(bptable,&k))
+ bp = hTabNextItem(bptable,&k))
{
if ((bp->bpType == USER || bp->bpType == TMPUSER )
- && ( bp->bpnum == bpnum ))
+ && ( bp->bpnum == bpnum ))
{
if ( bp->commands )
Safe_free(bp->commands);
bpnum, cond?cond:""));
for ( bp = hTabFirstItem(bptable,&k); bp ;
- bp = hTabNextItem(bptable,&k))
+ bp = hTabNextItem(bptable,&k))
{
if ((bp->bpType == USER || bp->bpType == TMPUSER )
- && ( bp->bpnum == bpnum ))
+ && ( bp->bpnum == bpnum ))
{
if ( bp->condition )
Safe_free(bp->condition);
bpnum, ignorecnt));
for ( bp = hTabFirstItem(bptable,&k); bp ;
- bp = hTabNextItem(bptable,&k))
+ bp = hTabNextItem(bptable,&k))
{
if ((bp->bpType == USER || bp->bpType == TMPUSER )
- && ( bp->bpnum == bpnum ))
+ && ( bp->bpnum == bpnum ))
{
bp->ignoreCnt = bp->hitCnt + ignorecnt;
return;
if ( bp->hitCnt > 0 )
fprintf(stdout,"\tbreakpoint already hit %d time%s\n",
bp->hitCnt,bp->hitCnt>1?"s":"" );
-
+
}
}
bp = hTabNextItemWK(bptable)) {
/* if this is a step then delete */
- if (bp->bpType == USER || bp->bpType == TMPUSER)
+ if (bp->bpType == USER || bp->bpType == TMPUSER)
{
hTabDeleteItem(&bptable,bp->addr,bp,DELETE_ITEM,NULL);
/* if this leaves no other break points then
send command to simulator to delete bp from this addr */
- if (hTabSearch(bptable,bp->addr) == NULL)
+ if (hTabSearch(bptable,bp->addr) == NULL)
{
simClearBP(bp->addr);
}
}
/* dispatch the call back functions */
- for (; bp; bp = hTabNextItemWK(bptable))
+ for (; bp; bp = hTabNextItemWK(bptable))
{
rv += (*bp->callBack)(addr,bp,ctxt);
}
return rv;
}
-/*-----------------------------------------------------------------*/
-/* 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 ( STACK_EMPTY(callStack) && !strcmp(func->sym->name,"main"))
- {
- fprintf(stdout,"Program exited with code %d.\n",simGetValue (0x82,'I',2));
- return 1;
- }
- return 0;
-}
/*-----------------------------------------------------------------*/
/* userBpCB - call back function for user break points */
/*-----------------------------------------------------------------*/
Dprintf(D_break, ("break: userBpCB: commands:%p\n", bp->commands));
setCmdLine(bp->commands);
}
-
+
if (srcMode == SRC_CMODE) {
fprintf(stdout,"Breakpoint %d, %s() at %s:%d\n",
bp->bpnum,
/* if this leaves no other break points then
send command to simulator to delete bp from this addr */
- if (hTabSearch(bptable,bp->addr) == NULL)
+ if (hTabSearch(bptable,bp->addr) == NULL)
{
simClearBP (bp->addr);
Dprintf(D_break, ("break: simClearBP 0x%x\n", bp->addr));