/*****************************************************************************
 *
 *  xdbx - X Window System interface to the dbx debugger
 *
 *  Copyright 1989 The University of Texas at Austin
 *  Copyright 1990 Microelectronics and Computer Technology Corporation
 *
 *  Permission to use, copy, modify, and distribute this software and its
 *  documentation for any purpose and without fee is hereby granted,
 *  provided that the above copyright notice appear in all copies and that
 *  both that copyright notice and this permission notice appear in
 *  supporting documentation, and that the name of The University of Texas
 *  and Microelectronics and Computer Technology Corporation (MCC) not be 
 *  used in advertising or publicity pertaining to distribution of
 *  the software without specific, written prior permission.  The
 *  University of Texas and MCC makes no representations about the 
 *  suitability of this software for any purpose.  It is provided "as is" 
 *  without express or implied warranty.
 *
 *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
 *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
 *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 *  Author:  	Po Cheung
 *  Created:   	March 10, 1989
 * 
 *****************************************************************************
 * 
 *  xxgdb - X Window System interface to the gdb debugger
 *  
 * 	Copyright 1990,1994 Thomson Consumer Electronics, Inc.
 *  
 *  Permission to use, copy, modify, and distribute this software and its
 *  documentation for any purpose and without fee is hereby granted,
 *  provided that the above copyright notice appear in all copies and that
 *  both that copyright notice and this permission notice appear in
 *  supporting documentation, and that the name of Thomson Consumer
 *  Electronics (TCE) not be used in advertising or publicity pertaining
 *  to distribution of the software without specific, written prior
 *  permission.  TCE makes no representations about the suitability of
 *  this software for any purpose.  It is provided "as is" without express
 *  or implied warranty.
 *
 *  TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
 *  SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
 *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 *  SOFTWARE.
 *
 *  Adaptation to GDB:  Pierre Willard
 *  XXGDB Created:   	December, 1990
 *
 *****************************************************************************
 *
 *  Modifications for use under System V
 *
 *      Copyright 1990 Bull Worldwide Information Systems, Inc.
 *
 *  Permission to use, copy, modify, and distribute this software and its
 *  documentation for any purpose and without fee is hereby granted,
 *  provided that the above copyright notice appear in all copies and that
 *  both that copyright notice and this permission notice appear in
 *  supporting documentation, and that the name of Bull Worldwide
 *  Information Systems not be used in advertising or publicity pertaining
 *  to distribution of the software without specific, written prior
 *  permission.  Bull makes no representations about the suitability of
 *  this software for any purpose.  It is provided "as is" without express
 *  or implied warranty.
 *
 *  BULL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
 *  SHALL BULL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
 *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 *  SOFTWARE.
 *
 *  Adaptation to SYSV: James Tsillas
 *                      March, 1991
 *
 *****************************************************************************
 *
 *	Note that this software uses some files which are 
 *  Copyright (C) 1985 Free Software Foundation, Inc.
 *	See copyright header in regex.c and regex.h.
 *
 *****************************************************************************/

Please send XDBX comments and bug reports to:

    Po Cheung
    cheung@sw.mcc.com	
    Microelectronics and Computer Technology Corporation
      -- or --
    po@cerc.utexas.edu 	
    University of Texas at Austin

Please send XXGDB comments and bug reports to:

	Pierre Willard
	pierre@eng.sun.com
	Thomson Consumer Electronics, Inc.

