⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
/************************************************************************ *									* *			Copyright (c) 1986 by				* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//************************************************************************ *									* *			Modification History				* *                                                                      * *  011	- Added support for vectors.							* *		  (L Miller, 18JAN90)									* *									* *      010 - Modifications for dxdb, format of printf and .dbxinit     * *	      (David Metsky, Feb 6, 1989)				* *									* *	009 - Added a xterm path argument to -x for xdb.		* *	      (David Metsky, July 27, 1988)				* *									* *	008 - Changed signal handlers to void.				* *	      (Mark Parenti, June 9, 1988)				* *									* *      007 - Defined a new flag, -x for xdb.				* *            (David Metsky, March 8, 1988)				* *									* *	006 - Added new debugging flag "tracefuncs".			* *	      (vjh, July 16, 1986)					* *									* *	005 - Merged in 4.3 changes.					* *	      (vjh, April 29, 1986)					* *									* *	004 - Update copyright.						* *	      (vjh, August 23, 1985)					* *									* *	003 - Require inclusion of version.h, to print out current	* *	      software release version number.				* *	      (vjh, May 10, 1985)					* *									* *	002 - Require a flag INHOUSE to be defined for the command	* *	      line switches -b, -e, -s, and -n to be permitted.		* *	      These are all switches used in debugging dbx.		* *	      (vjh, April 15, 1985)					* *									* *	001 - Shortened prompt by calling rindex to remove preceding	* *	      directory specification.  Added routine mkinitfile to	* *	      "build" the name of the initialization file; makes	* *	      debugging the debugger easier.				* *	      (Victoria Holt, April 9, 1985)				* *									* ************************************************************************//* * Copyright (c) 1983 Regents of the University of California. * All rights reserved.  The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */#ifndef lintchar copyright[] ="@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n";#endif not lint#ifndef lintstatic char *sccsid = "@(#)main.c	4.2	ULTRIX	11/9/90";#endif not lint/* * Debugger main routine. */#include "defs.h"#include <setjmp.h>#include <signal.h>#include <errno.h>#include "main.h"#include "eval.h"#include "debug.h"#include "symbols.h"#include "scanner.h"#include "keywords.h"#include "process.h"#include "runtime.h"#include "source.h"#include "object.h"#include "mappings.h"#include "coredump.h"#include "version.h"#ifndef public#define isterm(file)	(interactive or isatty(fileno(file)))#include <sgtty.h>#include <fcntl.h>typedef struct {    struct sgttyb sg;		/* standard sgttyb structure */    struct tchars tc;		/* terminal characters */    struct ltchars ltc;		/* local special characters */    integer ldisc;		/* line discipline */    integer local;		/* TIOCLGET */    integer fcflags;		/* fcntl(2) F_GETFL, F_SETFL */} Ttyinfo;#endifpublic boolean vectorcapable;   /* true if vector capable processor */public boolean found_a_vec_inst; /*  true if instrction decode in   */								 /*  findnextaddr found a vector    */								 /*  instruction.                   */public boolean needruncmd;       /* used by rerun/reread to force run()*/public boolean coredump;		/* true if using a core dump */public boolean runfirst;		/* run program immediately */public boolean interactive;		/* standard input IS a terminal */public boolean lexdebug;		/* trace scanner return values */public boolean tracebpts;		/* trace create/delete breakpoints */public boolean traceexec;		/* trace execution */public boolean traceeval;		/* trace expression evaluation */public boolean tracesyms;		/* print symbols are they are read */public boolean traceblocks;		/* trace blocks when reading symbols */public boolean tracefuncs;		/* print names of functions as they */					/*   are entered into function table */public boolean vaddrs;			/* map addresses through page tables */public boolean xdb;			/* xdb specific feature */public String xdbpath;   		/* xdb specific feature */public File corefile;			/* File id of core dump */public char **myenvp;			/* global environ pointer */#define FIRST_TIME 0			/* initial value setjmp returns */#define MAXFILNAMSIZ 14			/* limit init file to 14 chars */private Boolean initdone = false;	/* true if initialization done */private jmp_buf env;			/* setjmp/longjmp data */private char outbuf[BUFSIZ];		/* standard output buffer */private char namebuf[512];		/* possible name of object file */private int firstarg;			/* first program argument (for -r) */private Ttyinfo ttyinfo;private String corename;		/* name of core file */private void catchintr();/* * Main program. */main(argc, argv, envp)int argc;String argv[];String envp[];{    register integer i;    extern String date;    extern integer versionNumber;	myenvp = envp;	cmdname = argv[0];    if (rindex(cmdname, '/') != nil) {	cmdname = rindex(cmdname, '/') + 1;    }    mkinitfile();    catcherrs();    onsyserr(EINTR, nil);    printf("dbx version %s of %s.\nType 'help' for help.\n",														version, date);    fflush(stdout);    scanargs(argc, argv);	Input_init();    language_init();	OpInit();    symbols_init();    process_init();	needruncmd = false;    if (runfirst) {	if (setjmp(env) == FIRST_TIME) {	    arginit();	    for (i = firstarg; i < argc; i++) {		newarg(argv[i]);	    }	    run();	    /* NOTREACHED */	} else {	    runfirst = false;	}    } else {	init();    }    if (setjmp(env) != FIRST_TIME) {	restoretty(stdout, &ttyinfo);    }    signal(SIGINT, catchintr);    yyparse();    putchar('\n');    quit(0);}/* * Build the name of the initialization file: *	. + <1st 8 chars. of cmdname> + init + \0 * Filenames are limited to 14 characters. */private mkinitfile(){    Char buf[MAXFILNAMSIZ];    String prefix;    Integer i;    prefix = cmdname;    if (*prefix == '\0') {	initfile = strdup(".dbxinit");    } else {        buf[0] = '.';        for (i = 1; i <= 8; i++) {	    if (*prefix == '\0') break;       	    buf[i] = *prefix++;        }        strcpy(&buf[i], "init");        buf[i+4] = '\0';        initfile = strdup(buf);    }}    /* * Initialize the world, including setting initial input file * if the file exists. */public init(){    File f;    String home;    char buf[100];    extern String getenv();    savetty(stdout, &ttyinfo);    enterkeywords();    scanner_init();    if (not coredump and not runfirst) {	start(nil, nil, nil);    }    printf("reading symbolic information ...");    fflush(stdout);    readobj(objname);    printf("\n");    fflush(stdout);    if (coredump) {	printf("[using memory image in %s]\n", corename);	if (vaddrs) {	    coredump_getkerinfo();	}	setcurfunc(whatblock(pc));	never_run = false;    } else {	setcurfunc(program);    }    bpinit(needruncmd);    if (!xdb) {                      /* 010 - don't use .dbxinit */        f = fopen(initfile, "r");        if (f != nil) {	    fclose(f);	    setinput(initfile);        } else {	    home = getenv("HOME");	    if (home != nil) {	        sprintf(buf, "%s/%s", home, initfile);	        f = fopen(buf, "r");	        if (f != nil) {		    fclose(f);		    setinput(strdup(buf));	        }	    }        }    }  /* end if !xdb */    initdone = true;}/* * Re-initialize the world, first de-allocating all storage. * This is necessary when the symbol information must be re-read * from the object file when it has changed. * * Before "forgetting" things, we save the current tracing/breakpoint * information to a temp file.  Then after re-creating the world,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -