home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
4
/
4004
< prev
next >
Wrap
Text File
|
1991-09-08
|
41KB
|
1,411 lines
Newsgroups: alt.sources
Path: wupost!zaphod.mps.ohio-state.edu!think.com!news.bbn.com!mips2!bubba!jtsillas
From: jtsillas@bubba.ma30.bull.com (James Tsillas)
Subject: mxgdb 1.0.3 (part 2/10)
Organization: Bull HN, Worldwide Information Systems, Billerica, Mass., USA
Distribution: alt
Date: 6 Sep 91 14:20:39
Message-ID: <JTSILLAS.91Sep6142039@bubba.ma30.bull.com>
Sender: news@mips2.ma30.bull.com (Usenet News Manager)
---- Cut Here and feed the following to sh ----
#!/bin/sh
# this is mxgdb.02 (part 2 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file mxgdb/Makefile continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 2; then
echo Please unpack part "$Scheck" next!
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping mxgdb/Makefile'
else
echo 'x - continuing file mxgdb/Makefile'
sed 's/^X//' << 'SHAR_EOF' >> 'mxgdb/Makefile' &&
X
X DEPLIBS = $(LOCAL_LIBRARIES)
X
X DEPLIBS1 = $(DEPLIBS)
X DEPLIBS2 = $(DEPLIBS)
X DEPLIBS3 = $(DEPLIBS)
X
###########################################################################
# Imake rules for building libraries, programs, scripts, and data files
# rules: $XConsortium: Imake.rules,v 1.70 90/05/04 16:57:30 keith Exp $
X
###########################################################################
# start of Imakefile
X
# $Id: Imakefile,v 1.3 1991/08/23 16:34:24 jtsillas Exp $
X
#
# Read the README file for a list of options to include for your system
#
LOCAL_LIBRARIES = $(XMLIB) $(XTLIB) $(XLIB)
X
X SRCS1 = callgdb.c command.c gdb.c dialog.c filemenu.c \
X handler.c parser.c regex.c signs.c signals.c source.c \
X utils.c windows.c mxgdb.c malloc.c bitmaps.c
X
X OBJS1 = callgdb.o command.o gdb.o dialog.o filemenu.o \
X handler.o parser.o regex.o signs.o signals.o source.o \
X utils.o windows.o mxgdb.o malloc.o bitmaps.o
X
PROGRAMS = mxgdb
X
..c.o:
X $(RM) $@
X $(CC) -c $(CFLAGS) $*.c
X
X OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
X SRCS = $(SRCS1) $(SRCS2) $(SRCS3)
X
all:: $(PROGRAMS)
X
mxgdb: $(OBJS1) $(DEPLIBS1)
X $(RM) $@
X $(CC) -o $@ $(LDOPTIONS) $(OBJS1) $(LOCAL_LIBRARIES) $(LDLIBS) $(SYSLIBS) $(EXTRA_LOAD_FLAGS)
X
install:: mxgdb
X $(INSTALL) -c -s $(INSTPGMFLAGS) mxgdb $(BINDIR)
X
mxgdb.1:: mxgdb.man
X nroff -man $? > $@
X
all:: mxgdb.1
X
clean::
X rm -f mxgdb.1
X
install.man:: mxgdb.1
X $(INSTALL) -c $(INSTMANFLAGS) -f mxgdb.1 $(MANDIR)/mxgdb.1
X
depend::
X $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
lint:
X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
lint1:
X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
clean::
X $(RM) $(PROGRAMS)
X
install:: Mxgdb.ad
X $(INSTALL) -c -f $(INSTAPPFLAGS) Mxgdb.ad $(XAPPLOADDIR)/Mxgdb
X
handler.o: gdb_handler.c
parser.o: gdb_parser.c gdb_regex.h
X
###########################################################################
# common rules for all Makefiles - do not edit
X
emptyrule::
X
clean::
X $(RM_CMD) \#*
X
Makefile::
X -@if [ -f Makefile ]; then \
X echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X else exit 0; fi
X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
tags::
X $(TAGS) -w *.[ch]
X $(TAGS) -xw *.[ch] > TAGS
X
###########################################################################
# empty rules for directories that do not have SUBDIRS - do not edit
X
install::
X @echo "install in $(CURRENT_DIR) done"
X
install.man::
X @echo "install.man in $(CURRENT_DIR) done"
X
Makefiles::
X
includes::
X
###########################################################################
# dependencies generated by makedepend
X
SHAR_EOF
echo 'File mxgdb/Makefile is complete' &&
chmod 0644 mxgdb/Makefile ||
echo 'restore of mxgdb/Makefile failed'
Wc_c="`wc -c < 'mxgdb/Makefile'`"
test 12188 -eq "$Wc_c" ||
echo 'mxgdb/Makefile: original size 12188, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= mxgdb/command.c ==============
if test -f 'mxgdb/command.c' -a X"$1" != X"-c"; then
echo 'x - skipping mxgdb/command.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting mxgdb/command.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/command.c' &&
static char rcsid[] = "$Id: command.c,v 1.10 1991/08/23 16:34:30 jtsillas Exp $";
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 contribute 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 * xxgdb - X Window System interface to the gdb debugger
X *
X * Copyright 1990 Thomson Consumer Electronics, Inc.
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 Thomson Consumer
X * Electronics (TCE) not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. TCE 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 * TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
X * SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
X * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X * Adaptation to GDB: Pierre Willard
X * XXGDB Created: December, 1990
X *
X *****************************************************************************
X
/* command.c
X *
X * Create the command window, the command buttons and their callbacks.
X *
X * CreateCommandPanel() : Create a window with command buttons
X * CreateButtons() : Create command buttons in panel
X * AddButton() : Add a command button into the command window
X * ButtonSet() : Action proc for command button translation
X *
X * Command callbacks for the command buttons:
X *
X * forwardSearch() : forward string search
X * reverseSearch() : reverse string search
X * Search() : call either forwardSearch() or reverseSearch()
X * PopupSearch() : command callback for search button
X * DoneSearch() : command callback for DONE button in search panel
X * CreateSearchPopup() : create search panel
X *
X * Command queue manipulation routines:
X * send_command(): send a command to dbx and record in the queue
X * get_command(): read command off head of queue
X * insert_command(): insert command at the head of queue
X * delete_command(): delete command from head of queue
X */
X
#include <signal.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "global.h"
#include "arrows.h"
#include <Xm/Xm.h>
#include <Xm/SelectioB.h>
X
#define REVERSE 0
#define FORWARD 1
X
static Widget searchPopupShell;
static Widget AddButton();
/* static Widget button[30]; */
static char SearchString[BUFSIZ] = ""; /* search string buffer */
static char command[LINESIZ];
static CommandRec *commandQueue = NULL;
X
/* ARGSUSED */
/* Execute the dbx command specifed in client_data
X */
void DoIt (w, command, call_data)
X Widget w;
X XtPointer command;
X XtPointer call_data;
{
X /* run, cont, next, step, where, up, down, status */
X send_command(command);
X AppendDialogText(command);
}
X
/*
X here client_data is "break" or "tbreak"
X
*/
void Break(w, client_data, call_data)
X Widget w;
X char * client_data;
X XtPointer call_data;
{
X XmTextPosition pos;
X int line;
X char *string1;
X char *string2;
X char *s;
X
X string1 = (char *) XmTextGetSelection(sourceWindow);
X string2 = (char *) XmTextGetSelection(dialogWindow);
X
X if(string2 && !string1)
X {
X string1 = string2;
X string2 = NULL;
X }
X
X if(string2) XtFree(string2);
X
X if (string1 && *string1)
X {
X s = string1;
X while (*s == ' ') s++; /* skip leading spaces (if any) */
X if ((*s >= '0') && (*s <= '9'))
X sprintf(command, "%s *%s\n",client_data,string1);
X else
X sprintf(command, "%s %s\n",client_data,string1);
X }
X else
X {
X if (displayedFile != NULL)
X {
X pos = XmTextGetInsertionPosition(sourceWindow);
X line = TextPositionToLine(pos);
X sprintf(command, "%s %d\n",client_data,line);
X }
X else
X {
X UpdateMessageWindow(BREAK_HELP, NULL);
X bell(0);
X if(string1) XtFree(string1);
X return;
X }
X }
X
X if(string1) XtFree(string1);
X send_command(command);
X AppendDialogText(command);
X }
X
/* Clear removes the stop_no associated with a given line number.
X * RemoveStop() is called to undisplay the stop sign only when there
X * are no more stop_no's associated with that line number.
X */
X /* A modification to this would allow selecting
X a function name which has a break associated
X with it. A shift-Btn1Down should give a
X selection-box of all available break points
X - Jim (5-4-91)*/
/* ARGSUSED */
void Clear(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X XmTextPosition pos;
X int line;
X char *string1, *string2;
X
X string1 = (char *) XmTextGetSelection(sourceWindow);
X string2 = (char *) XmTextGetSelection(dialogWindow);
X
X if(string2 && !string1)
X {
X string1 = string2;
X string2 = NULL;
X }
X
X if(string2) XtFree(string2);
X
X if(string1 && *string1 != '\0')
X {
X sprintf(command, "clear %s\n", string1);
X send_command(command);
X AppendDialogText(command);
X XtFree(string1);
X return;
X }
X if(string1) XtFree(string1);
X
X if (displayedFile) {
X pos = XmTextGetInsertionPosition(sourceWindow);
X line = TextPositionToLine(pos);
X if (LineToStop_no(line)) {
X sprintf(command, "clear %d\n", line);
X send_command(command);
X AppendDialogText(command);
X return;
X }
X }
X UpdateMessageWindow(CLEAR_HELP, NULL);
X bell(0);
}
X
/* ARGSUSED */
void Print(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X char *string1, *string2;
X int nbytes;
X
X string1 = (char *) XmTextGetSelection(sourceWindow);
X string2 = (char *) XmTextGetSelection(dialogWindow);
X
X if(string2 && !string1)
X {
X string1 = string2;
X string2 = NULL;
X }
X
X if(string2) XtFree(string2);
X
X if(!string1 || *string1 == '\0')
X {
X UpdateMessageWindow(PRINT_HELP, NULL);
X bell(0);
X if(string1) XtFree(string1);
X return;
X }
X if (client_data == (XtPointer)0)
X sprintf(command, "print %s\n", string1);
X else if (client_data == (XtPointer)1)
X sprintf(command, "print *%s\n", string1);
X send_command(command);
X AppendDialogText(command);
X if(string1) XtFree(string1);
}
X
/* ARGSUSED */
void Quit(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X
X int status;
X
X write_dbx("quit\n");
X XtDestroyApplicationContext(app_context);
X kill(dbxpid, SIGKILL);
X
#if defined(SYSV) && !defined(SUNOS4)
X waitpid(&status, NULL, WNOHANG);
#else
X wait3(&status, WNOHANG, NULL);
#endif
X
X exit(0);
}
X
extern int helpstackidx;
X
void Help(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X helpstackidx = 0;
X query_dbx("help\n");
}
X
/* ARGSUSED */
void Display_(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X char *string1, *string2;
X int nbytes;
X
X if(!XtIsManaged(displayFD)) XtManageChild(displayFD);
X
X string1 = (char *)XmTextGetSelection(sourceWindow);
X string2 = (char *)XmTextGetSelection(dialogWindow);
X
X if(string2 && !string1)
X {
X string1 = string2;
X string2 = NULL;
X }
X
X if(string2) XtFree(string2);
X
X if(string1 && *string1 != '\0')
X {
X sprintf(command, "display %s\n", string1);
X send_command(command);
X AppendDialogText(command);
X XtFree(string1);
X return;
X }
X if(string1) XtFree(string1);
X
}
X
/* ARGSUSED */
void Undisplay(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X char *string1, s[5], *st1, *st2;
X int stop_no, nbytes;
X
X string1 = XmTextGetSelection(displayWindow);
X
X if (string1 && *string1)
X {
X st1 = s;
X st2 = string1;
X while((*st1++ = *st2++)!=':' && *st1);
X *(st1-1) = '\0';
X XtFree(string1);
X if ((stop_no = atoi(s)) > 0)
X {
X sprintf(command, "undisplay %d\n", stop_no);
X send_command(command);
X AppendDialogText(command);
X }
X else
X {
X UpdateMessageWindow(UNDISPLAY_HELP, NULL);
X bell(0);
X return;
X }
X }
X else
X {
X if(XtIsManaged(displayFD))
X XtUnmanageChild(displayFD);
X if(string1) XtFree(string1);
X return;
X }
}
X
/* Beginning from startpos, this routine searches text forward for
X * searchstring, and returns 1 if searchstring is found, also returning
X * the left and right positions of the matched string in left and right;
X * else 0 is returned.
X * It also does wrap-around search.
X */
X
static forwardSearch(text, startpos, searchstring, left, right)
X char *text;
X XmTextPosition startpos;
X char *searchstring;
X XmTextPosition *left, *right;
{
X int searchlength, searchsize, i, n=0;
X char *s1, *s2;
X
X searchlength = strlen(searchstring);
X searchsize = strlen(text) - searchlength;
X for (i=startpos+1; i < searchsize; i++) {
X n = searchlength;
X s1 = &text[i];
X s2 = searchstring;
X while (--n >= 0 && *s1++ == *s2++);
X if (n < 0) break;
X }
X if (n < 0) {
X *left = i;
X *right = i+searchlength;
X return 1;
X }
X else {
X for (i=0; i <= startpos; i++) {
X n = searchlength;
X s1 = &text[i];
X s2 = searchstring;
X while (--n >= 0 && *s1++ == *s2++);
X if (n < 0) break;
X }
X if (n < 0) {
X *left = i;
X *right = i+searchlength;
X return 1;
X }
X return 0;
X }
}
X
X
/* Similar to forwardSearch(), except that it does a reverse search
X */
static reverseSearch(text, startpos, searchstring, left, right)
X char *text;
X XmTextPosition startpos;
X char *searchstring;
X XmTextPosition *left, *right;
{
X int searchlength, i, n=0;
X char *s1, *s2;
X
X searchlength = strlen(searchstring);
X for (i=startpos; i >= searchlength; i--) {
X n = searchlength;
X s1 = &text[i];
X s2 = &searchstring[searchlength-1];
X while (--n >= 0 && *--s1 == *s2--);
X if (n < 0) break;
X }
X if (n < 0) {
X *right = i;
X *left = *right-searchlength;
X return 1;
X }
X else {
X for (i=strlen(text); i > startpos; i--) {
X n = searchlength;
X s1 = &text[i];
X s2 = &searchstring[searchlength-1];
X while (--n >= 0 && *--s1 == *s2--);
X if (n < 0) break;
X }
X if (n < 0) {
X *right = i;
X *left = *right-searchlength;
X return 1;
X }
X return 0;
X }
}
X
static XmTextPosition last_pos_before_search;
X
/* ARGSUSED */
void PopupSearch(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X if (!displayedFile) {
X UpdateMessageWindow(SEARCH_HELP, NULL);
X bell(0);
X }
X else {
X last_pos_before_search = XmTextGetInsertionPosition(sourceWindow);
X XtManageChild(searchPopupShell);
X }
}
X
/* This callback is used by the Cancel button to return to the saved text
X * position after a search.
X */
static void StopSearch(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X XtUnmanageChild(searchPopupShell);
}
X
/* This callback is used by the Cancel button to return to the saved text
X * position after a search.
X */
static void CancelSearch(w, client_data, call_data)
X Widget w;
X XtPointer client_data;
X XtPointer call_data;
{
X AdjustText(TextPositionToLine(last_pos_before_search));
X XmTextSetInsertionPosition(sourceWindow, last_pos_before_search);
}
X
/* ARGSUSED */
/* This routine handles both forward and reverse text search.
X * If no text has been entered, the contents of the cut buffer are used
X * for searching.
X */
static void Search(w, direction, call_data)
X Widget w;
X XtPointer direction;
X XtPointer call_data;
{
X XmTextPosition pos, left, right;
X char *searchString;
X
X searchString = XmTextGetString(XmSelectionBoxGetChild(searchPopupShell,
X XmDIALOG_TEXT));
X if(searchString && *searchString)
X {
X pos = XmTextGetInsertionPosition(sourceWindow);
X if ((direction == (XtPointer)FORWARD &&
X forwardSearch(displayedFile->buf, pos, searchString, &left, &right)) ||
X (direction == (XtPointer)REVERSE &&
X reverseSearch(displayedFile->buf, pos, searchString, &left, &right))) {
X AdjustText(TextPositionToLine(left));
X XmTextSetSelection(sourceWindow, left, right, 0);
X XmTextSetInsertionPosition(sourceWindow, left);
X }
X else {
X if (direction == (XtPointer)FORWARD)
X UpdateMessageWindow("String not found", NULL);
X else if (direction == (XtPointer)REVERSE)
X UpdateMessageWindow("String not found", NULL);
X else
X abort();
X bell(0);
X }
X }
X if(searchString) XtFree(searchString);
}
X
void CreateSearchPopup(parent)
Widget parent;
{
X Arg args[MAXARGS];
X Display *topdisplay;
X Pixel bg;
X Widget applybutton, okbutton, cancelbutton, helpbutton;
X
X XtSetArg(args[0], XmNdialogTitle,
X XmStringCreateLtoR("String Search", XmSTRING_DEFAULT_CHARSET));
X searchPopupShell = XmCreatePromptDialog(parent, "searchPopupSelection",
X args, 2);
X applybutton = XmSelectionBoxGetChild(searchPopupShell,
X XmDIALOG_APPLY_BUTTON);
X okbutton = XmSelectionBoxGetChild(searchPopupShell,
X XmDIALOG_OK_BUTTON);
X cancelbutton = XmSelectionBoxGetChild(searchPopupShell,
X XmDIALOG_CANCEL_BUTTON);
X helpbutton = XmSelectionBoxGetChild(searchPopupShell,
X XmDIALOG_HELP_BUTTON);
X XtManageChild(applybutton);
X
X XtSetArg(args[0], XmNkeyboardFocusPolicy, XmPOINTER);
X XtSetValues(XtParent(searchPopupShell), args, 1);
X
X topdisplay = XtDisplay(toplevel);
X XtSetArg(args[0], XmNbackground, &bg);
X XtGetValues(searchPopupShell, args, 1);
X
X XtSetArg(args[0], XmNlabelType, XmPIXMAP);
X XtSetArg(args[1], XmNlabelPixmap, XCreatePixmapFromBitmapData (
X topdisplay, DefaultRootWindow(topdisplay),
X arrowup_bits, arrowup_width,
X arrowup_height, app_resources.stop_color, bg,
X DefaultDepth(topdisplay,
X DefaultScreen(topdisplay))));
X XtSetValues(applybutton, args, 2);
X
X XtSetArg(args[1], XmNlabelPixmap, XCreatePixmapFromBitmapData (
X topdisplay, DefaultRootWindow(topdisplay),
X arrowdown_bits, arrowdown_width,
X arrowdown_height, app_resources.stop_color, bg,
X DefaultDepth(topdisplay,
X DefaultScreen(topdisplay))));
X XtSetValues(okbutton, args, 2);
X XtSetArg(args[0], XmNlabelString,
X XmStringCreateLtoR("Stop", XmSTRING_DEFAULT_CHARSET));
X XtSetValues(helpbutton, args, 1);
X XtRemoveAllCallbacks(applybutton, XmNactivateCallback);
X XtRemoveAllCallbacks(okbutton, XmNactivateCallback);
X XtAddCallback(applybutton, XmNactivateCallback,
X Search, (XtPointer)REVERSE);
X XtAddCallback(okbutton, XmNactivateCallback,
X Search, (XtPointer)FORWARD);
X XtAddCallback(cancelbutton, XmNactivateCallback, CancelSearch, NULL);
X XtAddCallback(helpbutton, XmNactivateCallback, StopSearch, NULL);
X
}
X
/**************************************************************************
X *
X * Command queue functions
X *
X **************************************************************************/
X
/* Append command to end of the command queue and send the command to gdb */
X
void send_command(command)
char *command;
{
X CommandRec *p, *q, *r;
X
X p = (CommandRec *)XtNew(CommandRec);
X p->command = XtNewString(command);
X p->next = NULL;
X if (!commandQueue)
X commandQueue = p;
X else {
X q = commandQueue;
X while (r = q->next)
X q = r;
X q->next = p;
X }
X write_dbx(command);
}
X
/* Read command at the head of the command queue */
X
char *get_command()
{
X if (commandQueue) {
X return (commandQueue->command);
X }
X else
X return NULL;
}
X
/* Delete command from the head of the command queue */
X
void delete_command()
{
X CommandRec *p;
X
X if (p = commandQueue) {
X commandQueue = p->next;
X XtFree(p->command);
X XtFree(p);
X }
}
X
/* Insert command into head of queue */
X
void insert_command(command)
char *command;
{
X CommandRec *p;
X
X p = (CommandRec *)XtNew(CommandRec);
X p->command = XtNewString(command);
X p->next = NULL;
X if (!commandQueue)
X commandQueue = p;
X else {
X p->next = commandQueue;
X commandQueue = p;
X }
}
SHAR_EOF
chmod 0664 mxgdb/command.c ||
echo 'restore of mxgdb/command.c failed'
Wc_c="`wc -c < 'mxgdb/command.c'`"
test 18082 -eq "$Wc_c" ||
echo 'mxgdb/command.c: original size 18082, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= mxgdb/Mxgdb.ad ==============
if test -f 'mxgdb/Mxgdb.ad' -a X"$1" != X"-c"; then
echo 'x - skipping mxgdb/Mxgdb.ad (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting mxgdb/Mxgdb.ad (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/Mxgdb.ad' &&
!
! $Id: Mxgdb.ad,v 1.13 1991/08/23 16:34:25 jtsillas Exp $
!
Mxgdb*fontList:-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1
!
! useCommandDialog (false by default) creates a popup dialog to contain your
! command buttons rather than putting them beside the source window.
!
Mxgdb*useCommandDialog: false
!
! fileWindow - contains the filename and linenumber labels.
! fileLabel - the label for the current file.
! lineLabel - the laebl for the current line-number.
!
Mxgdb*fileWindow.height: 15
Mxgdb*fileWindow*fileLabel.borderWidth: 0
Mxgdb*fileWindow*lineLabel.borderWidth: 0
!
! sourceScroll - the scrolled window containing the sourceForm.
!
Mxgdb*sourceScroll.paneMinimum: 100
!
! The source form is the FormWidget containing the sourceWindow, the
! command buttons and the arrow/stopsign/etc. labels.
!
Mxgdb*sourceForm.borderWidth: 0
Mxgdb*sourceForm.shadowThickness: 0
Mxgdb*sourceForm.width: 500
!
! The source window is the TextWidget with the source text.
!
Mxgdb*sourceWindow.borderWidth: 0
Mxgdb*sourceWindow.highlightThickness: 0
Mxgdb*sourceWindow.shadowThickness: 0
Mxgdb*sourceWindow.rows: 19
Mxgdb*sourceWindow.marginWidth: 5
Mxgdb*sourceWindow.fontList: 6x13
Mxgdb*sourceWindow.translations: #override \
X Shift<Btn1Down>,Shift<Btn1Up>: SelectWord() Update(warp) \n\
X <Btn1Down>: SelectStart() \n\
X <Btn1Motion>: SelectAdjust() \n\
X <Btn1Up>: SelectEnd() Update(warp) \n\
X <Key>osfUp: process-up() Update() \n\
X <Key>osfDown: process-down() Update() \n\
X <Key>osfLeft: backward-character() Update() \n\
X <Key>osfRight: forward-character() Update() \n\
X <Key>osfPageDown: next-page() Update(warp) \n\
X <Key>osfPageUp: previous-page() Update(warp) \n\
X Ctrl<Key>osfPageUp: page-left() Update(warp) \n\
X Ctrl<Key>osfPageDown: page-right() Update(warp) \n\
X Ctrl<Key>osfBeginLine: beginning-of-file() Update() \n\
X Ctrl<Key>osfEndLine: end-of-file() Update()
!
! These translations reset the bounds for the sign placement
! vpane is the paned window widget.
!
Mxgdb*vpane*sash.translations: #override \
X <Btn1Up>: SashAction(Commit) resetLineBounds() \n\
X <Btn2Up>: SashAction(Commit) resetLineBounds()
!
! The message window echoes the gdb result lines.
!
Mxgdb*messageWindow.height: 25
!
! The dialog Window is the text command line window. dialogWindowSW is the
! Scrolled Window parent of the TextWidget.
!
Mxgdb*dialogWindowSW.paneMinimum: 50
Mxgdb*dialogWindow.height: 200
Mxgdb*dialogWindow.fontList: 6x13
Mxgdb*dialogWindow.translations: #override \
X Shift<Btn1Down>,Shift<Btn1Up>: SelectWord() \n\
X <Btn1Down>: SelectStart() \n\
X <Btn1Motion>: SelectAdjust() \n\
X <Btn1Up>: SelectEnd()\n\
X <Btn2Down>: InsertSelection() copy-primary() \n\
X Ctrl<Key>C: SigInt()\n\
X Ctrl<Key>D: SigEof()\n\
X Ctrl<Key>|: SigQuit()\n\
X <Key>osfBackSpace: InsertSpace() delete-previous-character() \n\
X <Key>Return: end-of-file() newline() Dispatch() \n\
X <Key>: end-of-file() self-insert()
!
| The displayWindow is the scrolled text wigdet within displayWindowFD
! which is the FormDialog widget.
!
Mxgdb*displayWindow.translations: #override \n\
X <Btn1Up>: set-insertion-point() SelectVar()
Mxgdb*displayWindowFD.height: 150
Mxgdb*displayWindowFD.width: 100
Mxgdb*displayWindow.fontList: 6x13
!
! File Selector Box Settings
!
!Mxgdb*fileSelectorBox
!
! End
X
SHAR_EOF
chmod 0664 mxgdb/Mxgdb.ad ||
echo 'restore of mxgdb/Mxgdb.ad failed'
Wc_c="`wc -c < 'mxgdb/Mxgdb.ad'`"
test 3289 -eq "$Wc_c" ||
echo 'mxgdb/Mxgdb.ad: original size 3289, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= mxgdb/bitmaps.h ==============
if test -f 'mxgdb/bitmaps.h' -a X"$1" != X"-c"; then
echo 'x - skipping mxgdb/bitmaps.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting mxgdb/bitmaps.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/bitmaps.h' &&
/* $Id: bitmaps.h,v 1.3 1991/08/23 16:34:28 jtsillas Exp $ */
X
#define mxgdb48_width 48
#define mxgdb48_height 48
extern char mxgdb48_bits[];
X
#define mxgdb64_width 64
#define mxgdb64_height 64
extern char mxgdb64_bits[];
X
#define stop_width 16
#define stop_height 16
#define stop_x_hot -1
#define stop_y_hot -1
extern char stop_bits[];
X
#define arrow_width 16
#define arrow_height 16
#define arrow_x_hot -1
#define arrow_y_hot -1
extern char arrow_bits[];
X
#define updown_width 16
#define updown_height 16
#define updown_x_hot -1
#define updown_y_hot -1
extern char updown_bits[];
X
#define bomb_width 16
#define bomb_height 16
extern char bomb_bits[];
X
#define pageR_width 24
#define pageR_height 24
extern char pageR_bits[];
X
#define pageL_width 24
#define pageL_height 24
extern char pageL_bits[];
X
#define step_width 24
#define step_height 24
extern char step_bits[];
X
#define next_width 24
#define next_height 24
extern char next_bits[];
X
#define print_width 24
#define print_height 24
extern char print_bits[];
X
#define down_width 16
#define down_height 16
extern char down_bits[];
X
#define up_width 16
#define up_height 16
extern char up_bits[];
X
#define stack_width 24
#define stack_height 24
extern char stack_bits[];
X
#define cont_width 24
#define cont_height 24
extern char cont_bits[];
X
#define finish_width 24
#define finish_height 24
extern char finish_bits[];
X
#define run_width 24
#define run_height 24
extern char run_bits[];
X
#define disp_width 24
#define disp_height 24
extern char disp_bits[];
X
#define undisp_width 24
#define undisp_height 24
extern char undisp_bits[];
X
#define clear_width 24
#define clear_height 24
extern char clear_bits[];
X
#define prints_width 24
#define prints_height 24
extern char prints_bits[];
X
#define args_width 24
#define args_height 24
extern char args_bits[];
X
#define locals_width 24
#define locals_height 24
extern char locals_bits[];
X
#define triton_width 64
#define triton_height 64
extern char triton_bits[];
SHAR_EOF
chmod 0664 mxgdb/bitmaps.h ||
echo 'restore of mxgdb/bitmaps.h failed'
Wc_c="`wc -c < 'mxgdb/bitmaps.h'`"
test 1967 -eq "$Wc_c" ||
echo 'mxgdb/bitmaps.h: original size 1967, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= mxgdb/callgdb.c ==============
if test -f 'mxgdb/callgdb.c' -a X"$1" != X"-c"; then
echo 'x - skipping mxgdb/callgdb.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting mxgdb/callgdb.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/callgdb.c' &&
static char rcsid[] = "$Id: callgdb.c,v 1.1 1991/08/23 16:34:20 jtsillas Exp $";
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 * xxgdb - X Window System interface to the gdb debugger
X *
X * Copyright 1990 Thomson Consumer Electronics, Inc.
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 Thomson Consumer
X * Electronics (TCE) not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. TCE 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 * TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
X * SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
X * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X * Adaptation to GDB: Pierre Willard
X * XXGDB Created: December, 1990
X *
X *****************************************************************************
X
/* callgdb.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 * callgdb(): Invoke dbx.
X */
X
#ifdef Mips
#include <sysv/sys/termio.h>
#else
#include <termio.h>
#endif
X
#include "global.h"
X
#ifdef SYSV
#ifdef SCO
# include <sys/fcntl.h>
#endif
#endif
#ifdef SVR4_PTY
#include <sys/stropts.h>
#endif
X
FILE *dbxfp = NULL; /* file pointer to gdb */
int dbxpid = 0; /* dbx process id */
char dbxfbuf[BUFSIZ]; /* A buffer used by setvbuf on master pty */
static int dbxInputId; /* dbx input id */
X
#ifdef SVR4_PTY
static char pty[] = "/dev/ptmx"; /* master side of pseudo-terminal */
static char tty[] = "/dev/pts/XXX"; /* slave side of pseudo-terminal */
#else
static char pty[11] = "/dev/pty??"; /* master side of pseudo-terminal */
static char tty[11] = "/dev/tty??"; /* slave side of pseudo-terminal */
#endif
X
extern char *dbxprompt;
static int hold_slave = -1;
X
/*
X * mxgdb talks to gdb 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. Some
X * systems use ptmx style pty's. For these define SVR4_PTY.
X */
static int open_master()
{
X int i, master;
X char c;
X
#ifdef SVR4_PTY
X if ((master = open(pty, O_RDWR)) >= 0)
X return master;
#else /* ! SVR4_PTY */
X for (c='p'; c<'t'; c++) {
X for (i=0; i<16; i++) {
X pty[8] = c;
X pty[9] = "0123456789abcdef"[i];
X tty[8] = pty[8];
X tty[9] = pty[9];
X if ((master = open(pty, O_RDWR)) >= 0)
X {
X if ((hold_slave = open(tty, O_RDWR)) >= 0)
X return (master);
X else close(master);
X }
X }
X }
#endif /* SVR4_PTY */
X fprintf(stderr, "mxgdb: all ptys in use\n");
X exit(2);
}
X
static int open_slave()
{
X int slave;
X
X if (hold_slave >= 0) {
X close(hold_slave);
X hold_slave = -1;
X }
X if ((slave = open(tty, O_RDWR)) >= 0)
X return (slave);
X fprintf(stderr, "mxgdb: open: cannot open slave pty %s", tty);
X exit(2);
}
X
/* ARGSUSED */
void callgdb(argc, argv)
int argc;
char *argv[];
{
X struct termio Termio;
X int master; /* file descriptor of master pty */
X int slave = -1; /* 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 */
#ifdef SVR4_PTY
X char *slavename;
X char *ptsname();
#endif
X char errmsg[LINESIZ];
X
X debugger = (char *) getenv("MXGDB_DEBUGGER"); /* first looks up env var */
X
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 */
#ifndef SYSV
X if ((fd = open("/dev/tty", O_RDWR)) > 0) {
X ioctl(fd, TIOCNOTTY, 0);
X close(fd);
X }
#endif /* SYSV */
X
X master = open_master();
X
#ifndef SYSV
X slave = open_slave();
#endif
X
X dbxpid = fork();
X if (dbxpid == -1) {
X perror("mxgdb error: cannot fork process");
X exit(2);
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 if (slave >= 0) {
X close(slave);
X slave = -1;
X }
X close(0);
X close(1);
X fcntl(master, F_SETFL, FNDELAY);
X dbxfp = (FILE *)fdopen(master, "r+");
X setvbuf(dbxfp, dbxfbuf, _IONBF, BUFSIZ);
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
#ifdef SYSV
X setpgrp();
#ifdef SVR4_PTY
X grantpt (master); /* change permission of slave */
X unlockpt (master); /* unlock slave */
X slavename = ptsname (master); /* get name of slave */
X strcpy (tty, slavename); /* copy over to save area */
#endif
X slave = open_slave();
#ifdef SVR4_PTY
X /*XXX todo: need to make sure these succeed */
X ioctl (slave, I_PUSH, "ptem");
X ioctl (slave, I_PUSH, "ldterm");
#endif
#endif /* SYSV */
X close(master);
X
X /*
X * Modify local and output mode of slave pty
X */
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
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 */
#ifndef SYSV
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);
#endif
X argv[0] = debugger;
X execvp(debugger, argv);
X sprintf(errmsg, "mxgdb error: cannot exec %s", debugger);
X perror(errmsg);
X exit(2);
X }
X }
X
SHAR_EOF
chmod 0664 mxgdb/callgdb.c ||
echo 'restore of mxgdb/callgdb.c failed'
Wc_c="`wc -c < 'mxgdb/callgdb.c'`"
test 9084 -eq "$Wc_c" ||
echo 'mxgdb/callgdb.c: original size 9084, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= mxgdb/source.c ==============
if test -f 'mxgdb/source.c' -a X"$1" != X"-c"; then
echo 'x - skipping mxgdb/source.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting mxgdb/source.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/source.c' &&
X
static char rcsid[] = "$Id: source.c,v 1.13 1991/08/23 16:34:43 jtsillas Exp $";
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
SHAR_EOF
true || echo 'restore of mxgdb/source.c failed'
fi
echo 'End of part 2'
echo 'File mxgdb/source.c is continued in part 3'
echo 3 > _shar_seq_.tmp
exit 0