亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dbgdata.c

?? 一個小型虛擬機的實現(xiàn)代碼
?? C
字號:
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                                                   +
+ dbgdata.c reads executable, populates debug data structures       +
+                                                                   +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
+ macros                                                            +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

#define SIZE_HEADER		26		/* byte size of executable header */
#define SIZE_GLOBREC	37		/* byte size of global record */
#define SIZE_PROCREC	25		/* byte size of procedure record */
#define SIZE_RETREC		16		/* byte size of return value record */
#define SIZE_ARGREC		16		/* byte size of argument record */
#define SIZE_LOCREC		16		/* byte size of local variable record */
#define SIZE_LBLREC		20		/* byte size of label record */

#define MAX_RECSIZE		SIZE_GLOBREC

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
+ declarations                                                      +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

struct HeaderRec
{
	U2 magic;		/*should be magic number 0xDEED */
	U8 szSymTbl;	/*size of symbol table*/
	U8 szStrTbl;	/*size of string table*/
	U8 szByteCode;  /*size of bytecode*/
};

struct Contents
{
	U4 nGlobVarRec;		/*number of global variable records in symbol table*/
	U4 nProcRec;		/*number of procedure records in symbol table*/
};

#define	SZ_BYTE		1	/*used to indicate GlobVar type*/
#define SZ_WORD		2
#define SZ_DWORD	4
#define SZ_QWORD	8
char *globSz[]={"","SZ_BYTE","SZ_WORD","","SZ_DWORD",
                "","","","SZ_QWORD"};

struct GlobVarRec
{
	U8 text;		/*index into StrTbl of where identifier begins*/
	U1 dType;		/* SZ_BYTE, SZ_WORD, SZ_DWORD, SZ_QWORD */
	U8 len;			/* # elements if array */
	U8 size;		/* total byte size */
	S8 offset;      /* offset below $TOP, address(g) = $TOP - offset*/
	U4 line;		/* source code line containing declaration */
};
struct StackFrameRec
{
	U8 text;		/* index into StrTbl of where identifier begins */
	S4 fpOffset;	/* +n or -n from $FP */
	U4 line;		/* source code line containing declaration */
};
struct LabelRec
{
	U8 text;		/* index into StrTbl of where identifier begins */
	U8 address;		/* address of label*/
	U4 line;		/* source code line containing declaration */
};
struct ProcRec
{
	U8 text;		/* index into StrTbl of where identifier begins */
	U8 address;		/* address of procedure */
	U4 line;		/* source code line containing declaration */
	struct StackFrameRec ret;
	U1 nRet;		/* 0 = void return, 1 = returns a value*/
	struct StackFrameRec *arg;
	U1 nArg;
	struct StackFrameRec *local;
	U1 nLocal;
	struct LabelRec *label;
	U2 nLabel;
};
struct DebugData
{
	struct Contents contents;
	struct GlobVarRec *gvRec;
	struct ProcRec *pRec;
	U1 *strTbl;
};

U1 debug;		/* TRUE if VM is in debug mode */

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private variables                                                 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

struct DebugData debugData;
U1 debugbytes[MAX_RECSIZE];	/*holds data read in for single record*/

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ public prototypes                                                 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

void printDebugData(struct DebugData *ptr);
void populateDebugData(struct HeaderRec *hptr, struct DebugData *ptr, FILE *fptr);

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private prototypes                                                +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

void printProcRec(struct ProcRec *pptr, struct DebugData *ptr);
void printStackFrameRec(struct StackFrameRec *sptr, struct DebugData *ptr);
void printLabelRec(struct LabelRec *lptr, struct DebugData *ptr);

struct HeaderRec readHeaderRec(FILE *fptr);
struct Contents readContents(FILE* fptr);
struct GlobVarRec readGlobVarRec(FILE *fptr);
struct ProcRec readProcRec(FILE *fptr);
struct StackFrameRec readStackFrameRec(FILE *fptr);
struct LabelRec readLabelRec(FILE *fptr);

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
+ definitions                                                       +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

