home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1991-07-17 | 40.1 KB | 1,210 lines
Newsgroups: alt.sources From: jtsillas@sprite.ma30.bull.com (James Tsillas) Subject: mxgdb Part 6/9 Date: 16 Jul 91 13:10:53 Message-ID: <JTSILLAS.91Jul16131053@sprite.ma30.bull.com> ---- Cut Here and feed the following to sh ---- #!/bin/sh # this is mxgdb.06 (part 6 of a multipart archive) # do not concatenate these parts, unpack them in order with /bin/sh # file mxgdb/gdb_regex.h continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 6; 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/gdb_regex.h' else echo 'x - continuing file mxgdb/gdb_regex.h' sed 's/^X//' << 'SHAR_EOF' >> 'mxgdb/gdb_regex.h' && #define O_INFO_DIR 5 /* NEW for GDB */ #define O_FRAME_CURR 6 /* O_FRAME_CURR = O_UPDOWN */ #define O_UPDOWN 6 #define O_BELL 7 #define O_SEARCH 8 #define O_INFO_LINE 9 /* Instead of O_FILE */ #define O_PRINT 10 #define O_DEBUG 11 #define O_DIRECTORY 12 #define O_LIST 13 /* for dbx, O_LIST = O_SEARCH */ #define O_DISPLAY 14 #define O_DISPLAY_INFO 15 #define O_PWD 16 #define O_CD 16 /* O_PWD = O_CD */ #define O_RECEIVED_SIGNAL 17 /* test program received signal */ #define O_EXEC_DISPLAY 18 /* special for filter_display_info */ #define O_READING_SYMBOLS 19 /* special for filter_reading_symbols */ #define O_HELP 20 X #define C_ANY -1 #define C_EXEC 0 #define C_BREAK 1 /* Instead of C_STOPAT & C_STOPIN */ #define C_INFO_DIR 2 /* NEW for GDB */ #define C_FRAME_CURR 3 #define C_UPDOWN 4 #define C_CLEAR 5 #define C_FINISH 6 /* Instead of C_FUNC */ #define C_INFO_LINE 7 /* Instead of C_FILE */ #define C_SYMBOL_FILE 8 #define C_CD 9 #define C_DIRECTORY 10 /* Instead of C_USE */ #define C_PWD 11 #define C_LIST 12 #define C_SEARCH 13 #define C_DISPLAY_INFO 14 /* must be BEFORE C_DISPLAY ! */ #define C_DISPLAY 15 #define C_UNDISPLAY 16 #define C_PRINT 17 #define C_INFO_BREAK 18 #define C_SOURCE 19 #define C_EXEC_FILE 20 #define C_CORE_FILE 21 #define C_DEFINE 22 #define C_DOCUMENT 23 #define C_END 24 #define C_HELP 25 X /*--------------------------------------------------------------------------+ | | | DBX | | | | Reading symbolic information... | | Read 46 symbols | | (dbx) | | (dbx) | | stopped in main at line 5 in file "pw.c" | | 5 for (i=0; i<100; i++) | | (dbx) use | | /usr1/gnu_sun4/xdbx/ | | (dbx) file | | pw.c | | (dbx) file | | No current source file | | | +--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------+ | | | GDB | | | | Reading symbol data from /usr1/gnu_sun4/xdbx/pw...done. | | Type "help" for a list of commands. | | (gdb) | | (gdb) | | Bpt 1, main () (pw.c line 5) | | 5 for (i=0; i<100; i++) | | (gdb) info directories | | Source directories searched: /usr1/gnu_sun4/xdbx:/usr1/toto | | (gdb) info line | | Line 10 of "pw.c" starts at pc 0x22dc and ends at 0x22e4. | | (gdb) info line | | No source file specified. | | | +--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------+ | | | GDB -fullname | | | | | | We use option -fullname (see dbxoptions() in xdbx.c). | | | | GDB prints (see source.c of gdb): | | | | "\032\032%s:%d:%d:%s:0x%x\n", s->fullname, | | line, s->line_charpos[line - 1], | | mid_statement ? "middle" : "beg", | | get_frame_pc (get_current_frame())); | | | | (gdb) break main | | Reading in symbols for pw.c...done. | | Breakpoint 1 at 0x229c: file pw.c, line 5. | | (gdb) run | | Starting program: /usr1/gnu_sun4/xdbx/pw | | | | Bpt 1, main () (pw.c line 5) | | /usr1/gnu_sun4/xdbx/pw.c:5:17:beg:0x229c | | (gdb) step | | /usr1/gnu_sun4/xdbx/pw.c:6:40:beg:0x22b0 | | (gdb) | | | | (gdb) info directories | | Source directories searched: /usr1/gnu_sun4/xdbx | | (gdb) info line | | Line 10 of "pw.c" starts at pc 0x22dc and ends at 0x22e4. | | (gdb) info line | | No source file specified. | | (gdb) info line | | Line number 34 is out of range for "bug1.c". | | | | (gdb) display i | | 3: i = 0 | | (gdb) display | | 4: i + 1 = 1 | | 3: i = 0 | | (gdb) undisplay 2 | | (gdb) display | | (gdb) | | | | (gdb) up | | #2 0x2314 in main () (pw.c line 35) | | /usr1/gnu_sun4/xdbx/pw.c:35:158:beg:0x2360 | | (gdb) up | | Initial frame selected; you cannot go up. | | (gdb) | | | | (gdb) down | | #0 glop (number=1) (pw2.c line 5) | | /usr1/gnu_sun4/xdbx/pw2.c:5:33:beg:0x2360 | | (gdb) down | | Bottom (i.e., innermost) frame selected; you cannot go down. | | (gdb) | | | | (gdb) pwd | | Working directory /usr1/gnu_sun4/xdbx. | | (gdb) cd .. | | Working directory /usr1/gnu_sun4. | | (gdb) cd xdbx | | Working directory /usr1/gnu_sun4/xdbx. | | (gdb) cd toto | | toto: No such file or directory. | | (gdb) | | | | Program exited with code 01. | | (gdb) | | | +--------------------------------------------------------------------------*/ /* X X . --> any character but '\n' X * --> any character 0 to n times X + --> any character 1 to n times X ? --> any character 0 or 1 time X ^ --> begin of line or NOT following character X $ --> end of line or '$' X \\w --> character '0..9a..zA...Z' X \\W --> character NOT '0..9a..zA...Z' X \\< --> word begin (word is composed of 0..9a..zA...Z) X \\> --> word end (word is composed of 0..9a..zA...Z) X \\b --> word bound X \\B --> not word bound X \\| --> means OR X \\` --> begin buffer X \\\' --> end buffer X X >> WARNING : be carefull with \\| (OR) : the re_match() function >> will NOT correctly update the string for a pattern which is >> optional ! >> --> The number SHOULD NOT point to a patterm which is optional ! X */ X X /* (PW)5DEC90: I have a problem if we say \\(Bpt.*\n\\)? in exec pattern. X That is why I have two cases : with or without Bpt... X Note that 'exec without Message' includes 'exec with Message'. X We display 'Bpt...' in the message window. */ X X /* (PW)14JAN91 (v1.01) : use X \\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\) X instead of X \\(\\([0-9]+:.*\n\\)*\\) X for display pattern. X */ X X static PatternRec output_pattern[] = { X /* exec with Message after */ X {"\\(.*\n\\)*\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n\\([ ]*[^0-9].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)", X NULL, X {6, -1, -1, 3, 2, 7} X }, X /* exec with Message before */ X {"\\(.*\n\\)*\\([ ]*[^ ].*\n\\)\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)", X NULL, X {2, -1, -1, 4, 3, 7} X }, X /* exec without Message */ X {"\\(.*\n\\)*\032\032\\(\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)", X NULL, X {2, -1, -1, 4, 3, 7} X }, X /* done */ X {"\\(.*\n\\)*\n\\(Program terminated with signal \\|Program exited with code 0\\|Program exited normally\\).*\n\\(.*\n\\)*", X NULL, X {-1, -1, -1, -1, -1, -1} X }, X /* break */ X {"\\(.*\n\\)*Breakpoint \\([0-9]+\\) at [^ ]+: file \\([^ ]+\\), line \\([0-9]+\\).\n", X NULL, X {-1, 2, -1, 4, 3, -1} X }, X /* info directories */ X {"Source directories searched:[ ]*\\([^ ]+\\)[ ]*\n", X NULL, X { -1, -1, -1, -1, 1, -1} X }, X /* up, down */ X {"\\(.*\n\\)*\\(#[0-9]+[ ]+\\(0x[^ ]+[ ]+in[ ]+\\)?\\([^ ]+\\).*\n\\)\\(Source file is more recent than executable.\n\\)?\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n", X NULL, X {2, -1, 4, 7, 6, -1} X }, X /* bell */ X {"\\(Undefined command: .*\n\\|Already at the \\(top\\|bottom\\) call level\n\\|\ No active stack frames\n\\|no program to run\n\\|no process to run\n\\|\ program is not active\n\\|can't continue execution\n\\|\ .*\ncan't write to process.*\n\\|\ \\(Top\\|End\\)-of-file; did not find search string:.*\n\\)", X NULL, X {-1, -1, -1, -1, -1} X }, X /* search */ X {"\\([0-9]+\\).*\n", X NULL, X {-1, -1, -1, 1, -1, -1} X }, X /* info line */ X {"\\(Line \\(number \\)?[0-9]+ \\(of\\|is out of range for\\) \"\\([^ ]+\\)\".*\\)\n", X NULL, X {-1, -1, -1, -1, 4, -1} X }, X /* print */ X {"\\(warning: .*\n\\)?\\(\\(.*\\) = .*\n\\(.*\n\\)*\\)", X NULL, X { 3, -1, -1, -1, -1, 2} X }, X /* start gdb (debug) */ X {"\\(.*\n\\)*Type \"help\" for a list of commands.\n", X NULL, X { -1, -1, -1, -1, -1, -1} X }, X /* directory */ X {"\\([^ ]+ is already in the source path.[ ]*\n\\)*Source directories searched:[ ]*\\([^ ]+\\)[ ]*\n", X NULL, X { -1, -1, -1, -1, 1, -1} X }, X /* list */ X {"\\(.*\n\\)*\\(\\([0-9]+\\).*\n\\)", X NULL, X { -1, -1, -1, 3, -1, -1} X }, X /* display */ X {"\\([0-9]+:.*\n\\)", X NULL, X { -1, -1, -1, -1, -1, 1} X }, X /* info display */ X {"\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)", X NULL, X { -1, -1, -1, -1, -1, 1} X }, X /* pwd or cd */ X {"Working directory[ ]+\\([^ ]+\\).[ ]*\n\\([ ]*(canonically[ ]+\\([^ ]+\\)).\n\\)?", X NULL, X { 1, -1, -1, -1, -1, 3} X }, X /* program received signal */ X {"\\(.*\n\\)*\n\\(Program received signal \\([-]?[0-9]+\\), [^ ]+.*\n\\)\\(.*\n\\)*", X NULL, X { 2, 3, -1, -1, -1, -1} X }, X /* special for test in filter_display_info() */ X {"\\([^0-9].*\n\\)*\\([0-9]+:.*\n\\)\\(.*\n\\)*", X NULL, X { -1, -1, -1, -1, -1, 2} X }, X /* special for test in filter_reading_symbols() */ X {"\\(.*\n\\)*\\(Reading in symbols for .*done.\n\\)\\(.*\n\\)*", X NULL, X { 2, -1, -1, -1, -1, -1} X }, X {"\\(.*\n\\)*", NULL, {-1, -1, -1, -1, -1, -1} X }, X NULL }; X /* X X To simplify the patterns, I used for example : X X "fr[ame]*" instead of "frame\\|fram\\|fra||fr". X X This will cause 'frmeame' to be accepted. But this is X no problem because 'Undefined command' output is parsed X before parsing the command line (see parse() in parser.c). */ X static PatternRec command_pattern[] = { X /* run -r - cont - c - next - n - step - s - nexti - ni - stepi - si - return X jump - until - u */ X {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|nexti\\|stepi\\|ni\\|si\\|ret[urn]*\\|j[ump]*\\|unt[il]*\\|u\\)\\( .*\\)?\n", X NULL, {-1, -1, -1, -1, -1, -1}}, X /* break - tbreak */ X {"[ ]*\\(t\\)?\\(b\\|br\\|bre\\|brea\\|break\\)\\( .*\\)?\n", X NULL, {-1, -1, -1, -1, -1, -1}}, X {"[ ]*info[ ]+directories[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* 'frame' is special case of 'frame n' since it does not change the X current frame. Else 'frame n' is like up or down. */ X {"[ ]*fr[ame]*[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X {"[ ]*\\(up\\|down\\|dow\\|do\\|fr[ame]*\\)\\( .*\\)?\n", X NULL, {-1, -1, -1, -1, -1, -1}}, X X /* delete - d - clear - enable - disable - dis - disa */ X /* gdb commands 'delete display' 'enable display' and 'delete environment' X are also found here. This is superfluous, but no problem */ X X {"[ ]*\\(del[ete]*\\|d\\|cl[ear]*\\|en[able]*\\|disab[le]*\\|dis\\|disa\\)\\( .*\\)?\n", X NULL, {-1, -1, -1, -1, -1, -1}}, X X {"[ ]*fi[nish]*[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X {"[ ]*info[ ]+line[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* symbol-file */ X {"[ ]*sy.*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X {"[ ]*cd[ ]*[^ ]+[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* directory */ X {"[ ]*dir.*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X {"[ ]*pwd[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X /* list */ X {"[ ]*l.*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* forward-search or reverse-search or search */ X X {"[ ]*\\(fo[rward-search]*\\|rev[erse-search]*\\|sea[rch]*\\)[ ]*", X NULL, {-1, -1, -1, -1, -1, -1}}, X X /* 'display' is a special case of 'display exp' since it does not X add any expression to be displayed */ X {"[ ]*disp[lay]*[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X {"[ ]*disp[lay]\\(/[^ ]+\\)?*[ ]*[^ ]+[ ]*.*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* undisplay */ X {"[ ]*und.*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* Note that Token.mesg (if any) is updated with print command (see 1) */ X X {"[ ]*print[ ]*\\([^ ]?\\([ ]+[^ ]+\\)*\\)[ ]*\n", NULL, { 1, -1, -1, -1, -1, -1}}, X {"[ ]*info[ ]+break[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* source (note that Token.TK_FILE is updated here) */ X {"[ ]*so[urce]*[ ]*\\(.*\\)\n", NULL, {-1, -1, -1, -1, 1, -1}}, X X /* exec-file (just used internally) */ X {"[ ]*exec-file .*\n", NULL, {-1, -1, -1, -1, -1, -1}}, X X /* core-file */ X {"[ ]*cor[e-file]*.*\n", NULL, X {-1, -1, -1, -1, -1, -1}}, X X /* define */ X {"[ ]*def[ine]*[ ]+[^ ]+\n", NULL, X {-1, -1, -1, -1, -1, -1}}, X X /* document */ X {"[ ]*doc[ument]*[ ]+[^ ]+\n", NULL, X {-1, -1, -1, -1, -1, -1}}, X X /* end of define or document */ X {"[ ]*end[].*", NULL, X {-1, -1, -1, -1, -1, -1}}, X X {"[ ]*help.*\n", NULL, X {-1, -1, -1, -1, -1, -1}}, X X NULL }; SHAR_EOF echo 'File mxgdb/gdb_regex.h is complete' && chmod 0664 mxgdb/gdb_regex.h || echo 'restore of mxgdb/gdb_regex.h failed' Wc_c="`wc -c < 'mxgdb/gdb_regex.h'`" test 17655 -eq "$Wc_c" || echo 'mxgdb/gdb_regex.h: original size 17655, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= mxgdb/getpagesize.h ============== if test -f 'mxgdb/getpagesize.h' -a X"$1" != X"-c"; then echo 'x - skipping mxgdb/getpagesize.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting mxgdb/getpagesize.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/getpagesize.h' && /* $Id: getpagesize.h,v 1.1.1.1 1991/05/16 21:42:20 jtsillas Exp $ */ X #ifdef BSD #ifndef BSD4_1 #define HAVE_GETPAGESIZE #endif #endif X #ifndef HAVE_GETPAGESIZE X #include <sys/param.h> X #ifdef EXEC_PAGESIZE #define getpagesize() EXEC_PAGESIZE #else #ifdef NBPG #define getpagesize() NBPG * CLSIZE #ifndef CLSIZE #define CLSIZE 1 #endif /* no CLSIZE */ #else /* no NBPG */ #ifdef NBPC #define getpagesize() NBPC #else #define getpagesize() NBPP #endif #endif /* no NBPG */ #endif /* no EXEC_PAGESIZE */ X #endif /* not HAVE_GETPAGESIZE */ X SHAR_EOF chmod 0664 mxgdb/getpagesize.h || echo 'restore of mxgdb/getpagesize.h failed' Wc_c="`wc -c < 'mxgdb/getpagesize.h'`" test 539 -eq "$Wc_c" || echo 'mxgdb/getpagesize.h: original size 539, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= mxgdb/windows.c ============== if test -f 'mxgdb/windows.c' -a X"$1" != X"-c"; then echo 'x - skipping mxgdb/windows.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting mxgdb/windows.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/windows.c' && static char rcsid[] = "$Id: windows.c,v 1.5 1991/07/11 21:14:20 jtsillas Exp $"; 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 /* 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 #include "global.h" X #include <Xm/Xm.h> #include <Xm/PanedW.h> #include <Xm/RowColumn.h> #include <Xm/Form.h> #include <Xm/Label.h> #include <Xm/CascadeB.h> #include <Xm/ScrolledW.h> #include <Xm/PushB.h> #include <Xm/MessageB.h> X Widget fileWindow, /* parent of fileLabel and lineLabel */ X messageWindow, /* window for displaying messages */ X separator, /* separator in vpane */ X displayWindow, /* area for displaying variables */ X fileSel, X displayFD, X topMenuBar, X topForm, X fileCButton, commandsCButton, X filePMenu, commandPMenu, X filePbutton, searchPbutton, quitPbutton, X runningCbutton, helpPMenu, helpCButton, X helpFD, helpselectscroll, helpupbutton, helpquitbutton; X Widget vpane, exitWarning; X static Widget fileLabel, /* filename of displayed text */ X lineLabel; /* line number of caret position */ X /* X * Private routines for creating various subwindows for xdbx. X */ X static void CreateFileLabel(parent) Widget parent; { X Arg args[MAXARGS]; X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR("No Source File ", X XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNleftAttachment, XmATTACH_FORM); X fileLabel = XtCreateManagedWidget("fileLabel", xmLabelWidgetClass, X parent, args, 2); } X static void CreateLineLabel(parent) Widget parent; { X Arg args[MAXARGS]; X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR("0 ", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNrightAttachment, XmATTACH_FORM); X lineLabel = XtCreateManagedWidget("lineLabel", xmLabelWidgetClass, X parent, args, 2); X } X static void CreateFileWindow(parent) Widget parent; { X Arg args[MAXARGS]; X Dimension height; X X fileWindow = XtCreateManagedWidget("fileWindow", xmFormWidgetClass, X parent, args, 0); X X X XtSetArg(args[0], XmNheight, &height); X XtGetValues(fileWindow, args, 1); X XtSetArg(args[0], XmNpaneMinimum, height); X XtSetArg(args[1], XmNpaneMaximum, height); X XtSetValues(fileWindow, args, 2); X X CreateFileLabel(fileWindow); X CreateLineLabel(fileWindow); } X static void CreateMessageWindow(parent) Widget parent; { X Arg args[MAXARGS]; X Cardinal n; X Dimension height; X X n = 0; X XtSetArg(args[0], XmNalignment, XmALIGNMENT_BEGINNING); X XtSetArg(args[1], XmNlabelString, X XmStringCreateLtoR("", X XmSTRING_DEFAULT_CHARSET)); X X messageWindow = XtCreateManagedWidget("messageWindow", xmLabelWidgetClass, X parent, args, 2); X X XtSetArg(args[0], XmNheight, &height); X XtGetValues(messageWindow, args, 1); X XtSetArg(args[0], XmNpaneMinimum, height); X XtSetArg(args[1], XmNpaneMaximum, height); X XtSetValues(messageWindow, args, 2); X } X static void SelectVar(w, event, params, num_params) X Widget w; X XEvent *event; X String *params; X Cardinal *num_params; { X char *displayString, *term1, *term2; X XmTextPosition pos, bottom, left, right; X X displayString = (char *) XmTextGetString(w); X pos = XmTextGetInsertionPosition(w); X bottom = XmTextGetLastPosition(w); X X if(displayString && *displayString) X { X left = pos; X right = pos; X while(left > 0 && displayString[left-1] != '\n') left--; X while(right <= bottom && displayString[right] != '\n') right++; X X XmTextSetSelection(w, left, right, 0); X } X if(displayString) XtFree(displayString); } X X /* Create a window for displaying variables as specified by the display X * command in dbx. X */ static void CreateDisplayWindow(parent) Widget parent; { X Arg args[MAXARGS]; X Widget displaySW; X X static XtActionsRec display_actions[] = { X {"SelectVar", (XtActionProc) SelectVar}, X {NULL, NULL} X }; X X X XtSetArg(args[0], XmNdialogTitle, X XmStringCreateLtoR("Auto Display", XmSTRING_DEFAULT_CHARSET)); X X displayFD = XmCreateFormDialog(parent, "displayFD", args, 1); X X XtSetArg(args[0], XmNeditable, False); X XtSetArg(args[1], XmNeditMode, XmMULTI_LINE_EDIT); X XtSetArg(args[2], XmNscrollLeftSide, True); X XtSetArg(args[3], XmNcursorPositionVisible, False); X XtSetArg(args[4], XmNscrollBarDisplayPolicy, XmSTATIC); X XtSetArg(args[5], XmNscrollHorizontal, True); X XtSetArg(args[6], XmNscrollVertical, True); X X displayWindow = (Widget) XmCreateScrolledText(displayFD, "displayWindow", X args, 7); X XtManageChild(displayWindow); X X XtAppAddActions(app_context, display_actions, XtNumber(display_actions)); X X displaySW = XtParent(displayWindow); X XtSetArg(args[0], XmNleftAttachment, XmATTACH_FORM); X XtSetArg(args[1], XmNrightAttachment, XmATTACH_FORM); X XtSetArg(args[2], XmNbottomAttachment, XmATTACH_FORM); X XtSetArg(args[3], XmNtopAttachment, XmATTACH_FORM); X XtSetValues(displaySW, args, 4); } X /* Create a window for displaying variables as specified by the display X * command in dbx. X */ X extern char helpstack[5][40]; extern int helpstackidx; extern char help_buttons_use_flag; X void HelpQuitActivate(w, client_data, call_data) X Widget w; X XtPointer client_data; X XmPushButtonCallbackStruct *call_data; { X XtUnmanageChild(helpFD); } X void HelpUpActivate(w, client_data, call_data) X Widget w; X XtPointer client_data; X XmArrowButtonCallbackStruct *call_data; { X char command[256]; X X --helpstackidx; X sprintf(command, "help %s\n", helpstack[helpstackidx-1]); X help_buttons_use_flag=1; X query_dbx(command); X help_buttons_use_flag=0; } X void ManageQuit(w, client_data, call_data) X Widget w; X XtPointer client_data; X XmPushButtonCallbackStruct *call_data; { X XtManageChild(exitWarning); } X Widget scrollselect; X static void CreateHelpWindow(parent) Widget parent; { X Arg args[MAXARGS]; X Widget helpSW; X int nlabel, nbutton; X X XtSetArg(args[0], XmNdialogTitle, X XmStringCreateLtoR("MXGDB help", XmSTRING_DEFAULT_CHARSET)); X X helpFD = XmCreateFormDialog(parent, "helpFD", args, 1); X XtSetArg(args[0], XmNscrollingPolicy, XmAUTOMATIC); X XtSetArg(args[1], XmNleftAttachment, XmATTACH_FORM); X XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM); X XtSetArg(args[3], XmNtopAttachment, XmATTACH_FORM); X XtSetArg(args[4], XmNbottomAttachment, XmATTACH_FORM); X X scrollselect = XtCreateManagedWidget("scrollselect", X xmScrolledWindowWidgetClass, X helpFD, args, 5); X helpselectscroll = XtCreateManagedWidget("helpselectscroll", X xmFormWidgetClass, X scrollselect, args, 0); X XmScrolledWindowSetAreas(scrollselect, NULL, NULL, helpselectscroll); X X X XtSetArg(args[0], XmNarrowDirection, XmARROW_UP); X XtSetArg(args[1], XmNtopAttachment, XmATTACH_FORM); X XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM); X helpupbutton = XmCreateArrowButton(helpFD, "helpupbutton", args, 3); X XtAddCallback(helpupbutton, XmNactivateCallback, HelpUpActivate, NULL); X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR("Quit", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNtopAttachment, XmATTACH_FORM); X XtSetArg(args[2], XmNleftAttachment, XmATTACH_FORM); X helpquitbutton = XtCreateManagedWidget("helpquitbutton", X xmPushButtonWidgetClass, X helpFD, args, 3); X XtAddCallback(helpquitbutton, XmNactivateCallback, HelpQuitActivate, NULL); X X for(nlabel=0; nlabel < NHELPLABELS; nlabel++) X helplabels[nlabel] = NULL; X for(nbutton=0; nbutton < NHELPBUTTONS; nbutton++) X helpbuttons[nbutton] = NULL; X } X X void CreateFileMenuPane(parent) Widget parent; { X Arg args[MAXARGS]; X X filePMenu = XmCreatePulldownMenu(parent, "filePMenu", args, 0); X XtSetArg(args[0], XmNsubMenuId, filePMenu); X XtSetArg(args[1], XmNlabelString, X XmStringCreateLtoR("File", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[2], XmNmnemonic, 'F'); X fileCButton = XmCreateCascadeButton(parent,"fileCButton", args, 3); X XtManageChild(fileCButton); X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR("File...", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNaccelerator, "Ctrl <Key> f"); X XtSetArg(args[2], XmNacceleratorText, X XmStringCreateLtoR("!f", XmSTRING_DEFAULT_CHARSET)); X filePbutton = XmCreatePushButtonGadget(filePMenu, "filePbutton", args, 3); X XtManageChild(filePbutton); X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR("Search...", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNaccelerator, "Ctrl <Key> s"); X XtSetArg(args[2], XmNacceleratorText, X XmStringCreateLtoR("!s", XmSTRING_DEFAULT_CHARSET)); X searchPbutton = XmCreatePushButtonGadget(filePMenu, X "searchPbutton", args, 3); X XtManageChild(searchPbutton); X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR("Exit", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNaccelerator, "Ctrl <Key> e"); X XtSetArg(args[2], XmNacceleratorText, X XmStringCreateLtoR("!e", XmSTRING_DEFAULT_CHARSET)); X quitPbutton = XmCreatePushButtonGadget(filePMenu, "quitPbutton", args, 3); X XtManageChild(quitPbutton); X X XtAddCallback(filePbutton, XmNactivateCallback, File, NULL); X XtAddCallback(searchPbutton, XmNactivateCallback, PopupSearch, NULL); X XtAddCallback(quitPbutton, XmNactivateCallback, ManageQuit, NULL); } X static MenuButtonStruct helpButtons[] ={ X { NULL, "Gdb Help...", "", "helpPMB", Help, "Ctrl <Key> h", "!h" }, }; X static MenuButtonStruct runningButtons[] = { X { NULL, "Run", "run\n", "runPMB", DoIt, "Ctrl <Key> r", "!r" }, X { NULL, "Continue", "cont\n", "contPMB", DoIt, "", "" }, X { NULL, "Next", "next\n", "nextPMB", DoIt, "Ctrl <Key> n", "!n" }, X { NULL, "Step", "step\n", "stepPMB", DoIt, "Ctrl <Key> s", "!t" }, X { NULL, "Finish", "finish\n", "finishPMB", DoIt, "", "" }, }; X static MenuButtonStruct dataButtons[] = { X { NULL, "Print", "", "printPMB", Print, "Ctrl <Key> p", "!p"}, X { NULL, "Display...", "", "displayPMB", Display_, "", ""}, X { NULL, "Undisplay", "", "undisplayPMB", Undisplay, "", "" }, }; X static MenuButtonStruct breakpointsButtons[] = { X { NULL, "Break", "break", "breakPMB", Break, "Ctrl <Key> b", "!b" }, X { NULL, "Clear", "", "clearPMB", Clear, "", "" }, X { NULL, "Tbreak", "tbreak", "tbreakPMB", Break, "", ""}, }; X static MenuButtonStruct stackButtons[] = { X { NULL, "Up", "up\n", "upPMB", DoIt, "Ctrl <Key> u", "!u" }, X { NULL, "Down", "down\n", "downPMB", DoIt, "Ctrl <Key> d", "!d" }, }; X static MenuButtonStruct infoButtons[] = { X { NULL, "Locals", "info locals\n", "ilocalsPMB", DoIt, "", "" }, X { NULL, "Args", "info args\n", "iargsPMB", DoIt, "", "" }, X { NULL, "Stack", "info stack\n", "istackPMB", DoIt, "", "" }, }; X static PMCBStruct commandMB[] = { X { NULL, NULL, "Running", "runningPM", "runningCB", runningButtons, 5, 'R'}, X { NULL, NULL, "Data", "dataPM", "dataCB", dataButtons, 3, 'D' }, X { NULL, NULL, "Breakpoints", "breakpointsPM", "breakpointsCB", X breakpointsButtons, 3, 'B' }, X { NULL, NULL, "Stack", "stackPM", "stackCB", stackButtons, 2, 'S' }, X { NULL, NULL, "Info", "infoPM", "infoCB", infoButtons, 3, 'I' }, }; X void CreateMenuButton(parent, Buttons, nbuttons) Widget parent; MenuButtonStruct Buttons[]; int nbuttons; { X Arg args[5]; X int widgetcount; X Cardinal nargs; X X for(widgetcount=0; widgetcount<nbuttons; widgetcount++) X { X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR(Buttons[widgetcount].Label, X XmSTRING_DEFAULT_CHARSET)); X nargs = 1; X if(*Buttons[widgetcount].accel != '\0') X { X XtSetArg(args[1], XmNaccelerator, Buttons[widgetcount].accel); X XtSetArg(args[2], XmNacceleratorText, X XmStringCreateLtoR(Buttons[widgetcount].acceltext, X XmSTRING_DEFAULT_CHARSET)); X nargs = 3; X } X Buttons[widgetcount].Button = X XmCreatePushButtonGadget(parent, X Buttons[widgetcount].RN, X args, nargs); X XtManageChild(Buttons[widgetcount].Button); X XtAddCallback(Buttons[widgetcount].Button, X XmNactivateCallback, X Buttons[widgetcount].CB, X Buttons[widgetcount].Argument); X } } X void CreatePulldownMenu(parent, MenuPane, Npanes) Widget parent; PMCBStruct MenuPane[]; int Npanes; { X Arg args[MAXARGS]; X int widgetcount; X X X for(widgetcount=0; widgetcount<Npanes; widgetcount++) X { X MenuPane[widgetcount].PM = X XmCreatePulldownMenu(parent, MenuPane[widgetcount].RNPM, X args, 0); X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR(MenuPane[widgetcount].Label, X XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNsubMenuId, MenuPane[widgetcount].PM); X XtSetArg(args[2], XmNmnemonic, MenuPane[widgetcount].mnemonic); X MenuPane[widgetcount].CB = X XmCreateCascadeButton(parent, MenuPane[widgetcount].RNCB, X args, 3); X XtManageChild(MenuPane[widgetcount].CB); X CreateMenuButton(MenuPane[widgetcount].PM, X MenuPane[widgetcount].Buttons, X MenuPane[widgetcount].Nbuttons); X } } X void CreateMenuPane(parent) Widget parent; { X Arg args[MAXARGS]; X X topForm = XtCreateManagedWidget("topForm", xmFormWidgetClass, parent, X args, 0); X X XtSetArg(args[0], XmNtopAttachment, XmATTACH_FORM); X XtSetArg(args[1], XmNleftAttachment, XmATTACH_FORM); X XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM); X topMenuBar = XmCreateMenuBar(topForm, "topMenuBar", args, 3); X XtManageChild(topMenuBar); X X XtSetArg(args[0], XmNbottomAttachment, XmATTACH_FORM); X XtSetArg(args[3], XmNtopWidget, topMenuBar); X XtSetArg(args[4], XmNtopAttachment, XmATTACH_WIDGET); X vpane = XtCreateManagedWidget( "vpane", xmPanedWindowWidgetClass, X topForm, args, 5); X X CreateFileMenuPane(topMenuBar); X X commandPMenu = XmCreatePulldownMenu(topMenuBar, "commandPMenu", args, 0); X X XtSetArg(args[0], XmNsubMenuId, commandPMenu); X XtSetArg(args[1], XmNlabelString, X XmStringCreateLtoR("Commands", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[2], XmNmnemonic, 'C'); X commandsCButton = XmCreateCascadeButton(topMenuBar, "commandsCButton", X args, 3); X XtManageChild(commandsCButton); X X CreatePulldownMenu(commandPMenu, commandMB, 5); X X helpPMenu = XmCreatePulldownMenu(topMenuBar, "helpPMenu", args, 0); X XtSetArg(args[0], XmNsubMenuId, helpPMenu); X XtSetArg(args[1], XmNlabelString, X XmStringCreateLtoR("Help", XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[2], XmNmnemonic, 'H'); X helpCButton = XmCreateCascadeButton(topMenuBar, "helpCButton", X args, 3); X XtManageChild(helpCButton); X CreateMenuButton(helpPMenu, helpButtons, 1); X } X X /* X * Top level function for creating all the xdbx subwindows. X */ void CreateSubWindows(parent) Widget parent; { X Arg args[MAXARGS]; X Cardinal n; X XmFontList labelFontList; X X X labelFontList = XmFontListCreate(XLoadQueryFont(XtDisplay(toplevel), X "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1"), X XmSTRING_DEFAULT_CHARSET); X X X CreateMenuPane(parent); X CreateFileWindow(vpane); X CreateSourceWindow(vpane); X CreateMessageWindow(vpane); X CreateDialogWindow(vpane); X X XtSetArg(args[0], XmNdialogTitle, X XmStringCreateLtoR("Symbol/Source Select", X XmSTRING_DEFAULT_CHARSET)); X fileSel = XmCreateFileSelectionDialog(toplevel, "fileSel", args, 1); X XtSetArg(args[0], XmNkeyboardFocusPolicy, XmPOINTER); X XtSetValues(XtParent(fileSel), args, 1); X X XtSetArg(args[1], XmNhighlightOnEnter, True); X XtSetArg(args[0], XmNfontList, labelFontList); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, X XmDIALOG_FILTER_TEXT), args, 2); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_TEXT), args, 2); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, X XmDIALOG_FILTER_LABEL), args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_DIR_LIST), args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_DIR_LIST_LABEL), X args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_LIST), args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_LIST_LABEL), X args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_OK_BUTTON), X args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_APPLY_BUTTON), X args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_CANCEL_BUTTON), X args, 1); X XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_SELECTION_LABEL), X args, 1); X X XtUnmanageChild(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_HELP_BUTTON)); X X XtAddCallback(fileSel, XmNokCallback, OKCallBack, NULL); X XtAddCallback(fileSel, XmNcancelCallback, CancelCallBack, NULL); X X CreateDisplayWindow(toplevel); X CreateHelpWindow(toplevel); X CreateSearchPopup(toplevel); X X XtSetArg(args[0], XmNmessageString, X XmStringCreateLtoR("OK to Exit Mxgdb?", X XmSTRING_DEFAULT_CHARSET)); X XtSetArg(args[1], XmNdialogTitle, X XmStringCreateLtoR("Mxgdb - Alert", X XmSTRING_DEFAULT_CHARSET)); X exitWarning = XmCreateQuestionDialog(toplevel, "exitWarning", args, 2); X XtAddCallback(exitWarning, XmNokCallback, Quit, NULL); X XtUnmanageChild(XmMessageBoxGetChild(exitWarning, XmDIALOG_HELP_BUTTON)); X XtSetArg(args[0], XmNfontList, labelFontList); X XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_CANCEL_BUTTON) X , args, 1); X XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_OK_BUTTON) X , args, 1); X XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_CANCEL_BUTTON) X , args, 1); X XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_MESSAGE_LABEL) X , args, 1); } 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 void UpdateFileLabel(string) char *string; { X Arg args[MAXARGS]; X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET)); X XtSetValues(fileLabel, args, 1); X } X void UpdateLineLabel(line) Cardinal line; { 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[0], XmNlabelString, X XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET)); X XtSetValues(lineLabel, args, 1); } X /*--------------------------------------------------------------------------+ X | | X | Note : UpdateMessageWindow assumes that the format string | X | can only contain one %s specifier. | X | arg is either NULL or is a string. | X | format is a string (never NULL). | X | | X +--------------------------------------------------------------------------*/ void UpdateMessageWindow(format, arg) X char *format, *arg; { X char *message; X char string[LINESIZ]; X int fulllength; X Arg args[MAXARGS]; X Cardinal n; X X fulllength = strlen (" ") + strlen (format) + 1 X + ((arg == NULL) ? 0 : strlen (arg)); X X if (fulllength > LINESIZ) X message = (char*) XtMalloc (fulllength); X else X message = string; X X strcpy(message, " "); X sprintf(message + strlen(message), format, arg); X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR(message, XmSTRING_DEFAULT_CHARSET)); X XtSetValues(messageWindow, args, 1); X X if (fulllength > LINESIZ) X XtFree(message); } X void ClearMessageWindow() { X Arg args[MAXARGS]; X X XtSetArg(args[0], XmNlabelString, X XmStringCreateLtoR("", XmSTRING_DEFAULT_CHARSET)); X XtSetValues(messageWindow, args, 1); } X SHAR_EOF chmod 0664 mxgdb/windows.c || echo 'restore of mxgdb/windows.c failed' Wc_c="`wc -c < 'mxgdb/windows.c'`" test 21601 -eq "$Wc_c" || echo 'mxgdb/windows.c: original size 21601, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= mxgdb/handler.c ============== if test -f 'mxgdb/handler.c' -a X"$1" != X"-c"; then echo 'x - skipping mxgdb/handler.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting mxgdb/handler.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/handler.c' && static char rcsid[] = "$Id: handler.c,v 1.1.1.1 1991/05/16 21:42:25 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 SHAR_EOF true || echo 'restore of mxgdb/handler.c failed' fi echo 'End of part 6' echo 'File mxgdb/handler.c is continued in part 7' echo 7 > _shar_seq_.tmp exit 0 -- == James Tsillas Bull HN Information Systems Inc. == == (508) 294-2937 300 Concord Road 826A == == jtsillas@bubba.ma30.bull.com Billerica, MA 01821 == == == == The opinions expressed above are solely my own and do not reflect == == those of my employer. == -== no solicitations please ==-