#include "break.h"
#include "cmd.h"
-int listLines = 10;
+/* default number of lines to list out */
+int listLines = 16;
+
+/* mainly used to retain a reference to the active module being
+ listed. May be used as a general context for other commands if
+ no better context is available */
+static module *list_mod = NULL;
+
EXTERN_STACK_DCL(callStack,function *,1024);
#if defined(__APPLE__) && defined(__MACH__)
/*-----------------------------------------------------------------*/
static void setBPatModLine (module *mod, int line)
{
+ int next_line;
+
/* look for the first executable line after the line
specified & get the break point there */
if (srcMode == SRC_CMODE && line > mod->ncLines) {
return ;
}
- for ( ; line < (srcMode == SRC_CMODE ? mod->ncLines : mod->nasmLines ) ;
- line++ ) {
+ next_line = line;
+ for ( ; next_line < (srcMode == SRC_CMODE ? mod->ncLines : mod->nasmLines ) ;
+ next_line++ ) {
if (srcMode == SRC_CMODE) {
- if (mod->cLines[line]->addr) {
- setBreakPoint (mod->cLines[line]->addr, CODE, USER,
- userBpCB, mod->c_name, line);
- break;
+ if (mod->cLines[next_line]->addr) {
+ setBreakPoint (mod->cLines[next_line]->addr, CODE, USER,
+ userBpCB, mod->c_name, next_line);
+ return;
+// break;
}
}
else {
- if (mod->asmLines[line]->addr) {
- setBreakPoint (mod->asmLines[line]->addr, CODE, USER,
- userBpCB, mod->asm_name, line);
- break;
+ if (mod->asmLines[next_line]->addr) {
+ setBreakPoint (mod->asmLines[next_line]->addr, CODE, USER,
+ userBpCB, mod->asm_name, next_line);
+ return;
+// break;
}
}
}
+ fprintf(stderr,"No line %d or after in file \"%s\"..\n",
+ line,mod->c_name);
+
return;
}
else
setBPatModLine(func->mod,line);
} else
- setBPatModLine(cctxt->func->mod,line);
+ setBPatModLine(cctxt->func->mod,line);
} else {
- fprintf(stdout,"No symbol information currently\n");
+ if (list_mod) {
+ setBPatModLine(list_mod,line);
+ } else {
+ fprintf(stdout,"Sdcdb fails to have module symbol context at %d\n", __LINE__);
+ }
}
goto ret;
return 0;
}
+/*-----------------------------------------------------------------
+ cmdListSymbols - list symbols
+|-----------------------------------------------------------------*/
+int cmdListSymbols (char *s, context *cctxt)
+{
+ int our_verbose = 0;
+ symbol *sy;
+ int i;
+
+ if (strstr(s, "v1")) {
+ our_verbose = 1;
+ } else if (strstr(s, "v2")) {
+ our_verbose = 2;
+ }
+
+ printf("[symbols]\n");
+ sy = setFirstItem(symbols);
+ i = 0;
+ for (;;) {
+ if (sy == NULL)
+ break;
+ if (our_verbose <= 1)
+ printf("<%s>", sy->name);
+
+ if (our_verbose > 1) {
+ printf(" %d) name:%s, size:%d, level:%d block:%d\n", i,
+ 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",
+ 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(" next:%x\n", sy->next);
+ }
+ ++i;
+ sy = setNextItem(symbols);
+ }
+ printf(" %d symbols\n", i);
+ return 0;
+}
+
+/*-----------------------------------------------------------------
+ cmdListFunctions - list functions.
+|-----------------------------------------------------------------*/
+int cmdListFunctions (char *s, context *cctxt)
+{
+ function *f;
+ int i;
+ int our_verbose = 0;
+
+ if (strstr(s, "v1")) {
+ our_verbose = 1;
+ } else if (strstr(s, "v2")) {
+ our_verbose = 2;
+ }
+
+ printf("[functions]\n");
+ f = setFirstItem(functions);
+ i = 0;
+ for (;;) {
+ if (f == NULL)
+ break;
+ if (our_verbose) {
+ printf(" %d) sym:%x, modName:%s, mod:%x\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);
+ printf(" cfpoints:%x, afpoints:%x, laddr:%x, lline:%d\n",
+ f->cfpoints, f->afpoints, f->laddr, f->lline);
+ }
+ else {
+ printf("<%s>", f->modName);
+ }
+ ++i;
+ f = setNextItem(functions);
+ }
+ printf(" %d functions\n", i);
+ return 0;
+}
+
+/*-----------------------------------------------------------------
+ cmdListModules - list functions.
+|-----------------------------------------------------------------*/
+int cmdListModules (char *s, context *cctxt)
+{
+ module *m;
+ srcLine *cs, *as;
+ int i, mi;
+ int our_verbose = 0;
+
+ if (strstr(s, "v1")) {
+ our_verbose = 1;
+ } else if (strstr(s, "v2")) {
+ our_verbose = 2;
+ }
+
+ printf("[modules]\n");
+ m = setFirstItem(modules);
+ mi = 0;
+ for (;;) {
+ if (m == NULL)
+ break;
+
+ if (our_verbose >= 0) {
+ printf(" %d) cfullname:%s, afullname:%s, name:%s\n", ++mi,
+ 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(" cLines:%x, asmLines:%x\n",
+ m->cLines, m->asmLines);
+ }
+ if (our_verbose > 2) {
+ i = 0;
+ if (m->cLines) {
+ cs = m->cLines[i++];
+ printf(" [cLines] ");
+ while (cs) {
+ if (our_verbose)
+ printf(" (%d) addr:%x, block:%d, level:%d, src:%s\n",
+ i, cs->addr, cs->block, cs->level, cs->src);
+ cs = m->cLines[i++];
+ }
+ if (!our_verbose)
+ printf("%d records", i);
+ }
+ i = 0;
+ if (m->asmLines) {
+ as = m->asmLines[i++];
+ printf(" [asmLines] ");
+ while (as) {
+ if (our_verbose)
+ printf(" (%d) addr:%x, block:%d, level:%d, src:%s\n",
+ i, as->addr, as->block, as->level, as->src);
+ as = m->asmLines[i++];
+ }
+ if (!our_verbose)
+ printf("%d records", i);
+ }
+ printf("\n");
+ }
+
+ m = setNextItem(modules);
+ }
+ return 0;
+}
+
+/*-----------------------------------------------------------------
+ infoSymbols - This is really just a tool to dump all these
+ huge program structures out into human readable form.
+|-----------------------------------------------------------------*/
+static void infoSymbols(context *ctxt)
+{
+ int our_verbose = 0;
+
+ printf("[context:%x] func:%x modName:%s addr:%x\n",
+ ctxt, ctxt->func, ctxt->modName, ctxt->addr);
+
+ printf(" cline:%d asmline:%d block:%d level:%d\n",
+ ctxt->cline, ctxt->asmline, ctxt->level);
+
+ printf("[globals] currCtxt:%x, modules:%x, functions:%x symbols:%x\n",
+ currCtxt, modules, functions, symbols);
+ printf(" nStructs:%d, structs:%x, ssdirl:%s\n",
+ nStructs, structs, ssdirl);
+
+ /**************** modules *******************/
+ {
+ module *m;
+ srcLine *cs, *as;
+ int i, mi;
+ printf("[modules]\n");
+ m = setFirstItem(modules);
+ mi = 0;
+ for (;;) {
+ if (m == NULL)
+ break;
+ printf(" %d) cfullname:%s, afullname:%s, name:%s\n", ++mi,
+ 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(" cLines:%x, asmLines:%x\n",
+ m->cLines, m->asmLines);
+ i = 0;
+ if (m->cLines) {
+ cs = m->cLines[i++];
+ printf(" [cLines] ");
+ while (cs) {
+ if (our_verbose)
+ printf(" (%d) addr:%x, block:%d, level:%d, src:%s\n",
+ i, cs->addr, cs->block, cs->level, cs->src);
+ cs = m->cLines[i++];
+ }
+ if (!our_verbose)
+ printf("%d records", i);
+ }
+ i = 0;
+ if (m->asmLines) {
+ as = m->asmLines[i++];
+ printf(" [asmLines] ");
+ while (as) {
+ if (our_verbose)
+ printf(" (%d) addr:%x, block:%d, level:%d, src:%s\n",
+ i, as->addr, as->block, as->level, as->src);
+ as = m->asmLines[i++];
+ }
+ if (!our_verbose)
+ printf("%d records", i);
+ }
+ printf("\n");
+
+ m = setNextItem(modules);
+ }
+ }
+
+ /**************** functions *******************/
+ {
+ function *f;
+ int i;
+ printf("[functions]\n");
+ f = setFirstItem(functions);
+ i = 0;
+ for (;;) {
+ if (f == NULL)
+ break;
+ if (our_verbose) {
+ printf(" %d) sym:%x, modName:%s, mod:%x\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);
+ printf(" cfpoints:%x, afpoints:%x, laddr:%x, lline:%d\n",
+ f->cfpoints, f->afpoints, f->laddr, f->lline);
+ }
+ ++i;
+ f = setNextItem(functions);
+ }
+ if (!our_verbose)
+ printf(" %d functions\n", i);
+ }
+
+ /**************** symbols *******************/
+ {
+ symbol *s;
+ int i;
+ printf("[symbols]\n");
+ s = setFirstItem(symbols);
+ i = 0;
+ for (;;) {
+ if (s == NULL)
+ break;
+ if (our_verbose) {
+ printf(" %d) name:%s, size:%d, level:%d block:%d\n", 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);
+ printf(" eaddr:%d, addr_type:%c, type:%x etype:%x\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);
+ printf(" next:%x\n", s->next);
+ }
+ ++i;
+ s = setNextItem(symbols);
+ }
+ if (!our_verbose)
+ printf(" %d symbols\n", i);
+ }
+
+}
+
/*-----------------------------------------------------------------*/
/* infoStack - print call stack information */
/*-----------------------------------------------------------------*/
return 0;
}
+ /* info stack display call stack */
+ if (strcmp(s,"symbols") == 0) {
+ /* dump out symbols we have read in */
+ fprintf(stdout,"Dumping symbols...\n");
+ infoSymbols(cctxt);
+ return 0;
+ }
+
fprintf(stdout,"Undefined info command: \"%s\". Try \"help\n",s);
return 0;
static int currline = 0;
int i =0 ;
int pline = 0;
- static module *mod = NULL;
int llines = listLines;
while (*s && isspace(*s)) s++;
FILE:LINE - filename line number
FUNCTION - list a function
FILE:FUNCTION - function in file */
- if (!cctxt || !cctxt->func || !cctxt->func->mod) {
- fprintf(stdout,"No symbol table is loaded. Use the \"file\" command.\n");
- return 0;
- }
+
if (*s) {
/* case a) LINE */
if (isdigit(*s)) {
sscanf(s,"%d",&pline);
- mod = cctxt->func->mod;
+ if (!cctxt || !cctxt->func || !cctxt->func->mod) {
+ if (!list_mod) {
+ fprintf(stdout,"Sdcdb fails to have a proper context at %d.\n", __LINE__);
+ return 0;
+ }
+ }
+ else
+ list_mod = cctxt->func->mod;
}
else {
char *bp;
bp ++;
if (isdigit(*bp)) {
/* FILE:LINE */
+ list_mod=NULL; /* bug fix 2-09-02, moduleWithCName expects mod to be null */
if (srcMode == SRC_CMODE) {
- if (!applyToSet(modules,moduleWithCName,s,&mod)) {
- fprintf (stderr,"No source file named %s.\n",s);
+ if (!applyToSet(modules,moduleWithCName,s,&list_mod)) {
+ fprintf (stderr,"No c source file named %s.\n",s);
return 0;
}
} else {
- if (!applyToSet(modules,moduleWithAsmName,s,&mod)) {
+ if (!applyToSet(modules,moduleWithAsmName,s,&list_mod)) {
fprintf (stderr,"No source file named %s.\n",s);
return 0;
}
}
- sscanf(bp,"%d",&pline);
+ sscanf(bp,"%d",&pline);
} else {
/* FILE:FUCTION */
if (!applyToSet(functions,funcWithNameModule,bp,s,&func)) {
fprintf(stdout,"Function \"%s\" not defined.\n",bp);
return 0;
}
- mod = func->mod;
+ list_mod = func->mod;
if (srcMode == SRC_CMODE) {
pline = func->entryline;
llines = func->exitline - func->entryline + 1;
return 0;
}
else {
- mod = func->mod;
+ list_mod = func->mod;
if (srcMode == SRC_CMODE) {
pline = func->entryline;
llines = func->exitline - func->entryline + 1;
llines = func->aexitline - func->aentryline + 1;
}
}
- }
+ }
}
} else {
/* if no line specified & we had listed
if (currline)
pline = currline ;
else {
- mod = cctxt->func->mod;
+ if (!cctxt || !cctxt->func || !cctxt->func->mod) {
+ fprintf(stdout,"Missing context at %d. Try list filename:lineno\n", __LINE__);
+ return 0;
+ }
+ list_mod = cctxt->func->mod;
if (srcMode == SRC_CMODE)
pline = cctxt->cline;
else
pline = cctxt->asmline;
}
}
+
+ if (!list_mod) {
+ fprintf(stdout,"Sdcdb fails to have a valid module context at %d.\n", __LINE__);
+ return 0;
+ }
+ if (llines > listLines) llines = listLines;
+
for ( i = 0 ; i < llines ; i++ ) {
if (srcMode == SRC_CMODE) {
- if ( (pline + i) >= mod->ncLines )
+ if ( (pline + i) >= list_mod->ncLines )
break;
fprintf(stdout,"%d\t%s",pline + i,
- mod->cLines[pline +i]->src);
+ list_mod->cLines[pline +i]->src);
} else {
- if ( (pline + i) >= mod->nasmLines )
+ if ( (pline + i) >= list_mod->nasmLines )
break;
fprintf(stdout,"%d\t%s",pline + i,
- mod->asmLines[pline +i]->src);
+ list_mod->asmLines[pline +i]->src);
}
}
currline = pline + i ;
else {
printValBasic(sym,sym->addr,sym->addrspace,sym->size);
fprintf(stdout,"\n");
+ //fprintf(stdout,"(BASIC %x,%c,%d)\n",sym->addr,sym->addrspace,sym->size);
}
}
bp++ ;
*bp = '\0';
- if (!cctxt || !cctxt->func) {
- fprintf(stdout,"No symbol \"%s\" in current context.\n",
- s);
- return 0;
- }
if ((sym = symLookup(s,cctxt))) {
printSymValue(sym,cctxt);
} else {
bp++ ;
*bp = '\0';
- if (!cctxt || !cctxt->func) {
- fprintf(stdout,"No symbol \"%s\" in current context.\n",
- s);
- return 0;
- }
-
if ((sym = symLookup(s,cctxt))) {
printTypeInfo(sym->type);
fprintf(stdout,"\n");
} else {
fprintf(stdout,
- "No symbol \"%s\" in current context.\n",
+ "No symbol \"%s\" in current context.\n",
s);
}
return 0;
precede the synonym "b" */
/* break point */
{ "break" , cmdSetUserBp ,
- "{b}reak\t\t\t [LINE | FILE:LINE | FILE:FUNCTION | FUNCTION]\n",
+ "{b}reak\t\t\t [LINE | FILE:LINE | FILE:FUNCTION | FUNCTION]\n",
},
{ "b" , cmdSetUserBp , NULL },
{ "h" , cmdHelp , NULL },
{ "info" , cmdInfo ,
- "info"
- "\t {break}\t list all break points\n"
- "\t {stack}\t information about call stack\n"
- "\t {frame}\t current frame information\n"
- "\t {registers}\t display value of all registers\n"
+ "info <break stack frame registers>\n"
+ "\t list all break points, call-stack, frame or register information\n"
},
{ "listasm" , cmdListAsm ,
"listasm {la}\t\t list assembler code for the current C line\n"
},
{ "la" , cmdListAsm , NULL },
+ { "ls" , cmdListSymbols , "ls,lf,lm\t\t list symbols,functions,modules\n" },
+ { "lf" , cmdListFunctions, NULL },
+ { "lm" , cmdListModules , NULL },
{ "list" , cmdListSrc ,
"{l}ist\t\t\t [LINE | FILE:LINE | FILE:FUNCTION | FUNCTION]\n"
},
{ "l" , cmdListSrc , NULL },
{ "show" , cmdShow ,
"show"
- "\t {copying}\t copying & distribution terms\n"
- "\t {warranty}\t warranty information\n"
+ " <copying warranty>\t copying & distribution terms, warranty\n"
},
- { "set" , cmdSetOption , NULL },
+ { "set" , cmdSetOption , "set <srcmode>\t\t toggle between c/asm.\n" },
{ "step" , cmdStep ,
"{s}tep\t\t\t Step program until it reaches a different source line.\n"
},
{ "!" , cmdSimulator ,
"!<simulator command>\t send a command directly to the simulator\n"
},
+ { "." , cmdSimulator ,
+ ".{cmd}\t switch from simulator or debugger command mode\n"
+ },
{ "quit" , cmdQuit ,
"{q}uit\t\t\t \"Watch me now. Iam going Down. My name is Bobby Brown\"\n"
},
int cmdHelp (char *s, context *cctxt)
{
int i ;
+ int endline = 999;
+ int startline = 0;
+
+ while (isspace(*s))
+ ++s;
+ if (isdigit(*s)) {
+ endline = ((*s - '0') * 20) + 20;
+ if (endline > 0)
+ startline = endline - 20;
+ }
for (i = 0 ; i < (sizeof(cmdTab)/sizeof(struct cmdtab)) ; i++) {
- /* command string matches */
- if (cmdTab[i].htxt)
- fprintf(stdout,"%s",cmdTab[i].htxt);
+ /* command string matches */
+
+ if ((cmdTab[i].htxt) && (i >= startline))
+ fprintf(stdout,"%s",cmdTab[i].htxt);
+ if (i == endline)
+ break;
}
return 0;
}
#define MAX_CMD_LEN 512
-char *prompt = "(sdcdb) ";
-char cmdbuff[MAX_CMD_LEN];
+static char cmdbuff[MAX_CMD_LEN];
+static int sim_cmd_mode = 0;
-/*-----------------------------------------------------------------*/
-/* interpretCmd - interpret and do the command */
-/*-----------------------------------------------------------------*/
+/*-----------------------------------------------------------------
+ interpretCmd - interpret and do the command. Return 0 to continue,
+ return 1 to exit program.
+|-----------------------------------------------------------------*/
int interpretCmd (char *s)
{
static char *pcmd = NULL;
int i ;
int rv = 0 ;
+
/* if nothing & previous command exists then
execute the previous command again */
if (*s == '\n' && pcmd)
- strcpy(s,pcmd);
+ strcpy(s,pcmd);
+
/* if previous command exists & is different
from the current command then copy it */
if (pcmd) {
- if (strcmp(pcmd,s)) {
- free(pcmd);
- pcmd = strdup(s);
- }
+ if (strcmp(pcmd,s)) {
+ free(pcmd);
+ pcmd = strdup(s);
+ }
} else
- pcmd = strdup(s);
- /* lookup the command table and do the
- task required */
+ pcmd = strdup(s);
+
+ /* lookup the command table and do the task required */
strtok(s,"\n");
+ if (sim_cmd_mode) {
+ if (strcmp(s,".") == 0) {
+ sim_cmd_mode = 0;
+ return 0;
+ }
+ else if (s[0] == '.') {
+ /* kill the preceeding '.' and pass on as SDCDB command */
+ char *s1 = s+1;
+ char *s2 = s;
+ while (*s1 != 0)
+ *s2++ = *s1++;
+ *s2 = 0;
+ } else {
+ cmdSimulator (s, currCtxt);
+ return 0;
+ }
+ } else {
+ if (strcmp(s,".") ==0) {
+ sim_cmd_mode = 1;
+ return 0;
+ }
+ }
+
for (i = 0 ; i < (sizeof(cmdTab)/sizeof(struct cmdtab)) ; i++) {
- /* command string matches */
- if (strncmp(s,cmdTab[i].cmd,strlen(cmdTab[i].cmd)) == 0) {
- if (!cmdTab[i].cmdfunc)
- return 1;
- rv = (*cmdTab[i].cmdfunc)(s + strlen(cmdTab[i].cmd),currCtxt);
-
- /* if full name then give the file name & position */
- if (fullname && currCtxt && currCtxt->func) {
- if (srcMode == SRC_CMODE)
- fprintf(stdout,"\032\032%s:%d:1\n",
- currCtxt->func->mod->cfullname,
- currCtxt->cline+1);
- else
- fprintf(stdout,"\032\032%s:%d:1\n",
- currCtxt->func->mod->afullname,
- currCtxt->asmline+1);
+ /* command string matches */
+ if (strncmp(s,cmdTab[i].cmd,strlen(cmdTab[i].cmd)) == 0) {
+ if (!cmdTab[i].cmdfunc)
+ return 1;
+
+ rv = (*cmdTab[i].cmdfunc)(s + strlen(cmdTab[i].cmd),currCtxt);
+
+ /* if full name then give the file name & position */
+ if (fullname && currCtxt && currCtxt->func) {
+ if (srcMode == SRC_CMODE)
+ fprintf(stdout,"\032\032%s:%d:1\n",
+ currCtxt->func->mod->cfullname,
+ currCtxt->cline+1);
+ else
+ fprintf(stdout,"\032\032%s:%d:1\n",
+ currCtxt->func->mod->afullname,
+ currCtxt->asmline+1);
+ }
+ goto ret;
}
- goto ret;
- }
}
fprintf(stdout,"Undefined command: \"%s\". Try \"help\".\n",s);
/*-----------------------------------------------------------------*/
void commandLoop()
{
+ char *prompt = "(sdcdb) ";
+ char *sim_prompt = "(sim) ";
- while (1) {
- fprintf(stdout,"%s",prompt);
- fflush(stdout);
+ while (1) {
+ if (sim_cmd_mode)
+ printf("%s",sim_prompt);
+ else
+ fprintf(stdout,"%s",prompt);
- if (fgets(cmdbuff,sizeof(cmdbuff),stdin) == NULL)
- break;
+ fflush(stdout);
- if (interpretCmd(cmdbuff))
+ if (fgets(cmdbuff,sizeof(cmdbuff),stdin) == NULL)
break;
+#if 0
+ /* make a way to go into "ucSim" mode */
+ if (cmdbuff[0] == '$') {
+ if (sim_cmd_mode) sim_cmd_mode = 0;
+ else sim_cmd_mode = 1;
+ continue;
}
+#endif
+
+ if (interpretCmd(cmdbuff))
+ break;
+ }
}
/*-----------------------------------------------------------------*/
{
int i ;
char *filename = NULL;
- char buffer[100];
+ int passon_args_flag = 0; /* if true, pass on args to simulator */
+
for ( i = 1; i < argc ; i++) {
- fprintf(stdout,"%s\n",argv[i]);
+ //fprintf(stdout,"%s\n",argv[i]);
+
+ if (passon_args_flag) { /* if true, pass on args to simulator */
+ simArgs[nsimArgs++] = strdup(argv[i]);
+ continue;
+ }
/* if this is an option */
if (argv[i][0] == '-') {
continue;
}
+ /* model string */
+ if (strncmp(argv[i],"-m",2) == 0) {
+ strncpy(model_str, &argv[i][2], 15);
+ if (strcmp(model_str,"avr") == 0)
+ simArgs[0] = "savr";
+ else if (strcmp(model_str,"xa") == 0)
+ simArgs[0] = "sxa";
+ else if (strcmp(model_str,"z80") == 0)
+ simArgs[0] = "sz80";
+ continue ;
+ }
+
+ /* -z all remaining options are for simulator */
+ if (strcmp(argv[i],"-z") == 0) {
+ passon_args_flag = 1;
+ continue ;
+ }
+
/* the simulator arguments */
/* cpu */
}
/* serial port */
- if (strcmp(argv[i],"-s") == 0) {
+ if ( (strcmp(argv[i],"-S") == 0) ||
+ (strcmp(argv[i],"-s") == 0)) {
simArgs[nsimArgs++] = "-s";
simArgs[nsimArgs++] = strdup(argv[++i]);
continue ;
}
- if (strcmp(argv[i],"-S") == 0) {
- simArgs[nsimArgs++] = "-s";
- simArgs[nsimArgs++] = strdup(argv[++i]);
- continue ;
- }
-
- /* model string */
- if (strncmp(argv[i],"-m",2) == 0) {
- strncpy(model_str, &argv[i][2], 15);
- if (strcmp(model_str,"avr") == 0)
- simArgs[0] = "savr";
- else if (strcmp(model_str,"rrz80") == 0)
- simArgs[0] = "rrz80";
- else if (strcmp(model_str,"xa") == 0)
- simArgs[0] = "sxa";
- else if (strcmp(model_str,"z80") == 0)
- simArgs[0] = "sz80";
- continue ;
- }
-
fprintf(stderr,"unknown option %s --- ignored\n",
argv[i]);
+
} else {
/* must be file name */
if (filename) {
int main ( int argc, char **argv)
{
printVersionInfo();
+ printf("WARNING: SDCDB is EXPERIMENTAL and NOT A FULLY FUNCTIONING TOOL.\n");
simArgs[nsimArgs++] = "s51";
simArgs[nsimArgs++] = "-P";