what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
+#define link unix_link
+#define _GNU_SOURCE
+#include <unistd.h>
+#undef link
#include "sdcdb.h"
#include "symtab.h"
#include "simi.h"
char model_str[20];
/* fake filename & lineno to make linker */
char *filename=NULL;
+char *current_directory;
int lineno = 0;
int fatalError = 0;
{
char *dirs , *sdirs;
FILE *rfile = NULL;
- char buffer[128];
+ char buffer[1024];
/* first try the current directory */
if ((rfile = fopen(fname,"r"))) {
{
char *dirs , *sdirs;
FILE *rfile = NULL;
- char buffer[128];
+ char buffer[1024];
/* first try the current directory */
if ((rfile = fopen(fname,"r")))
}
}
-
-/*-----------------------------------------------------------------*/
-/* setEntryExitBP - set the entry & exit Break Points for functions*/
-/*-----------------------------------------------------------------*/
-DEFSETFUNC(setEntryExitBP)
-{
- function *func = item;
-
- if (func->sym && func->sym->addr && func->sym->eaddr) {
-
- /* set the entry break point */
- setBreakPoint (func->sym->addr , CODE , FENTRY ,
- fentryCB ,func->mod->c_name , func->entryline);
-
- /* set the exit break point */
- setBreakPoint (func->sym->eaddr , CODE , FEXIT ,
- fexitCB ,func->mod->c_name , func->exitline );
- }
-
- return 0;
-}
-
/*-----------------------------------------------------------------*/
/* cmdFile - load file into the debugger */
/*-----------------------------------------------------------------*/
int cmdFile (char *s,context *cctxt)
{
FILE *cdbFile;
- char buffer[128];
+ char buffer[1024];
char *bp;
s = trim_left(s);
/*set the break points
required by the debugger . i.e. the function entry
and function exit break points */
- applyToSet(functions,setEntryExitBP);
+// applyToSet(functions,setEntryExitBP);
setMainContext();
return 0;
static char cmdbuff[MAX_CMD_LEN];
static int sim_cmd_mode = 0;
+char *
+canonname(char *file)
+{
+ static char buffer[1024];
+ if (*file == '/')
+ return file;
+ sprintf(buffer,"%s/%s", current_directory, file);
+ return buffer;
+}
+
/*-----------------------------------------------------------------
interpretCmd - interpret and do the command. Return 0 to continue,
return 1 to exit program.
/* if nothing & previous command exists then
execute the previous command again */
- if (*s == '\n' && pcmd)
+ if ((*s == '\n' || *s == '\0') && pcmd)
strcpy(s,pcmd);
/* if previous command exists & is different
showfull = 0;
if (srcMode == SRC_CMODE)
fprintf(stdout,"\032\032%s:%d:1:beg:0x%08x\n",
- currCtxt->func->mod->cfullname,
+ canonname(currCtxt->func->mod->cfullname),
currCtxt->cline+1,currCtxt->addr);
else
fprintf(stdout,"\032\032%s:%d:1:beg:0x%08x\n",
- currCtxt->func->mod->afullname,
+ canonname(currCtxt->func->mod->afullname),
currCtxt->asmline,currCtxt->addr);
displayAll(currCtxt);
}
}
if (strncmp(argv[i],"-cd=",4) == 0) {
- chdir(argv[i][4]);
+ chdir(argv[i]+4);
continue;
}
printVersionInfo();
printf("WARNING: SDCDB is EXPERIMENTAL.\n");
+ current_directory = get_current_dir_name();
simArgs[nsimArgs++] = "s51";
simArgs[nsimArgs++] = "-P";
simArgs[nsimArgs++] = "-r 9756";