1 /*-------------------------------------------------------------------------
2 sdcdb.c - main source file for sdcdb debugger
3 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999)
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding!
22 -------------------------------------------------------------------------*/
35 char *currModName = NULL;
36 cdbrecs *recsRoot = NULL ;
37 set *modules = NULL; /* set of all modules */
38 set *functions = NULL ; /* set of functions */
39 set *symbols = NULL ; /* set of symbols */
40 set *sfrsymbols= NULL ; /* set of symbols of sfr or sbit */
42 structdef **structs = NULL ; /* all structures */
44 linkrec **linkrecs = NULL; /* all linkage editor records */
45 context *currCtxt = NULL;
48 char userinterrupt = 0;
51 char *ssdirl = DATADIR LIB_DIR_SUFFIX ":" DATADIR LIB_DIR_SUFFIX "/small" ;
56 /* fake filename & lineno to make linker */
64 char *cmd ; /* command the user will enter */
65 int (*cmdfunc)(char *,context *); /* function to execute when command is entered */
66 char *htxt ; /* short help text */
69 /* NOTE:- the search is done from the top, so "break" should
70 precede the synonym "b" */
72 { "break" , cmdSetUserBp ,
73 "{b}reak\t\t\t [LINE | FILE:LINE | FILE:FUNCTION | FUNCTION | *<address>]\n",
75 { "tbreak" , cmdSetTmpUserBp ,
76 "tbreak\t\t\t [LINE | FILE:LINE | FILE:FUNCTION | FUNCTION | *<address>]\n",
78 { "b" , cmdSetUserBp , NULL },
81 "jump\t\t\tContinue program being debugged at specified line or address\n [LINE | FILE:LINE | *<address>]\n",
83 { "clear" , cmdClrUserBp ,
84 "{cl}ear\t\t\t [LINE | FILE:LINE | FILE:FUNCTION | FUNCTION]\n"
86 { "cl" , cmdClrUserBp , NULL },
88 { "continue" , cmdContinue ,
89 "{c}ontinue\t\t Continue program being debugged, after breakpoint.\n"
91 { "c" , cmdContinue , NULL },
93 { "disassemble",cmdDisasmF , "disassemble [startaddr [endaddress]]\tdisassemble asm commands\n" },
94 { "delete" , cmdDelUserBp ,
95 "{d}elete n\t\t clears break point number n\n"
97 { "display" , cmdDisplay ,
98 "display [/<fmt>] [<variable>]\t print value of given variable each time the program stops\n"
100 { "undisplay" , cmdUnDisplay ,
101 "undisplay [<variable>]\t dont display this variable or all\n"
104 "down\t\tSelect and print stack frame called by this one.\nAn argument says how many frames down to go.\n"
107 "up\t\tSelect and print stack frame that called this one.\nAn argument says how many frames up to go.\n"
109 { "d" , cmdDelUserBp , NULL },
112 "info <break stack frame registers all-registers>\n"
113 "\t list all break points, call-stack, frame or register information\n"
116 { "listasm" , cmdListAsm ,
117 "listasm {la}\t\t list assembler code for the current C line\n"
119 { "la" , cmdListAsm , NULL },
120 { "ls" , cmdListSymbols , "ls,lf,lm\t\t list symbols,functions,modules\n" },
121 { "lf" , cmdListFunctions, NULL },
122 { "lm" , cmdListModules , NULL },
123 { "list" , cmdListSrc ,
124 "{l}ist\t\t\t [LINE | FILE:LINE | FILE:FUNCTION | FUNCTION]\n"
126 { "l" , cmdListSrc , NULL },
129 " <copying warranty>\t copying & distribution terms, warranty\n"
131 { "set" , cmdSetOption , "set <srcmode>\t\t toggle between c/asm.\nset variable <var> = >value\t\tset variable to new value\n" },
132 { "stepi" , cmdStepi ,
133 "stepi\t\t\tStep one instruction exactly.\n"
136 "{s}tep\t\t\tStep program until it reaches a different source line.\n"
138 { "source" , cmdSource ,
139 "source <FILE>\t\t\tRead commands from a file named FILE.\n"
141 { "s" , cmdStep , NULL },
142 { "nexti" , cmdNexti ,
143 "nexti\t\t\tStep one instruction, but proceed through subroutine calls.\n"
146 "{n}ext\t\t\tStep program, proceeding through subroutine calls.\n"
148 { "n" , cmdNext , NULL },
150 "{r}un\t\t\tStart debugged program. \n"
152 { "r" , cmdRun , NULL },
153 { "ptype" , cmdPrintType ,
154 "{pt}ype <variable>\tprint type information of a variable\n"
156 { "pt" , cmdPrintType , NULL },
157 { "print" , cmdPrint ,
158 "{p}rint <variable>\t print value of given variable\n"
160 { "output" , cmdOutput ,
161 "output <variable>\t print value of given variable without $ and newline \n"
163 { "p" , cmdPrint , NULL },
165 "file <filename>\t\t load symbolic information from <filename>\n"
167 { "frame" , cmdFrame ,
168 "{fr}ame\t\t print information about the current Stack\n"
170 { "finish" , cmdFinish ,
171 "{fi}nish\t\t execute till return of current function\n"
173 { "fi" , cmdFinish , NULL },
174 { "where" , cmdWhere , "where\t\t print stack\n" },
175 { "fr" , cmdFrame , NULL },
176 { "f" , cmdFrame , NULL },
177 { "x /i" , cmdDisasm1 , "x\t\t disassemble one asm command\n" },
178 { "!" , cmdSimulator ,
179 "!<simulator command>\t send a command directly to the simulator\n"
181 { "." , cmdSimulator ,
182 ".{cmd}\t switch from simulator or debugger command mode\n"
185 "{h|?}elp\t [CMD_NAME | 0,1,2,3(help page)] (general help or specific help)\n"
187 { "?" , cmdHelp , NULL },
188 { "h" , cmdHelp , NULL },
191 "{q}uit\t\t\t \"Watch me now. Iam going Down. My name is Bobby Brown\"\n"
193 { "q" , cmdQuit , NULL }
196 /*-----------------------------------------------------------------*/
197 /* gc_strdup - make a string duplicate garbage collector aware */
198 /*-----------------------------------------------------------------*/
199 char *gc_strdup(const char *s)
202 ret = Safe_malloc(strlen(s)+1);
207 /*-----------------------------------------------------------------*/
208 /* alloccpy - allocate copy and return a new string */
209 /*-----------------------------------------------------------------*/
210 char *alloccpy ( char *s, int size)
217 d = Safe_malloc(size+1);
224 /*-----------------------------------------------------------------*/
225 /* resize - resizes array of type with new size */
226 /*-----------------------------------------------------------------*/
227 void **resize (void **array, int newSize)
232 vptr = Safe_realloc(array,newSize*(sizeof(void **)));
234 vptr = calloc(1, sizeof(void **));
237 fprintf(stderr,"sdcdb: out of memory \n");
245 /*-----------------------------------------------------------------*/
246 /* readCdb - reads the cdb files & puts the records into cdbLine */
248 /*-----------------------------------------------------------------*/
249 static int readCdb (FILE *file)
255 if (!(bp = fgets(buffer,sizeof(buffer),file)))
258 currl = Safe_calloc(1,sizeof(cdbrecs));
263 /* make sure this is a cdb record */
264 if (strchr("STLFM",*bp) && *(bp+1) == ':') {
265 /* depending on the record type */
270 currl->type = SYM_REC;
273 currl->type = STRUCT_REC;
276 currl->type = LNK_REC;
279 currl->type = FUNC_REC;
282 currl->type = MOD_REC ;
286 currl->line = Safe_malloc(strlen(bp));
287 strncpy(currl->line,bp,strlen(bp)-1);
288 currl->line[strlen(bp)-1] = '\0';
291 if (!(bp = fgets(buffer,sizeof(buffer),file)))
297 currl->next = Safe_calloc(1,sizeof(cdbrecs));
301 return (recsRoot->line ? 1 : 0);
304 /*-----------------------------------------------------------------*/
305 /* searchDirsFname - search directory list & return the filename */
306 /*-----------------------------------------------------------------*/
307 char *searchDirsFname (char *fname)
313 /* first try the current directory */
314 if ((rfile = fopen(fname,"r"))) {
316 return strdup(fname) ;
320 return strdup(fname);
322 /* make a copy of the source directories */
323 dirs = sdirs = strdup(ssdirl);
325 /* assume that the separator is ':'
326 and try for each directory in the search list */
327 dirs = strtok(dirs,":");
329 if (dirs[strlen(dirs)] == '/')
330 sprintf(buffer,"%s%s",dirs,fname);
332 sprintf(buffer,"%s/%s",dirs,fname);
333 if ((rfile = fopen(buffer,"r")))
335 dirs = strtok(NULL,":");
341 return strdup(buffer);
343 return strdup(fname);
346 /*-----------------------------------------------------------------*/
347 /* searchDirsFopen - go thru list of directories for filename given*/
348 /*-----------------------------------------------------------------*/
349 FILE *searchDirsFopen(char *fname)
355 /* first try the current directory */
356 if ((rfile = fopen(fname,"r")))
361 /* make a copy of the source directories */
362 dirs = sdirs = strdup(ssdirl);
364 /* assume that the separator is ':'
365 and try for each directory in the search list */
366 dirs = strtok(dirs,":");
368 sprintf(buffer,"%s/%s",dirs,fname);
369 if ((rfile = fopen(buffer,"r")))
371 dirs = strtok(NULL,":");
379 /*-----------------------------------------------------------------*/
380 /* loadFile - loads a file into module buffer */
381 /*-----------------------------------------------------------------*/
382 srcLine **loadFile (char *name, int *nlines)
387 srcLine **slines = NULL;
390 if (!(mfile = searchDirsFopen(name))) {
391 fprintf(stderr,"sdcdb: cannot open module %s -- use '--directory=<source directory> option\n",name);
395 while ((bp = fgets(buffer,sizeof(buffer),mfile))) {
398 slines = (srcLine **)resize((void **)slines,*nlines);
400 slines[(*nlines)-1] = Safe_calloc(1,sizeof(srcLine));
401 slines[(*nlines)-1]->src = alloccpy(bp,strlen(bp));
409 /*-----------------------------------------------------------------*/
410 /* loadModules - reads the source files into module structure */
411 /*-----------------------------------------------------------------*/
412 static void loadModules ()
418 /* go thru the records & find out the module
419 records & load the modules specified */
420 for ( loop = recsRoot ; loop ; loop = loop->next ) {
422 switch (loop->type) {
423 /* for module records do */
425 currMod = parseModule(loop->line,TRUE);
426 currModName = currMod->name ;
428 currMod->cfullname = searchDirsFname(currMod->c_name);
430 /* load it into buffer */
431 currMod->cLines = loadFile (currMod->c_name,
434 /* do the same for the assembler file */
435 currMod->afullname = searchDirsFname(currMod->asm_name);
436 currMod->asmLines=loadFile (currMod->asm_name,
437 &currMod->nasmLines);
440 /* if this is a function record */
442 parseFunc(loop->line);
445 /* if this is a structure record */
447 parseStruct(loop->line);
450 /* if symbol then parse the symbol */
452 parseSymbol(loop->line,&rs,2);
456 parseLnkRec(loop->line);
462 /*-----------------------------------------------------------------*/
463 /* generate extra sets of sfr and sbit symbols */
464 /*-----------------------------------------------------------------*/
465 static void specialFunctionRegs ()
468 for (sym = setFirstItem(symbols);
470 sym = setNextItem(symbols))
472 if ( sym->addrspace == 'I' ||
473 sym->addrspace == 'J')
475 addSet(&sfrsymbols,sym);
479 /*-----------------------------------------------------------------*/
480 /* functionPoints - determine the execution points within a func */
481 /*-----------------------------------------------------------------*/
482 static void functionPoints ()
488 /* for all functions do */
489 for ( func = setFirstItem(functions); func;
490 func = setNextItem(functions)) {
496 Dprintf(D_sdcdb, ("sdcdb: func '%s' has entry '0x%x' exit '0x%x'\n",
501 if (!func->sym->addr && !func->sym->eaddr)
504 /* for all source lines in the module find
505 the ones with address >= start and <= end
506 and put them in the point */
508 if (! applyToSet(modules,moduleWithName,func->modName,&mod))
511 func->entryline= INT_MAX;
513 func->aentryline = INT_MAX ;
516 /* do it for the C Lines first */
517 for ( j = 0 ; j < mod->ncLines ; j++ ) {
518 if (mod->cLines[j]->addr >= sym->addr &&
519 mod->cLines[j]->addr <= sym->eaddr ) {
522 /* add it to the execution point */
523 if (func->entryline > j)
526 if (func->exitline < j)
529 ep = Safe_calloc(1,sizeof(exePoint));
530 ep->addr = mod->cLines[j]->addr ;
532 ep->block= mod->cLines[j]->block;
533 ep->level= mod->cLines[j]->level;
534 addSet(&func->cfpoints,ep);
537 /* check double line execution points of module */
538 for (ep = setFirstItem(mod->cfpoints); ep;
539 ep = setNextItem(mod->cfpoints))
541 if (ep->addr >= sym->addr &&
542 ep->addr <= sym->eaddr )
544 addSet(&func->cfpoints,ep);
547 /* do the same for asm execution points */
548 for ( j = 0 ; j < mod->nasmLines ; j++ ) {
549 if (mod->asmLines[j]->addr >= sym->addr &&
550 mod->asmLines[j]->addr <= sym->eaddr ) {
553 /* add it to the execution point */
554 if (func->aentryline > j)
555 func->aentryline = j;
557 if (func->aexitline < j)
560 /* add it to the execution point */
561 ep = Safe_calloc(1,sizeof(exePoint));
562 ep->addr = mod->asmLines[j]->addr ;
564 addSet(&func->afpoints,ep);
569 if (!( D_sdcdb & sdcdbDebug))
572 Dprintf(D_sdcdb, ("sdcdb: function '%s' has the following C exePoints\n",
577 for (ep = setFirstItem(func->cfpoints); ep;
578 ep = setNextItem(func->cfpoints))
579 Dprintf(D_sdcdb, ("sdcdb: {0x%x,%d} %s",
580 ep->addr,ep->line+1,mod->cLines[ep->line]->src));
582 Dprintf(D_sdcdb, ("sdcdb: and the following ASM exePoints\n"));
583 for (ep = setFirstItem(func->afpoints); ep;
584 ep = setNextItem(func->afpoints))
585 Dprintf (D_sdcdb, ("sdcdb: {0x%x,%d} %s",
586 ep->addr,ep->line+1,mod->asmLines[ep->line]->src));
593 /*-----------------------------------------------------------------*/
594 /* setEntryExitBP - set the entry & exit Break Points for functions*/
595 /*-----------------------------------------------------------------*/
596 DEFSETFUNC(setEntryExitBP)
598 function *func = item;
600 if (func->sym && func->sym->addr && func->sym->eaddr) {
602 /* set the entry break point */
603 setBreakPoint (func->sym->addr , CODE , FENTRY ,
604 fentryCB ,func->mod->c_name , func->entryline);
606 /* set the exit break point */
607 setBreakPoint (func->sym->eaddr , CODE , FEXIT ,
608 fexitCB ,func->mod->c_name , func->exitline );
614 /*-----------------------------------------------------------------*/
615 /* cmdFile - load file into the debugger */
616 /*-----------------------------------------------------------------*/
617 int cmdFile (char *s,context *cctxt)
623 while (isspace(*s)) s++;
625 fprintf(stdout,"No exec file now.\nNo symbol file now.\n");
629 sprintf(buffer,"%s.cdb",s);
630 /* try creating the cdbfile */
631 if (!(cdbFile = searchDirsFopen(buffer))) {
632 fprintf(stdout,"Cannot open file\"%s\", no symbolic information loaded\n",buffer);
636 /* allocate for context */
637 currCtxt = Safe_calloc(1,sizeof(context));
640 /* readin the debug information */
641 if (!readCdb (cdbFile)) {
642 fprintf(stdout,"No symbolic information found in file %s.cdb\n",s);
647 /* parse and load the modules required */
650 /* determine the execution points for this
654 /* extract known special function registers */
655 specialFunctionRegs();
657 /* start the simulator & setup connection to it */
659 openSimulator((char **)simArgs,nsimArgs);
660 fprintf(stdout,"%s",simResponse());
661 /* now send the filename to be loaded to the simulator */
662 sprintf(buffer,"%s.ihx",s);
663 bp=searchDirsFname(buffer);
667 /*set the break points
668 required by the debugger . i.e. the function entry
669 and function exit break points */
670 applyToSet(functions,setEntryExitBP);
676 /*-----------------------------------------------------------------*/
677 /* cmdSource - read commands from file */
678 /*-----------------------------------------------------------------*/
679 int cmdSource (char *s, context *cctxt)
681 fprintf(stderr,"'source <file>' command not yet implemented\n",s);
685 /*-----------------------------------------------------------------*/
686 /* cmdHelp - help command */
687 /*-----------------------------------------------------------------*/
688 int cmdHelp (char *s, context *cctxt)
697 endline = ((*s - '0') * 20) + 20;
699 startline = endline - 20;
703 for (i = 0 ; i < (sizeof(cmdTab)/sizeof(struct cmdtab)) ; i++)
705 if ((cmdTab[i].htxt) && !strcmp(cmdTab[i].cmd,s))
707 s = strrchr(cmdTab[i].htxt,'\t');
712 fprintf(stdout,"%s",s);
719 for (i = 0 ; i < (sizeof(cmdTab)/sizeof(struct cmdtab)) ; i++) {
721 /* command string matches */
723 if ((cmdTab[i].htxt) && (i >= startline))
724 fprintf(stdout,"%s",cmdTab[i].htxt);
732 #define MAX_CMD_LEN 512
733 static char cmdbuff[MAX_CMD_LEN];
734 static int sim_cmd_mode = 0;
736 /*-----------------------------------------------------------------
737 interpretCmd - interpret and do the command. Return 0 to continue,
738 return 1 to exit program.
739 |-----------------------------------------------------------------*/
740 int interpretCmd (char *s)
742 static char *pcmd = NULL;
746 /* if nothing & previous command exists then
747 execute the previous command again */
748 if (*s == '\n' && pcmd)
751 /* if previous command exists & is different
752 from the current command then copy it */
754 if (strcmp(pcmd,s)) {
761 /* lookup the command table and do the task required */
765 if (strcmp(s,".") == 0) {
769 else if (s[0] == '.') {
770 /* kill the preceeding '.' and pass on as SDCDB command */
777 cmdSimulator (s, currCtxt);
781 if (strcmp(s,".") ==0) {
787 for (i = 0 ; i < (sizeof(cmdTab)/sizeof(struct cmdtab)) ; i++) {
789 /* command string matches */
790 if (strncmp(s,cmdTab[i].cmd,strlen(cmdTab[i].cmd)) == 0) {
791 if (!cmdTab[i].cmdfunc)
794 rv = (*cmdTab[i].cmdfunc)(s + strlen(cmdTab[i].cmd),currCtxt);
796 /* if full name then give the file name & position */
797 if (fullname && showfull && currCtxt && currCtxt->func) {
799 if (srcMode == SRC_CMODE)
800 fprintf(stdout,"\032\032%s:%d:1:beg:0x%08x\n",
801 currCtxt->func->mod->cfullname,
802 currCtxt->cline+1,currCtxt->addr);
804 fprintf(stdout,"\032\032%s:%d:1:beg:0x%08x\n",
805 currCtxt->func->mod->afullname,
806 currCtxt->asmline,currCtxt->addr);
807 displayAll(currCtxt);
813 fprintf(stdout,"Undefined command: \"%s\". Try \"help\".\n",s);
818 /*-----------------------------------------------------------------*/
819 /* commandLoop - the main command loop */
820 /*-----------------------------------------------------------------*/
823 char *prompt = "(sdcdb) ";
824 char *sim_prompt = "(sim) ";
828 printf("%s",sim_prompt);
830 fprintf(stdout,"%s",prompt);
834 if (fgets(cmdbuff,sizeof(cmdbuff),stdin) == NULL)
838 /* make a way to go into "ucSim" mode */
839 if (cmdbuff[0] == '$') {
840 if (sim_cmd_mode) sim_cmd_mode = 0;
841 else sim_cmd_mode = 1;
846 if (interpretCmd(cmdbuff))
851 /*-----------------------------------------------------------------*/
852 /* printVersionInfo - print the version information */
853 /*-----------------------------------------------------------------*/
854 static void printVersionInfo()
857 "SDCDB is free software and you are welcome to distribute copies of it\n"
858 "under certain conditions; type \"show copying\" to see the conditions.\n"
859 "There is absolutely no warranty for SDCDB; type \"show warranty\" for details.\n"
860 "SDCDB 0.8 . Copyright (C) 1999 Sandeep Dutta (sandeep.dutta@usa.net)\n"
861 "Type ? for help\n");
865 /*-----------------------------------------------------------------*/
866 /* parseCmdLine - parse the commandline arguments */
867 /*-----------------------------------------------------------------*/
868 static void parseCmdLine (int argc, char **argv)
871 char *filename = NULL;
872 int passon_args_flag = 0; /* if true, pass on args to simulator */
874 Dprintf(D_sdcdb, ("sdcdb: parseCmdLine\n"));
877 for ( i = 1; i < argc ; i++) {
878 //fprintf(stdout,"%s\n",argv[i]);
880 if (passon_args_flag) { /* if true, pass on args to simulator */
881 simArgs[nsimArgs++] = strdup(argv[i]);
885 /* if this is an option */
886 if (argv[i][0] == '-') {
888 /* if directory then mark directory */
889 if (strncmp(argv[i],"--directory=",12) == 0) {
891 ssdirl = &argv[i][12];
893 char *p = Safe_malloc(strlen(ssdirl)+strlen(&argv[i][12])+2);
894 strcat(strcat(strcpy(p,&argv[i][12]),":"),ssdirl);
900 if (strncmp(argv[i],"-fullname",9) == 0) {
905 if (strcmp(argv[i],"-cd") == 0) {
911 if (strncmp(argv[i],"-cd=",4) == 0) {
917 if (strncmp(argv[i],"-d=",3) == 0) {
918 sdcdbDebug = strtol(&argv[i][3],0,0);
922 if (strncmp(argv[i],"-contsim",8) == 0) {
926 if (strncmp(argv[i],"-q",2) == 0) {
931 if (strncmp(argv[i],"-m",2) == 0) {
932 strncpy(model_str, &argv[i][2], 15);
933 if (strcmp(model_str,"avr") == 0)
935 else if (strcmp(model_str,"xa") == 0)
937 else if (strcmp(model_str,"z80") == 0)
942 /* -z all remaining options are for simulator */
943 if (strcmp(argv[i],"-z") == 0) {
944 passon_args_flag = 1;
948 /* the simulator arguments */
951 if (strcmp(argv[i],"-t") == 0 ||
952 strcmp(argv[i],"-cpu") == 0) {
954 simArgs[nsimArgs++] = "-t";
955 simArgs[nsimArgs++] = strdup(argv[++i]);
960 if (strcmp(argv[i],"-X") == 0 ||
961 strcmp(argv[i],"-frequency") == 0) {
962 simArgs[nsimArgs++] = "-X";
963 simArgs[nsimArgs++] = strdup(argv[++i]);
968 if ( (strcmp(argv[i],"-S") == 0) ||
969 (strcmp(argv[i],"-s") == 0)) {
970 simArgs[nsimArgs++] = strdup(argv[i]);
971 simArgs[nsimArgs++] = strdup(argv[++i]);
975 fprintf(stderr,"unknown option %s --- ignored\n",
979 /* must be file name */
981 fprintf(stderr,"too many filenames .. parameter '%s' ignored\n",
986 filename = strtok(argv[i],".");
992 cmdFile(filename,NULL);
995 /*-----------------------------------------------------------------*/
996 /* setsignals - catch some signals */
997 /*-----------------------------------------------------------------*/
1010 /* may be interrupt from user: stop debugger and also simulator */
1016 /* the only child can be the simulator */
1017 static void sigchld(int sig)
1019 /* the only child can be the simulator */
1021 retpid = wait ( &status );
1022 /* if ( retpid == simPid ) */
1029 signal(SIGHUP , bad_signal);
1030 signal(SIGINT , sigintr );
1031 signal(SIGTERM, bad_signal);
1032 signal(SIGCHLD, sigchld );
1034 signal(SIGABRT, bad_signal);
1035 signal(SIGALRM, bad_signal);
1036 //signal(SIGFPE, bad_signal);
1037 //signal(SIGILL, bad_signal);
1038 signal(SIGPIPE, bad_signal);
1039 signal(SIGQUIT, bad_signal);
1040 //signal(SIGSEGV, bad_signal);
1043 /*-----------------------------------------------------------------*/
1045 /*-----------------------------------------------------------------*/
1047 int main ( int argc, char **argv)
1050 printf("WARNING: SDCDB is EXPERIMENTAL.\n");
1052 simArgs[nsimArgs++] = "s51";
1053 simArgs[nsimArgs++] = "-P";
1054 simArgs[nsimArgs++] = "-r 9756";
1055 /* parse command line */
1058 parseCmdLine(argc,argv);