home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume16 / xxgdb / patch6 < prev    next >
Encoding:
Text File  |  1992-02-21  |  33.7 KB  |  1,294 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: pierre@la.tce.com (Pierre Willard)
  4. Subject: v16i093: patch xxgdb 1.06 from 1.05, Patch1, Part01/01
  5. Message-ID: <1992Feb22.183636.4583@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-16i093-olvwm-3.0@uunet.UU.NET>
  10. Date: Sat, 22 Feb 1992 18:36:36 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: pierre@la.tce.com (Pierre Willard)
  14. Posting-number: Volume 16, Issue 93
  15. Archive-name: xxgdb/patch6
  16. Patch-To: xxgdb: Volume 14, Issue 100
  17.  
  18.  
  19.     XXGDB version 1.06 ( X window interface to the GDB debugger )
  20.     -------------------------------------------------------------
  21.  
  22. Posting history :
  23. January 91 : xxgdb 1.01 complete source files (Volume 11, Issue 42-55),
  24. May 91 :     xxgdb 1.03 (patch from 1.01) (Volume 12, Issue 78),
  25. July 91 :    xxgdb 1.04 (patch from 1.03) (Volume 13, Issue 80).
  26. Sept 91 :    xxgdb 1.05 (patch from 1.04) (Volume 14, Issue 100).
  27. Feb 92:         xxgdb 1.06 (patch from 1.05) (Volume 16, Issue 93).
  28.  
  29. Please find in the following the differences from version
  30. 1.05 to 1.06.
  31.  
  32. Please post this complete message to comp.sources.x
  33.  
  34. NEW FEATURES OF VERSION 1.06  :
  35.  
  36.     Fix bug in creating more than 16 popup windows.
  37.     Edit defs.h for X11R5.
  38.     Remove xxgdb start-up error message with no file specified.
  39.     Fix bug display arrays.
  40.     Port to SysVr4 and miscellaneous improvements (Mark J. Hewitt)
  41.     Fix bug for directories in filemenu (Norbert Kiesel)
  42.     Fix bug pointers in arrays in popup windows.
  43.     Add option -nx for xxgdb.
  44.     Color for scrollbar is black in resource file.    
  45.     Fix pb when no image file is loaded at startup (Tom Pavel)
  46.  
  47. TO PATCH XXGDB FROM VERSION 1.05 TO VERSION 1.06 :
  48.  
  49.     cd <original xxgdb 1.05 source directory>
  50.     chmod +rw *
  51.     patch < <patch_file>
  52.     
  53. THE FOLLOWING IS THE PATCH FILE FOR XXGDB 1.06 FROM XXGDB 1.05 :
  54. diff -rc2 v1.05/Imakefile v1.06/Imakefile
  55. *** v1.05/Imakefile    Tue May 14 09:00:24 1991
  56. --- v1.06/Imakefile    Thu Oct 31 16:31:44 1991
  57. ***************
  58. *** 8,11 ****
  59. --- 8,13 ----
  60.   #endif
  61.   
  62. + CC = gcc -v
  63.   #if defined(SunArchitecture)
  64.   #if OSMajorVersion >= 4
  65. diff -rc2 v1.05/Makefile v1.06/Makefile
  66. *** v1.05/Makefile    Wed Aug 28 18:35:53 1991
  67. --- v1.06/Makefile    Thu Oct 31 16:31:52 1991
  68. ***************
  69. *** 42,46 ****
  70.                  AR = ar cq
  71.     BOOTSTRAPCFLAGS =
  72. !                CC = gcc -v
  73.   
  74.            COMPRESS = compress
  75. --- 42,46 ----
  76.                  AR = ar cq
  77.     BOOTSTRAPCFLAGS =
  78. !                CC = cc
  79.   
  80.            COMPRESS = compress
  81. ***************
  82. *** 227,230 ****
  83. --- 227,232 ----
  84.   
  85.   DEFGDB =  -DGDB -g
  86. + CC = gcc -v
  87.   
  88.           DEFINES = -DSUNOS4 $(DEFGDB)
  89. diff -rc2 v1.05/README v1.06/README
  90. *** v1.05/README    Tue Jan 15 12:32:09 1991
  91. --- v1.06/README    Mon Dec 23 16:49:06 1991
  92. ***************
  93. *** 1,4 ****
  94.   
  95. ! This is the source files for xxgdb v1.01 (and xdbx 2.1 patch level 2)
  96.   ----------------------------------------------------------------------
  97.   
  98. --- 1,4 ----
  99.   
  100. ! This is the source files for xxgdb v1.06 (and xdbx 2.1)
  101.   ----------------------------------------------------------------------
  102.   
  103. diff -rc2 v1.05/XDbx.ad v1.06/XDbx.ad
  104. *** v1.05/XDbx.ad    Thu May 30 17:51:39 1991
  105. --- v1.06/XDbx.ad    Mon Nov 11 15:12:41 1991
  106. ***************
  107. *** 8,12 ****
  108.   *messageWindow.background:        snow2
  109.   *commandWindow.background:         snow2
  110. ! *Scrollbar.foreground:             snow3
  111.   
  112.   *allowShellResize:                  True
  113. --- 8,12 ----
  114.   *messageWindow.background:        snow2
  115.   *commandWindow.background:         snow2
  116. ! *Scrollbar.foreground:             black
  117.   
  118.   *allowShellResize:                  True
  119. diff -rc2 v1.05/XXGDB_README v1.06/XXGDB_README
  120. *** v1.05/XXGDB_README    Mon Sep 23 16:13:14 1991
  121. --- v1.06/XXGDB_README    Thu Dec  5 13:10:02 1991
  122. ***************
  123. *** 105,115 ****
  124.   
  125.       Pierre Willard
  126. !     pierre@tce.com
  127.       Thomson Consumer Electronics, Inc.
  128.   
  129. ! XXGDB version 1.05
  130.   ------------------
  131.   
  132.       >> SEE ALSO XDBX DOCUMENTATION <<
  133.       
  134.       XXGDB is a X window interface to the GDB debugger.
  135. --- 105,116 ----
  136.   
  137.       Pierre Willard
  138. !     pierre@la.tce.com
  139.       Thomson Consumer Electronics, Inc.
  140.   
  141. ! XXGDB version 1.06
  142.   ------------------
  143.   
  144.       >> SEE ALSO XDBX DOCUMENTATION <<
  145. +     >> SEE ALSO xxgdb.man DOCUMENTATION <<
  146.       
  147.       XXGDB is a X window interface to the GDB debugger.
  148. ***************
  149. *** 255,259 ****
  150.                   Fix bug in search window.
  151.                   Update for gdb 4.0 (PW)(SH).
  152. !                 
  153.   
  154.   Acknowledgement
  155. --- 256,270 ----
  156.                   Fix bug in search window.
  157.                   Update for gdb 4.0 (PW)(SH).
  158. !     1.06    October 1991
  159. !                 Fix bug in creating more than 16 popup windows.
  160. !                 Edit defs.h for X11R5.
  161. !                 Remove xxgdb start-up error message with no file specified.
  162. !                 Fix bug display arrays.
  163. !                 Port to SysVr4 and miscellaneous improvements (MJH)
  164. !                 Fix bug for directories in filemenu (Norbert Kiesel)
  165. !                 Fix bug pointers in arrays in popup windows.
  166. !                 Add option -nx for xxgdb.
  167. !                 Color for scrollbar is black in resource file.    
  168. !                 Fix pb when no image file is loaded at startup (Tom Pavel)
  169.   
  170.   Acknowledgement
  171. ***************
  172. *** 265,268 ****
  173. --- 276,280 ----
  174.       generic BSD machines.
  175.       Thanks to Stephan Heuer (SH) for some updates to gdb 4.0.
  176. +     Thanks to Mark J. Hewitt (MJH) for porting to SysVr4.
  177.   
  178.       
  179. diff -rc2 v1.05/calldbx.c v1.06/calldbx.c
  180. *** v1.05/calldbx.c    Thu Jul 18 17:44:08 1991
  181. --- v1.06/calldbx.c    Thu Oct 31 13:56:17 1991
  182. ***************
  183. *** 81,89 ****
  184.   
  185.   #ifdef SYSV 
  186.   #ifdef sco
  187.   #  include    <sys/fcntl.h>
  188. ! #endif
  189. ! #endif
  190.   
  191.   FILE               *dbxfp = NULL;        /* file pointer to dbx */
  192.   int                dbxpid = 0;        /* dbx process id */
  193. --- 81,101 ----
  194.   
  195.   #ifdef SYSV 
  196. + #ifdef SVR4                /* (MJH) Need to use STREAMS pseudo-ttys */
  197. + #define MASTER_CLONE "/dev/ptmx"
  198. + #include <sys/types.h>
  199. + #include <sys/stat.h>
  200. + #include <sys/stropts.h>
  201. + #include <fcntl.h>
  202. + #include <stdio.h>
  203. + #include <signal.h>
  204. + #else
  205.   #ifdef sco
  206.   #  include    <sys/fcntl.h>
  207. ! #endif /* sco */
  208. ! #endif /* SVR4 */
  209. ! #endif /* SYSV */
  210.   
  211. + extern char *progname;        /* (MJH) */
  212.   FILE               *dbxfp = NULL;        /* file pointer to dbx */
  213.   int                dbxpid = 0;        /* dbx process id */
  214. ***************
  215. *** 94,99 ****
  216. --- 106,113 ----
  217.   
  218.   static int    dbxInputId;        /* dbx input id */
  219. + #ifndef SVR4                /* (MJH) */
  220.   static char     pty[11] = "/dev/pty??";    /* master side of pseudo-terminal */
  221.   static char     tty[11] = "/dev/tty??";    /* slave side of pseudo-terminal */
  222. + #endif /* SVR4 */
  223.   extern char    *dbxprompt;
  224.   
  225. ***************
  226. *** 105,109 ****
  227.   static int open_master()
  228.   {
  229. !     int  i, master; 
  230.       char c;
  231.   
  232. --- 119,132 ----
  233.   static int open_master()
  234.   {
  235. !     int master;
  236. !     
  237. ! #ifdef SVR4                /* (MJH) Use STREAMS */
  238. !     if((master = open(MASTER_CLONE, O_RDWR)) < 0)
  239. !     perror(MASTER_CLONE);
  240. !     else
  241. !     return master;
  242. ! #else
  243. !     int  i;
  244.       char c;
  245.   
  246. ***************
  247. *** 123,126 ****
  248. --- 146,150 ----
  249.       }
  250.   #endif
  251. + #endif /* SVR4 */
  252.   
  253.   #ifdef GDB
  254. ***************
  255. *** 132,145 ****
  256.   }
  257.   
  258. ! static int open_slave()
  259.   {
  260.       int slave;
  261.   
  262.       tty[8] = pty[8];
  263.       tty[9] = pty[9];
  264. !     if ((slave = open(tty, O_RDWR)) >= 0)
  265. !     return (slave);
  266. !     fprintf(stderr, "open: cannot open slave pty %s", tty);
  267. !     exit(1);
  268.   }
  269.   
  270. --- 156,192 ----
  271.   }
  272.   
  273. ! /*ARGSUSED*/
  274. ! static int open_slave(master)
  275. !     int master;
  276.   {
  277.       int slave;
  278.   
  279. + #ifdef SVR4                /* (MJH) */
  280. +     char *slave_name;
  281. +     extern char *ptsname(int master);
  282. +     void (*handler)();
  283. +     if((handler = signal(SIGCHLD, SIG_DFL) != SIG_ERR) &&
  284. +        (grantpt(master) == 0) &&
  285. +        (signal(SIGCHLD, handler) == SIG_DFL) &&
  286. +        (unlockpt(master) == 0) &&
  287. +        ((slave_name = ptsname(master)) != NULL) &&
  288. +        ((slave = open(slave_name, O_RDWR)) >= 0) &&
  289. +        (ioctl(slave, I_PUSH, "ptem") >= 0) &&
  290. +        (ioctl(slave, I_PUSH, "ldterm") >= 0))
  291. +     return slave;
  292. +     perror("Pseudo-tty slave");
  293. +     fprintf(stderr, "open: cannot open slave pty %s", slave_name);
  294. +     exit(1);
  295. + #else
  296.       tty[8] = pty[8];
  297.       tty[9] = pty[9];
  298. !     if ((slave = open(tty, O_RDWR)) < 0)
  299. !         {
  300. !         perror(tty);
  301. !         exit(1);
  302. !         }
  303. !     return slave;
  304. ! #endif /* SVR4 */
  305.   }
  306.   
  307. ***************
  308. *** 190,193 ****
  309. --- 237,243 ----
  310.       sprintf(dbxprompt, "(%s) ", debugger);
  311.       }
  312. +     
  313. +     if (debug)
  314. +         fprintf(stderr,"debugger=\"%s\"\nprompt=\"%s\"\n",debugger,dbxprompt);
  315.     
  316.       /*
  317. ***************
  318. *** 196,210 ****
  319.        * controlling tty.
  320.        */
  321. !     if ((fd = open("/dev/tty", O_RDWR)) > 0) {
  322.   #ifndef SYSV 
  323. !     ioctl(fd, TIOCNOTTY, 0);
  324.   #endif /* SYSV */
  325. !     close(fd);
  326. !     }
  327.   
  328.       master = open_master();
  329.       
  330. ! #ifndef SYSV 
  331. !     slave = open_slave();
  332.   #endif
  333.   
  334. --- 246,269 ----
  335.        * controlling tty.
  336.        */
  337. ! #if defined(SVR4)    /* (MJH) */
  338. !     if ((tcgetsid(0) != tcgetpgrp(0)) && /* Check if fore- or back-ground  */
  339. !     (fd = open("/dev/tty", O_RDWR|O_NDELAY)) > 0) {
  340. !       ioctl(fd, TIOCNOTTY, 0);
  341. !       close(fd);
  342. !       }
  343. ! #else    /* not SVR4 */
  344. !     if ((fd = open("/dev/tty", O_RDWR)) > 0) {
  345.   #ifndef SYSV 
  346. !       ioctl(fd, TIOCNOTTY, 0);
  347.   #endif /* SYSV */
  348. !       close(fd);
  349. !       }
  350. ! #endif    /* SVR4 */
  351.   
  352.       master = open_master();
  353.       
  354. ! #if defined(SVR4) || !defined(SYSV)
  355. !     slave = open_slave(master);
  356.   #endif
  357.   
  358. ***************
  359. *** 211,219 ****
  360.       dbxpid = fork();
  361.       if (dbxpid == -1) {
  362. ! #ifdef GDB
  363. !     perror("xxgdb error: cannot fork process");
  364. ! #else
  365. !     perror("xdbx error: cannot fork process");
  366. ! #endif
  367.       exit(1);
  368.       }
  369. --- 270,275 ----
  370.       dbxpid = fork();
  371.       if (dbxpid == -1) {
  372. !     sprintf(errmsg, "%s error: Cannot fork %s\n", progname, debugger);    /* (MJH) */
  373. !     perror(errmsg);
  374.       exit(1);
  375.       }
  376. ***************
  377. *** 227,231 ****
  378. --- 283,291 ----
  379.        *        register dbx input with X
  380.        */
  381. + #if defined(SVR4) || !defined(SYSV)        /* (MJH) */
  382.       close(slave);
  383. + #endif /* SYSV */
  384.       close(0);
  385.       close(1);
  386. ***************
  387. *** 232,236 ****
  388.       fcntl(master, F_SETFL, FNDELAY);
  389.       
  390. !     dbxfp = fdopen(master, "r+");
  391.       
  392.       /* (PW)10APR91 : I use 'setvbuf' instead of 'setlinebuf',
  393. --- 292,300 ----
  394.       fcntl(master, F_SETFL, FNDELAY);
  395.       
  396. !     if((dbxfp = fdopen(master, "r+")) == NULL)    /* (MJH) */
  397. !     {
  398. !         perror("Associating stdio stream with pty master");
  399. !         exit(1);
  400. !     }
  401.       
  402.       /* (PW)10APR91 : I use 'setvbuf' instead of 'setlinebuf',
  403. ***************
  404. *** 245,249 ****
  405.      
  406.   #ifdef SYSV
  407. !     setvbuf(dbxfp, dbxfbuf, _IONBF, BUFSIZ); */
  408.   #else
  409.   #ifdef BSD
  410. --- 309,313 ----
  411.      
  412.   #ifdef SYSV
  413. !     setvbuf(dbxfp, dbxfbuf, _IONBF, BUFSIZ);
  414.   #else
  415.   #ifdef BSD
  416. ***************
  417. *** 265,271 ****
  418.        */
  419.         
  420. ! #ifdef SYSV 
  421.           setpgrp();
  422. !         slave = open_slave();
  423.   #endif
  424.       close(master);
  425. --- 329,335 ----
  426.        */
  427.         
  428. ! #if defined(SYSV) && !defined(SVR4)        /* (MJH) */
  429.           setpgrp();
  430. !         slave = open_slave(master);
  431.   #endif
  432.       close(master);
  433. ***************
  434. *** 317,327 ****
  435.   #endif /* not SYSV */
  436.   
  437.       argv[0] = debugger;
  438.       execvp(debugger, argv);
  439. ! #ifdef GDB
  440. !     sprintf(errmsg, "xxgdb error: cannot exec %s", debugger);
  441. ! #else
  442. !     sprintf(errmsg, "xdbx error: cannot exec %s", debugger);
  443. ! #endif
  444.       perror(errmsg);
  445.       exit(1);
  446. --- 381,392 ----
  447.   #endif /* not SYSV */
  448.   
  449. + #ifdef SVR4                        /* (MJH) */
  450. +     tcsetpgrp(0, tcgetpgrp(0));
  451. +     tcsetpgrp(0, getpid());
  452. + #endif /* SVR4 */
  453.       argv[0] = debugger;
  454.       execvp(debugger, argv);
  455. !     sprintf(errmsg, "%s error: cannot exec %s", progname, debugger);
  456.       perror(errmsg);
  457.       exit(1);
  458. diff -rc2 v1.05/command.c v1.06/command.c
  459. *** v1.05/command.c    Mon Sep 23 13:59:50 1991
  460. --- v1.06/command.c    Thu Oct 31 16:31:23 1991
  461. ***************
  462. *** 339,345 ****
  463.       XtDestroyApplicationContext(app_context);
  464.       kill(dbxpid, SIGKILL);
  465. ! #ifdef SYSV 
  466. !     waitpid(&status, NULL, WNOHANG);
  467.   #else
  468.       wait3(&status, WNOHANG, NULL);
  469.   #endif /* SYSV */
  470. --- 339,349 ----
  471.       XtDestroyApplicationContext(app_context);
  472.       kill(dbxpid, SIGKILL);
  473. ! #ifdef SYSV
  474. ! #ifdef SVR4 
  475. !     status = waitpid(dbxpid, (int *)0, WNOHANG);    /* (MJH) */
  476.   #else
  477. +     waitpid(&status, NULL, WNOHANG);
  478. + #endif    /* SVR4 */
  479. + #else    /* not SYSV */
  480.       wait3(&status, WNOHANG, NULL);
  481.   #endif /* SYSV */
  482. ***************
  483. *** 818,822 ****
  484. --- 822,830 ----
  485.       }
  486.   
  487. + #ifdef GDB
  488.       write_dbx_available();
  489. + #else
  490. +     write_dbx(command);
  491. + #endif /* GDB */
  492.   }
  493.   
  494. diff -rc2 v1.05/datadpy.c v1.06/datadpy.c
  495. *** v1.05/datadpy.c    Fri Sep 20 14:34:56 1991
  496. --- v1.06/datadpy.c    Thu Oct 31 10:23:51 1991
  497. ***************
  498. *** 207,210 ****
  499. --- 207,225 ----
  500.       p = dataDpy->buf + dataDpy->linepos[fromLine];
  501.   
  502. + #ifdef GDB    /* (PW)  we now use a new parser which should work better,
  503. +     in particular for arrays */
  504. +     {
  505. +     char *parse_gdb_print();
  506. +     char *newcommand;
  507. +     
  508. +     newcommand = parse_gdb_print(command, dataDpy->buf, dataDpy->buf + left );
  509. +     if (*newcommand)
  510. +         {
  511. +         PopupMode = True;
  512. +         query_gdb(newcommand, PARSE_ON | ECHO_OFF | FILTER_OFF);
  513. +         }
  514. +     }
  515. + #else    /* not GDB */
  516.       if (re_match(dataPattern[D_FIELD].buf, p, strlen(p), 0, ®s) >= 0) {
  517.       r = dataPattern[D_FIELD].reg_token[TK_POINTER];
  518. ***************
  519. *** 240,243 ****
  520. --- 255,259 ----
  521.       else
  522.           strcpy(name, field[0]);
  523. +         
  524.       for (i=1; field[i]; i++) {
  525.           strcat(name, ".");
  526. ***************
  527. *** 250,255 ****
  528.   #else
  529.       query_dbx(command);
  530. ! #endif
  531.       }
  532.   }
  533.   
  534. --- 266,272 ----
  535.   #else
  536.       query_dbx(command);
  537. ! #endif    /* GDB */
  538.       }
  539. + #endif /* GDB */
  540.   }
  541.   
  542. ***************
  543. *** 632,637 ****
  544.   
  545.       /* Searches the table for an unused or empty slot */
  546. !     for (i=0; dataDpyTable && dataDpyTable[i] && dataDpyTable[i]->state == USED 
  547. !           && i < dataDpyTableSize; i++);
  548.       if (i == dataDpyTableSize) {            /* Table full */
  549.       dataDpyTableSize += ADD_SIZE;
  550. --- 649,655 ----
  551.   
  552.       /* Searches the table for an unused or empty slot */
  553. !     /* (PW)17OCT91 : test i < dataDpyTableSize first (else segment violation)*/
  554. !     for (i=0; dataDpyTable && i < dataDpyTableSize && dataDpyTable[i]
  555. !         && dataDpyTable[i]->state == USED ; i++);
  556.       if (i == dataDpyTableSize) {            /* Table full */
  557.       dataDpyTableSize += ADD_SIZE;
  558. ***************
  559. *** 674,675 ****
  560. --- 692,952 ----
  561.       XUndefineCursor(display, XtWindow(toplevel));
  562.   }
  563. + #ifdef GDB
  564. + #include <string.h>
  565. + #define GOODCHARNAME(c)                            \
  566. +             (    (((c) >='a') &&  ((c) <= 'z'))    \
  567. +             ||    (((c) >='A') &&  ((c) <= 'Z'))    \
  568. +             ||    (((c) >='0') &&  ((c) <= '9'))    \
  569. +             ||    ((c) == '_')                    \
  570. +             ||    ((c) == '$')                    \
  571. +             )
  572. + static char *result;        /* start of result buffer */
  573. + static int result_index;    /* current index in result buffer */
  574. + static char *start_txt;        /* pointer 1st char of output to parse */
  575. + static char *curr_txt;        /* current pointer in output to parse */
  576. + /*--------------------------------------------------------------------------+
  577. + |                                                                            |
  578. + |    Store a character into the buffer.                                        |
  579. + |                                                                            |
  580. + |    Note that characters are added to the buffer RIGHT TO LEFT !            |
  581. + |    This is because we parse the output from right to left.                    |
  582. + |                                                                            |
  583. + |    If the result buffer is full, we set result to "".                        |
  584. + |                                                                            |
  585. + +--------------------------------------------------------------------------*/
  586. + static void add_char(c)
  587. + char c;
  588. + {
  589. + int i;
  590. +     if (result_index == 0)    /* buffer full */
  591. +         {
  592. +         *result = 0;
  593. +         return;
  594. +         }
  595. +     
  596. +     result_index--;
  597. +     *(result+result_index) = c;
  598. + }
  599. + /*--------------------------------------------------------------------------+
  600. + |                                                                            |
  601. + |    Store a string into the buffer.                                            |
  602. + |                                                                            |
  603. + +--------------------------------------------------------------------------*/
  604. + static void add_string(s)
  605. + char *s;
  606. + {
  607. + int nbchar;
  608. +     nbchar = strlen(s);
  609. +     
  610. +     /* copy number from last digit */
  611. +     
  612. +     while (nbchar > 0)
  613. +         add_char(*(s + (--nbchar)));
  614. + }
  615. + /*--------------------------------------------------------------------------+
  616. + |                                                                            |
  617. + |    Store a number into the buffer.                                            |
  618. + |                                                                            |
  619. + +--------------------------------------------------------------------------*/
  620. + static void add_num(number)
  621. + int number;
  622. + {
  623. + char tmpnum[128];
  624. +     sprintf(tmpnum,"%d",number);
  625. +     add_string(tmpnum);
  626. + }
  627. + /*--------------------------------------------------------------------------+
  628. + |                                                                            |
  629. + |    Init buffer.                                                            |
  630. + |                                                                            |
  631. + |    Store a NULL character (as end of string).                                |
  632. + |                                                                            |
  633. + +--------------------------------------------------------------------------*/
  634. + static void init_result(buffer,buflen)
  635. + char *buffer;
  636. + int buflen;
  637. + {
  638. +     result = buffer;
  639. +     result_index = buflen;
  640. +     add_char(0);            /* end result by null char */
  641. + }
  642. + /*--------------------------------------------------------------------------+
  643. + |                                                                            |
  644. + |    Store the current variable or struct name.                                |
  645. + |                                                                            |
  646. + |    input :        curr_txt points to '=' character,                            |
  647. + |                start_txt points to beginning of the parse string.            |
  648. + |                                                                            |
  649. + |    output :    curr_txt points to character before 1st character of        |
  650. + |                    name.                                                    |
  651. + |                                                                            |
  652. + |    Note : we have to test for the beginning of the parse string,            |
  653. + |    because add_name() is called also for adding the "$n" name                |
  654. + |    of the gdb output.                                                        |
  655. + |                                                                            |
  656. + +--------------------------------------------------------------------------*/
  657. + static void add_name ()
  658. + {
  659. +     curr_txt--;                                /* point before '=' */
  660. +     while (*curr_txt == ' ') curr_txt--;    /* skip spaces */
  661. +     
  662. +     /* loop over name */
  663. +     while ((curr_txt >= start_txt) && GOODCHARNAME(*curr_txt))
  664. +         add_char(*curr_txt--);
  665. + }
  666. + /*--------------------------------------------------------------------------+
  667. + |                                                                            |
  668. + |    Skip all previous characters until corresponding " or ' character.        |
  669. + |                                                                            |
  670. + |    input : curr_txt points before ' or " character                            |
  671. + |                                                                            |
  672. + |    output : curr_txt points before corresponding ' or " character.            |
  673. + |                                                                            |
  674. + +--------------------------------------------------------------------------*/
  675. + void search_char(c)
  676. + char c;
  677. + {
  678. +     while(1)
  679. +         {
  680. +         while(c != *(curr_txt--));
  681. +         
  682. +         /* make sure there is not a '\' just before */
  683. +         
  684. +         if (*curr_txt != '\\')
  685. +             return;
  686. +         }
  687. + }
  688. + /*--------------------------------------------------------------------------+
  689. + |                                                                            |
  690. + |    Skip all previous characters until previous corresponding '{'.            |
  691. + |    All "{...}" sequences are skip.                                            |
  692. + |    Return the array item number (if applicable)                            |
  693. + |                                                                            |
  694. + |    input :        curr_txt points to string.                                    |
  695. + |                                                                            |
  696. + |    output :    curr_txt points to character before '{'                        |
  697. + |                return number of commas                                        |
  698. + |                                                                            |
  699. + +--------------------------------------------------------------------------*/
  700. + static int skip_level()
  701. + {
  702. + int nbcommas;
  703. + char c;
  704. +     nbcommas = 0;
  705. +     
  706. +     while(1)
  707. +         {
  708. +         switch (c = *(curr_txt--))
  709. +             {
  710. +             case '{' :
  711. +                 return nbcommas;
  712. +             
  713. +             case ',' :
  714. +                 nbcommas++;
  715. +                 break;
  716. +                 
  717. +             case '}' :
  718. +                 skip_level();
  719. +                 break;
  720. +             
  721. +             case '"' :
  722. +             case '\'' :
  723. +                 search_char(c);
  724. +                 break;
  725. +                 
  726. +             default:
  727. +                 break;
  728. +             }
  729. +         }
  730. + }
  731. + /*--------------------------------------------------------------------------+
  732. + |                                                                            |
  733. + |    Function to parse an output of a gdb print from                            |
  734. + |    a pointer (0x...) and return a command line to                            |
  735. + |    print *(0x...)                                                            |
  736. + |                                                                            |
  737. + |    input : command line pointer (LINESIZ size),                            |
  738. + |            pointer print output,                                            |
  739. + |            pointer 0x...                                                    |
  740. + |                                                                            |
  741. + |    output : command line (stored RIGHT justified in commandline)            |
  742. + |                                                                            |
  743. + |    example                                                                    |
  744. + |                                                                            |
  745. + |        start = "$1 = { (struct foo *) 0x1224}"                                |
  746. + |        current points to 0x1224 in start,                                    |
  747. + |                                                                            |
  748. + |        commandline = "print *($1)"                                            |
  749. + |                                                                            |
  750. + +--------------------------------------------------------------------------*/
  751. + char *parse_gdb_print (commandline, start, current)
  752. + char *commandline;
  753. + char *start;
  754. + char *current;
  755. + {
  756. + char *begin;
  757. +     start_txt = start;        /* in static variables */
  758. +     curr_txt = current;
  759. +     begin = strchr(start,'=');    /* find '=' in "$n =" */
  760. +     
  761. +     if (!begin)
  762. +         return;
  763. +         
  764. +     init_result(commandline,LINESIZ);
  765. +     add_string(")\n");
  766. +     
  767. +     while (begin <= curr_txt)
  768. +         {
  769. +         switch (*curr_txt)
  770. +             {
  771. +             case '=':
  772. +                 add_name();
  773. +                 
  774. +                 /* stop now if we just parsed the '=' in "$n =" */
  775. +                 if (curr_txt >= start_txt)
  776. +                     {
  777. +                     add_char('.');
  778. +                     skip_level();
  779. +                     }
  780. +                 break;
  781. +             
  782. +             case ',':
  783. +             case '{':
  784. +                 add_char(']');
  785. +                 add_num(skip_level());
  786. +                 add_char('[');
  787. +                 break;
  788. +         
  789. +             default:
  790. +                 curr_txt--;
  791. +             }
  792. +         }
  793. +         
  794. +     add_string("print *(");
  795. +     
  796. +     if (debug)
  797. +         fprintf(stderr,"datadpy=%s\n",result+result_index);
  798. +     
  799. +     return result+result_index;
  800. + }
  801. + #endif /* GDB */
  802. diff -rc2 v1.05/defs.h v1.06/defs.h
  803. *** v1.05/defs.h    Fri Sep 20 16:04:42 1991
  804. --- v1.06/defs.h    Thu Oct 31 16:00:52 1991
  805. ***************
  806. *** 88,91 ****
  807. --- 88,92 ----
  808.   #include <X11/cursorfont.h>
  809.   
  810. + #if XtVersion < 11005
  811.   /* incompatibility of header file with X11R4 documentation */
  812.   #define XawChainTop    XtChainTop
  813. ***************
  814. *** 93,96 ****
  815. --- 94,98 ----
  816.   #define XawChainLeft    XtChainLeft
  817.   #define XawChainRight    XtChainRight
  818. + #endif
  819.   
  820.   #ifndef AssignMax
  821. ***************
  822. *** 150,153 ****
  823. --- 152,157 ----
  824.       String    db_name;      /* name for dbx child */
  825.       String    db_prompt;    /* prompt for dbx child */
  826. +     Boolean   nx;            /* if True, do not execute gdbinit */
  827.   
  828.       Pixel     stop_color;    /* color of stop sign */
  829. diff -rc2 v1.05/dialog.c v1.06/dialog.c
  830. *** v1.05/dialog.c    Mon Sep 23 14:36:07 1991
  831. --- v1.06/dialog.c    Thu Oct 31 16:31:22 1991
  832. ***************
  833. *** 207,210 ****
  834. --- 207,211 ----
  835.       if (Prompt)
  836.           {
  837. + #ifdef GDB
  838.           /* When we send \n to gdb, it executes the last command,
  839.           so better tell xxgdb what gdb is doing */
  840. ***************
  841. *** 218,221 ****
  842. --- 219,223 ----
  843.               AppendDialogText(gdb_command);
  844.               }
  845. + #endif /* GDB */
  846.           send_command (s);
  847.           }
  848. ***************
  849. *** 268,272 ****
  850. --- 270,278 ----
  851.   {
  852.       FalseSignal = TRUE;
  853. + #ifdef SVR4        /* (MJH) */        /* (PW) is this true for all SYSV ? */
  854. +     kill(-(dbxpid), SIGQUIT);
  855. + #else
  856.       killpg(dbxpid, SIGQUIT);
  857. + #endif /* SVR4 */
  858.   }
  859.   
  860. diff -rc2 v1.05/filemenu.c v1.06/filemenu.c
  861. *** v1.05/filemenu.c    Mon Sep 23 13:51:58 1991
  862. --- v1.06/filemenu.c    Wed Oct 30 09:12:52 1991
  863. ***************
  864. *** 152,156 ****
  865. --- 152,166 ----
  866.       sprintf(command, "cd %s\n", store);
  867.   #ifdef GDB
  868. +    /* because silly gdb 4.0 displays nothing with cd command when
  869. +       confirm is on (possibly a gdb bug) , I just reset confirm to on
  870. +       just for this command !. */
  871. +    
  872. +    if (new_gdb4()) 
  873. +      query_gdb("set confirm on\n",    PARSE_OFF | ECHO_OFF | FILTER_OFF);
  874. +    
  875.       query_gdb(command, PARSE_ON | ECHO_OFF | FILTER_OFF);
  876. +     
  877. +    if (new_gdb4()) /* reset confirm to off */
  878. +      query_gdb("set confirm off\n",    PARSE_OFF | ECHO_OFF | FILTER_OFF);
  879.   #else
  880.       query_dbx(command);
  881. diff -rc2 v1.05/gdb_handler.c v1.06/gdb_handler.c
  882. *** v1.05/gdb_handler.c    Mon Sep 23 16:00:42 1991
  883. --- v1.06/gdb_handler.c    Thu Dec  5 13:10:28 1991
  884. ***************
  885. *** 156,160 ****
  886.        query_gdb("list ,main\n", PARSE_ON | ECHO_OFF | FILTER_ON); 
  887.   
  888. !     if (LoadCurrentFile() == 0)
  889.           {
  890.           arrow.line = 0;            /* clear arrow sign */
  891. --- 156,161 ----
  892.        query_gdb("list ,main\n", PARSE_ON | ECHO_OFF | FILTER_ON); 
  893.   
  894. !     if (displayedFile && LoadCurrentFile() == 0)
  895. !         /* Only if there is a current displayedFile (pavel 4-Dec-1991) */
  896.           {
  897.           arrow.line = 0;            /* clear arrow sign */
  898. ***************
  899. *** 550,554 ****
  900.               }
  901.               
  902. !         close(fp);
  903.           }
  904.   }
  905. --- 551,555 ----
  906.               }
  907.               
  908. !         fclose(fp);
  909.           }
  910.   }
  911. diff -rc2 v1.05/gdb_parser.c v1.06/gdb_parser.c
  912. *** v1.05/gdb_parser.c    Mon Sep 23 15:06:55 1991
  913. --- v1.06/gdb_parser.c    Fri Oct 25 18:37:19 1991
  914. ***************
  915. *** 548,557 ****
  916.           p = p2;                        /* skip display text */
  917.                       
  918. !         if (begin_struct)
  919.               {
  920. !             /* try to find end of display structure */
  921.               
  922. !             if (p1 = strstr(p,"\n}\n"))
  923. !                 p = p1 + strlen("\n}\n");
  924.               }
  925.           }
  926. --- 548,569 ----
  927.           p = p2;                        /* skip display text */
  928.                       
  929. !         if (begin_struct)    /* skip the whole data displayed */
  930.               {
  931. !             do                /* find the last '}' */
  932. !                 {
  933. !                 switch(*(p++))
  934. !                     {
  935. !                     case '{':
  936. !                         begin_struct++;
  937. !                         break;
  938. !                     case '}':
  939. !                         begin_struct--;
  940. !                         break;
  941. !                     }
  942. !                 }
  943. !             while (begin_struct);
  944.               
  945. !             /* now skip until end of line */
  946. !             while (*(p++) != '\n');
  947.               }
  948.           }
  949. diff -rc2 v1.05/gdb_regex.h v1.06/gdb_regex.h
  950. *** v1.05/gdb_regex.h    Mon Sep 23 15:07:04 1991
  951. --- v1.06/gdb_regex.h    Fri Oct 25 18:37:07 1991
  952. ***************
  953. *** 287,291 ****
  954.   #ifndef NeXT  /* if standard GDB */
  955.       /* exec with Message after */
  956. !     {"\\(.*\n\\)*\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):0x.+\n\\([ ]*[^0-9\n].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  957.        NULL,
  958.        {6, -1, -1, 3, 2, 7}
  959. --- 287,291 ----
  960.   #ifndef NeXT  /* if standard GDB */
  961.       /* exec with Message after */
  962. !     {"\\(.*\n\\)*\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):0x.+\n\\([ ]*[^0-9\n].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  963.        NULL,
  964.        {6, -1, -1, 3, 2, 7}
  965. ***************
  966. *** 292,296 ****
  967.       },
  968.       /* exec with Message before */
  969. !     {"\\(.*\n\\)*\\([ ]*[^ \n].*\n\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):0x.+\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  970.        NULL,
  971.        {2, -1, -1, 4, 3, 7}    
  972. --- 292,296 ----
  973.       },
  974.       /* exec with Message before */
  975. !     {"\\(.*\n\\)*\\([ ]*[^ \n].*\n\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):0x.+\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  976.        NULL,
  977.        {2, -1, -1, 4, 3, 7}    
  978. ***************
  979. *** 297,301 ****
  980.       },
  981.       /* exec without Message */
  982. !     {"\\(.*\n\\)*\032\032\\(\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):0x.+\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  983.        NULL,
  984.        {2, -1, -1, 4, 3, 7}
  985. --- 297,301 ----
  986.       },
  987.       /* exec without Message */
  988. !     {"\\(.*\n\\)*\032\032\\(\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):0x.+\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  989.        NULL,
  990.        {2, -1, -1, 4, 3, 7}
  991. ***************
  992. *** 304,308 ****
  993.   #else  /* NeXT is a special case : same as standard except that ":0x.+" are removed. */
  994.       /* exec with Message after */
  995. !     {"\\(.*\n\\)*\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\([ ]*[^0-9\n].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  996.        NULL,
  997.        {6, -1, -1, 3, 2, 7}
  998. --- 304,308 ----
  999.   #else  /* NeXT is a special case : same as standard except that ":0x.+" are removed. */
  1000.       /* exec with Message after */
  1001. !     {"\\(.*\n\\)*\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\([ ]*[^0-9\n].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  1002.        NULL,
  1003.        {6, -1, -1, 3, 2, 7}
  1004. ***************
  1005. *** 309,313 ****
  1006.       },
  1007.       /* exec with Message before */
  1008. !     {"\\(.*\n\\)*\\([ ]*[^ \n].*\n\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  1009.        NULL,
  1010.        {2, -1, -1, 4, 3, 7}    
  1011. --- 309,313 ----
  1012.       },
  1013.       /* exec with Message before */
  1014. !     {"\\(.*\n\\)*\\([ ]*[^ \n].*\n\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  1015.        NULL,
  1016.        {2, -1, -1, 4, 3, 7}    
  1017. ***************
  1018. *** 314,318 ****
  1019.       },
  1020.       /* exec without Message */
  1021. !     {"\\(.*\n\\)*\032\032\\(\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  1022.        NULL,
  1023.        {2, -1, -1, 4, 3, 7}
  1024. --- 314,318 ----
  1025.       },
  1026.       /* exec without Message */
  1027. !     {"\\(.*\n\\)*\032\032\\(\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  1028.        NULL,
  1029.        {2, -1, -1, 4, 3, 7}
  1030. ***************
  1031. *** 367,373 ****
  1032.       },
  1033.       /* info line */
  1034. !     {"\\(Line \\(number \\)?[0-9]+ \\(of\\|is out of range for\\) \"\\([^ \n]+\\)\".*\\)\n",
  1035.        NULL,
  1036. !      {-1, -1, -1, -1, 4, -1}
  1037.       },
  1038.       /* print */
  1039. --- 367,373 ----
  1040.       },
  1041.       /* info line */
  1042. !     {"\\(\\(Line \\(number \\)?[0-9]+ \\(of\\|is out of range for\\) \"\\([^ \n]+\\)\".*\\)\\|\\(No symbol table is loaded.*\\)\\|\\(No source file specified.*\\)\\)\n",
  1043.        NULL,
  1044. !      {-1, -1, -1, -1, 5, -1}
  1045.       },
  1046.       /* print */
  1047. ***************
  1048. *** 402,406 ****
  1049.       },
  1050.       /* info display */
  1051. !     {"\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)\\(\\(.*\n\\)*\\)",
  1052.        NULL,
  1053.        {  5, -1, -1, -1, -1, 1}
  1054. --- 402,406 ----
  1055.       },
  1056.       /* info display */
  1057. !     {"\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)\\(\\(.*\n\\)*\\)",
  1058.        NULL,
  1059.        {  5, -1, -1, -1, -1, 1}
  1060. diff -rc2 v1.05/patchlevel.h v1.06/patchlevel.h
  1061. *** v1.05/patchlevel.h    Wed Sep 11 16:53:48 1991
  1062. --- v1.06/patchlevel.h    Mon Dec 23 16:53:12 1991
  1063. ***************
  1064. *** 1 ****
  1065. ! #define PATCHLEVEL 3
  1066. --- 1 ----
  1067. ! #define PATCHLEVEL 4
  1068. diff -rc2 v1.05/regex.c v1.06/regex.c
  1069. *** v1.05/regex.c    Tue Apr  2 08:58:56 1991
  1070. --- v1.06/regex.c    Tue Oct 29 08:57:04 1991
  1071. ***************
  1072. *** 123,126 ****
  1073. --- 123,131 ----
  1074.   #endif
  1075.   
  1076. + #ifdef __STDC__
  1077. + static int bcmp_translate (unsigned char *, unsigned char *s2,
  1078. +                            int len, unsigned char *translate);    /* (MJH) */
  1079. + #endif /* __STDC__ */
  1080.   #ifdef emacs
  1081.   
  1082. ***************
  1083. *** 1202,1206 ****
  1084. --- 1207,1219 ----
  1085.             mcnt = dend2 - d2;
  1086.           /* Compare that many; failure if mismatch, else skip them. */
  1087. + #ifndef __STDC__    /* (MJH) */
  1088.           if (translate ? bcmp_translate (d, d2, mcnt, translate) : bcmp (d, d2, mcnt))
  1089. + #else
  1090. +         if (translate ? bcmp_translate ((unsigned char *)d,
  1091. +                         (unsigned char *)d2,
  1092. +                         mcnt,
  1093. +                         translate)
  1094. +             : bcmp (d, d2, mcnt))
  1095. + #endif    /* __STDC__ */
  1096.             goto fail;
  1097.           d += mcnt, d2 += mcnt;
  1098. diff -rc2 v1.05/signals.c v1.06/signals.c
  1099. *** v1.05/signals.c    Tue Apr  2 08:59:04 1991
  1100. --- v1.06/signals.c    Tue Oct 29 09:44:03 1991
  1101. ***************
  1102. *** 83,87 ****
  1103. --- 83,91 ----
  1104.        */
  1105.   #ifdef SYSV 
  1106. + #ifdef SVR4
  1107. +     waitpid((pid_t)0, &status, WNOHANG|WUNTRACED);    /* (MJH) */
  1108. + #else
  1109.       waitpid(&status, NULL , WNOHANG|WUNTRACED);
  1110. + #endif /* SVR4 */
  1111.   #else
  1112.       wait3(&status, WNOHANG|WUNTRACED, NULL);
  1113. diff -rc2 v1.05/xdbx.c v1.06/xdbx.c
  1114. *** v1.05/xdbx.c    Wed Sep 11 16:57:35 1991
  1115. --- v1.06/xdbx.c    Mon Dec 23 16:50:23 1991
  1116. ***************
  1117. *** 72,76 ****
  1118.   
  1119.   #ifdef GDB
  1120. ! #define XGDBVERSION    "1.05"
  1121.   #endif
  1122.   
  1123. --- 72,76 ----
  1124.   
  1125.   #ifdef GDB
  1126. ! #define XGDBVERSION    "1.06"
  1127.   #endif
  1128.   
  1129. ***************
  1130. *** 87,90 ****
  1131. --- 87,92 ----
  1132.   #define Offset(field) (XtOffset(XdbxResources *, field))
  1133.   
  1134. + char *progname;
  1135.   char            cwd[MAXPATHLEN];        /* The current working directory */
  1136.   XtAppContext      app_context;         /* application context */
  1137. ***************
  1138. *** 112,115 ****
  1139. --- 114,120 ----
  1140.       Offset(db_prompt), XtRImmediate, (caddr_t)NULL},
  1141.   
  1142. +     {"nx", "nx", XtRBoolean, sizeof(Boolean), 
  1143. +     Offset(nx), XtRImmediate, (caddr_t)False},
  1144.       {"delimiters", "Delimiters", XtRString, sizeof(char *), 
  1145.       Offset(delimiters), XtRImmediate, (caddr_t)NULL},
  1146. ***************
  1147. *** 204,207 ****
  1148. --- 209,213 ----
  1149.   #ifdef GDB
  1150.       {"-d",    "includeDir",    XrmoptionSepArg, NULL},
  1151. +     {"-nx",    "nx",            XrmoptionNoArg, "True"},
  1152.   #else
  1153.       {"-r",    "dbxopt_r",    XrmoptionNoArg, "True"},
  1154. ***************
  1155. *** 290,296 ****
  1156.   
  1157.   #ifdef GDB
  1158. !     strcpy(xdbxinit, ".gdbinit");
  1159. !     if (access(xdbxinit, R_OK) == -1) {
  1160. !         sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".gdbinit");
  1161.   #else
  1162.       strcpy(xdbxinit, ".dbxinit");
  1163. --- 296,311 ----
  1164.   
  1165.   #ifdef GDB
  1166. !     if (app_resources.nx)
  1167. !         strcpy(xdbxinit, "");
  1168. !     else
  1169. !         {
  1170. !         strcpy(xdbxinit, ".gdbinit");
  1171. !         if (access(xdbxinit, R_OK) == -1)
  1172. !             {
  1173. !             sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".gdbinit");
  1174. !             if (access(xdbxinit, R_OK) == -1)
  1175. !                 strcpy(xdbxinit, "");
  1176. !             }
  1177. !         }
  1178.   #else
  1179.       strcpy(xdbxinit, ".dbxinit");
  1180. ***************
  1181. *** 297,305 ****
  1182.       if (access(xdbxinit, R_OK) == -1) {
  1183.           sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".dbxinit");
  1184. ! #endif    /* not GDB */
  1185. !         if (access(xdbxinit, R_OK) == -1) {
  1186. !         strcpy(xdbxinit, "");
  1187. !     }
  1188.       }
  1189.       source_init();
  1190.       signs_init();
  1191. --- 312,319 ----
  1192.       if (access(xdbxinit, R_OK) == -1) {
  1193.           sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".dbxinit");
  1194. !         if (access(xdbxinit, R_OK) == -1)
  1195. !             strcpy(xdbxinit, "");
  1196.       }
  1197. + #endif    /* not GDB */
  1198.       source_init();
  1199.       signs_init();
  1200. ***************
  1201. *** 360,369 ****
  1202.        *  instead.
  1203.        */
  1204. -      /* for GDB, just use option -nx */
  1205.        
  1206. -     if (strcmp(xdbxinit, "")) {        /* .dbxinit or ~/.dbxinit exists */
  1207.   #ifdef GDB
  1208.       dbxargv[i++] = "-nx";
  1209.   #else
  1210.   #ifdef BSD
  1211.       dbxargv[i++] = "-c";
  1212. --- 374,383 ----
  1213.        *  instead.
  1214.        */
  1215.        
  1216.   #ifdef GDB
  1217. +      /* for GDB, always use option -nx */
  1218.       dbxargv[i++] = "-nx";
  1219.   #else
  1220. +     if (strcmp(xdbxinit, "")) {        /* .dbxinit or ~/.dbxinit exists */
  1221.   #ifdef BSD
  1222.       dbxargv[i++] = "-c";
  1223. ***************
  1224. *** 372,377 ****
  1225.   #endif
  1226.       dbxargv[i++] = (char *) mktemp(temp);
  1227. - #endif    /* not GDB */
  1228.       }
  1229.       if (app_resources->startup) {    /* overwrites dbxinit */
  1230.       Tstartup = False;
  1231. --- 386,391 ----
  1232.   #endif
  1233.       dbxargv[i++] = (char *) mktemp(temp);
  1234.       }
  1235. + #endif    /* not GDB */
  1236.       if (app_resources->startup) {    /* overwrites dbxinit */
  1237.       Tstartup = False;
  1238. ***************
  1239. *** 399,403 ****
  1240.   {
  1241.       char     **dbxargv;
  1242.   #ifdef SYSV 
  1243.       getcwd((char *)cwd, MAXPATHLEN);
  1244. --- 413,420 ----
  1245.   {
  1246.       char     **dbxargv;
  1247. !     char *p;
  1248. !     
  1249. !     progname = argv[0];            /* (MJH) */
  1250. !         
  1251.   #ifdef SYSV 
  1252.       getcwd((char *)cwd, MAXPATHLEN);
  1253.  
  1254. -- 
  1255. --
  1256. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1257. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1258. Sunnyvale, California 94086            at&t: 408/522-9236
  1259.