XXGDB version 1.12
------------------

	>> SEE ALSO XDBX DOCUMENTATION <<
	>> SEE ALSO xxgdb.man DOCUMENTATION <<
	
	XXGDB is a X window interface to the GDB debugger.
	
	GDB must be accessible in the current path.
	
	xxgdb should run gdb 4.x (as well as the older versions).
	
	This X window interface has been adapted to GDB from the source
	distribution files of XDBX version 2.1 (patch level 2) which
	implements an X window interface to the DBX debugger.
	
	See the XDBX_README file for more information on XDBX.
	
	XXGDB has been originally tested on Sparc workstation running Solaris
	It should also run on SUN OS.
	
	To build, xxgdb, first build the makefile by using 'xmkmf' or other
	shell script using 'imake'.
	
    Also, any System V should be able to build by setting the -DSYSV flag.
    SCO Unix also requires the -Dsco flag. Bull DPX/2 [23]00 requires the
    -Dncl_mr flag as well as -DSYSV. Some systems may also need to set
    -DUSG to use the GNU malloc instead of the native one. The GNU malloc
    works much quicker and is much more reliable. SCO Unix requires GNU
    malloc to work correctly. GNU malloc is not provided here, you should
    get malloc.c and getpagesize.h from the source of gdb.

    Also note that if building on SCO you must also link with -lsocket
    and if building on DPX/2 you must also link with -linet. You will need
    the R4 release of X11 for both.

	- When compiled with -DCREATE_IO_WINDOW, xxgdb will use a separate io
	window to talk to gdb, so program output is not confused with gdb output.
	This is not the default. Link with -lsocket is necessary in that case.
	Type command 'iowin' to create io window. Also the program xxgdbiowin 
	has to be compiled because it is used for this io window.

	- When compiled with -DNEW_INTERFACE -DOPEN_ALL_WINDOWS, xxgdb uses
	a new interface with 4 different X windows for the source, the commands,
	the buttons and the display window. See README.NEW_INTERFACE and
	XDbx.NEW_INTERFACE.

	- When linking on SunOS 4.1, it could happen that you get the
	following error when linking :
	 	ld: Undefined symbol
 	   		_get_wmShellWidgetClass
 	  		_get_applicationShellWidgetClass
	It is a dynamic linking problem. I am not sure why it happens.
	Anyway, you can either do a static link (gcc -static), or just
	set the execution bit, and the program will run.

	- XXGDB changes the GDB default 'set prettyprint' to ON (or 'set
	p pretty' if gdb 4.0). This is necessary to be able to display
	the pointed object when clicking a pointer value in a popup window
	(see also 'Displaying C Data Structures' in xdbx documentation).
	Except for this feature, xxgdb works with 'set prettyprint off'.
	
	- XXGDB changes the GDB default 'set screensize' to 0 (or 
	'set height' and 'set width' to 0 if gdb 4.0).

	- XXGDB changes the GDB default 'set confirm' to off (if gdb 4.0).
	THIS IS IMPORTANT. DO NOT SET CONFIRM TO OFF OR XXGDB MIGHT HANG. 

	- With the 'list' command, XXGDB will put the cursor at the last 
	listed line and will make sure that this last line is visible
	in the source window.
	
	- The file button will execute 'core-file <filename>' if the file
	is named 'core', 'list <filename>:1' if the file is not executable
	and 'exec-file <filename> symbol-file <filename> if the file
	is executable. Executable files are displayed with a trailing '*'
	character.
	
	- For systems which do not have the ANSI strstr function in their
	library, one is included in gdb_parser.c and is compiled if NEED_STRSTR
	is defined.
	
	- if you define UNDISPWIN when compiling, then the display window
	will disappear when there is nothing to display.
	(eg, add -DUNDISPWIN in DEFGDB definition in Imakefile).
	See display_info_handler function in gdb_handler.c
	
	- Copy the application default file (XDbx.ad) into your home
	directory or into the X '/usr/lib/X11/app-defaults' directory
	(without the .ad suffix) (eg, 'cp -p XDbx.ad ~/XDbx').
	
	- The name of the debugger called by xxgdb is by default 'gdb'.
	It can be overridden with the environment variable XXGDB_DEBUGGER.
	WARNING : by default prompt is the name of the debugger enclosed in
	parenthesis followed by a space. So if the prompt is still "(gdb) ",
	you HAVE TO use -db_prompt "gdb"
	
	- DO NOT modify the gdb prompt (using the 'set prompt' command).
	XXGDB assumes that the gdb prompt is 'gdb' or the XXGDB_DEBUGGER
	environment variable if defined.
	
	There are new application resources and command line args:
   	 - db_name can be used to specify the name of the debugger to
     override the default "gdb" (instead of using an env. variable).
     - db_prompt can be used to specify to xgdb the string to be used by
     the debugger as a prompt.  The default is to expect the prompt
     used by the debugger to be the name of the debugger enclosed in
     parenthesis.  This is no good for gdbvx, which expects a prompt
     of (gdb).
   	 - i can be used the name of the command file automatically
	 loaded by gdb. The default is ".gdbinit" file.


	To build xxgdb, 'Imakefile' defines :
	
#define TARGET_IS_GDB 1


XXGDB version BUG LIST
----------------------

This version of XXGDB is pretty much working. 
The following bugs will probably be fixed in future versions.

	- 'define' command of GDB is not completely supported by xxgdb
		because xxgdb does not interpret what the defined commands
		do.
		
	- 'set confirm off' might hang xxgdb later on.
	
	- 'source' command of XXGDB behaves slighlty differently from 
	the one in GDB. The specified file is read line by line by xxgdb
	and each line is sent to gdb. Thus gdb will ask confirmation of
	some commands (except for gdb 4.0 because of 'set confirm off'
	used by xxgdb).
	This is also the case for the execution of the '.gdbinit' file.
	
	- Repeat command of XXGDB behaves slighlty differently from the one
	in GDB.

	- '~' character in filename is not expanded by xxgdb.

FAQ
---
Why do ^M characters appear at the end of each line ?

	This is because the terminal settings are WRONG. The possible
	reason is that xxgdb was compiled with gcc and NON ANSI include
	files. Solution : run 'fixincludes' of gcc and/or check the '-I'
	options. In particular, on Sun, make sure you do not have
	/usr/include in the include path.


SunOS 5.3:
----------
Compile with :
	gcc -O -I/usr/openwin/include -DSYSV -DSVR4 -DSUNOS4 -DGDB -DCREATE_IO_WINDOW
Link with :
	-lXaw -lXmu -lXt -lXext -lX11 -lm -lsocket


SunOS 4.1:
----------
Compile with :
	gcc -O -I/usr/openwin/include -DGDB -DCREATE_IO_WINDOW
Link with :
	-lXaw -lXmu -lXt -lXext -lX11 -lm -static


AIX 2.3 (RS6000):
-----------------
Compile with :
	xlc -qlanglvl=ansi -I/usr/openwin/include -DSYSV -D_POSIX_SOURCE -D_ALL_SOURCE -DREAD_ZERO_NOT_EOF -DBSD=45 -DGDB -g 
Link with :
	-L/usr/openwin/lib/R5 -lXaw -lXmu -lXt -lXext -lX11 -lm -lc


XXGDB history
-------------
	
	1.0		December 1990.
	1.01	January 1991 (posted to comp.sources.x news group)
				Fix bug with display command (when displaying structures).
				Fix bug with undisplay command (display window went blank).
				Add XXGDB no warranty message at start-up.
	1.02	February 1991.
				Add source files selection in file button.
				Special test for core file in file button.
				Fix bug includeDir resource.
				Fix bug source file directories.
				Add patches for SUN-OS3.
				Add strstr function in gdb_parser.c (with #ifdef NEED_STRSTR)
				Remove bad test for MIPS and BSD in case of GDB.
	1.03	April 1991
				Miscellaneous patches for lint.
				Port to SYSV + SCO +SYSV32.
				Fix bug up/down/frame when arguments are on several lines.
				Fix bug in UpdateMessageWindow when arguments are too long.
				Fix bug define commands in .gdbinit or source files
				Add db_name and db_prompt option (GWC)
	1.04	May 1991
				display command print all error messages (if any).
				fix bug display C structures.
				several patches for more generic BSD machines (JBL)
				patches for NeXT because some GDB incompatibilities.
				display gdb messages when executing list command.
				fix problem scrolling symbols while scrolling with keys (GWC).
				fix bug displaying arrow when up/down in recursive function.
	1.05	July - September 1991
				Fix bug in search window.
				Update for gdb 4.0 (PW)(SH).
	1.06	October 1991
				Fix bug in creating more than 16 popup windows.
				Edit defs.h for X11R5.
				Remove xxgdb start-up error message with no file specified.
				Fix bug display arrays.
				Port to SysVr4 and miscellaneous improvements (MJH)
				Fix bug for directories in filemenu (Norbert Kiesel)
				Fix bug pointers in arrays in popup windows.
				Add option -nx for xxgdb.
				Color for scrollbar is black in resource file.	
				Fix pb when no image file is loaded at startup (Tom Pavel)
	1.07	February 1992
				Fix problem xxgdb for NeXT because of test for gdb-4.0.
				Fix 'info break' problem with gdb 4.5 (Ken Mandelberg)
				New buttons and misc. improvements (Amir J. Katz)(AJK)
	1.08	November 1993
				Update for gdb 4.11.
				Cleanup + Alpha port + NEW_INTERFACE from Dean Michaels, TRLabs.
	1.09	April 1994
				New -gdbinit resource and command line option to specify init filename.
				Fix problem 'Inappropriate ioctl for device' on Solaris.
				Fix bugs displaying C++ structures (Klamer).
				Use reliable signals on SYSV (Iand).
				Fix problem compiling with 'cc'.
	1.10	August 1994
				Cleanup calldbx.c (svalente@MIT.EDU)
				Add fix for Modula-2 (Norbert Kiesel)
				Fix bug command too long for fputs.
				Port to RS6000 (AIX 2.3 rs6000)
				Add configurable tab widths (Matt Day <mday@artisoft.com>)
	1.11	March 1995
				Misc. updates.
	1.12	November 1995
			Do not define signal for linux in signals.c (schweikh@ito.uni-stuttgart.de)
			In global.h define alloca only in certain cases.
			Test for MAXPATHLEN already defined (in global.h)
			Update Imakefile for different architectures (Philippe.Defert@cern.ch)
			Update for NeXT (doug@foxtrot.ccmrc.ucsb.edu)
			Update for gdb-4.14 : different address format when step/next/up/down.

	
				--------------------------

