under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
static void printTypeInfo(link *);
static void printValAggregates (symbol *,link *,char,unsigned int,int);
static void printTypeInfo(link *);
static void printValAggregates (symbol *,link *,char,unsigned int,int);
-static int printOrSetSymValue (symbol *sym, context *cctxt,
- int flg, int dnum, int fmt,
+static int printOrSetSymValue (symbol *sym, context *cctxt,
+ int flg, int dnum, int fmt,
char *rs, char *val, char cmp);
int srcMode = SRC_CMODE ;
char *rs, char *val, char cmp);
int srcMode = SRC_CMODE ;
if (srcMode == SRC_AMODE && line > mod->nasmLines) {
fprintf(stderr,"No line %d in file \"%s\".\n",
line,mod->asm_name);
if (srcMode == SRC_AMODE && line > mod->nasmLines) {
fprintf(stderr,"No line %d in file \"%s\".\n",
line,mod->asm_name);
- setBreakPoint (mod->cLines[next_line]->addr, CODE, bpType,
+ setBreakPoint (mod->cLines[next_line]->addr, CODE, bpType,
- setBreakPoint (mod->asmLines[next_line]->addr, CODE, bpType,
+ setBreakPoint (mod->asmLines[next_line]->addr, CODE, bpType,
if (srcMode == SRC_AMODE && line > mod->ncLines) {
fprintf(stderr,"No line %d in file \"%s\".\n",
line,mod->c_name);
return ;
if (srcMode == SRC_AMODE && line > mod->ncLines) {
fprintf(stderr,"No line %d in file \"%s\".\n",
line,mod->c_name);
return ;
/*-----------------------------------------------------------------*/
/* funcWithNameModule - returns functions with a name module combo */
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
/* funcWithNameModule - returns functions with a name module combo */
/*-----------------------------------------------------------------*/
/* in the address range */
if (func->sym->addr <= addr &&
func->sym->eaddr >= addr) {
/* in the address range */
if (func->sym->addr <= addr &&
func->sym->eaddr >= addr) {
- setBreakPoint (func->sym->addr , CODE , STEP ,
+ setBreakPoint (func->sym->addr , CODE , STEP ,
-
- setBreakPoint (ep->addr, CODE, bptype,
+
+ setBreakPoint (ep->addr, CODE, bptype,
-
- setBreakPoint (ep->addr, CODE, bptype,
+
+ setBreakPoint (ep->addr, CODE, bptype,
/* find the c line number */
if(applyToSet(func->cfpoints,lineAtAddr,addr,
/* find the c line number */
if(applyToSet(func->cfpoints,lineAtAddr,addr,
currCtxt->cline = func->lline = line;
else if(applyToSet(func->cfpoints,lineNearAddr,addr,
currCtxt->cline = func->lline = line;
else if(applyToSet(func->cfpoints,lineNearAddr,addr,
/* find the asm line number */
line = 0;
if (applyToSet(func->afpoints,lineAtAddr,addr,
&line,NULL,NULL))
/* find the asm line number */
line = 0;
if (applyToSet(func->afpoints,lineAtAddr,addr,
&line,NULL,NULL))
/* simGo - send 'go' cmd to simulator and wait till a break occurs */
/*-----------------------------------------------------------------*/
void simGo (unsigned int gaddr)
/* simGo - send 'go' cmd to simulator and wait till a break occurs */
/*-----------------------------------------------------------------*/
void simGo (unsigned int gaddr)
-static int printAsmLine( function *func, module *m, long saddr, long eaddr)
+static int printAsmLine( function *func, module *m, unsigned saddr, unsigned eaddr)
lastaddr = m->asmLines[i]->addr;
printf("0x%08x <%s",lastaddr,symname);
if (delta > 0) printf("+%d",delta);
lastaddr = m->asmLines[i]->addr;
printf("0x%08x <%s",lastaddr,symname);
if (delta > 0) printf("+%d",delta);
printf("Dump of assembler code for function %s:\n",func->sym->name);
printAsmLine(func,func->mod,-1,-1);
printf("End of assembler dump.\n");
printf("Dump of assembler code for function %s:\n",func->sym->name);
printAsmLine(func,func->mod,-1,-1);
printf("End of assembler dump.\n");
printf("Dump of assembler code:\n");
printAsmLine(NULL,modul,saddr,eaddr);
printf("End of assembler dump.\n");
printf("Dump of assembler code:\n");
printAsmLine(NULL,modul,saddr,eaddr);
printf("End of assembler dump.\n");
}
/*-----------------------------------------------------------------*/
/* cmdDisasm1 - disassemble one asm instruction */
}
/*-----------------------------------------------------------------*/
/* cmdDisasm1 - disassemble one asm instruction */
/* user break point location specification can be of the following
forms
a) <nothing> - break point at current location
/* user break point location specification can be of the following
forms
a) <nothing> - break point at current location
c) filename:lineno - line number of the given file
e) filename:function- function X in file Y (useful for static functions)
f) function - function entry point
c) filename:lineno - line number of the given file
e) filename:function- function X in file Y (useful for static functions)
f) function - function entry point
else
setBreakPoint ( cctxt->addr , CODE , bpType , userBpCB ,
cctxt->func->mod->asm_name, cctxt->asmline);
else
setBreakPoint ( cctxt->addr , CODE , bpType , userBpCB ,
cctxt->func->mod->asm_name, cctxt->asmline);
module *modul;
if (!applyToSet(modules,moduleLineWithAddr,braddr,&modul,&line))
{
module *modul;
if (!applyToSet(modules,moduleLineWithAddr,braddr,&modul,&line))
{
}
/* if current context not present then we must get the module
which has main & set the break point @ line number provided
}
/* if current context not present then we must get the module
which has main & set the break point @ line number provided
- of that module : if current context known then set the bp
- at the line number given for the current module
+ of that module : if current context known then set the bp
+ at the line number given for the current module
*/
if (cctxt->func) {
if (!cctxt->func->mod) {
if (!applyToSet(functions,funcWithName,"main"))
fprintf(stderr,"Function \"main\" not defined.\n");
*/
if (cctxt->func) {
if (!cctxt->func->mod) {
if (!applyToSet(functions,funcWithName,"main"))
fprintf(stderr,"Function \"main\" not defined.\n");
if (srcMode == SRC_CMODE) {
if (!applyToSet(modules,moduleWithCName,s,&mod)) {
fprintf (stderr,"No source file named %s.\n",s);
if (srcMode == SRC_CMODE) {
if (!applyToSet(modules,moduleWithCName,s,&mod)) {
fprintf (stderr,"No source file named %s.\n",s);
- if (!applyToSet(functions,funcWithNameModule,bp+1,s,&func))
- fprintf(stderr,"Function \"%s\" not defined.\n",bp+1);
- else
+ if (!applyToSet(functions,funcWithNameModule,bp+1,s,&func))
+ fprintf(stderr,"Function \"%s\" not defined.\n",bp+1);
+ else
/* case e) function */
Dprintf(D_break, ("commonSetUserBp: e) \n"));
if (!applyToSet(functions,funcWithName,s,&func))
/* case e) function */
Dprintf(D_break, ("commonSetUserBp: e) \n"));
if (!applyToSet(functions,funcWithName,s,&func))
else
setBPatModLine(func->mod,
(srcMode == SRC_CMODE ?
func->entryline :
func->aentryline),bpType);
else
setBPatModLine(func->mod,
(srcMode == SRC_CMODE ?
func->entryline :
func->aentryline),bpType);
- if (!applyToSet(modules,moduleWithCName,s,&mod))
+ if (!applyToSet(modules,moduleWithCName,s,&mod))
/*-----------------------------------------------------------------*/
int cmdListAsm (char *s, context *cctxt)
{
/*-----------------------------------------------------------------*/
int cmdListAsm (char *s, context *cctxt)
{
{
/* actual line */
if ( cctxt->addr != INT_MAX )
{
if (printAsmLine(cctxt->func,cctxt->func->mod,
(long)cctxt->addr,(long)cctxt->addr))
{
/* actual line */
if ( cctxt->addr != INT_MAX )
{
if (printAsmLine(cctxt->func,cctxt->func->mod,
(long)cctxt->addr,(long)cctxt->addr))
{
listlines = strtol(s+9,0,0);
if ( listlines < LISTLINES )
{
listlines = strtol(s+9,0,0);
if ( listlines < LISTLINES )
/* cmdIgnore - set ignorecount for breakpoint */
/*-----------------------------------------------------------------*/
int cmdIgnore (char *s, context *cctxt)
/* cmdIgnore - set ignorecount for breakpoint */
/*-----------------------------------------------------------------*/
int cmdIgnore (char *s, context *cctxt)
/* cmdCondition - set condition for breakpoint */
/*-----------------------------------------------------------------*/
int cmdCondition (char *s, context *cctxt)
/* cmdCondition - set condition for breakpoint */
/*-----------------------------------------------------------------*/
int cmdCondition (char *s, context *cctxt)
/* cmdCommands - set commands for breakpoint */
/*-----------------------------------------------------------------*/
int cmdCommands (char *s, context *cctxt)
/* cmdCommands - set commands for breakpoint */
/*-----------------------------------------------------------------*/
int cmdCommands (char *s, context *cctxt)
fflush(stdout);
fgets(buffer,sizeof(buffer),stdin);
if (toupper(buffer[0]) == 'Y')
fflush(stdout);
fgets(buffer,sizeof(buffer),stdin);
if (toupper(buffer[0]) == 'Y')
/* determine the break point number */
if (sscanf(s,"%d",&bpnum) == 1)
deleteUSERbp(bpnum);
/* determine the break point number */
if (sscanf(s,"%d",&bpnum) == 1)
deleteUSERbp(bpnum);
if (0 /*STACK_EMPTY(callStack)*/)
fprintf(stdout,"The program is not being run.\n");
if (0 /*STACK_EMPTY(callStack)*/)
fprintf(stdout,"The program is not being run.\n");
if ((func = STACK_PEEK(callStack))) {
if (srcMode == SRC_CMODE)
applyToSet (func->cfpoints,setStepEPBp,STEP,
if ((func = STACK_PEEK(callStack))) {
if (srcMode == SRC_CMODE)
applyToSet (func->cfpoints,setStepEPBp,STEP,
else
applyToSet (func->afpoints,setStepEPBp,STEP,
func->mod->asm_name);
else
applyToSet (func->afpoints,setStepEPBp,STEP,
func->mod->asm_name);
/* set breakpoints at all function entry points
and all exepoints of this functions & for
all functions one up in the call stack */
/* set breakpoints at all function entry points
and all exepoints of this functions & for
all functions one up in the call stack */
if (srcMode == SRC_CMODE) {
/* for all execution points in this function */
applyToSet(cctxt->func->cfpoints,setStepEPBp,STEP,
cctxt->func->mod->c_name);
if (srcMode == SRC_CMODE) {
/* for all execution points in this function */
applyToSet(cctxt->func->cfpoints,setStepEPBp,STEP,
cctxt->func->mod->c_name);
- setBreakPoint (cctxt->func->sym->eaddr, CODE, STEP ,
- stepBpCB, cctxt->func->mod->c_name,
+ setBreakPoint (cctxt->func->sym->eaddr, CODE, STEP ,
+ stepBpCB, cctxt->func->mod->c_name,
/* now break point @ callers execution points */
if ((func = STACK_PPEEK(callStack))) {
applyToSet (func->cfpoints,setStepEPBp,STEP,
/* now break point @ callers execution points */
if ((func = STACK_PPEEK(callStack))) {
applyToSet (func->cfpoints,setStepEPBp,STEP,
- setBreakPoint (func->sym->eaddr, CODE, STEP ,
- stepBpCB, func->mod->c_name,
+ setBreakPoint (func->sym->eaddr, CODE, STEP ,
+ stepBpCB, func->mod->c_name,
func->exitline);
}
} else {
/* for all execution points in this function */
applyToSet(cctxt->func->afpoints,setStepEPBp,STEP,
cctxt->func->mod->asm_name);
func->exitline);
}
} else {
/* for all execution points in this function */
applyToSet(cctxt->func->afpoints,setStepEPBp,STEP,
cctxt->func->mod->asm_name);
- setBreakPoint (cctxt->func->sym->eaddr, CODE, STEP ,
- stepBpCB, cctxt->func->mod->asm_name,
+ setBreakPoint (cctxt->func->sym->eaddr, CODE, STEP ,
+ stepBpCB, cctxt->func->mod->asm_name,
applyToSet (func->afpoints,setStepEPBp,STEP,
applyToSet (func->afpoints,setStepEPBp,STEP,
- setBreakPoint (func->sym->eaddr, CODE, STEP ,
- stepBpCB, func->mod->asm_name,
+ setBreakPoint (func->sym->eaddr, CODE, STEP ,
+ stepBpCB, func->mod->asm_name,
{
if (STACK_EMPTY(callStack))
fprintf(stdout,"The program is not being run.\n");
{
if (STACK_EMPTY(callStack))
fprintf(stdout,"The program is not being run.\n");
if ((func = STACK_PEEK(callStack))) {
if (srcMode == SRC_CMODE)
applyToSet (func->cfpoints,setStepEPBp,NEXT,
if ((func = STACK_PEEK(callStack))) {
if (srcMode == SRC_CMODE)
applyToSet (func->cfpoints,setStepEPBp,NEXT,
else
applyToSet (func->afpoints,setStepEPBp,NEXT,
func->mod->asm_name);
else
applyToSet (func->afpoints,setStepEPBp,NEXT,
func->mod->asm_name);
- setBreakPoint (cctxt->func->sym->eaddr, CODE, NEXT ,
- nextBpCB, cctxt->func->mod->c_name,
+ setBreakPoint (cctxt->func->sym->eaddr, CODE, NEXT ,
+ nextBpCB, cctxt->func->mod->c_name,
if ((func = STACK_PPEEK(callStack))) {
applyToSet (func->cfpoints,setNextEPBp,NEXT ,
if ((func = STACK_PPEEK(callStack))) {
applyToSet (func->cfpoints,setNextEPBp,NEXT ,
- setBreakPoint (func->sym->eaddr, CODE, NEXT ,
- stepBpCB, func->mod->c_name,
+ setBreakPoint (func->sym->eaddr, CODE, NEXT ,
+ stepBpCB, func->mod->c_name,
- setBreakPoint (cctxt->func->sym->eaddr, CODE, NEXT ,
- nextBpCB, cctxt->func->mod->asm_name,
+ setBreakPoint (cctxt->func->sym->eaddr, CODE, NEXT ,
+ nextBpCB, cctxt->func->mod->asm_name,
if ((func = STACK_PPEEK(callStack))) {
applyToSet (func->cfpoints,setNextEPBp,NEXT ,
if ((func = STACK_PPEEK(callStack))) {
applyToSet (func->cfpoints,setNextEPBp,NEXT ,
- setBreakPoint (func->sym->eaddr, CODE, NEXT ,
- stepBpCB, func->mod->asm_name,
+ setBreakPoint (func->sym->eaddr, CODE, NEXT ,
+ stepBpCB, func->mod->asm_name,
fprintf(stdout,
"The program being debugged has been started already.\n");
fprintf(stdout,"Start it from the beginning? (y or n) ");
fprintf(stdout,
"The program being debugged has been started already.\n");
fprintf(stdout,"Start it from the beginning? (y or n) ");
sy->name, sy->size, sy->level, sy->block);
printf(" isonstack:%d, isfunc:%d, offset:%d addr:%d\n",
sy->isonstack, sy->isfunc, sy->offset, sy->addr);
sy->name, sy->size, sy->level, sy->block);
printf(" isonstack:%d, isfunc:%d, offset:%d addr:%d\n",
sy->isonstack, sy->isfunc, sy->offset, sy->addr);
- printf(" eaddr:%d, addr_type:%c, type:%x etype:%x\n",
+ printf(" eaddr:%d, addr_type:%c, type:%p etype:%p\n",
sy->eaddr, sy->addr_type, sy->type, sy->etype);
printf(" scopetype:%c, sname:%s, rname:%s addrspace:%c\n",
sy->scopetype, sy->sname, sy->rname, sy->addrspace);
sy->eaddr, sy->addr_type, sy->type, sy->etype);
printf(" scopetype:%c, sname:%s, rname:%s addrspace:%c\n",
sy->scopetype, sy->sname, sy->rname, sy->addrspace);
- printf(" %d) sym:%x, fname:%s, modName:%s, mod:%x\n", i,
+ printf(" %d) sym:%p, fname:%s, modName:%s, mod:%p\n", i,
f->sym, f->sym->name, f->modName, f->mod);
printf(" entryline:%d, aentryline:%d, exitline:%d, aexitline:%d\n",
f->entryline, f->aentryline, f->exitline, f->aexitline);
f->sym, f->sym->name, f->modName, f->mod);
printf(" entryline:%d, aentryline:%d, exitline:%d, aexitline:%d\n",
f->entryline, f->aentryline, f->exitline, f->aexitline);
- printf(" cfpoints:%x, afpoints:%x, laddr:%x, lline:%d\n",
+ printf(" cfpoints:%p, afpoints:%p, laddr:%x, lline:%d\n",
f->cfpoints, f->afpoints, f->laddr, f->lline);
}
else {
f->cfpoints, f->afpoints, f->laddr, f->lline);
}
else {
m->cfullname, m->afullname, m->name);
printf(" c_name:%s, asm_name:%s, ncLines:%d, nasmLines:%d\n",
m->c_name, m->asm_name, m->ncLines, m->nasmLines);
m->cfullname, m->afullname, m->name);
printf(" c_name:%s, asm_name:%s, ncLines:%d, nasmLines:%d\n",
m->c_name, m->asm_name, m->ncLines, m->nasmLines);
ctxt, ctxt->func, ctxt->modName, ctxt->addr);
printf(" cline:%d asmline:%d block:%d level:%d\n",
ctxt, ctxt->func, ctxt->modName, ctxt->addr);
printf(" cline:%d asmline:%d block:%d level:%d\n",
- printf("[globals] currCtxt:%x, modules:%x, functions:%x symbols:%x\n",
+ printf("[globals] currCtxt:%p, modules:%p, functions:%p symbols:%p\n",
currCtxt, modules, functions, symbols);
currCtxt, modules, functions, symbols);
- printf(" nStructs:%d, structs:%x, ssdirl:%s\n",
+ printf(" nStructs:%d, structs:%p, ssdirl:%s\n",
nStructs, structs, ssdirl);
/**************** modules *******************/
nStructs, structs, ssdirl);
/**************** modules *******************/
m->cfullname, m->afullname, m->name);
printf(" c_name:%s, asm_name:%s, ncLines:%d, nasmLines:%d\n",
m->c_name, m->asm_name, m->ncLines, m->nasmLines);
m->cfullname, m->afullname, m->name);
printf(" c_name:%s, asm_name:%s, ncLines:%d, nasmLines:%d\n",
m->c_name, m->asm_name, m->ncLines, m->nasmLines);
- printf(" %d) sym:%x, modName:%s, mod:%x\n", i,
+ printf(" %d) sym:%p, modName:%s, mod:%p\n", i,
f->sym, f->modName, f->mod);
printf(" entryline:%d, aentryline:%d, exitline:%d, aexitline:%d\n",
f->entryline, f->aentryline, f->exitline, f->aexitline);
f->sym, f->modName, f->mod);
printf(" entryline:%d, aentryline:%d, exitline:%d, aexitline:%d\n",
f->entryline, f->aentryline, f->exitline, f->aexitline);
- printf(" cfpoints:%x, afpoints:%x, laddr:%x, lline:%d\n",
+ printf(" cfpoints:%p, afpoints:%p, laddr:%x, lline:%d\n",
f->cfpoints, f->afpoints, f->laddr, f->lline);
}
++i;
f->cfpoints, f->afpoints, f->laddr, f->lline);
}
++i;
s->name, s->size, s->level, s->block);
printf(" isonstack:%d, isfunc:%d, offset:%d addr:%d\n",
s->isonstack, s->isfunc, s->offset, s->addr);
s->name, s->size, s->level, s->block);
printf(" isonstack:%d, isfunc:%d, offset:%d addr:%d\n",
s->isonstack, s->isfunc, s->offset, s->addr);
- printf(" eaddr:%d, addr_type:%c, type:%x etype:%x\n",
+ printf(" eaddr:%d, addr_type:%c, type:%p etype:%p\n",
s->eaddr, s->addr_type, s->type, s->etype);
printf(" scopetype:%c, sname:%s, rname:%s addrspace:%c\n",
s->scopetype, s->sname, s->rname, s->addrspace);
s->eaddr, s->addr_type, s->type, s->etype);
printf(" scopetype:%c, sname:%s, rname:%s addrspace:%c\n",
s->scopetype, s->sname, s->rname, s->addrspace);
/*-----------------------------------------------------------------*/
static void infoRegisters( int all, context *ctxt)
{
/*-----------------------------------------------------------------*/
static void infoRegisters( int all, context *ctxt)
{
- static unsigned int regaddrs[] = {0x81,0x82,0x83,0xb8,0xd0,0xe0,0xf0,0};
+ static int regaddrs[] = {0x81,0x82,0x83,0xb8,0xd0,0xe0,0xf0,0};
fprintf(stdout,"IP : 0x%04X RegisterBank %d:\nR0-7:",ctxt->addr,(i>>3)&3);
for ( j = 0; j < 8 ; j++ )
{
fprintf(stdout,"IP : 0x%04X RegisterBank %d:\nR0-7:",ctxt->addr,(i>>3)&3);
for ( j = 0; j < 8 ; j++ )
{
fprintf(stdout,"Source files for which symbols have been read in:\n\n");
for (m = setFirstItem(modules); m ; m = setNextItem(modules))
{
fprintf(stdout,"Source files for which symbols have been read in:\n\n");
for (m = setFirstItem(modules); m ; m = setNextItem(modules))
{
- fprintf(stdout,"%s%s, %s",k ? ", ":"",m->cfullname, m->afullname);
+ fprintf(stdout,"%s%s, %s",k ? ", ":"",m->cfullname, m->afullname);
/* cmdQuit - quit debugging */
/*-----------------------------------------------------------------*/
int cmdQuit (char *s, context *cctxt)
/* cmdQuit - quit debugging */
/*-----------------------------------------------------------------*/
int cmdQuit (char *s, context *cctxt)
/* cmdListSrc - list src */
/*-----------------------------------------------------------------*/
int cmdListSrc (char *s, context *cctxt)
/* cmdListSrc - list src */
/*-----------------------------------------------------------------*/
int cmdListSrc (char *s, context *cctxt)
else
list_mod = cctxt->func->mod;
pline = strtol(s,&s,10) - 1;
else
list_mod = cctxt->func->mod;
pline = strtol(s,&s,10) - 1;
/* if ':' present then FILE:LINE || FILE:FUNCTION */
if ((bp = strchr(s,':'))) {
*bp = '\0';
/* if ':' present then FILE:LINE || FILE:FUNCTION */
if ((bp = strchr(s,':'))) {
*bp = '\0';
}
if (!applyToSet(functions,funcWithName,s,&func)) {
}
if (!applyToSet(functions,funcWithName,s,&func)) {
if ( pline >= list_mod->ncLines )
pline = cctxt->cline;
firstaddr = lastaddr = list_mod->cLines[pline]->addr;
if (!func && cctxt && cctxt->func )
func = cctxt->func;
if ( pline >= list_mod->ncLines )
pline = cctxt->cline;
firstaddr = lastaddr = list_mod->cLines[pline]->addr;
if (!func && cctxt && cctxt->func )
func = cctxt->func;
pline+1,
list_mod->c_name, lastaddr,
func ? func->sym->name : "?",
pline+1,
list_mod->c_name, lastaddr,
func ? func->sym->name : "?",
lastaddr,
func ? func->sym->name : "?",
func ? lastaddr -func->sym->addr : 0);
lastaddr,
func ? func->sym->name : "?",
func ? lastaddr -func->sym->addr : 0);
if (IS_LONG(etype))
v.val = strtol(val,NULL,0);
else
v.i.lo = strtol(val,NULL,0);
else
v.val = strtol(val,NULL,0);
if (IS_LONG(etype))
v.val = strtol(val,NULL,0);
else
v.i.lo = strtol(val,NULL,0);
else
v.val = strtol(val,NULL,0);
/*-----------------------------------------------------------------*/
/* printFmtInteger - print value in bin,oct,dez or hex */
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
/* printFmtInteger - print value in bin,oct,dez or hex */
/*-----------------------------------------------------------------*/
-static void printFmtInteger(char *deffmt,int fmt, long val,
+static void printFmtInteger(char *deffmt,int fmt, long val,
{
'0' , '1' , '2' , '3' , '4' , '5' ,
'6' , '7' , '8' , '9' , 'a' , 'b' ,
{
'0' , '1' , '2' , '3' , '4' , '5' ,
'6' , '7' , '8' , '9' , 'a' , 'b' ,
- 'c' , 'd' , 'e' , 'f' , 'g' , 'h'
+ 'c' , 'd' , 'e' , 'f' , 'g' , 'h'
};
static int radixOfFormat[] = { 0 , 2, 8 ,10, 16 };
static int olenOfSize[] = { 0 , 3, 6 , 8, 11 };
};
static int radixOfFormat[] = { 0 , 2, 8 ,10, 16 };
static int olenOfSize[] = { 0 , 3, 6 , 8, 11 };
static void printValBasic(symbol *sym, link *type,
char mem, unsigned addr,int size, int fmt)
{
static void printValBasic(symbol *sym, link *type,
char mem, unsigned addr,int size, int fmt)
{
v.val = simGetValue(addr,mem,size);
/* if this a floating point number then */
v.val = simGetValue(addr,mem,size);
/* if this a floating point number then */
else
if (IS_PTR(type))
fprintf(stdout,"0x%*x",size<<1,v.val);
else
else
if (IS_PTR(type))
fprintf(stdout,"0x%*x",size<<1,v.val);
else
if (IS_LONG(etype))
if (SPEC_USIGN(etype))
printFmtInteger("%u",fmt,(long)v.val,0,size);
if (IS_LONG(etype))
if (SPEC_USIGN(etype))
printFmtInteger("%u",fmt,(long)v.val,0,size);
- fprintf(stdout,"0x%0*x",size<<1,v.val);
+ fprintf(stdout,"0x%0*x",size<<1,v.val);
- printValAggregates(sym,elem_type,space,addr,fmt);
+ printValAggregates(sym,elem_type,space,addr,fmt);
} else {
printValBasic(sym,elem_type,space,addr,getSize(elem_type),fmt);
}
} else {
printValBasic(sym,elem_type,space,addr,getSize(elem_type),fmt);
}
}
/*-----------------------------------------------------------------*/
/* printStructValue - prints structures elements */
/*-----------------------------------------------------------------*/
}
/*-----------------------------------------------------------------*/
/* printStructValue - prints structures elements */
/*-----------------------------------------------------------------*/
-static void printStructValue (symbol *sym, link *type,
- char space, unsigned int addr, int fmt)
+static void printStructValue (symbol *sym, link *type,
+ char space, unsigned int addr, int fmt)
- if (IS_STRUCT(type)) {
- printStructValue(sym, type, space, addr, fmt);
- return;
- }
+ if (IS_STRUCT(type)) {
+ printStructValue(sym, type, space, addr, fmt);
+ return;
+ }
}
/*-----------------------------------------------------------------*/
/* printOrSetSymValue - print or set value of a symbol */
/*-----------------------------------------------------------------*/
}
/*-----------------------------------------------------------------*/
/* printOrSetSymValue - print or set value of a symbol */
/*-----------------------------------------------------------------*/
-static int printOrSetSymValue (symbol *sym, context *cctxt,
- int flg, int dnum, int fmt, char *rs,
+static int printOrSetSymValue (symbol *sym, context *cctxt,
+ int flg, int dnum, int fmt, char *rs,
{
fprintf(stdout,"cannot determine stack frame\n");
return 1;
}
sym->addr = simGetValue(bp->addr,bp->addrspace,bp->size)
{
fprintf(stdout,"cannot determine stack frame\n");
return 1;
}
sym->addr = simGetValue(bp->addr,bp->addrspace,bp->size)
fprintf(stdout,"%d: ", dnum);
if ( fmt != FMT_NON )
fprintf(stdout,"/%c ",fmtChar[fmt]);
fprintf(stdout,"%d: ", dnum);
if ( fmt != FMT_NON )
fprintf(stdout,"/%c ",fmtChar[fmt]);
}
/* arrays & structures first */
if (! IS_INTEGRAL(fields->type))
{
fprintf(stdout,"Wrong type of variable \"%s\" for index \n", s);
}
/* arrays & structures first */
if (! IS_INTEGRAL(fields->type))
{
fprintf(stdout,"Wrong type of variable \"%s\" for index \n", s);
if ( n < 0 || n >= DCL_ELEM(type))
{
fprintf(stdout,"Wrong index %d.\n", n);
if ( n < 0 || n >= DCL_ELEM(type))
{
fprintf(stdout,"Wrong index %d.\n", n);
- simSetValue(addr,sym->addrspace,size,newval);
+ simSetValue(addr,sym->addrspace,size,newval);
- (IS_LONG(p) ? fputs("long ",stdout) :
- ( IS_SHORT(p) ? fputs("short ",stdout) :
+ (IS_LONG(p) ? fputs("long ",stdout) :
+ ( IS_SHORT(p) ? fputs("short ",stdout) :
/* conditionIsTrue - compare variable with constant value */
/*-----------------------------------------------------------------*/
int conditionIsTrue( char *s, context *cctxt)
/* conditionIsTrue - compare variable with constant value */
/*-----------------------------------------------------------------*/
int conditionIsTrue( char *s, context *cctxt)
/* cmdPrint - print value of variable */
/*-----------------------------------------------------------------*/
int cmdPrint (char *s, context *cctxt)
/* cmdPrint - print value of variable */
/*-----------------------------------------------------------------*/
int cmdPrint (char *s, context *cctxt)
symbol *sym ;
int fmt;
char *rs;
if ( !( rs = preparePrint(s, cctxt, &fmt, &sym )))
return 0;
symbol *sym ;
int fmt;
char *rs;
if ( !( rs = preparePrint(s, cctxt, &fmt, &sym )))
return 0;
{
printOrSetSymValue(sym,cctxt,1,0,fmt,rs,NULL,'\0');
{
printOrSetSymValue(sym,cctxt,1,0,fmt,rs,NULL,'\0');
/* cmdOutput - print value of variable without number and newline */
/*-----------------------------------------------------------------*/
int cmdOutput (char *s, context *cctxt)
/* cmdOutput - print value of variable without number and newline */
/*-----------------------------------------------------------------*/
int cmdOutput (char *s, context *cctxt)
symbol *sym ;
int fmt;
char *rs;
if ( !( rs = preparePrint(s, cctxt, &fmt, &sym )))
return 0;
symbol *sym ;
int fmt;
char *rs;
if ( !( rs = preparePrint(s, cctxt, &fmt, &sym )))
return 0;
{
printOrSetSymValue(sym,cctxt,0,0,fmt,rs,NULL,'\0');
{
printOrSetSymValue(sym,cctxt,0,0,fmt,rs,NULL,'\0');
{
if ( (sym = symLookup(dsym->name,cctxt)))
printOrSetSymValue(sym,cctxt,2,dsym->dnum,dsym->fmt,
{
if ( (sym = symLookup(dsym->name,cctxt)))
printOrSetSymValue(sym,cctxt,2,dsym->dnum,dsym->fmt,
/* cmdDisplay - display value of variable */
/*-----------------------------------------------------------------*/
int cmdDisplay (char *s, context *cctxt)
/* cmdDisplay - display value of variable */
/*-----------------------------------------------------------------*/
int cmdDisplay (char *s, context *cctxt)
/* cmdUnDisplay - undisplay value of variable */
/*-----------------------------------------------------------------*/
int cmdUnDisplay (char *s, context *cctxt)
/* cmdUnDisplay - undisplay value of variable */
/*-----------------------------------------------------------------*/
int cmdUnDisplay (char *s, context *cctxt)
- if (applyToSetFTrue(dispsymbols,dsymWithNumber,dnum,&dsym))
+ if (applyToSetFTrue(dispsymbols,dsymWithNumber,dnum,&dsym))
/* cmdPrintType - print type of a variable */
/*-----------------------------------------------------------------*/
int cmdPrintType (char *s, context *cctxt)
/* cmdPrintType - print type of a variable */
/*-----------------------------------------------------------------*/
int cmdPrintType (char *s, context *cctxt)
}
/*-----------------------------------------------------------------*/
/* cmdClrUserBp - clear user break point */
/*-----------------------------------------------------------------*/
int cmdClrUserBp (char *s, context *cctxt)
}
/*-----------------------------------------------------------------*/
/* cmdClrUserBp - clear user break point */
/*-----------------------------------------------------------------*/
int cmdClrUserBp (char *s, context *cctxt)
/* clear break point location specification can be of the following
forms
a) <nothing> - break point at current location
/* clear break point location specification can be of the following
forms
a) <nothing> - break point at current location
/* clear the break point @ current location */
clearUSERbp (cctxt->addr);
else
fprintf(stderr,"No default breakpoint address now.\n");
/* clear the break point @ current location */
clearUSERbp (cctxt->addr);
else
fprintf(stderr,"No default breakpoint address now.\n");
/* if current context not present then we must get the module
which has main & set the break point @ line number provided
/* if current context not present then we must get the module
which has main & set the break point @ line number provided
- of that module : if current context known then set the bp
- at the line number given for the current module
+ of that module : if current context known then set the bp
+ at the line number given for the current module
*/
if (cctxt->func) {
if (!cctxt->func->mod) {
if (!applyToSet(functions,funcWithName,"main"))
fprintf(stderr,"Function \"main\" not defined.\n");
*/
if (cctxt->func) {
if (!cctxt->func->mod) {
if (!applyToSet(functions,funcWithName,"main"))
fprintf(stderr,"Function \"main\" not defined.\n");
if (!applyToSet(modules,moduleWithCName,s,&mod)) {
fprintf (stderr,"No source file named %s.\n",s);
goto ret;
}
/* case c) filename:lineno */
if (!applyToSet(modules,moduleWithCName,s,&mod)) {
fprintf (stderr,"No source file named %s.\n",s);
goto ret;
}
/* case c) filename:lineno */
- if (isdigit(*(bp +1))) {
-
- clearBPatModLine (mod,atoi(bp+1));
+ if (isdigit(*(bp +1))) {
+
+ clearBPatModLine (mod,atoi(bp+1));
- if (!applyToSet(functions,funcWithNameModule,bp+1,s,&func))
- fprintf(stderr,"Function \"%s\" not defined.\n",bp+1);
+ if (!applyToSet(functions,funcWithNameModule,bp+1,s,&func))
+ fprintf(stderr,"Function \"%s\" not defined.\n",bp+1);
/* case e) function */
if (!applyToSet(functions,funcWithName,s,&func))
/* case e) function */
if (!applyToSet(functions,funcWithName,s,&func))
}
/*-----------------------------------------------------------------*/
/* cmdSimulator - send command to simulator */
/*-----------------------------------------------------------------*/
int cmdSimulator (char *s, context *cctxt)
}
/*-----------------------------------------------------------------*/
/* cmdSimulator - send command to simulator */
/*-----------------------------------------------------------------*/
int cmdSimulator (char *s, context *cctxt)
if (!applyToSet(functions,funcWithName,"_main",&func) &&
!applyToSet(functions,funcWithName,"main",&func))
return;
if (!applyToSet(functions,funcWithName,"_main",&func) &&
!applyToSet(functions,funcWithName,"main",&func))
return;
/* cmdFrame - Frame command */
/*-----------------------------------------------------------------*/
int cmdFrame (char *s, context *cctxt)
/* cmdFrame - Frame command */
/*-----------------------------------------------------------------*/
int cmdFrame (char *s, context *cctxt)
- setBreakPoint (ctxt->func->sym->eaddr, CODE, STEP,
- stepBpCB, ctxt->func->mod->c_name,
+ setBreakPoint (ctxt->func->sym->eaddr, CODE, STEP,
+ stepBpCB, ctxt->func->mod->c_name,
- setBreakPoint (ctxt->func->sym->eaddr, CODE, STEP,
- stepBpCB, ctxt->func->mod->asm_name,
+ setBreakPoint (ctxt->func->sym->eaddr, CODE, STEP,
+ stepBpCB, ctxt->func->mod->asm_name,