+2003-05-28 Karl Bongers(patches from Martin Helmling)
+ * debugger/mcs51/sdcdb.c,cmd.c,break.c and .h files. Martin adds
+ condition and ignore commands.
+
2003-05-28 Frieder Ferlemann <Frieder.Ferlemann@web.de>
* doc/sdccman.lyx: Changes all over, index improved, smaller margins. The manual
======================
+ddd - Notes from Martin Helmling, May 23, 2003
+========================
+
+Additionally following new commands work:
+
+ignore <breakpointnumber> <ignorecount> - ignore the breakpoint n times
+condition <breakpointnumber> <variable> <|>|<=|>=|==|!= <constant> - break condition
+commands - see gdb description -
+
ddd - Notes from Martin Helmling, April 28, 2003
========================
#include "sdcdb.h"
#include "symtab.h"
#include "break.h"
+#include "cmd.h"
#include "newalloc.h"
static hTab *bptable = NULL;
return bpnum;
}
+void resetHitCount()
+{
+ int k;
+ breakp *bp;
+ for ( bp = hTabFirstItem(bptable,&k); bp ;
+ bp = hTabNextItem(bptable,&k))
+ {
+ bp->hitCnt = 0;
+ bp->ignoreCnt = 0;
+ }
+}
+
/*-----------------------------------------------------------------*/
/* setBreakPoint - creates an entry in the break point table */
/*-----------------------------------------------------------------*/
int setBreakPoint (unsigned addr, char addrType, char bpType,
- int (*callBack)(unsigned,char,char,int,context *) ,
+ int (*callBack)(unsigned,breakp *,context *) ,
char *fileName, int lineno)
{
breakp *bp, *bpl;
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 */
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)) {
-
- /* if this is a step then delete */
- if (bp->bpType == STEP) {
- hTabDeleteItem(&bptable,bp->addr,bp,DELETE_ITEM,NULL);
+ bp = hTabNextItem(bptable,&k))
+ {
- free(bp);
- }
+ /* if this is a step then delete */
+ if (bp->bpType == STEP)
+ {
+ 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)) {
-
- /* if this is a step then delete */
- if (bp->bpType == NEXT) {
- hTabDeleteItem(&bptable,bp->addr,bp,DELETE_ITEM,NULL);
+ bp = hTabNextItem(bptable,&k))
+ {
- free(bp);
- }
+ /* if this is a step then delete */
+ if (bp->bpType == NEXT)
+ {
+ hTabDeleteItem(&bptable,bp->addr,bp,DELETE_ITEM,NULL);
+ Safe_free(bp);
+ }
}
}
+static void freeUSERbp(breakp *bp)
+{
+ if ( bp->commands )
+ Safe_free(bp->commands);
+ if ( bp->condition )
+ Safe_free(bp->condition);
+ Safe_free(bp);
+}
+
/*-----------------------------------------------------------------*/
/* deleteUSERbp - deletes USER break point with number */
/*-----------------------------------------------------------------*/
/* for break points delete if they are STEP */
for ( bp = hTabFirstItem(bptable,&k); bp ;
- bp = hTabNextItem(bptable,&k)) {
-
- /* if this is a user then delete if break
- point matches or bpnumber == -1 (meaning delete
- all user break points */
- if ((bp->bpType == USER || bp->bpType == TMPUSER )
- && ( bp->bpnum == bpnum || bpnum == -1)) {
- 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) {
- simClearBP (bp->addr);
- Dprintf(D_break, ("break: deleteUSERbp:simClearBP 0x%x\n", bp->addr));
-
- }
- fprintf(stdout,"Deleted breakpoint %d\n",
- bp->bpnum);
- userBpPresent --;
- if (bpnum == -1)
- continue ;
- else
- break;
- }
+ bp = hTabNextItem(bptable,&k)) {
+
+ /* if this is a user then delete if break
+ point matches or bpnumber == -1 (meaning delete
+ all user break points */
+ if ((bp->bpType == USER || bp->bpType == TMPUSER )
+ && ( bp->bpnum == bpnum || bpnum == -1))
+ {
+ 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) {
+ simClearBP (bp->addr);
+ Dprintf(D_break, ("break: deleteUSERbp:simClearBP 0x%x\n", bp->addr));
+
+ }
+ fprintf(stdout,"Deleted breakpoint %d\n",bp->bpnum);
+ userBpPresent-- ;
+ freeUSERbp(bp);
+ if (bpnum == -1)
+ continue ;
+ else
+ break;
+ }
}
if (!bp && bpnum != -1)
- fprintf(stderr,"No breakpoint number %d.\n",bpnum);
+ fprintf(stderr,"No breakpoint number %d.\n",bpnum);
}
/*-----------------------------------------------------------------*/
fprintf(stderr,"No breakpoint number %d.\n",bpnum);
}
+/*-----------------------------------------------------------------*/
+/* setUserbpCondition - set condition string for breakpoint */
+/*-----------------------------------------------------------------*/
+void setUserbpCondition (int bpnum, char *cond)
+{
+ breakp *bp;
+ int k;
+ Dprintf(D_break, ("break: setUserbpCondition %d: condition:'%s'\n",
+ bpnum, cond?cond:""));
+
+ for ( bp = hTabFirstItem(bptable,&k); bp ;
+ bp = hTabNextItem(bptable,&k))
+ {
+ if ((bp->bpType == USER || bp->bpType == TMPUSER )
+ && ( bp->bpnum == bpnum ))
+ {
+ if ( bp->condition )
+ Safe_free(bp->condition);
+ bp->condition = cond;
+ return;
+ }
+ }
+ fprintf(stderr,"No breakpoint number %d.\n",bpnum);
+}
+
+/*-----------------------------------------------------------------*/
+/* setUserbpIgnCount - set ignorecount for breakpoint */
+/*-----------------------------------------------------------------*/
+void setUserbpIgnCount (int bpnum, int ignorecnt )
+{
+ breakp *bp;
+ int k;
+ Dprintf(D_break, ("break: setUserbpIgnCount %d: ignorecnt=%d\n",
+ bpnum, ignorecnt));
+
+ for ( bp = hTabFirstItem(bptable,&k); bp ;
+ bp = hTabNextItem(bptable,&k))
+ {
+ if ((bp->bpType == USER || bp->bpType == TMPUSER )
+ && ( bp->bpnum == bpnum ))
+ {
+ bp->ignoreCnt = bp->hitCnt + ignorecnt;
+ return;
+ }
+ }
+ fprintf(stderr,"No breakpoint number %d.\n",bpnum);
+}
+
/*-----------------------------------------------------------------*/
/* listUSERbp - list all user break points */
/*-----------------------------------------------------------------*/
void listUSERbp ()
{
breakp *bp;
- int k;
+ int k, isuser;
/* if there are none then say so & return */
if (!userBpPresent) {
- fprintf(stdout,"No breakpoints.\n");
- return ;
+ fprintf(stdout,"No breakpoints.\n");
+ return ;
}
fprintf(stdout,"Num Type Disp Enb Address What\n");
for ( bp = hTabFirstItem(bptable,&k) ; bp ;
- bp = hTabNextItem(bptable,&k)) {
-
- if (bp->bpType == USER ) {
- fprintf(stdout,"%-3d breakpoint keep y 0x%08x at %s:%d\n",
- bp->bpnum,bp->addr,
- bp->filename,bp->lineno+1);
-
- }
- else if (bp->bpType == TMPUSER ) {
- fprintf(stdout,"%-3d breakpoint del y 0x%08x at %s:%d\n",
- bp->bpnum,bp->addr,
- bp->filename,bp->lineno+1);
+ bp = hTabNextItem(bptable,&k)) {
+
+ isuser = 0;
+ if (bp->bpType == USER ) {
+ fprintf(stdout,"%-3d breakpoint keep y 0x%08x at %s:%d\n",
+ bp->bpnum,bp->addr,
+ bp->filename,bp->lineno+1);
+ isuser = 1;
+ }
+ else if (bp->bpType == TMPUSER ) {
+ fprintf(stdout,"%-3d breakpoint del y 0x%08x at %s:%d\n",
+ bp->bpnum,bp->addr,
+ bp->filename,bp->lineno+1);
+ isuser = 1;
+ }
+ if ( ! isuser )
+ continue;
+ if ( bp->ignoreCnt > bp->hitCnt )
+ fprintf(stdout,"\tignore next %d hits\n",
+ bp->ignoreCnt - bp->hitCnt );
+ if ( bp->condition )
+ fprintf(stdout,"\tstop only if %s\n",bp->condition );
+ if ( bp->hitCnt > 0 )
+ fprintf(stdout,"\tbreakpoint already hit %d time%s\n",
+ bp->hitCnt,bp->hitCnt>1?"s":"" );
+
- }
}
}
/* for break points delete if they are STEP */
for ( bp = hTabFirstItemWK(bptable,addr); bp ;
- bp = hTabNextItemWK(bptable)) {
-
- /* if this is a step then delete */
- 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) {
- simClearBP(bp->addr);
-
- }
- fprintf(stdout,"Deleted breakpoint %d\n",
- bp->bpnum);
- userBpPresent-- ;
- break;
- }
+ bp = hTabNextItemWK(bptable)) {
+
+ /* if this is a step then delete */
+ 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)
+ {
+ simClearBP(bp->addr);
+ }
+ fprintf(stdout,"Deleted breakpoint %d\n",
+ bp->bpnum);
+ userBpPresent-- ;
+ freeUSERbp(bp);
+ break;
+ }
}
if (!bp)
- fprintf(stderr,"No breakpoint at address 0x%x.\n",addr);
+ fprintf(stderr,"No breakpoint at address 0x%x.\n",addr);
}
/*-----------------------------------------------------------------*/
/* dispatch the call back functions */
for (; bp; bp = hTabNextItemWK(bptable))
{
- if ( bp->commands )
- {
- char save_ch;
- Dprintf(D_break, ("break: dispatchCB: commands:\n%send\n", bp->commands));
- setCmdLine(bp->commands);
- }
-
- rv += (*bp->callBack)(addr,bp->addrType,
- bp->bpType,bp->bpnum,ctxt);
+ rv += (*bp->callBack)(addr,bp,ctxt);
}
if (rv == 0) {
/*-----------------------------------------------------------------*/
BP_CALLBACK(userBpCB)
{
- Dprintf(D_break, ("break: userBpCB: BP_CALLBACK entry\n"));
+ bp->hitCnt++ ;
+ Dprintf(D_break, ("break: userBpCB: BP_CALLBACK entry hit=%d ignor=%d\n",
+ bp->hitCnt, bp->ignoreCnt));
+ if ( bp->ignoreCnt > bp->hitCnt )
+ return 0;
+
+ if ( bp->condition )
+ {
+ if (! conditionIsTrue( bp->condition, ctxt ))
+ return 0;
+ }
+
+ if ( bp->commands )
+ {
+ Dprintf(D_break, ("break: userBpCB: commands:%d\n", bp->commands));
+ setCmdLine(bp->commands);
+ }
+
if (srcMode == SRC_CMODE) {
- fprintf(stdout,"Breakpoint %d, %s() at %s:%d\n",
- bpnum,
- ctxt->func->sym->name,
- ctxt->func->mod->c_name,
- ctxt->cline+1);
- if (ctxt->func->mod && ctxt->cline > 0)
- fprintf(stdout,"%d\t%s",ctxt->cline+1,
- ctxt->func->mod->cLines[ctxt->cline]->src);
+ fprintf(stdout,"Breakpoint %d, %s() at %s:%d\n",
+ bp->bpnum,
+ ctxt->func->sym->name,
+ ctxt->func->mod->c_name,
+ ctxt->cline+1);
+ if (ctxt->func->mod && ctxt->cline > 0)
+ fprintf(stdout,"%d\t%s",ctxt->cline+1,
+ ctxt->func->mod->cLines[ctxt->cline]->src);
} else {
- fprintf(stdout,"Breakpoint %d, %s() at %s:%d\n",
- bpnum,
- ctxt->func->sym->name,
- ctxt->func->mod->asm_name,
- ctxt->asmline+1);
- if (ctxt->func->mod && ctxt->asmline > 0)
- fprintf(stdout,"%d\t%s",ctxt->asmline+1,
- ctxt->func->mod->asmLines[ctxt->asmline]->src);
+ fprintf(stdout,"Breakpoint %d, %s() at %s:%d\n",
+ bp->bpnum,
+ ctxt->func->sym->name,
+ ctxt->func->mod->asm_name,
+ ctxt->asmline+1);
+ if (ctxt->func->mod && ctxt->asmline > 0)
+ fprintf(stdout,"%d\t%s",ctxt->asmline+1,
+ ctxt->func->mod->asmLines[ctxt->asmline]->src);
}
- if ( bpType == TMPUSER && bpnum > 0 )
- deleteUSERbp (bpnum);
+ if ( bp->bpType == TMPUSER && bp->bpnum > 0 )
+ {
+ 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)
+ {
+ simClearBP (bp->addr);
+ Dprintf(D_break, ("break: simClearBP 0x%x\n", bp->addr));
+
+ }
+ userBpPresent-- ;
+ freeUSERbp(bp);
+ }
return 1;
}
char *filename; /* file name */
int lineno ; /* lineno */
int (*callBack)
- (unsigned,char,char,int,context *);/* address of call back
+ (unsigned,struct breakp *,context *);/* address of call back
* function */
char *commands;
+ int ignoreCnt;
+ int hitCnt;
+ char *condition;
} breakp;
#define BP_CALLBACK(func) \
int func (unsigned addr, \
- char addrType, \
- char bpType , \
- int bpnum ,\
+ breakp *bp, \
context *ctxt)
#define EXTERN_BP_CALLBACK(func) \
extern int func (unsigned addr, \
- char addrType, \
- char bpType , \
- int bpnum ,\
+ breakp *bp, \
context *ctxt)
extern char userBpPresent;
int setBreakPoint (unsigned , char , char,
- int (*callBack)(unsigned,char,char,int,context *),char *, int);
+ int (*callBack)(unsigned,breakp *bp,context *),char *, int);
-extern long getLastBreakptNumber(void);
+long getLastBreakptNumber(void);
+void resetHitCount(void);
+void setUserbpCommand (int , char *);
+void setUserbpCondition (int , char *);
+void setUserbpIgnCount (int , int );
void clearUSERbp ( unsigned int );
void deleteSTEPbp();
static void printTypeInfo(link *);
static void printValAggregates (symbol *,link *,char,unsigned int,int);
-static void printOrSetSymValue (symbol *sym, context *cctxt,
- int flg, int dnum, int fmt, char *rs, char *val);
+static int printOrSetSymValue (symbol *sym, context *cctxt,
+ int flg, int dnum, int fmt,
+ char *rs, char *val, char cmp);
int srcMode = SRC_CMODE ;
static set *dispsymbols = NULL ; /* set of displayable symbols */
while (isspace(*s)) *s++ = '\0';
if (*s)
{
- printOrSetSymValue(sym,cctxt,0,0,0,rs,s);
+ printOrSetSymValue(sym,cctxt,0,0,0,rs,s,'\0');
return 0;
}
else
return 0;
}
+/*-----------------------------------------------------------------*/
+/* cmdIgnore - set ignorecount for breakpoint */
+/*-----------------------------------------------------------------*/
+int cmdIgnore (char *s, context *cctxt)
+{
+ int bpnum, cnt ;
+ while (isspace(*s)) s++;
+ if (!*s )
+ {
+ fprintf(stdout,"Argument required (breakpoint number).\n");
+ return 0;
+ }
+ bpnum = strtol(s,&s,10);
+ while (isspace(*s)) s++;
+ if (!*s )
+ {
+ fprintf(stdout,"Second argument (specified ignore-count) is missing.");
+ return 0;
+ }
+ cnt = strtol(s,0,10);
+ setUserbpIgnCount(bpnum,cnt);
+ return 0;
+}
+
+/*-----------------------------------------------------------------*/
+/* cmdCondition - set condition for breakpoint */
+/*-----------------------------------------------------------------*/
+int cmdCondition (char *s, context *cctxt)
+{
+ int bpnum ;
+ while (isspace(*s)) s++;
+ if (!*s )
+ {
+ fprintf(stdout,"Argument required (breakpoint number).\n");
+ return 0;
+ }
+ bpnum = strtol(s,&s,10);
+ while (isspace(*s)) s++;
+ if (*s)
+ s = Safe_strdup(s);
+ else
+ s = NULL;
+ setUserbpCondition(bpnum,s);
+ return 0;
+}
+
/*-----------------------------------------------------------------*/
/* cmdCommands - set commands for breakpoint */
/*-----------------------------------------------------------------*/
fprintf(stdout,"No executable file specified.\nUse the \"file\" command.\n");
return 0;
}
+ resetHitCount();
simGo(0);
} else {
fgets(buff,sizeof(buff),stdin);
if (toupper(buff[0]) == 'Y') {
simReset();
+ resetHitCount();
simGo(0);
}
}
return 0;
}
-static void setValBasic(symbol *sym, link *type,
- char mem, unsigned addr,int size, char *val)
+static unsigned long getValBasic(symbol *sym, link *type, char *val)
{
char *s;
union
else
v.val = strtol(val,NULL,0);
}
- simSetValue(addr,mem,size,v.val);
+ return v.val;
}
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
/* printOrSetSymValue - print or set value of a symbol */
/*-----------------------------------------------------------------*/
-static void printOrSetSymValue (symbol *sym, context *cctxt,
- int flg, int dnum, int fmt, char *rs, char *val)
+static int printOrSetSymValue (symbol *sym, context *cctxt,
+ int flg, int dnum, int fmt, char *rs,
+ char *val, char cmp )
{
static char fmtChar[] = " todx ";
static int stack = 1;
if (!bp)
{
fprintf(stdout,"cannot determine stack frame\n");
- return ;
+ return 1;
}
sym->addr = simGetValue(bp->addr,bp->addrspace,bp->size)
*s2 = save_ch2;
if ( ! fields )
{
- fprintf(stdout,"Unkown variable \"%s\" for index.\n", s);
- return;
+ fprintf(stdout,"Unknown variable \"%s\" for index.\n", s);
+ return 1;
}
/* arrays & structures first */
if (! IS_INTEGRAL(fields->type))
{
fprintf(stdout,"Wrong type of variable \"%s\" for index \n", s);
- return;
+ return 1;
}
n = simGetValue(fields->addr,fields->addrspace,getSize(fields->type));
}
if ( n < 0 || n >= DCL_ELEM(type))
{
fprintf(stdout,"Wrong index %d.\n", n);
- return;
+ return 1;
}
type = type->next;
size = getSize(type);
if ( ! fields )
{
fprintf(stdout,"Unknown field \"%s\" of structure\n", s);
- return;
+ return 1;
}
type = fields->type;
size = getSize(type);
if (IS_AGGREGATE(type))
{
if ( val )
- fprintf(stdout,"Cannot set aggregate variable\n");
+ {
+ fprintf(stdout,"Cannot set/compare aggregate variable\n");
+ return 1;
+ }
else
printValAggregates(sym,type,sym->addrspace,addr,fmt);
}
{
if ( !val )
printValFunc(sym,fmt);
+ else
+ return 1;
}
else
{
if ( val )
- setValBasic (sym,type,sym->addrspace,addr,size,val);
+ {
+ unsigned long newval;
+ newval = getValBasic(sym,type,val);
+
+ if ( cmp )
+ {
+ unsigned long lval;
+ lval = simGetValue(addr,sym->addrspace,size);
+ switch ( cmp )
+ {
+ case '<' : return ( lval < newval ? 1:0 ); break;
+ case '>' : return ( lval > newval ? 1:0 ); break;
+ case 'l' : return ( lval <= newval ? 1:0 ); break;
+ case 'g' : return ( lval >= newval ? 1:0 ); break;
+ case '=' : return ( lval == newval ? 1:0 ); break;
+ case '!' : return ( lval != newval ? 1:0 ); break;
+ }
+ }
+ else
+ {
+ simSetValue(addr,sym->addrspace,size,newval);
+ return 1;
+ }
+ }
else
printValBasic(sym,type,sym->addrspace,addr,size,fmt);
}
if ( flg > 0 ) fprintf(stdout,"\n");
-
+ return 0;
}
/*-----------------------------------------------------------------*/
}
}
+/*-----------------------------------------------------------------*/
+/* conditionIsTrue - compare variable with constant value */
+/*-----------------------------------------------------------------*/
+int conditionIsTrue( char *s, context *cctxt)
+{
+ symbol *sym = NULL;
+ int fmt;
+ char *rs, *dup, cmp_char;
+ dup = s = Safe_strdup(s);
+ if ( !( rs = preparePrint(s, cctxt, &fmt, &sym )) || !sym)
+ fmt = 1;
+ else if (!( s = strpbrk(rs,"<>=!")))
+ fmt = 1;
+ else
+ {
+ cmp_char = *s;
+ *s++ = '\0';
+ if ( *s == '=' )
+ {
+ /* if <= or >= an other char is used
+ * == or != not checked in switch
+ */
+ switch( cmp_char )
+ {
+ case '>': cmp_char = 'g' ; break;
+ case '<': cmp_char = 'l' ; break;
+ }
+ s++ ;
+ }
+ while (isspace(*s)) *s++ = '\0';
+ fmt = printOrSetSymValue(sym,cctxt,0,0,0,rs,s,cmp_char);
+ }
+ Safe_free(dup);
+ return fmt;
+}
+
/*-----------------------------------------------------------------*/
/* cmdPrint - print value of variable */
/*-----------------------------------------------------------------*/
if ( sym )
{
- printOrSetSymValue(sym,cctxt,1,0,fmt,rs,NULL);
+ printOrSetSymValue(sym,cctxt,1,0,fmt,rs,NULL,'\0');
}
return 0;
}
if ( sym )
{
- printOrSetSymValue(sym,cctxt,0,0,fmt,rs,NULL);
+ printOrSetSymValue(sym,cctxt,0,0,fmt,rs,NULL,'\0');
}
return 0;
}
dsym = setNextItem(dispsymbols))
{
if ( (sym = symLookup(dsym->name,cctxt)))
- printOrSetSymValue(sym,cctxt,2,dsym->dnum,dsym->fmt,dsym->rs,NULL);
+ printOrSetSymValue(sym,cctxt,2,dsym->dnum,dsym->fmt,
+ dsym->rs,NULL,'\0');
}
}
extern int cmdListSrc (char *, context *);
extern int cmdListAsm (char *, context *);
extern int cmdSetOption (char *, context *);
+extern int cmdCondition (char *, context *);
+extern int cmdIgnore (char *, context *);
extern int cmdContinue (char *, context *);
extern int cmdDelUserBp (char *, context *);
extern int cmdStep (char *, context *);
extern int cmdListSymbols (char *s, context *cctxt);
extern void setMainContext( void);
+int conditionIsTrue( char *s, context *cctxt);
#endif
{ "continue" , cmdContinue ,
"{c}ontinue\t\t Continue program being debugged, after breakpoint.\n"
},
+ { "condition" , cmdCondition ,
+ "condition brkpoint_number expr\t\tSet condition for breakpoint.\n"
+ },
+ { "ignore" , cmdIgnore ,
+ "brkpoint_number count\t\tSet ignore count for breakpoint.\n"
+ },
{ "commands" , cmdCommands ,
- "commands [brkpoint number]\t\tSetting commands for breakpoint.\n"
+ "commands [brkpoint_number]\t\tSetting commands for breakpoint.\n"
},
{ "c" , cmdContinue , NULL },
/*-----------------------------------------------------------------*/
char *getNextCmdLine()
{
+ //fprintf(stderr,"getNextCmdLine() actualcmdfile=%p\n",actualcmdfile);
if (!actualcmdfile)
return NULL;
+ fprintf(stdout,">");
+ fflush(stdout);
if (fgets(cmdbuff,sizeof(cmdbuff),actualcmdfile) == NULL)
+ {
+ // fprintf(stderr,"getNextCmdLine() returns null\n");
return NULL;
+ }
+ //fprintf(stderr,"getNextCmdLine() returns: %s",cmdbuff);
return cmdbuff;
}
fflush(stdout);
}
+ //fprintf(stderr,"commandLoop actualcmdfile=%p cmdfile=%p\n",
+ // actualcmdfile,cmdfile);
if (fgets(cmdbuff,sizeof(cmdbuff),cmdfile) == NULL)
break;
static void
setsignals()
{
- signal(SIGHUP , bad_signal);
+ signal(SIGHUP , SIG_IGN);
+ signal(SIGCONT, SIG_IGN);
signal(SIGINT , sigintr );
signal(SIGTERM, bad_signal);
signal(SIGCHLD, sigchld );
char *alloccpy(char *,int );
char *gc_strdup(const char *s);
srcLine **loadFile (char *name, int *nlines);
+
extern short fullname;
extern int srcMode;
extern char contsim;