#include "simi.h"
#include "break.h"
#include "cmd.h"
+#include "newalloc.h"
char *currModName = NULL;
cdbrecs *recsRoot = NULL ;
char *gc_strdup(const char *s)
{
char *ret;
- Safe_calloc(1,ret, strlen(s)+1);
+ ret = Safe_malloc(strlen(s)+1);
strcpy(ret, s);
return ret;
}
if (!size)
return NULL;
- Safe_calloc(1,d,size+1);
+ d = Safe_malloc(size+1);
memcpy(d,s,size);
d[size] = '\0';
if (!(bp = fgets(buffer,sizeof(buffer),file)))
return 0;
- Safe_calloc(1,currl,sizeof(cdbrecs));
+ currl = Safe_calloc(1,sizeof(cdbrecs));
recsRoot = currl ;
while (1) {
}
bp += 2;
- Safe_calloc(1,currl->line,strlen(bp));
+ currl->line = Safe_malloc(strlen(bp));
strncpy(currl->line,bp,strlen(bp)-1);
currl->line[strlen(bp)-1] = '\0';
}
if (feof(file))
break;
- Safe_calloc(1,currl->next,sizeof(cdbrecs));
+ currl->next = Safe_calloc(1,sizeof(cdbrecs));
currl = currl->next;
}
slines = (srcLine **)resize((void **)slines,*nlines);
- Safe_calloc(1,slines[(*nlines)-1],sizeof(srcLine));
+ slines[(*nlines)-1] = Safe_calloc(1,sizeof(srcLine));
slines[(*nlines)-1]->src = alloccpy(bp,strlen(bp));
}
sym = func->sym;
-#ifdef SDCDB_DEBUG
- printf("func '%s' has entry '%x' exit '%x'\n",
+ Dprintf(D_sdcdb, ("func '%s' has entry '%x' exit '%x'\n",
func->sym->name,
func->sym->addr,
- func->sym->eaddr);
-#endif
+ func->sym->eaddr));
+
if (!func->sym->addr && !func->sym->eaddr)
continue ;
if (func->exitline < j)
func->exitline = j;
- Safe_calloc(1,ep,sizeof(exePoint));
+ ep = Safe_calloc(1,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 */
- Safe_calloc(1,ep,sizeof(exePoint));
+ ep = Safe_calloc(1,sizeof(exePoint));
ep->addr = mod->asmLines[j]->addr ;
ep->line = j;
addSet(&func->afpoints,ep);
}
#ifdef SDCDB_DEBUG
- printf("function '%s' has the following C exePoints\n",
- func->sym->name);
+ Dprintf(D_sdcdb, ("function '%s' has the following C exePoints\n",
+ func->sym->name));
{
exePoint *ep;
for (ep = setFirstItem(func->cfpoints); ep;
ep = setNextItem(func->cfpoints))
- fprintf (stdout,"{%x,%d} %s",ep->addr,ep->line,mod->cLines[ep->line]->src);
+ Dprintf(D_sdcdb, ("{%x,%d} %s",
+ ep->addr,ep->line,mod->cLines[ep->line]->src));
- fprintf(stdout," and the following ASM exePoints\n");
+ Dprintf(D_sdcdb, (" and the following ASM exePoints\n"));
for (ep = setFirstItem(func->afpoints); ep;
- ep = setNextItem(func->afpoints))
- fprintf (stdout,"{%x,%d} %s",ep->addr,ep->line,mod->asmLines[ep->line]->src);
-
+ ep = setNextItem(func->afpoints))
+ Dprintf (D_sdcdb, ("{%x,%d} %s",
+ ep->addr,ep->line,mod->asmLines[ep->line]->src));
}
#endif
}
}
/* allocate for context */
- Safe_calloc(1,currCtxt ,sizeof(context));
+ currCtxt = Safe_calloc(1,sizeof(context));
/* readin the debug information */
if (!readCdb (cdbFile)) {