void printDebugData(struct DebugData *ptr)
{
	U8 i;

	for(i=0;i<((*ptr).contents).nGlobVarRec;i++)
	{
		printf("GLOBVAR "); pU8(i); printf("\n");
		printf("\tid=%s\n",&((*ptr).strTbl[(*ptr).gvRec[i].text]));
		printf("\ttype=%s\n",globSz[(*ptr).gvRec[i].dType]);
		printf("\tlen="); pU8((*ptr).gvRec[i].len); printf("\n");
		printf("\tsize="); pU8((*ptr).gvRec[i].size); printf("\n");
		printf("\toffset="); pS8((*ptr).gvRec[i].offset); printf("\n");
		printf("\tline="); pU4((*ptr).gvRec[i].line); printf("\n\n");
	}

	for(i=0;i<((*ptr).contents).nProcRec;i++)
	{
		printf("PROC "); pU8(i); printf("\n");
		printProcRec(&((*ptr).pRec[i]),ptr);
	}

	return;

}/*end printDebugData*/

/*-----------------------------------------------------------------*/

void printProcRec(struct ProcRec *pptr, struct DebugData *ptr)
{
	U4 i;

	printf("\tid=%s\n",&((*ptr).strTbl[(*pptr).text]));
	printf("\taddress="); pU8((*pptr).address); printf("\n");
	printf("\tline="); pU4((*pptr).line); printf("\n");
	if((*pptr).nRet)
	{
		printf("\tRET\n");
		printStackFrameRec(&((*pptr).ret), ptr);
	}
	for(i=0;i<(*pptr).nArg;i++)
	{
		printf("\tARG->"); pU4(i); printf("\n");
		printStackFrameRec(&((*pptr).arg[i]), ptr);
	}
	for(i=0;i<(*pptr).nLocal;i++)
	{
		printf("\tLOCAL->"); pU4(i); printf("\n");
		printStackFrameRec(&((*pptr).local[i]), ptr);
	}
	for(i=0;i<(*pptr).nLabel;i++)
	{
		printf("\tLABEL->"); pU4(i); printf("\n");
		printLabelRec(&((*pptr).label[i]), ptr);
	}
	return;

}/*end printProcRec*/

/*-----------------------------------------------------------------*/

void printStackFrameRec(struct StackFrameRec *sptr, struct DebugData *ptr)
{
	printf("\t\tid=%s\n",&((*ptr).strTbl[(*sptr).text]));
	printf("\t\tfpOffset="); pS4((*sptr).fpOffset); printf("\n");
	printf("\t\tline="); pU4((*sptr).line); printf("\n");
	return;

}/*end printStackFrameRec*/

/*-----------------------------------------------------------------*/

void printLabelRec(struct LabelRec *lptr, struct DebugData *ptr)
{
	printf("\t\tid=%s\n",&((*ptr).strTbl[(*lptr).text]));
	printf("\t\taddress="); pU8((*lptr).address); printf("\n");
	printf("\t\tline="); pU4((*lptr).line); printf("\n");
	return;

}/*end printLabelRec*/

/*-----------------------------------------------------------------*/

void populateDebugData(struct HeaderRec *hptr, struct DebugData *ptr, FILE *fptr)
{
	U8 i;
	U4 np;
	U4 ng;

	/*1) read header, skip population if zero sizes */

	(*hptr) = readHeaderRec(fptr);

	if(((*hptr).szSymTbl==0)&&((*hptr).szStrTbl==0))
	{ 
		(*ptr).contents.nGlobVarRec = 0;
		(*ptr).contents.nProcRec = 0;
		return; 
	}

	/*2) read table of contents, info on number of globs and procs */

	(*ptr).contents = readContents(fptr);
	ng = ((*ptr).contents).nGlobVarRec;
	np = ((*ptr).contents).nProcRec;

	/*3) based on contents info, allocate globs and procs */

	(*ptr).gvRec = (struct GlobVarRec*)malloc(sizeof(struct GlobVarRec)*ng);

	if((*ptr).gvRec==NULL)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("could not allocate space for global variable records");
	}

	(*ptr).pRec = (struct ProcRec*)malloc(sizeof(struct ProcRec)*np);

	if((*ptr).pRec==NULL)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("could not allocate space for procedure records");
	}

	/*4) read in globvar recs following contents */

	for(i=0;i<ng;i++)
	{
		(*ptr).gvRec[i]= readGlobVarRec(fptr);
	}

	/*5) read in procs which follow globvars */

	for(i=0;i<np;i++)
	{
		(*ptr).pRec[i]= readProcRec(fptr);
	}

	/*
	6) allocate and populate string table (follows symbol table)
	   note: native limit via malloc(size_t) 
	*/

	(*ptr).strTbl = (U1*)malloc((size_t)(*hptr).szStrTbl);

	if((*ptr).strTbl==NULL)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("could not allocate space for string table");
	}

	for(i=0;i<(*hptr).szStrTbl;i++)
	{
		(*ptr).strTbl[i] = (U1)fgetc(fptr);
	}
	return;

}/*end populateDebugData*/

