v08i105: xdbx -- Dbx for X11, Part01/07

Po Cheung cheung%SW.MCC.COM at MCC.COM
Tue Aug 28 18:03:51 AEST 1990


Submitted-by: cheung%SW.MCC.COM at MCC.COM (Po Cheung)
Posting-number: Volume 8, Issue 105
Archive-name: xdbx/part01

The subject says it all -- this is version 2.0

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 7)."
# Contents:  Imakefile README XDbx.ad bsd_regex.h calldbx.c datadpy.h
#   dbx.c mips_regex.h patchlevel.h signals.c sun_regex.h utils.c
#   windows.c
# Wrapped by cheung at espresso.sw.mcc.com on Fri Aug 24 03:24:41 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(726 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
X#if defined(SunArchitecture) && OSMajorVersion >= 4
X        DEFINES = -DSUNOS4
X#endif
X
X#ifdef UltrixArchitecture
X#ifdef MipsArchitecture
X        DEFINES = -DBSD -DMIPS
X#else
X        DEFINES = -DBSD
X#endif
X#endif
X
X        DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X
X           SRCS = calldbx.c command.c dbx.c dialog.c datadpy.c filemenu.c \
X		  handler.c parser.c regex.c signs.c signals.c source.c \
X		  utils.c windows.c xdbx.c
X
X           OBJS = calldbx.o command.o dbx.o dialog.o datadpy.o filemenu.o \
X		  handler.o parser.o regex.o signs.o signals.o source.o \
X		  utils.o windows.o xdbx.o
X
XComplexProgramTarget(xdbx)
XInstallAppDefaults(XDbx)
END_OF_FILE
if test 726 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(968 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
XXdbx Version 2.1
X~~~~~~~~~~~~~~~~
XThis is the source distribution of xdbx, version 2.1 for X11R4 only.
XXdbx implements an X window system interface to the dbx debugger.  It
Xuses X11R4 Xt Intrinsics and Athena widgets.  Xdbx supports dbx on the 
XSun 3, Sun 4 workstations, and the DECstation 3100.
X
XChanges since version 2.0
X  +  conversion to R4
X  +  addition of icon
X  +  text selection behavior
X  +  bug fixes and enhancement
X
XXdbx has been tested on the following platforms:
X  o  Sun 4 running SunOS 4.0.3
X  o  Sun 3 running SunOS 4.1
X  o  Sun 3 running SunOS 4.0.3
X  o  DECStation 3100 running Ultrix 3.1
X  o  OpenWindows 1.1, 2.0
X  o  Window managers: mwm, twm, olwm
X
XBugs:
X  o  xdbx may get into an infinte loop while running on the DECstation 3100
X
XPlease send comments and bug reports to:
X
X    Po Cheung
X    cheung at sw.mcc.com	
X    Microelectronics and Computer Technology Corporation
X      -- or --
X    po at cerc.utexas.edu 	
X    University of Texas at Austin
X
END_OF_FILE
if test 968 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'XDbx.ad' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'XDbx.ad'\"
else
echo shar: Extracting \"'XDbx.ad'\" \(1734 characters\)
sed "s/^X//" >'XDbx.ad' <<'END_OF_FILE'
X#
X# Xdbx 2.1 Application defaults file
X#
X
X*background: 				snow1
X*foreground: 				black
X*fileWindow*background:			snow2
X*messageWindow.background:		snow2
X*commandWindow.background: 		snow2
X*Scrollbar.foreground: 			snow3
X
X*allowShellResize:              	True
X*borderWidth:				1
X*font:                          	fixed
X*vpane.width:                   	550
X*fileWindow*font:     			variable
X*fileLabel.width:     			500
X*lineLabel.width:     			50
X*sourceForm.preferredPaneSize:  	320
X*sourceWindow.leftMargin:       	35
X*sourceWindow.scrollHorizontal:		whenNeeded
X*sourceWindow.translations:		#override \n\
X	<Btn1Down>:             SelectStart() SelectWord() \n\
X	Shift<Btn1Up>:          Update() SelectEnd() PrintSelection() \n\
X	<Btn1Up>:               Update() SelectEnd() \n
X*messageWindow*font:  			variable
X*messageWindow.min:  			30
X*messageWindow.max:  			30
X*dialogWindow.preferredPaneSize:	200
X*dialogWindow.resizeToPreferred:	True
X*dialogWindow.translations:		#override \n\
X	<Btn1Down>:     SelectStart() SelectWord() \n\
X	Shift<Btn1Up>:  SelectEnd() PrintSelection() \n\
X	<Btn1Up>:       SelectEnd() \n
X*commandWindow.preferredPaneSize:	106
X*commandWindow.skipAdjust:		True
X*commandWindow.hSpace:			14
X*commandWindow.vSpace:			10
X*Command.height:                	20
X*Command.width:                 	60
X*List.columnSpacing:            	10
X*displayWindow.preferredPaneSize:	50
X*displayWindow.skipAdjust:      	True
X*displayWindow.scrollVertical:		whenNeeded
X*displayWindow.scrollHorizontal:	whenNeeded
X*displayWindow.translations:		#override \n\
X	<Btn1Down>:             SelectStart() SelectWord() \n\
X	Shift<Btn1Up>:          SelectEnd() PrintSelection() \n\
X	<Btn1Up>:               SelectEnd() \n
X*popup*showGrip:			False
END_OF_FILE
if test 1734 -ne `wc -c <'XDbx.ad'`; then
    echo shar: \"'XDbx.ad'\" unpacked with wrong size!
fi
# end of 'XDbx.ad'
fi
if test -f 'bsd_regex.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'bsd_regex.h'\"
else
echo shar: Extracting \"'bsd_regex.h'\" \(5064 characters\)
sed "s/^X//" >'bsd_regex.h' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/*  bsd_regex.h
X *
X *  Regular expression pattern matching for Berkeley dbx.
X *
X *  The reg_token array indicates the register no. for each token type.
X *      reg_token[0] : message
X *      reg_token[1] : stop number
X *      reg_token[2] : function name
X *      reg_token[3] : line number
X *      reg_token[4] : file name
X *      reg_token[5] : display command output
X */
X
X#define TK_MESG         0
X#define TK_STOP         1
X#define TK_FUNC         2
X#define TK_LINE         3
X#define TK_FILE         4
X#define TK_DISP		5
X
X#define O_EXEC          0
X#define O_DONE          1
X#define O_STOPAT        2
X#define O_STOPIN        3
X#define O_UPDOWN        4
X#define O_BELL          5
X#define O_LIST          6
X#define O_FILE          7
X#define O_SEARCH        8
X#define O_PRINT         9
X#define O_DEBUG         10
X
X#define C_ANY		-1
X#define C_EXEC          0
X#define C_STOPAT        1
X#define C_STOPIN        2
X#define C_UPDOWN        3
X#define C_DELETE        4
X#define C_FUNC          5
X#define C_FILE          6
X#define C_USE          	7
X#define C_LIST         	8
X#define C_SEARCH        9
X#define C_PRINT		10
X#define C_STATUS        11
X
X
Xstatic PatternRec output_pattern[] = {
X    /* exec */
X    {"\\(.*\n\\)*.*\\(\[[0-9]+\\] \\)?\\(\\(stopped\\|Bus error\\|Segmentation \
Xfault\\|Interrupt\\) in \\([^ ]+\\) at line \
X\\([0-9]+\\)\\( in file \"\\([^ ]+\\)\"\\)?\\)\n", 
X     NULL,
X     {3, -1, 5, 6, 8, -1}
X    },
X    /* done */
X    {"\\(.*\n\\)*execution completed",
X     NULL,
X     {-1, -1, -1, -1, -1, -1}
X    },
X    /* stop at */
X    {"\\[\\([0-9]+\\)\\] stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
X     NULL,
X     {-1, 1, -1, 4, 3, -1}
X    },
X    /* stop in */
X    {"\\[\\([0-9]+\\)\\] stop in \\([^ ]+\\)\n",
X     NULL,
X     {-1, 1, 2, -1, -1, -1}
X    },
X    /* up, down */
X    {"\\([^ ]+\\)(.*), line \\([0-9]+\\) in \"\\([^ ]+\\)\"\n",
X     NULL,
X     {-1, -1, 1, 2, 3, -1}
X    },
X    /* bell */
X    {"\\(not that many levels\n\\|can't continue execution\n\\)",
X     NULL,
X     {-1, -1, -1, -1, -1, -1}
X    },
X    /* list */
X    {"\\([ ]*[0-9]+.*\n\\)*[ ]+\\([0-9]+\\)[ ]+{.*\n",
X     NULL,
X     {-1, -1, -1, 2, -1, -1}
X    },
X    /* file */
X    {"\\([^ ]*\\)\n",
X     NULL,
X     {-1, -1, -1, -1, 1, -1}
X    },
X    /* search */
X    {"[ ]*\\([0-9]+\\).*\n",
X     NULL,
X     {-1, -1, -1, 1, -1, -1}
X    },
X    /* print, display */
X    {"\\(warning: .*\n\\)?\\(\\(.*\\) = .*\n\\(.*\n\\)*\\)",
X     NULL,
X     { 3, -1, -1, -1, -1, 2}
X    },
X    NULL
X};
X
Xstatic PatternRec command_pattern[] = {
X    {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|return\\)",
X						NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(stop\\|st\\)[ ]+at[ ]+[0-9]+",   	NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(stop\\|st\\)[ ]+in[ ]+[^ ]+",      NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(where\\|up\\|down\\)",             NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(delete\\|d\\)",                  	NULL, {-1, -1, -1,  1, -1, -1}},
X    {"[ ]*func[ ]*\\([^ ]+\\)[ ]*",           	NULL, {-1, -1,  1, -1, -1, -1}},
X    {"[ ]*file[ ]*",           			NULL, {-1, -1, -1, -1,  1, -1}},
X    {"[ ]*use[ ]*",           			NULL, {-1, -1, -1, -1,  1, -1}},
X    {"[ ]*list[ ]*",           			NULL, {-1, -1, -1, -1,  1, -1}},
X    {"[ ]*\\(/\\|\?\\)",                      	NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*print[ ]*[^ ]+",                      NULL, {-1, -1, -1, -1, -1, -1}},
X    NULL
X};
END_OF_FILE
if test 5064 -ne `wc -c <'bsd_regex.h'`; then
    echo shar: \"'bsd_regex.h'\" unpacked with wrong size!
fi
# end of 'bsd_regex.h'
fi
if test -f 'calldbx.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'calldbx.c'\"
else
echo shar: Extracting \"'calldbx.c'\" \(5814 characters\)
sed "s/^X//" >'calldbx.c' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/*  calldbx.c
X *
X *    Set up communication between dbx and xdbx using pseudo terminal, and
X *    call dbx.
X *
X *    open_master():	Open the master side of pty.
X *    open_slave(): 	Open the slave side of pty.
X *    calldbx(): 	Invoke dbx.
X */
X
X#include	<termio.h>
X#include	"global.h"
X
XFILE   	    	*dbxfp = NULL;		/* file pointer to dbx */
Xint    	    	dbxpid = 0;		/* dbx process id */
X
Xstatic int	dbxInputId;		/* dbx input id */
Xstatic char 	pty[11] = "/dev/pty??";	/* master side of pseudo-terminal */
Xstatic char 	tty[11] = "/dev/tty??";	/* slave side of pseudo-terminal */
Xextern char	*dbxprompt;
X
X/*
X *  Xdbx talks to dbx through a pseudo terminal which is a pair of master
X *  and slave devices: /dev/pty?? and /dev/tty??, where ?? goes from p0 to
X *  sf (system dependent).  The pty is opened for both read and write.
X */
Xstatic int open_master()
X{
X    int  i, master; 
X    char c;
X
X    for (c='p'; c<='s'; c++) {
X	pty[8] = c;
X	for (i=0; i<16; i++) {
X	    pty[9] = "0123456789abcdef"[i];
X	    if ((master = open(pty, O_RDWR)) != -1) 
X		return (master); 
X	}
X    }
X    fprintf(stderr, "xdbx: all ptys in use\n");
X    exit(1);
X}
X
Xstatic int open_slave()
X{
X    int slave;
X
X    tty[8] = pty[8];
X    tty[9] = pty[9];
X    if ((slave = open(tty, O_RDWR)) != -1)
X	return (slave);
X    fprintf(stderr, "open: cannot open slave pty %s", tty);
X    exit(1);
X}
X
X/* ARGSUSED */
Xvoid calldbx(argc, argv)
Xint argc;
Xchar *argv[];
X{
X    struct termio Termio;
X    int  	  master;		/* file descriptor of master pty */
X    int  	  slave; 		/* file descriptor of slave pty */
X    int		  fd; 			/* file descriptor of controlling tty */
X    int		  pid;			/* process id */
X    int		  pgrp;			/* process group id */
X    char 	  *debugger; 		/* name of executable debugger */
X    char	  errmsg[LINESIZ];
X
X    debugger = (char *) getenv("DEBUGGER");	/* first looks up env var */
X    if (debugger == NULL)
X	debugger = XtNewString(DEBUGGER);
X  
X    /* construct dbx prompt string based on the name of debugger invoked */
X    if (dbxprompt == NULL) {
X	dbxprompt = XtMalloc((4+strlen(debugger)) * sizeof(char));
X	sprintf(dbxprompt, "(%s) ", debugger);
X    }
X  
X    /*
X     * Clear controlling tty.  Do this now, so that open_slave and
X     * open_master will cause the selected pty to become the
X     * controlling tty.
X     */
X    if ((fd = open("/dev/tty", O_RDWR)) > 0) {
X	ioctl(fd, TIOCNOTTY, 0);
X	close(fd);
X    }
X
X    master = open_master();
X    slave = open_slave();
X
X    dbxpid = fork();
X    if (dbxpid == -1) {
X	perror("xdbx error: cannot fork process");
X	exit(1);
X    }
X    else if (dbxpid) { 
X	/* 
X	 * Parent : close the slave side of pty
X	 *	    close stdin and stdout
X	 *	    set the dbx file descriptor to nonblocking mode
X	 *	    open file pointer with read/write access to dbx
X	 *	    set line buffered mode
X	 *	    register dbx input with X
X	 */
X	close(slave);
X	close(0);
X	close(1);
X	fcntl(master, F_SETFL, FNDELAY);
X    	dbxfp = fdopen(master, "r+");
X	setlinebuf(dbxfp);
X	dbxInputId = XtAppAddInput(app_context, master, XtInputReadMask, 
X				   read_dbx, NULL);
X    }
X    else { 
X	/* 
X	 * Child : close master side of pty
X	 * 	   redirect stdin, stdout, stderr of dbx to pty
X	 *	   unbuffer output data from dbx
X	 *	   exec dbx with arguments
X	 */
X	close(master);
X
X	/*
X	 * Modify local and output mode of slave pty
X	 */
X	ioctl(slave, TCGETA, &Termio);
X	Termio.c_lflag &= ~ECHO;	/* No echo */
X	Termio.c_oflag &= ~ONLCR;	/* Do not map NL to CR-NL on output */
X	ioctl(slave, TCSETA, &Termio);
X
X	dup2(slave, 0);
X	dup2(slave, 1);
X	dup2(slave, 2);
X	if (slave > 2)
X	    close(slave);
X	fcntl(1, F_SETFL, FAPPEND);
X	setbuf(stdout, NULL);
X
X	/*
X	 * Set our process group to that of the terminal,
X	 * so we can change the group of the terminal.
X	 */
X	ioctl(0, TIOCGPGRP, &pgrp);
X	setpgrp(0, pgrp);
X
X	/*
X	 * Now set the process group of the terminal and of us
X	 * to our process id.  This clears us from the control
X	 * of the other process group.
X	 */
X	pid = getpid();
X	ioctl(0, TIOCSPGRP, &pid);
X	setpgrp(0, pid);
X
X	argv[0] = debugger;
X	execvp(debugger, argv);
X	sprintf(errmsg, "xdbx error: cannot exec %s", debugger);
X	perror(errmsg);
X	exit(1);
X    }
X}
END_OF_FILE
if test 5814 -ne `wc -c <'calldbx.c'`; then
    echo shar: \"'calldbx.c'\" unpacked with wrong size!
fi
# end of 'calldbx.c'
fi
if test -f 'datadpy.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'datadpy.h'\"
else
echo shar: Extracting \"'datadpy.h'\" \(2390 characters\)
sed "s/^X//" >'datadpy.h' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/*  datadpy.h:
X *
X *  Regular expression pattern matching for C structures
X *
X *  The reg_token array indicates the register no. for each token type.
X *      reg_token[0] : level of indentation
X *      reg_token[2] : field name
X *      reg_token[4] : pointer string
X */
X
X#define TK_INDENT       0
X#define TK_FIELD        2
X#define TK_POINTER      4
X
X#define D_POINTER	0
X#define D_FIELD		1
X#define D_STRUCT	2
X
XPatternRec dataPattern[] = {
X    {"0x[0-9a-f]+", 				  
X     NULL, {-1, -1, -1, -1, -1, -1}
X    },
X    {"\\([ ]*\\)\\(.*[^ ]+\\)[ ]* = \\(0x[0-9a-f]+\\)\n", 
X     NULL, { 1, -1,  2, -1,  3, -1}
X    },
X    {"\\([ ]*\\)\\(.*[^ ]*\\)[ ]* = {\n", 		  
X     NULL, { 1, -1,  2, -1, -1, -1}
X    },
X    NULL
X};
END_OF_FILE
if test 2390 -ne `wc -c <'datadpy.h'`; then
    echo shar: \"'datadpy.h'\" unpacked with wrong size!
fi
# end of 'datadpy.h'
fi
if test -f 'dbx.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dbx.c'\"
else
echo shar: Extracting \"'dbx.c'\" \(5682 characters\)
sed "s/^X//" >'dbx.c' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/*
X *  dbx.c
X *
X *    Handle dbx command initialization file (.dbxinit) and communication 
X *    between dbx and xdbx.
X *
X *    dbx_init():	Handle .dbxinit
X *    debug_init():	
X *    read_dbx():	Read dbx output, parse and filter it before displaying
X *			onto the dialog window.
X *    write_dbx():	Send a command to dbx.
X *    query_dbx():	Send a command to dbx and process it.
X */
X
X#include "global.h"
X
XBoolean	Prompt;			/* True when dbx prompt arrives */
Xchar 	*concat();
Xchar	*dbxprompt; 
Xchar	*xdbxprompt;
X
X/*  Given a dbx command initialization file, this routine executes each dbx 
X *  command in the file.  It sends the command to dbx, and calls read_dbx() 
X *  directly to process output returned from dbx.
X */
Xstatic void dbx_init(xdbxinit)
Xchar *xdbxinit;
X{
X    FILE *fp;
X    char s[LINESIZ];
X
X    if (strcmp(xdbxinit, "") == NULL)
X	return;
X    if (fp = fopen(xdbxinit, "r")) {
X	while (fgets(s, LINESIZ, fp)) {
X	    send_command(s);
X	    AppendDialogText(s);
X	    Prompt = False;
X	    while (!Prompt)
X		read_dbx();
X	}
X	close(fp);
X    }
X}
X
X/*
X *  This routine is called after getting the first dbx prompt.  
X *  > check the use list to create a list of directories for searching
X *    source files.
X *  > ask dbx for the source file and display it if it exists.
X *  > open the command initialization file and executed the commands;
X *    if Tstartup is true, remove the initialization file.
X */
Xvoid debug_init()
X{
X    static visited = False;
X
X    if (!visited) {
X	visited = True;
X	dbx_init(xdbxinit);
X	if (Tstartup)
X	    unlink(xdbxinit);
X	strcpy(xdbxinit, "");
X    }
X}
X
X/*
X *  This is a callback procedure invoked everytime when input is pending
X *  on the file descriptor to dbx.
X *  o reads all the data available on the file descriptor line by line
X *    into local variable 'string' and global variable 'output'.
X *    'output' records the entire dbx output whereas 'string' records
X *    only the data read in this invocation of read_dbx().
X *  o in Echo mode, the contents in 'string' is edited by filter()
X *    before it gets displayed on the dialog window.
X *  o once the dbx prompt is read, calls parse() to analyse the dbx output
X *    and take appropriate action.
X */
X/* ARGSUSED */
Xvoid read_dbx(master, source, id)
XXtPointer master;
Xint 	  *source;
XXtInputId *id;
X{
X    static char *output = NULL; 	/* buffer for dbx output */
X    static char *next_string = NULL;
X    static char *command;
X    char 	*string = NULL;
X    char 	s[LINESIZ];
X    Boolean 	more;
X
X    more = True;
X    while (more) {
X	Prompt = False;
X	/* keep reading until no more or until prompt arrives */
X	while (more = fgets(s, LINESIZ, dbxfp) && !Prompt) {
X	    if (debug)
X		fprintf(stderr, "=>%s", s);
X	    /* receive prompt? */
X	    if (strncmp(s, dbxprompt, strlen(dbxprompt)) == NULL) {
X		Prompt = True;
X		/* more stuff behind prompt? */
X		if (s[strlen(dbxprompt)])
X		    /* remember it */
X		    next_string = XtNewString(s+strlen(dbxprompt));
X		/* destroy contents */
X		strcpy(s, "");
X	    }
X	    string = concat(string, s);
X	    strcpy(s, "");
X	}
X	output = concat(output, string);
X	command = get_command();
X	if (Echo) {
X	    filter(string, output, command);
X	    if (Prompt) AppendDialogText(xdbxprompt);
X	}
X	if (string) {
X	    XtFree(string);
X	    string = NULL;
X	}
X	if (next_string) {
X	    string = concat(string, next_string);
X	    XtFree(next_string);
X	    next_string = NULL;
X	}
X	if (Prompt) {
X	    parse(output, command);
X	    delete_command();
X	    XtFree(output);
X	    output = NULL;
X	}
X    }
X}
X
X/*  Write string s to dbx, and flush the output.  */
X
Xvoid write_dbx(s)
Xchar *s;
X{
X    fputs(s, dbxfp);
X    fflush(dbxfp);
X}
X
X/*  Sends a command to dbx and read the corresponding output, directly
X *  invoking the Xt input procedure, read_dbx().
X */
Xvoid query_dbx(command)
Xchar *command;
X{
X    write_dbx(command);
X    insert_command(command);
X
X    Echo = False;
X    Prompt = False;
X    while (!Prompt)
X        read_dbx();
X
X    Parse = True;	/* Always reset Parse and Echo to True */
X    Echo = True;
X}
END_OF_FILE
if test 5682 -ne `wc -c <'dbx.c'`; then
    echo shar: \"'dbx.c'\" unpacked with wrong size!
fi
# end of 'dbx.c'
fi
if test -f 'mips_regex.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mips_regex.h'\"
else
echo shar: Extracting \"'mips_regex.h'\" \(5442 characters\)
sed "s/^X//" >'mips_regex.h' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	November 24, 1989
X *
X *****************************************************************************/
X
X/*  mips_regex.h:
X *
X *  Regular expression pattern matching for dbx on DECStation.
X *
X *  The reg_token array indicates the register no. for each token type.
X *      reg_token[0] : message
X *      reg_token[1] : stop number
X *      reg_token[2] : function name
X *      reg_token[3] : line number
X *      reg_token[4] : file name
X *      reg_token[5] : display command output
X */
X
X#define TK_MESG         0
X#define TK_STOP         1
X#define TK_FUNC         2
X#define TK_LINE         3
X#define TK_FILE         4
X#define TK_DISP		5
X
X#define O_EXEC          0
X#define O_DONE          1
X#define O_STOPAT        2
X#define O_STOPIN        3
X#define O_UPDOWN        4
X#define O_FUNC          4
X#define O_BELL          5
X#define O_LIST          6
X#define O_FILE          7
X#define O_SEARCH        8
X#define O_PRINT         9
X#define O_DEBUG         10
X
X#define C_ANY		-1
X#define C_EXEC          0
X#define C_STOPAT        1
X#define C_STOPIN        2
X#define C_UPDOWN        3
X#define C_DELETE        4
X#define C_FUNC          5
X#define C_FILE          6
X#define C_USE          	7
X#define C_LIST         	8
X#define C_SEARCH        9
X#define C_PRINT		10
X#define C_STATUS	11
X
X
Xstatic PatternRec output_pattern[] = {
X    /* exec */
X    {"\\(.*\n\\)*\\(\\(\\(\\(\[[0-9]+\\] \\)?\\(stopped at \\)?\\)\\|Bus error \
X\\|Segmentation fault \\|Interrupt \\)?\\[\\([^ ]+\\):\\([0-9]+\\).*\\]\\).*\n",
X     NULL,
X     {2, -1, 7, 8, -1, -1}
X    },
X    /* done */
X    {"\\(.*\n\\)*Program terminated normally\n",
X     NULL,
X     {-1, -1, -1, -1, -1, -1}
X    },
X    /* stop at */
X    {"\\[\\([0-9]+\\)\\] stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
X     NULL,
X     {-1, 1, -1, 4, 3, -1}
X    },
X    /* stop in */
X    {"\\(\\[.*\\]\n\\)*\\[\\([0-9]+\\)\\] stop in \\([^ ]+\\)\n",
X     NULL,
X     {-1, 2, 3, -1, -1, -1}
X    },
X    /* up, down, func */
X    {"\\(.*\n\\)*\\([^ ]+\\):[ ]*\\([0-9]+\\).*\n",
X     NULL,
X     {2, -1, 2, 3, -1, -1}
X    },
X    /* bell */
X    {"\n\\(not that many levels\\|program not active\\|program is not active\\|\
Xcannot read register unless program is active\\|cannot dump unless program is \
Xactive\\)\n",
X     NULL,
X     {-1, -1, -1, -1, -1, -1}
X    },
X    /* list */
X    {"[ ]*\\([0-9]+\\).*\n",
X     NULL,
X     {-1, -1, -1, 1, -1, -1}
X    },
X    /* file */
X    {"\\([^ ]+\\)\n",
X     NULL,
X     {-1, -1, -1, -1, 1, -1}
X    },
X    /* search */
X    {"[ ]*\\([0-9]+\\).*\n",
X     NULL,
X     {-1, -1, -1, 1, -1, -1}
X    },
X    /* print */
X    {"\\(.+\n\\(.*\n\\)*\\)",
X     NULL,
X     { 1, -1, -1, -1, -1, -1}
X    },
X    /* dbx init */
X    {"\\(.*\n\\)*.*\\(dbx version .*\nType 'help' for help.\nreading symbolic \
Xinformation ...\n\\)\\(\nwarning: .*\n\\)?\\([^ ]+\\):[ ]*\\([0-9]+\\).*\n",
X     NULL,
X     {-1, -1, 4, 5, -1, -1}
X    },
X    NULL
X};
X
Xstatic PatternRec command_pattern[] = {
X    {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|return\\)\\( \\|\n\\)",
X						NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(stop\\|st\\)[ ]+at[ ]+[0-9]+",   	NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(stop\\|st\\)[ ]+in[ ]+[^ ]+",      NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(up\\|down\\)",                   	NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(delete\\|d\\)",                  	NULL, {-1, -1, -1,  1, -1, -1}},
X    {"[ ]*func[ ]*\\([^ ]+\\)[ ]*",           	NULL, {-1, -1,  1, -1, -1, -1}},
X    {"[ ]*file[ ]*",           			NULL, {-1, -1, -1, -1,  1, -1}},
X    {"[ ]*use[ ]*",           			NULL, {-1, -1, -1, -1,  1, -1}},
X    {"[ ]*list[ ]*",           			NULL, {-1, -1, -1, -1,  1, -1}},
X    {"[ ]*\\(/\\|\?\\)",                      	NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(print\\|p\\)[ ]*[^ ]+",            NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*status[ ]*",         			NULL, {-1, -1, -1, -1,  1, -1}},
X    NULL
X};
END_OF_FILE
if test 5442 -ne `wc -c <'mips_regex.h'`; then
    echo shar: \"'mips_regex.h'\" unpacked with wrong size!
