char *simArgs[8];
int nsimArgs = 0;
+/* fake filename & lineno to make linker */
+char *filename=NULL;
+int lineno = 0;
+int fatalError = 0;
+
/* command table */
struct cmdtab
{
{ "q" , cmdQuit , NULL }
};
+/*-----------------------------------------------------------------*/
+/* gc_strdup - make a string duplicate garbage collector aware */
+/*-----------------------------------------------------------------*/
+char *gc_strdup(const char *s)
+{
+ char *ret;
+ Safe_calloc(ret, strlen(s)+1);
+ strcpy(ret, s);
+ return ret;
+}
+
/*-----------------------------------------------------------------*/
/* alloccpy - allocate copy and return a new string */
/*-----------------------------------------------------------------*/
if (!size)
return NULL;
- ALLOC(d,size+1);
+ Safe_calloc(d,size+1);
memcpy(d,s,size);
d[size] = '\0';
void **vptr;
if (array)
- vptr = GC_realloc(array,newSize*(sizeof(void **)));
+ vptr = Safe_realloc(array,newSize*(sizeof(void **)));
else
- vptr = GC_malloc(sizeof(void **));
+ vptr = calloc(1, sizeof(void **));
if (!vptr) {
fprintf(stderr,"sdcdb: out of memory \n");
if (!(bp = fgets(buffer,sizeof(buffer),file)))
return 0;
- ALLOC(currl,sizeof(cdbrecs));
+ Safe_calloc(currl,sizeof(cdbrecs));
recsRoot = currl ;
while (1) {
}
bp += 2;
- ALLOC(currl->line,strlen(bp));
+ Safe_calloc(currl->line,strlen(bp));
strncpy(currl->line,bp,strlen(bp)-1);
currl->line[strlen(bp)-1] = '\0';
}
if (feof(file))
break;
- ALLOC(currl->next,sizeof(cdbrecs));
+ Safe_calloc(currl->next,sizeof(cdbrecs));
currl = currl->next;
}
slines = (srcLine **)resize((void **)slines,*nlines);
- ALLOC(slines[(*nlines)-1],sizeof(srcLine));
+ Safe_calloc(slines[(*nlines)-1],sizeof(srcLine));
slines[(*nlines)-1]->src = alloccpy(bp,strlen(bp));
}
if (func->exitline < j)
func->exitline = j;
- ALLOC(ep,sizeof(exePoint));
+ Safe_calloc(ep,sizeof(exePoint));
ep->addr = mod->cLines[j]->addr ;
ep->line = j;
ep->block= mod->cLines[j]->block;
func->aexitline = j;
/* add it to the execution point */
- ALLOC(ep,sizeof(exePoint));
+ Safe_calloc(ep,sizeof(exePoint));
ep->addr = mod->asmLines[j]->addr ;
ep->line = j;
addSet(&func->afpoints,ep);
}
/* allocate for context */
- ALLOC(currCtxt ,sizeof(context));
+ Safe_calloc(currCtxt ,sizeof(context));
/* readin the debug information */
if (!readCdb (cdbFile)) {
if (!ssdirl)
ssdirl = &argv[i][12];
else {
- char *p = malloc(strlen(ssdirl)+strlen(&argv[i][12])+2);
+ char *p = Safe_malloc(strlen(ssdirl)+strlen(&argv[i][12])+2);
strcat(strcat(strcpy(p,&argv[i][12]),":"),ssdirl);
ssdirl = p;
}