/*-----------------------------------------------------------------*/

struct HeaderRec readHeaderRec(FILE *fptr)
{
	struct HeaderRec hr;
	int i;
	i = fread(debugbytes,sizeof(U1),SIZE_HEADER,fptr);
	if(i<SIZE_HEADER)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("error reading header record");
	}
	
	if((debugbytes[0]==0xDE)&&(debugbytes[1]==0xED))
	{ 
		hr.magic = 0xDEED; 
	}
	else
	{ 
		hr.magic = 0xBAD; 
	}
	
	hr.szSymTbl = bytecodeToQWord(&(debugbytes[2]));
	hr.szStrTbl = bytecodeToQWord(&(debugbytes[10]));
	hr.szByteCode = bytecodeToQWord(&(debugbytes[18]));

	return(hr);

}/*end readHeaderRec*/

/*-----------------------------------------------------------------*/

struct Contents readContents(FILE* fptr)
{
	struct Contents ct;
	int i;
	i = fread(debugbytes,sizeof(U1),8,fptr);
	if(i<8)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("error reading contents record");
	}
	
	ct.nGlobVarRec = bytecodeToDWord(&(debugbytes[0]));
	ct.nProcRec = bytecodeToDWord(&(debugbytes[4]));

	return(ct);

}/*end readContents*/

/*-----------------------------------------------------------------*/

struct GlobVarRec readGlobVarRec(FILE *fptr)
{
	struct GlobVarRec gr;
	int i;
	i = fread(debugbytes,sizeof(U1),SIZE_GLOBREC,fptr);
	if(i<SIZE_GLOBREC)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("error reading global record");
	}
	gr.text = bytecodeToQWord(&(debugbytes[0]));
	gr.dType = debugbytes[8];
	gr.len = bytecodeToQWord(&(debugbytes[9]));
	gr.size = bytecodeToQWord(&(debugbytes[17]));
	gr.offset = bytecodeToQWord(&(debugbytes[25]));
	gr.line = bytecodeToDWord(&(debugbytes[33]));

	return(gr);

}/*end readGlobVarRec*/

/*-----------------------------------------------------------------*/

struct ProcRec readProcRec(FILE *fptr)
{
	struct ProcRec pr;
	int i;
	i = fread(debugbytes,sizeof(U1),SIZE_PROCREC,fptr);
	if(i<SIZE_PROCREC)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("error reading procedure record");
	}

	pr.text = bytecodeToQWord(&(debugbytes[0]));
	pr.address = bytecodeToQWord(&(debugbytes[8]));
	pr.line = bytecodeToDWord(&(debugbytes[16]));
	pr.nRet = debugbytes[20];
	pr.nArg = debugbytes[21];
	pr.nLocal = debugbytes[22];
	pr.nLabel = bytecodeToWord(&(debugbytes[23]));

	pr.arg = (struct StackFrameRec *)malloc(pr.nArg*sizeof(struct StackFrameRec));
	pr.local= (struct StackFrameRec *)malloc(pr.nLocal*sizeof(struct StackFrameRec));
	pr.label= (struct LabelRec *)malloc(pr.nLabel*sizeof(struct LabelRec));

	if(pr.arg==NULL)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("could not allocate space for procedure-argument records");
	}
	if(pr.local==NULL)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("could not allocate space for procedure-local records");
	}
	if(pr.label==NULL)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("could not allocate space for procedure-label records");
	}

	if(pr.nRet)
	{
		pr.ret = readStackFrameRec(fptr);
	}
	for(i=0;i<pr.nArg;i++)
	{
		pr.arg[i]= readStackFrameRec(fptr);
	}
	for(i=0;i<pr.nLocal;i++)
	{
		pr.local[i]= readStackFrameRec(fptr);
	}
	for(i=0;i<pr.nLabel;i++)
	{
		pr.label[i]= readLabelRec(fptr);
	}

	return(pr);

}/*end readProcRec*/

/*-----------------------------------------------------------------*/