fi
# end of 'mips_regex.h'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X#define PATCHLEVEL 2
END_OF_FILE
if test 21 -ne `wc -c <'patchlevel.h'`; then
    echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
if test -f 'signals.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'signals.c'\"
else
echo shar: Extracting \"'signals.c'\" \(3952 characters\)
sed "s/^X//" >'signals.c' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/* signals.c
X *
X *   Signal handling for xdbx and dbx.
X *
X *   kill_hanlder():	For SIGINT, SIGQUIT, SIGILL, SIGBUS, SIGTERM
X *			print error message and exit with signal status.
X *   quit_handler():	SIGCHLD, wait for dbx to die and exit gracefully.
X *   stop_handler():	SIGTSTP, stop dbx process, then stop own process.
X *   cont_handler():	SIGCONT, continue dbx process.
X *   trap_signals():	Install signal handlers.
X */
X
X#include <signal.h>
X#include <sys/wait.h>
X#include "global.h"
X
X/*  Kill the dbx child process and then exits. */
X/*  ARGSUSED */
Xstatic void kill_handler(sig, code, scp, addr)
X    int sig, code;
X    struct sigcontext *scp;
X    char *addr;
X{
X    if (FalseSignal) {
X	FalseSignal = FALSE;
X	return;
X    }
X    kill(dbxpid, SIGKILL);
X    switch (sig) {
X      case SIGINT  : fprintf(stderr, "Interrupt\n"); break;
X      case SIGQUIT : fprintf(stderr, "Quit\n"); break;
X      case SIGILL  : fprintf(stderr, "Illegal instruction\n"); break;
X      case SIGBUS  : fprintf(stderr, "Bus error\n"); break;
X      case SIGSEGV : fprintf(stderr, "Segmentation violation\n"); break;
X      case SIGTERM : fprintf(stderr, "Soft kill\n"); break;
X    }
X    exit(sig);
X}
X
X
Xstatic void quit_handler()
X{
X    union wait status;
X
X    /*  wait for the child to report its status; if the child has died, 
X     *  exit gracefully.
X     */
X    wait3(&status, WNOHANG|WUNTRACED, NULL);
X    if ((WIFEXITED(status) || WIFSIGNALED(status)) && !WIFSTOPPED(status)) {
X    	exit(1);
X    }
X}
X
X
Xstatic void stop_handler()
X{
X    if (dbxpid)
X	kill(dbxpid, SIGSTOP);	/* stop dbx process */
X    kill(0, SIGSTOP);		/* stop own process */
X}
X
X
Xstatic void cont_handler()
X{
X    if (dbxpid) {
X	sleep(1);		/* we need this */
X	kill(dbxpid, SIGCONT);	/* continue dbx after stop */
X    }
X}
X
X
X/*
X *  Trap signals to xdbx so that the child process can be handled properly.
X */
Xvoid trap_signals()
X{
X    signal(SIGINT,  kill_handler);
X    signal(SIGQUIT, kill_handler);
X    signal(SIGILL,  kill_handler);
X    signal(SIGBUS,  kill_handler);
X    signal(SIGSEGV, kill_handler);
X    signal(SIGTERM, kill_handler);
X
X    signal(SIGTSTP, stop_handler);	/* stop signal from keyboard */
X    signal(SIGCONT, cont_handler);	/* continue after stop */
X    signal(SIGCHLD, quit_handler);	/* child status has changed */
X}
END_OF_FILE
if test 3952 -ne `wc -c <'signals.c'`; then
    echo shar: \"'signals.c'\" unpacked with wrong size!
