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 5/10) Organization: Bull HN, Worldwide Information Systems, Billerica, Mass., USA Distribution: alt Date: 6 Sep 91 14:25:36 Message-ID: Sender: news@mips2.ma30.bull.com (Usenet News Manager) ---- Cut Here and feed the following to sh ---- #!/bin/sh # this is mxgdb.05 (part 5 of a multipart archive) # do not concatenate these parts, unpack them in order with /bin/sh # file mxgdb/gdb_parser.c continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 5; 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_parser.c' else echo 'x - continuing file mxgdb/gdb_parser.c' sed 's/^X//' << 'SHAR_EOF' >> 'mxgdb/gdb_parser.c' && X X while (1) X if (fgets(s, LINESIZ, dbxfp)) X { X if (debug) X fprintf(stderr, "=>%s", s); X X if (strstr(s," is built-in.")) /* error for document of built-in command */ X { X AppendDialogText(s); X error_cmd = TRUE; X bell(0); X break; X } X X while (strstr(s,"Redefine command ") X || strstr(s,"Really redefine built-in command ")) { X write_dbx ("y\n"); /* answer to question if any */ X fgets(s, LINESIZ, dbxfp); X } X if (!strcmp(s,"End with a line saying just \"end\".\n")) X break; X } X X /* write command definition */ X X end_found = FALSE; X X while (fgets (s, LINESIZ, fp)) X { X if (!error_cmd) X { X AppendDialogText(s); X write_dbx (s); X } X X if (match(command_pattern, s, C_END) != -1) X { X end_found = TRUE; X break; X } X } X X if ((!error_cmd) && (!end_found)) X { X AppendDialogText("Error : missing \"end\" in file.\n"); X bell(0); X write_dbx ("end\n"); X } X X return TRUE; X } X X return FALSE; } X X SHAR_EOF echo 'File mxgdb/gdb_parser.c is complete' && chmod 0644 mxgdb/gdb_parser.c || echo 'restore of mxgdb/gdb_parser.c failed' Wc_c="`wc -c < 'mxgdb/gdb_parser.c'`" test 18249 -eq "$Wc_c" || echo 'mxgdb/gdb_parser.c: original size 18249, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= mxgdb/gdb_regex.h ============== if test -f 'mxgdb/gdb_regex.h' -a X"$1" != X"-c"; then echo 'x - skipping mxgdb/gdb_regex.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting mxgdb/gdb_regex.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/gdb_regex.h' && /* $Id: gdb_regex.h,v 1.2 1991/06/28 20:32:32 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 /* X * gdb_regex.h: X * X * Regular expression pattern matching for GNU gdb. 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 #define TK_MESG 0 #define TK_STOP 1 #define TK_FUNC 2 #define TK_LINE 3 #define TK_FILE 4 #define TK_DISP 5 X #define O_EXEC_MESS_AFTER 0 #define O_EXEC_MESS_BEFORE 1 #define O_EXEC 2 #define O_DONE 3 #define O_BREAK 4 /* Instead of O_STOPAT & O_STOPIN */ #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 chmod 0644 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/global.h ============== if test -f 'mxgdb/global.h' -a X"$1" != X"-c"; then echo 'x - skipping mxgdb/global.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting mxgdb/global.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/global.h' && /* $Id: global.h,v 1.13 1991/08/23 16:34:37 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 * Modifications for use under System V X * X * Copyright 1990 Bull Worldwide Information Systems, 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 Bull Worldwide X * Information Systems not be used in advertising or publicity pertaining X * to distribution of the software without specific, written prior X * permission. Bull 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 * BULL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT X * SHALL BULL 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 SYSV: James Tsillas X * XXGDB Created: March, 1991 X * X *****************************************************************************/ X /* global.h: X * X * Contain extern declarations of variables and functions. X */ X #ifdef __GNUC__ # define alloca __builtin_alloca #endif X #if !defined(MAXPATHLEN) && !defined(Mips) #define MAXPATHLEN 1024 #endif X X X #ifdef SYSV # define MAX(a,b) ((a)>(b)?(a):(b)) # define MIN(a,b) ((a)>(b)?(b):(a)) #ifdef SCO # include #endif #else # define sigset signal #endif X #include "defs.h" X /* callgdb.c */ X extern void callgdb(); /* fork child, exec dbx */ X /* command.c */ X extern void Break(); extern void DoIt(); extern void Print(); extern void Display_(); extern void Undisplay(); extern void Clear(); extern void Quit(); extern void Help(); extern void PopupSearch(); extern void CreateCommandPanel(); extern void send_command(); extern char *get_command(); extern void insert_command(); extern void delete_command(); X /* dbx.c */ extern void debug_init(); /* initial source display */ extern void read_dbx(); /* get data from dbx */ extern void write_dbx(); /* send data to dbx */ extern void query_dbx(); /* ask dbx for info */ X /* dialog.c */ X extern void CreateDialogWindow(); extern void AppendDialogText(); /* append text to buffer */ X /* filemenu.c */ X extern void File(); /* file button callback */ extern void OKCallBack(); extern void CancelCallBack(); X /* handler.c */ X extern void TextSetTopPosition(); /* sets topDisplayPosition */ extern void AdjustText(); /* adjust display position */ extern void exec_handler(); /* run, cont, next, step */ extern void done_handler(); /* run, cont, next, step */ extern void stop_at_handler(); /* stop at line */ extern void stop_in_handler(); /* stop in function */ extern void updown_handler(); /* move up/down the stack */ extern void clear_handler(); /* clear stop signs */ extern void func_handler(); /* display function */ extern void file_handler(); /* display file */ extern void debug_handler(); /* debug program */ extern void cd_handler(); /* change directory */ extern void pwd_handler(); /* print working directory */ extern void use_handler(); /* update use directory list */ extern void search_handler(); /* display searched string */ extern void list_handler(); /* list source code */ extern void display_handler(); /* show display variables */ extern void help_handler(); X extern Widget helplabels[]; extern Widget helpbuttons[]; X /* parser.c */ X extern void parser_init(); /* initialization */ extern void parse(); /* parse dbx output */ extern void filter(); /* modify dbx output */ X /* signals.c */ extern void trap_signals(); /* signal handling for xdbx */ X /* signs.c */ X extern void signs_init(); /* initilalize routine */ extern void DisplayStop(); /* show stop sign */ extern void UpdateStops(); /* update position of stops */ extern void ClearStops(); /* mark all stops invalid */ extern void RemoveStop(); /* undisplay stop sign */ extern void UpdateArrow(); /* update position of arrow */ extern void UpdateUpdown(); /* update position of updown */ extern void UpdateBomb(); /* update position of bomb */ X /* source.c */ X extern void SelectStart(); /* modified select-start */ extern void SelectEnd(); /* modified select-end */ extern void SelectWord(); /* my select word */ extern void PrintSelection(); /* select variable and print */ extern void Update(); /* update line label */ extern void source_init(); /* init routine */ extern void CreateSourceWindow(); extern int LoadFile(); /* display source file */ extern int LoadCurrentFile(); /* display source file */ extern char *GetPathname(); /* get full path name of file */ extern void PopupCommands(); /* Manage the commandDialog */ extern void MakeDirList(); /* maintain list of dirs */ X /* utils.c */ X extern XmTextPosition TextGetLastPos(); /* get last pos of text */ extern int TextPositionToLine(); /* convert line # to text pos */ extern int LineToStop_no(); /* convert line # to stop # */ extern void bell(); /* sound bell */ extern char *concat(); /* substring search */ X /* windows.c */ X extern void CreateSubWindows(); /* all subwindows of xdbx */ extern void UpdateFileLabel(); /* update current file name */ extern void UpdateLineLabel(); /* update current line num */ extern void UpdateMessageWindow(); /* update xdbx message */ extern void CreateSearchPopup(); X /* extern variables */ X extern Display *display; extern XtAppContext app_context; extern Widget toplevel, fileWindow, commandDialog, X sourceForm, sourceScroll, sourceWindow, messageWindow, X commandWindow, dialogWindow, searchWindow, separator, X displayWindow, fileSel, displayFD, scrollV, scrollH, X searchText, pageRbutton, pageLbutton, breakbutton, X stepbutton, nextbutton, printbutton, downbutton, upbutton, X stackbutton, contbutton, finishbutton, runbutton, X dispbutton, undispbutton, clearbutton, printsbutton, X argsbutton, localsbutton, helpFD, helpselectscroll, X helpupbutton, helpupbuttonlabel; X X X extern MxgdbResources app_resources; /* application resources */ extern char xdbxinit[]; /* initialization filename */ extern char *dbxprompt; /* dbx prompt string */ extern char *xdbxprompt; /* xdbx prompt string */ extern Boolean Tstartup; extern Boolean debug; X extern FileRec *displayedFile; /* pointer to current file info */ extern Tokens Token; /* token structure */ extern PatternRec dataPattern[]; /* data display pattern */ X extern Boolean Echo; /* echo dbx output onto window ? */ extern Boolean Prompt; /* command or program input ? */ extern Boolean Parse; /* flag for parser */ extern Boolean FalseSignal; /* real/false signal ? */ extern int dbxpid; /* dbx process id */ extern FILE *dbxfp; /* file pointer to dbx process */ X extern char CurrentFile[]; /* string for dbx output */ extern char cwd[]; /* current working directory of dbx */ X extern Arrow arrow; /* arrow widget and mapped info */ extern Updown updown; /* updown widget and mapped info */ extern Stops stops[]; /* stop widget and mapped info */ extern Bomb bomb; /* bomb widget and mapped info */ extern Cardinal nstops; /* number of stops */ extern ArrowSign arrowsign[]; extern UpdownSign updownsign[]; extern StopSign stopsign[]; extern BombSign bombsign[]; X extern void display_info_handler(); extern void break_handler(); extern void info_dir_handler(); extern void directory_handler(); extern void info_line_handler(); extern void info_break_handler(); X SHAR_EOF chmod 0664 mxgdb/global.h || echo 'restore of mxgdb/global.h failed' Wc_c="`wc -c < 'mxgdb/global.h'`" test 11294 -eq "$Wc_c" || echo 'mxgdb/global.h: original size 11294, 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 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 0644 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/signals.c ============== if test -f 'mxgdb/signals.c' -a X"$1" != X"-c"; then echo 'x - skipping mxgdb/signals.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting mxgdb/signals.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/signals.c' && static char rcsid[] = "$Id: signals.c,v 1.4 1991/08/23 16:34:42 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 /* 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 #include #include #include #include "global.h" X /* Kill the dbx child process and then exits. */ /* ARGSUSED */ static void kill_handler(sig, code, scp, addr) X int sig, code; X struct sigcontext *scp; X char *addr; { 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 static void quit_handler() { X X int status; X int pid; X /* wait for the child to report its status; if the child has died, X * exit gracefully. X */ X if(dbxpid) X { #if defined(SYSV) && !defined(SUNOS4) X pid = waitpid(dbxpid, &status , WNOHANG|WUNTRACED); #else X pid = wait3(&status, WNOHANG|WUNTRACED, NULL); #endif X if (dbxpid == pid && (WIFEXITED(status) || WIFSIGNALED(status)) && X !WIFSTOPPED(status)) X { X exit(1); X } X } } X X static void stop_handler() { X if (dbxpid) X kill(dbxpid, SIGSTOP); /* stop dbx process */ X kill(0, SIGSTOP); /* stop own process */ } X X static void cont_handler() { X if (dbxpid) { X sleep(1); /* we need this */ X kill(dbxpid, SIGCONT); /* continue dbx after stop */ X } } X X /* X * Trap signals to xdbx so that the child process can be handled properly. X */ void trap_signals() { X sigset(SIGINT, kill_handler); X sigset(SIGQUIT, kill_handler); X sigset(SIGILL, kill_handler); X sigset(SIGBUS, kill_handler); X sigset(SIGSEGV, kill_handler); X sigset(SIGTERM, kill_handler); X X sigset(SIGTSTP, stop_handler); /* stop signal from keyboard */ X sigset(SIGCONT, cont_handler); /* continue after stop */ X sigset(SIGCHLD, quit_handler); /* child status has changed */ } SHAR_EOF chmod 0664 mxgdb/signals.c || echo 'restore of mxgdb/signals.c failed' Wc_c="`wc -c < 'mxgdb/signals.c'`" test 4220 -eq "$Wc_c" || echo 'mxgdb/signals.c: original size 4220, 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.2 1991/08/23 16:34:38 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 SHAR_EOF true || echo 'restore of mxgdb/handler.c failed' fi echo 'End of part 5' echo 'File mxgdb/handler.c is continued in part 6' echo 6 > _shar_seq_.tmp exit 0