struct StackFrameRec readStackFrameRec(FILE *fptr)
{
	struct StackFrameRec sfr;
	int i;
	i = fread(debugbytes,sizeof(U1),SIZE_RETREC,fptr);
	if(i<SIZE_RETREC)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("error reading stackframe record");
	}

	sfr.text = bytecodeToQWord(&(debugbytes[0]));
	sfr.fpOffset = bytecodeToDWord(&(debugbytes[8]));
	sfr.line = bytecodeToDWord(&(debugbytes[12]));

	return(sfr);

}/*end readStackFramerec*/

/*-----------------------------------------------------------------*/

struct LabelRec readLabelRec(FILE *fptr)
{
	struct LabelRec lr;
	int i;
	i = fread(debugbytes,sizeof(U1),SIZE_LBLREC,fptr);
	if(i<SIZE_LBLREC)
	{
		FCLOSE(fptr);
		FATAL_ERROR1("error reading label record");
	}

	lr.text = bytecodeToQWord(&(debugbytes[0]));
	lr.address = bytecodeToQWord(&(debugbytes[8]));
	lr.line = bytecodeToDWord(&(debugbytes[16]));

	return(lr);

}/*end readLabelRec*/

/*-----------------------------------------------------------------*/

/*void testDriver(int argc, char *argv[])
{
	struct HeaderRec hr;
	FILE *fptr;

	if(argc==1)
	{
		printf("file name must be specified");
		return;
	}

	fptr = fopen(argv[1],"rb");
	if(fptr==NULL)
	{
		printf("cannot open %s\n",argv[1]);
		return;
	}

	populateDebugData(&hr, &debugData,fptr);

	printf("\n\nHEADER->\n");
	printf("\tmagic=%lX\n",hr.magic);
	printf("\tbytes in symbol table %lu\n",hr.szSymTbl);
	printf("\tbytes in string table %lu\n",hr.szStrTbl);
	printf("\tbytes in bytecode %lu\n",hr.szByteCode);

	printDebugData(&debugData);
	return;

}*//*end main*/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久伊99综合婷婷久久伊| 在线视频国内一区二区| 精品久久99ma| 国产毛片精品一区| 久久精品人人做人人爽97| 国产乱对白刺激视频不卡| 久久久精品tv| av欧美精品.com| 亚洲国产精品久久一线不卡| 欧美日韩国产高清一区二区三区 | 亚洲裸体在线观看| 色av成人天堂桃色av| 亚洲国产精品一区二区久久恐怖片| 欧美日韩小视频| 男男视频亚洲欧美| 中文字幕的久久| 91九色最新地址| 日本中文在线一区| 日本一区二区动态图| 欧美无乱码久久久免费午夜一区| 肉肉av福利一精品导航| 26uuuu精品一区二区| caoporen国产精品视频| 日韩精品成人一区二区三区| 久久综合九色综合欧美亚洲| 91一区二区在线| 男女男精品视频网| 中文字幕一区二区日韩精品绯色| 欧美精品少妇一区二区三区| 国产一区二区在线观看免费| 一区二区理论电影在线观看| 日韩欧美专区在线| 91麻豆.com| 精品一二三四区| 亚洲综合在线视频| 国产喂奶挤奶一区二区三区| 精品视频999| 成人夜色视频网站在线观看| 青青青爽久久午夜综合久久午夜| 国产精品久99| 欧美mv和日韩mv的网站| 91在线观看视频| 国产九色精品成人porny| 亚洲高清免费一级二级三级| 日本一区二区久久| 精品日韩欧美一区二区| 欧美日韩一区三区| www.日韩精品| 国产91综合一区在线观看| 午夜电影网一区| 亚洲免费观看高清在线观看| 久久精品一区二区三区四区| 欧美日韩国产在线播放网站| 99久久免费精品| 国产黄色91视频| 美女脱光内衣内裤视频久久网站 | 亚洲国产精品久久艾草纯爱 | 国产精品影音先锋| 日本不卡一区二区| 午夜一区二区三区视频| 亚洲欧美aⅴ...| 中文字幕一区二区三区精华液| 精品99999| 日韩视频免费观看高清在线视频| 欧美视频精品在线| 在线一区二区三区四区五区| 97se狠狠狠综合亚洲狠狠| 国产91丝袜在线播放九色| 国产一区亚洲一区| 精品午夜一区二区三区在线观看| 午夜亚洲国产au精品一区二区| 亚洲免费观看高清完整版在线观看熊| 国产女人18毛片水真多成人如厕| 精品欧美久久久| 日韩精品影音先锋| 欧美mv和日韩mv国产网站| 日韩久久免费av| 日韩免费观看2025年上映的电影| 91精品视频网| 日韩精品在线网站| 久久―日本道色综合久久| 精品久久久久久久久久久院品网 | 欧洲国内综合视频| 色天天综合久久久久综合片| 91免费观看在线| 在线观看国产精品网站| 欧美主播一区二区三区美女| 欧美自拍偷拍午夜视频| 欧美日韩国产一区二区三区地区| 欧美色爱综合网| 91精品国产综合久久精品图片| 日韩无一区二区| 国产午夜一区二区三区| 国产精品久线观看视频| 亚洲精品日日夜夜| 视频在线在亚洲| 国产精品一区在线观看乱码| 国产91精品精华液一区二区三区| 成人国产精品免费网站| 91极品美女在线| 欧美一区二区在线视频| 精品国产sm最大网站| 国产色产综合色产在线视频| 国产精品国产馆在线真实露脸 | 日本一区二区免费在线| 亚洲婷婷综合色高清在线| 亚洲国产综合色| 精品一区二区三区不卡| 99久久精品国产一区| 欧美高清视频不卡网| 久久久久亚洲蜜桃| 亚洲在线中文字幕| 精品一区精品二区高清| av电影天堂一区二区在线观看| 欧美日韩国产综合久久| 国产丝袜欧美中文另类| 亚洲影院在线观看| 国产一区二区三区免费看| 国产视频在线观看一区二区三区 | 亚洲美女免费视频| 青娱乐精品视频| 99国产精品久久久久久久久久 | 色综合色综合色综合| 日韩欧美国产1| 亚洲免费看黄网站| 国内偷窥港台综合视频在线播放| 91视频www| 欧美精品一区二区三区在线 | 国产欧美日韩在线| 亚洲va韩国va欧美va| 成人午夜私人影院| 91精品久久久久久蜜臀| 亚洲欧美一区二区在线观看| 六月丁香综合在线视频| 欧美专区日韩专区| 中文字幕第一区第二区| 久久精品国产一区二区| 欧美午夜精品免费| 国产精品理伦片| 韩国欧美一区二区| 欧美一区二区三区不卡| 亚洲综合999| 91蜜桃在线观看| 日本一区二区三区高清不卡| 另类综合日韩欧美亚洲| 欧美日韩高清一区| 一区二区三区在线高清| 日韩一区二区免费高清| 亚洲bdsm女犯bdsm网站| 91色.com| 亚洲私人影院在线观看| 成人精品视频网站| 久久综合久久综合亚洲| 美脚の诱脚舐め脚责91| 欧美一区欧美二区| 日韩专区欧美专区| 9191久久久久久久久久久| 午夜精品视频一区| 欧美日韩成人激情| 亚洲一区二区中文在线| 91国模大尺度私拍在线视频| 国产精品久久777777| av一区二区久久| 中日韩免费视频中文字幕| 懂色中文一区二区在线播放| 久久精品水蜜桃av综合天堂| 国产高清无密码一区二区三区| 久久久久国产精品麻豆ai换脸| 麻豆国产一区二区| 久久色在线视频| 国产精品正在播放| 中文字幕国产一区二区| 波多野结衣一区二区三区| 日韩美女视频一区| 色88888久久久久久影院按摩| 亚洲毛片av在线| 欧美在线不卡视频| 日韩国产一区二| 欧美成人国产一区二区| 韩国av一区二区三区四区| 久久精品一二三| 成人av免费在线播放| 一区二区三区美女| 欧美日韩国产影片| 激情综合亚洲精品| 国产精品热久久久久夜色精品三区| 粉嫩一区二区三区在线看| 亚洲免费观看高清完整版在线观看| 在线亚洲欧美专区二区| 日韩极品在线观看| 久久青草欧美一区二区三区| 国产成人av一区二区三区在线观看| 国产精品久久免费看| 在线看国产一区| 久久99精品久久久久久动态图 | 中文字幕不卡的av| 在线精品视频小说1| 麻豆国产一区二区| 国产精品黄色在线观看| 欧美酷刑日本凌虐凌虐|