run.c File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int cmd_run (int argc, char **argv)
 mycmd_init (run, cmd_run,"run","run filename")


Function Documentation

int cmd_run ( int  argc,
char **  argv 
)

Definition at line 5 of file run.c.

References context_reg, dMIPS32_NUM_DEBUG_REGISTERS, fd, and fMIPS32_ExecuteDebugModule().

00006 {
00007         unsigned long download_addr;
00008         struct stat statbuf;
00009         char *buf;
00010         int fd;
00011         unsigned long before=0,after=0;
00012         int context_reg[dMIPS32_NUM_DEBUG_REGISTERS];
00013         if(stat(argv[1],&statbuf)!=0)
00014         {
00015                 printf("error read file %s\n",argv[1]);
00016                 exit(-1);
00017         }
00018 
00019         if(argc>2)before=strtoul(argv[2],0,0);
00020         if(argc>3)after=strtoul(argv[3],0,0);
00021 
00022 printf("open file %s,size %d\n",argv[1],statbuf.st_size);
00023 buf=malloc(statbuf.st_size+before+after);
00024 if(!buf)printf("error allocate memory\n");
00025 fd=open(argv[1],O_RDONLY);
00026 read(fd,buf+before,statbuf.st_size);
00027 close(fd);
00028 
00029 printf("before=%x,after=%x\n",before,after);
00030 fMIPS32_ExecuteDebugModule(buf+before,statbuf.st_size+after,4);
00031 
00032 free(buf);
00033 
00034     return 0;
00035 }

Here is the call graph for this function:

mycmd_init ( run  ,
cmd_run  ,
"run"  ,
"run filename"   
)


Generated on Fri Nov 5 07:24:50 2010 for ejtag debug tools for loongson 232 cpu by  doxygen 1.5.6