fi
# end of 'signals.c'
fi
if test -f 'sun_regex.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sun_regex.h'\"
else
echo shar: Extracting \"'sun_regex.h'\" \(5571 characters\)
sed "s/^X//" >'sun_regex.h' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/*  sun_regex.h:
X *
X *  Regular expression pattern matching for Sun dbx.
X *  
X *  The reg_token array indicates the register no. for each token type.
X *      reg_token[0] : message
X *      reg_token[1] : stop number
X *      reg_token[2] : function name
X *      reg_token[3] : line number
X *      reg_token[4] : file name
X *      reg_token[5] : display command output
X */
X
X#define	TK_MESG 	0
X#define TK_STOP		1
X#define TK_FUNC 	2
X#define TK_LINE 	3
X#define TK_FILE 	4
X#define TK_DISP 	5
X
X#define	O_EXEC		0
X#define O_DONE		1
X#define O_STOPAT 	2
X#define O_STOPIN 	3
X#define O_UPDOWN 	4
X#define O_BELL		5
X#define O_LIST		6
X#define O_SEARCH        6
X#define O_FILE		7
X#define O_PRINT         8
X#define O_DEBUG         9
X
X#define	C_ANY		-1
X#define C_EXEC		0
X#define C_STOPAT	1
X#define C_STOPIN	2
X#define C_UPDOWN	3
X#define C_DELETE	4
X#define C_FUNC		5
X#define C_FILE		6
X#define C_DEBUG		7
X#define C_CD		8
X#define C_USE           9
X#define C_PWD           10
X#define C_LIST          11
X#define C_SEARCH        12
X#define C_DISPLAY       13
X#define C_PRINT         14
X
Xstatic PatternRec output_pattern[] = {
X    /* exec */
X    {"\\(.*\n\\)*.*\\(\\(stopped\\|Bus error\\|Segmentation fault\\|\
XInterrupt\\|signal.*\\) in \\([^ ]+\\) at line \\([0-9]+\\)\\( in file\
X \"\\([^ ]+\\)\"\\)?\\)\n\\(.*\n\\)?\\(\\(.*\n\\)*\\)", 
X     NULL,
X     {2, -1, 4, 5, 7, 9}
X    },
X    /* done */
X    {"\\(.*\n\\)*\\(execution completed\\|program exited with [0-9]+\\)",
X     NULL,
X     {-1, -1, -1, -1, -1, -1}
X    },
X    /* stop at */
X    {"(\\([0-9]+\\)) stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
X     NULL,
X     {-1, 1, -1, 4, 3, -1}
X    },
X    /* stop in */
X    {"(\\([0-9]+\\)) stop in \\([^ ]+\\)\n",
X     NULL,
X     {-1, 1, 2, -1, -1, -1}
X    },
X    /* up, down */
X    {"\\(.*\n\\)?\\(Current function is \\([^ ]+\\)\n\\)\\([ ]*\\([0-9]+\\).*\n\\)",
X     NULL,
X     {2, -1, 3, 5, -1, -1}
X    },
X    /* bell */
X    {"\\(Already at the \\(top\\|bottom\\) call level\n\\|\
XNo active stack frames\n\\|no program to run\n\\|no process to run\n\\|\
Xprogram is not active\n\\|can't continue execution\n\\|\
X.*\ncan't write to process.*\n\\|\
X\\(Top\\|End\\)-of-file; did not find search string:.*\n\\)",
X     NULL,
X     {-1, -1, -1, -1, -1}
X    },
X    /* list, search */
X    {"[ ]*\\([0-9]+\\).*\n",
X     NULL,
X     {-1, -1, -1, 1, -1, -1}
X    },
X    /* file */
X    {"\\(\\([^ ]*\\)\\|No current source file\\)\n",
X     NULL,
X     {-1, -1, -1, -1, 2, -1}
X    },
X    /* print, display */
X    {"\\(warning: .*\n\\)?\\(\\(.*\\) = .*\n\\(.*\n\\)*\\)",
X     NULL,
X     { 3, -1, -1, -1, -1, 2}
X    },
X    /* debug */
X    {"Reading symbolic information...\nRead [0-9]+ symbols\n",
X     NULL,
X     { -1, -1, -1, -1, -1, -1}
X    },
X    NULL 
X};
X
X
Xstatic PatternRec command_pattern[] = {
X    {"[ ]*\\(run\\|rerun\\|cont\\|next\\|step\\)\\( [0-9]+\\)?[ ]*", 	
X						NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*stop[ ]+at[ ]+\\(\"[^ ]+\":\\)?[0-9]+[ ]*\n", 		
X						NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*stop[ ]+in[ ]+[^ ]+[ ]*\n", 		NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(up\\|down\\)[ ]*\\( [0-9]+\\)?[ ]*\n", 		
X						NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(delete\\|d\\)[ ]+\\(all\\|[0-9]+\\)",	
X						NULL, {-1, -1, -1,  1, -1, -1}},
X    {"[ ]*func[ ]+\\([^ ]+\\)[ ]*\n", 		NULL, {-1, -1,  1, -1, -1, -1}},
X    {"[ ]*file[ ]*\\([^ ]+\\)?[ ]*\n",		NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*debug[ ]*[^ ]+[ ]*\n", 		NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*cd[ ]*[^ ]+[ ]*", 			NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*use[ ]*", 				NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*pwd[ ]*\n",				NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*list[ ]*",				NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(/\\|\?\\)[ ]*",			NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*\\(un\\)?display[ ]*[^ ]+[ ]*",	NULL, {-1, -1, -1, -1, -1, -1}},
X    {"[ ]*print[ ]*[^ ]+[ ]*",			NULL, {-1, -1, -1, -1, -1, -1}},
X    NULL
X};
END_OF_FILE
if test 5571 -ne `wc -c <'sun_regex.h'`; then
    echo shar: \"'sun_regex.h'\" unpacked with wrong size!
fi
# end of 'sun_regex.h'
fi
if test -f 'utils.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'utils.c'\"
else
echo shar: Extracting \"'utils.c'\" \(3943 characters\)
sed "s/^X//" >'utils.c' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to the dbx debugger
X *
X *  Copyright 1989 The University of Texas at Austin
X *  Copyright 1990 Microelectronics and Computer Technology Corporation
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
X *  used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas and MCC makes no representations about the 
X *  suitability of this software for any purpose.  It is provided "as is" 
X *  without express or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
X *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
X *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/*  utils.c
X *
X *    Contain common routines used by other functions.
X *
X *    TextGetLastPos():		Get the last insertion position of text.
X *    TextPositionToLine(): 	Return text position give a line number.
X *    LineToStopNo():		Return the stop number given a line number.
X *    DisableWindowResize():	Fix the size of a window inside vpane.
X *    bell():			Ring the bell.
X *    concat():			Concatenate two strings together
X */
X
X#include "global.h"
X
XXawTextPosition TextGetLastPos(w)
X    Widget w;
X{
X    TextWidget ctx = (TextWidget) w;
X    return (ctx->text.lastPos);
X}
X
X/*
X * Get the line number where the caret is.
X */
Xint TextPositionToLine(pos)
XXawTextPosition pos;
X{
X    int line;
X
X    if (displayedFile) {
X	if (pos >= displayedFile->linepos[displayedFile->topline]) {
X	    for (line = displayedFile->topline;
X		 pos > displayedFile->linepos[line]; line++);
X	    return (pos == displayedFile->linepos[line] ? line : line-1);
X	}
X	else {
X	    for (line = 1; pos > displayedFile->linepos[line]; line++);
X	    return (pos == displayedFile->linepos[line] ? line : line-1);
X	}
X    }
X    else
X        return 0;
X}
X
X/*
X *  Return the stop number associated with a given line number.
X *  Return 0 if stop number not found.
X */
Xint LineToStop_no(line)
Xint line;
X{
X    int i;
X
X    for (i=1; i <= nstops; i++)
X        if (stops[i].line == line && stops[i].file && displayedFile &&
X            strcmp(stops[i].file, displayedFile->pathname) == NULL) {
X            return i;
X        }
X    return 0;
X}
X
X
Xvoid DisableWindowResize(w)
XWidget w;
X{
X    Arg args[MAXARGS];
X    Cardinal n;
X    Dimension height;
X
X    n = 0;
X    XtSetArg(args[n], XtNheight, &height);                       n++;
X    XtGetValues(w, args, n);
X    XawPanedSetMinMax(w, height, height);
X    XawPanedAllowResize(w, False);
X}
X
X
Xvoid bell(volume)
Xint volume;
X{
X    XBell(XtDisplay(toplevel), volume);
X}
X
X/* append string s2 to end of string s1 and return the result */
X
Xchar *concat(s1, s2)
Xchar *s1, *s2;
X{
X    if (s2) {
X        if (s1 == NULL) {
X            s1 = XtMalloc((strlen(s2)+1)*sizeof(char));
X            strcpy(s1, s2);
X        }
X        else {
X            s1 = XtRealloc(s1, strlen(s1)+strlen(s2)+2);
X            strcat(s1, s2);
X        }
X    }
X    else
X        s1 = NULL;
X    return (s1);
X}
END_OF_FILE
if test 3943 -ne `wc -c <'utils.c'`; then
    echo shar: \"'utils.c'\" unpacked with wrong size!
fi
# end of 'utils.c'
fi
if test -f 'windows.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'windows.c'\"
else
echo shar: Extracting \"'windows.c'\" \(6616 characters\)
sed "s/^X//" >'windows.c' <<'END_OF_FILE'
X/*****************************************************************************
X *
X *  xdbx - X Window System interface to dbx
X *
X *  Copyright 1989, 1990 The University of Texas at Austin
X *
X *  Permission to use, copy, modify, and distribute this software and its
X *  documentation for any purpose and without fee is hereby granted,
X *  provided that the above copyright notice appear in all copies and that
X *  both that copyright notice and this permission notice appear in
X *  supporting documentation, and that the name of The University of Texas
X *  not be used in advertising or publicity pertaining to distribution of
X *  the software without specific, written prior permission.  The
X *  University of Texas makes no representations about the suitability of
X *  this software for any purpose.  It is provided "as is" without express
X *  or implied warranty.
X *
X *  THE UNIVERSITY OF TEXAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
X *  SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS BE LIABLE FOR ANY
X *  SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X *  Author:  	Po Cheung, The University of Texas at Austin
X *  Created:   	March 10, 1989
X *
X *****************************************************************************/
X
X/*  windows.c:
X *
X *    CreateTitleBar() :	Create title bar.
X *    CreateFileLabel() :	Create file label in file window.
X *    CreateLineLabel() :	Create line label in file window.
X *    CreateFileWindow() :	Create file window.
X *    CreateMessageWindow() :	Create message window.
X *    CreateDisplayWindow() :	Create display window.
X *    CreateSubWindows() :	Create the subwindows.
X *    UpdateFileLabel() :	Update file label.
X *    UpdateLineLabel() :	Update line label.
X *    UpdateMessageWindow() :	Update message window.
X */
X
X#include "global.h"
X
XWidget	fileWindow,			/* parent of fileLabel and lineLabel */
X	messageWindow,			/* window for displaying messages */
X	separator,			/* separator in vpane */
X	displayWindow;			/* area for displaying variables */
X
Xstatic Widget 	fileLabel,		/* filename of displayed text */
X		lineLabel;		/* line number of caret position */
X
X/*
X *  Private routines for creating various subwindows for xdbx.
X */
X
Xstatic void CreateFileLabel(parent)
XWidget parent;
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    XtSetArg(args[n], XtNlabel, (XtArgVal) "No Source File");           n++;
X    XtSetArg(args[n], XtNborderWidth, (XtArgVal) 0);           		n++;
X    fileLabel = XtCreateManagedWidget("fileLabel", labelWidgetClass, 
X				      parent, args, n);
X}
X
Xstatic void CreateLineLabel(parent)
XWidget parent;
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    XtSetArg(args[n], XtNlabel, (XtArgVal) "");           		n++;
X    XtSetArg(args[n], XtNborderWidth, (XtArgVal) 0);           		n++;
X    XtSetArg(args[n], XtNfromHoriz, (XtArgVal) fileLabel);          	n++;
X    XtSetArg(args[n], XtNhorizDistance, (XtArgVal) 0);          	n++;
X    lineLabel = XtCreateManagedWidget("lineLabel", labelWidgetClass, 
X				      parent, args, n);
X}
X
Xstatic void CreateFileWindow(parent)
XWidget parent;
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    XtSetArg(args[n], XtNshowGrip, (XtArgVal) False);			n++;
X    fileWindow = XtCreateManagedWidget("fileWindow", formWidgetClass, 
X				       parent, args, n);
X    CreateFileLabel(fileWindow);
X    CreateLineLabel(fileWindow);
X}
X
Xstatic void CreateMessageWindow(parent)
XWidget parent;
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    XtSetArg(args[n], XtNlabel, (XtArgVal) ""); 			n++;
X    XtSetArg(args[n], XtNjustify, (XtArgVal) XtJustifyLeft);          	n++;
X    XtSetArg(args[n], XtNshowGrip, (XtArgVal) False);			n++;
X    messageWindow = XtCreateManagedWidget("messageWindow", labelWidgetClass,
X					  parent, args, n);
X}
X
X/*  Create a window for displaying variables as specified by the display
X *  command in dbx.
X */
Xstatic void CreateDisplayWindow(parent)
XWidget parent;
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    XtSetArg(args[n], XtNborderWidth, (XtArgVal) 0);                    n++;
X    XtSetArg(args[n], XtNmin, (XtArgVal) 2); 				n++;
X    XtSetArg(args[n], XtNmax, (XtArgVal) 2); 				n++;
X    XtSetArg(args[n], XtNshowGrip, (XtArgVal) False);			n++;
X    separator = XtCreateWidget("", labelWidgetClass, parent, args, n);
X
X    n = 0;
X    XtSetArg(args[n], XtNeditType, (XtArgVal) XawtextRead);		n++;
X    displayWindow = XtCreateWidget("displayWindow", asciiTextWidgetClass, 
X				   parent, args, n);
X
X    if (app_resources.displayWindow) {
X	XtManageChild(separator);
X	XtManageChild(displayWindow);
X    }
X}
X
X
X/*  PUBLIC ROUTINES */
X/*
X *  Top level function for creating all the xdbx subwindows.
X */
Xvoid CreateSubWindows(parent)
XWidget parent;
X{
X    Widget	vpane;		/* outer widget containing various subwindows */
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    vpane = XtCreateManagedWidget("vpane", panedWidgetClass, parent, args, n);
X
X    CreateFileWindow(vpane);
X    CreateSourceWindow(vpane);
X    CreateMessageWindow(vpane);
X    CreateCommandPanel(vpane);
X    CreateDialogWindow(vpane);
X#ifndef BSD
X    CreateDisplayWindow(vpane);
X#endif
X} 
X
X/*
X *  Routines for updating fields for the filename and line number
X *  in the file window, and the execution status in the message window.
X */
X
Xvoid UpdateFileLabel(string)
Xchar *string;
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    XtSetArg(args[n], XtNlabel, (XtArgVal) string);        		n++;
X    XtSetValues(fileLabel, args, n);
X}
X
Xvoid UpdateLineLabel(line)
XCardinal line;
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X    char 	string[10];
X
X    n = 0;
X    if (line > 0)
X    	sprintf(string, "%d", line);
X    else
X	strcpy(string, "");
X    XtSetArg(args[n], XtNlabel, (XtArgVal) string);        	n++;
X    XtSetValues(lineLabel, args, n);
X}
X
Xvoid UpdateMessageWindow(format, arg)
Xchar *format, *arg;
X{
X    char 	message[LINESIZ], string[LINESIZ];
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    strcpy(message, "  ");
X    sprintf(string, format, arg);
X    strcat(message, string);
X    n = 0;
X    XtSetArg(args[n], XtNlabel, (XtArgVal) message);		n++;
X    XtSetValues(messageWindow, args, n);
X}
X
Xvoid ClearMessageWindow()
X{
X    Arg 	args[MAXARGS];
X    Cardinal 	n;
X
X    n = 0;
X    XtSetArg(args[n], XtNlabel, (XtArgVal) "");			n++;
X    XtSetValues(messageWindow, args, n);
X}
X
END_OF_FILE
if test 6616 -ne `wc -c <'windows.c'`; then
    echo shar: \"'windows.c'\" unpacked with wrong size!
fi
# end of 'windows.c'
fi
echo shar: End of archive 1 \(of 7\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 7 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

dan
----------------------------------------------------
O'Reilly && Associates   argv at sun.com / argv at ora.com
Opinions expressed reflect those of the author only.



More information about the Comp.sources.x mailing list