* mpw-make.in (VERSION): Update to 4.12.3.

(SiowGDB): New target, GDB using SIOW library.
	(init-new.c): New target, attempt to generate init.c from sources.
	(main.c.o, top.c.o): Put each in its own segment.
	* main.c (main) [MPW]: Always call mac_init.
	* utils.c (query) [MPW]: Always return "yes" if in MacGDB, output
	an extra newline otherwise.
	* mac-xdep.c: More comments in various places, remove junk.
	(mac_init): Add tests for MPW and SIOW.
	(use_wne, has_color_qd): Renamed.
	(use_color_qd): New variable.
	(grow_window): Only do console resizing to console window,
	call resize_console_window.
	(zoom_window): Call resize_console_window.
	(resize_console_window, scroll_text): New functions.
	(adjust_console_sizes): Always align viewrect to even multiples of
	text lines.
	(adjust_console_text): Always scroll by whole lines.
	(hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a
	recalculation of scroll positions if a newline was output.
	(hacked_fflush): Similarly, for flushing.
	(hacked_fgetc): New function, aborts if called in MacGDB.
	* ser-mac.c (mac_readchar): Rename starttime to start_time,
	remove debugging printf.
	(mac_write): Sleep on first 4 writes.
	(sec_sleep): New function, works like standard sleep.
	* macgdb.r: Adjust positioning and contents of About box.
	Set minimum size to 2000K, preferred size to 5000K.
	* config/m68k/xm-mpw.h (fgetc): Define as a macro.
This commit is contained in:
Stan Shebs 1994-06-22 19:57:02 +00:00
parent d81843e864
commit b8ec8d4ab0
7 changed files with 260 additions and 2582 deletions

View File

@ -1,3 +1,35 @@
Wed Jun 22 11:10:27 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (VERSION): Update to 4.12.3.
(SiowGDB): New target, GDB using SIOW library.
(init-new.c): New target, attempt to generate init.c from sources.
(main.c.o, top.c.o): Put each in its own segment.
* main.c (main) [MPW]: Always call mac_init.
* utils.c (query) [MPW]: Always return "yes" if in MacGDB, output
an extra newline otherwise.
* mac-xdep.c: More comments in various places, remove junk.
(mac_init): Add tests for MPW and SIOW.
(use_wne, has_color_qd): Renamed.
(use_color_qd): New variable.
(grow_window): Only do console resizing to console window,
call resize_console_window.
(zoom_window): Call resize_console_window.
(resize_console_window, scroll_text): New functions.
(adjust_console_sizes): Always align viewrect to even multiples of
text lines.
(adjust_console_text): Always scroll by whole lines.
(hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a
recalculation of scroll positions if a newline was output.
(hacked_fflush): Similarly, for flushing.
(hacked_fgetc): New function, aborts if called in MacGDB.
* ser-mac.c (mac_readchar): Rename starttime to start_time,
remove debugging printf.
(mac_write): Sleep on first 4 writes.
(sec_sleep): New function, works like standard sleep.
* macgdb.r: Adjust positioning and contents of About box.
Set minimum size to 2000K, preferred size to 5000K.
* config/m68k/xm-mpw.h (fgetc): Define as a macro.
Wed Jun 15 17:36:07 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (.c.o, .gc.o): Prefix segment names with gdb_.

View File

@ -61,6 +61,9 @@ void mpw_abort ();
#define fseek mpw_fseek
#define abort mpw_abort
/* Map these standard functions to versions that can do I/O in a console
window. */
#define printf hacked_printf
#define fprintf hacked_fprintf
#define vprintf hacked_vfprintf
@ -70,6 +73,8 @@ void mpw_abort ();
#define putc hacked_putc
#define fflush hacked_fflush
#define fgetc hacked_fgetc
/* Define as macros so as to mask the previous enum. */
#ifndef BFD_TRUE_FALSE

View File

@ -81,11 +81,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "mac-defs.h"
/* This is true if we are running as a standalone application. */
int mac_app;
int useWNE;
/* This is true if we are using WaitNextEvent. */
int hasColorQD;
int use_wne;
/* This is true if we have Color Quickdraw. */
int has_color_qd;
/* This is true if we are using Color Quickdraw. */
int use_color_qd;
int inbackground;
@ -109,7 +119,6 @@ Rect console_text_rect;
/* This will go away eventually. */
gdb_has_a_terminal () { return 1; }
mac_init ()
{
SysEnvRec se;
@ -122,6 +131,24 @@ mac_init ()
int i;
Handle menubar;
MenuHandle menu;
Handle siow_resource;
mac_app = 0;
/* Don't do anything if we`re running under MPW. */
if (!StandAlone)
return;
/* Don't do anything if we're using SIOW. */
/* This test requires that the siow 0 resource, as defined in
{RIncludes}siow.r, not be messed with. If it is, then the
standard Mac setup below will step on SIOW's Mac setup and
most likely crash the machine. */
siow_resource = GetResource('siow', 0);
if (siow_resource != nil)
return;
mac_app = 1;
/* Do the standard Mac environment setup. */
InitGraf (&QD (thePort));
@ -135,7 +162,9 @@ mac_init ()
/* Color Quickdraw is different from Classic QD. */
SysEnvirons(2, &se);
hasColorQD = se.hasColorQD;
has_color_qd = se.hasColorQD;
/* Use it if we got it. */
use_color_qd = has_color_qd;
sizerect.top = 50;
sizerect.left = 50;
@ -157,14 +186,12 @@ mac_init ()
DrawMenuBar ();
new_console_window ();
return 1;
}
new_console_window ()
{
/* Create the main window we're going to play in. */
if (hasColorQD)
if (has_color_qd)
console_window = GetNewCWindow (wConsole, NULL, (WindowPtr) -1L);
else
console_window = GetNewWindow (wConsole, NULL, (WindowPtr) -1L);
@ -201,24 +228,25 @@ mac_command_loop()
EventRecord event;
WindowPtr win;
RgnHandle cursorRgn;
int i;
int i, tm;
Handle menubar;
MenuHandle menu;
/* Figure out if the WaitNextEvent Trap is available. */
useWNE =
/* Figure out if the WaitNextEvent Trap is available. */
use_wne =
(NGetTrapAddress (0x60, ToolTrap) != NGetTrapAddress (0x9f, ToolTrap));
/* Pass WNE an empty region the 1st time thru. */
/* Pass WaitNextEvent an empty region the first time through. */
cursorRgn = NewRgn ();
/* Go into the main event-handling loop. */
/* Go into the main event-handling loop. */
while (!eventloopdone)
{
/* Use WaitNextEvent if it is available, otherwise GetNextEvent. */
if (useWNE)
/* Use WaitNextEvent if it is available, otherwise GetNextEvent. */
if (use_wne)
{
get_global_mouse (&mouse);
adjust_cursor (mouse, cursorRgn);
gotevent = WaitNextEvent (everyEvent, &event, GetCaretTime(), cursorRgn);
tm = GetCaretTime();
gotevent = WaitNextEvent (everyEvent, &event, tm, cursorRgn);
}
else
{
@ -249,6 +277,8 @@ mac_command_loop()
}
}
/* Collect the global coordinates of the mouse pointer. */
get_global_mouse (mouse)
Point *mouse;
{
@ -258,13 +288,16 @@ Point *mouse;
*mouse = evt.where;
}
/* Change the cursor's appearance to be appropriate for the given mouse
location. */
adjust_cursor (mouse, region)
Point mouse;
RgnHandle region;
{
}
/* Decipher an event, maybe do something with it. */
/* Decipher an event, maybe do something with it. */
do_event (evt)
EventRecord *evt;
@ -395,18 +428,19 @@ Point where;
GrafPtr oldport;
winsize = GrowWindow (win, where, &sizerect);
/* Only do anything if it actually changed size. */
if (winsize != 0)
{
GetPort (&oldport);
SetPort (win);
EraseRect (&win->portRect);
h = LoWord (winsize);
v = HiWord (winsize);
SizeWindow (win, h, v, 1);
adjust_console_sizes ();
adjust_console_scrollbars ();
adjust_console_text ();
InvalRect (&win->portRect);
if (win == console_window)
{
EraseRect (&win->portRect);
h = LoWord (winsize);
v = HiWord (winsize);
SizeWindow (win, h, v, 1);
resize_console_window ();
}
SetPort (oldport);
}
}
@ -417,10 +451,18 @@ Point where;
short part;
{
ZoomWindow (win, part, (win == FrontWindow ()));
if (win == console_window)
{
resize_console_window ();
}
}
resize_console_window ()
{
adjust_console_sizes ();
adjust_console_scrollbars ();
adjust_console_text ();
InvalRect (&(win->portRect));
InvalRect (&console_window->portRect);
}
close_window (win)
@ -501,6 +543,11 @@ do_mouse_down (WindowPtr win, EventRecord *event)
}
}
scroll_text (hlines, vlines)
int hlines, vlines;
{
}
activate_window (win, activate)
WindowPtr win;
int activate;
@ -717,27 +764,22 @@ int key;
bpstat_do_actions (&stop_bpstat);
}
}
else if (0 /* editing chars... */)
{
}
else
{
/* A self-inserting character. */
/* A self-inserting character. This includes delete. */
TEKey (key, console_text);
}
}
/* Draw all graphical stuff in the console window. */
draw_console ()
{
SetPort (console_window);
TEUpdate (&(console_window->portRect), console_text);
#if 0
FrameRect (&((*console_text)->viewRect));
FrameRect (&((*console_text)->destRect));
#endif
}
/* Cause an update of a window's entire contents. */
/* Cause an update of a given window's entire contents. */
force_update (win)
WindowPtr win;
@ -757,15 +799,20 @@ adjust_console_sizes ()
Rect tmprect;
tmprect = console_window->portRect;
/* Move and size the scrollbar. */
MoveControl (console_v_scrollbar, tmprect.right - sbarwid, 0);
SizeControl (console_v_scrollbar, sbarwid + 1, tmprect.bottom - sbarwid + 1);
/* Move and size the text. */
tmprect.left += 7;
tmprect.right -= sbarwid;
tmprect.bottom -= sbarwid;
InsetRect(&tmprect, 1, 1);
(*console_text)->viewRect = tmprect;
(*console_text)->destRect = tmprect;
/* (should fiddle bottom of viewrect to be even multiple of lines?) */
/* Fiddle bottom of viewrect to be even multiple of text lines. */
tmprect.bottom = tmprect.top
+ ((tmprect.bottom - tmprect.top) / (*console_text)->lineHeight)
* (*console_text)->lineHeight;
(*console_text)->viewRect = tmprect;
}
adjust_console_scrollbars ()
@ -793,8 +840,8 @@ adjust_console_text ()
TEScroll (((*console_text)->viewRect.left
- (*console_text)->destRect.left)
- 0 /* get h scroll value */,
(((*console_text)->viewRect.top
- (*console_text)->destRect.top)
((((*console_text)->viewRect.top - (*console_text)->destRect.top)
/ (*console_text)->lineHeight)
- GetCtlValue (console_v_scrollbar))
* (*console_text)->lineHeight,
console_text);
@ -890,7 +937,6 @@ hacked_fprintf (FILE *fp, const char *fmt, ...)
char buf[1000];
ret = vsprintf(buf, fmt, ap);
TESetSelect (40000, 40000, console_text);
TEInsert (buf, strlen(buf), console_text);
}
else
@ -908,12 +954,7 @@ hacked_printf (const char *fmt, ...)
va_list ap;
va_start (ap, fmt);
if (mac_app)
{
ret = hacked_vfprintf(stdout, fmt, ap);
}
else
ret = vfprintf (stdout, fmt, ap);
ret = hacked_vfprintf(stdout, fmt, ap);
va_end (ap);
return ret;
}
@ -929,8 +970,13 @@ hacked_vfprintf (FILE *fp, const char *format, va_list args)
int ret;
ret = vsprintf(buf, format, args);
TESetSelect (40000, 40000, console_text);
TEInsert (buf, strlen(buf), console_text);
if (strchr(buf, '\n'))
{
adjust_console_sizes ();
adjust_console_scrollbars ();
adjust_console_text ();
}
return ret;
}
else
@ -943,8 +989,13 @@ hacked_fputs (const char *s, FILE *fp)
{
if (mac_app && (fp == stdout || fp == stderr))
{
TESetSelect (40000, 40000, console_text);
TEInsert (s, strlen(s), console_text);
if (strchr(s, '\n'))
{
adjust_console_sizes ();
adjust_console_scrollbars ();
adjust_console_text ();
}
return 0;
}
else
@ -957,12 +1008,17 @@ hacked_fputc (const char c, FILE *fp)
{
if (mac_app && (fp == stdout || fp == stderr))
{
char buf[2];
char buf[1];
buf[0] = c;
TESetSelect (40000, 40000, console_text);
TEInsert (buf, 1, console_text);
return 0;
if (c == '\n')
{
adjust_console_sizes ();
adjust_console_scrollbars ();
adjust_console_text ();
}
return c;
}
else
return fputc (c, fp);
@ -974,11 +1030,17 @@ hacked_putc (const char c, FILE *fp)
{
if (mac_app && (fp == stdout || fp == stderr))
{
char buf[2];
char buf[1];
buf[0] = c;
TESetSelect (40000, 40000, console_text);
TEInsert (buf, 1, console_text);
if (c == '\n')
{
adjust_console_sizes ();
adjust_console_scrollbars ();
adjust_console_text ();
}
return c;
}
else
return fputc (c, fp);
@ -989,6 +1051,24 @@ hacked_putc (const char c, FILE *fp)
hacked_fflush (FILE *fp)
{
if (mac_app && (fp == stdout || fp == stderr))
return 0;
{
adjust_console_sizes ();
adjust_console_scrollbars ();
adjust_console_text ();
return 0;
}
return fflush (fp);
}
#undef fgetc
hacked_fgetc (FILE *fp)
{
if (mac_app && (fp == stdin))
{
/* Catch any attempts to use this. */
DebugStr("\pShould not be reading from stdin!");
return '\n';
}
return fgetc (fp);
}

View File

@ -75,7 +75,7 @@ resource 'MENU' (mDebug, preload) {
};
resource 'ALRT' (128) {
{40, 40, 229, 363},
{40, 40, 180, 420},
128,
{ /* array: 4 elements */
/* [1] */
@ -90,33 +90,20 @@ resource 'ALRT' (128) {
};
resource 'DITL' (128) {
{ /* array DITLarray: 4 elements */
{ /* array DITLarray: 2 elements */
/* [1] */
{164, 115, 184, 185},
{110, 150, 128, 200},
Button {
enabled,
"OK"
},
/* [2] */
{5, 10, 43, 290},
{10, 10, 100, 370},
StaticText {
disabled,
"MacGDB"
"GDB 4.12.3\n"
"Copyright © 1994 Free Software Foundation, Inc.\n"
},
/* [3] */
{76, 3, 154, 301},
StaticText {
disabled,
"GNU Debugger"
"\nCopyright © 1994 Free Software Foundation Inc.\n"
"Written by Stan Shebs."
},
/* [4] */
{53, 82, 71, 227},
StaticText {
disabled,
"version 4.12.1"
}
}
};
@ -146,8 +133,8 @@ resource 'SIZE' (-1) {
reserved,
reserved,
reserved,
4000*1024,
4000*1024
5000*1024,
2000*1024
};
resource 'DLOG' (128) {

2509
gdb/main.c

File diff suppressed because it is too large Load Diff

View File

@ -211,7 +211,7 @@ CDEPS = {XM_CDEPS} {TM_CDEPS} {NAT_CDEPS} \Option-d
ADD_FILES = {REGEX} {XM_ADD_FILES} {TM_ADD_FILES} {NAT_ADD_FILES}
ADD_DEPS = {REGEX1} {XM_ADD_FILES} {TM_ADD_FILES} {NAT_ADD_FILES}
VERSION = 4.12.1
VERSION = 4.12.3
DIST=gdb
LINT=:usr:5bin:lint
@ -678,7 +678,7 @@ YYOBJ = c-exp.tab.c.o m2-exp.tab.c.o ch-exp.tab.c.o
# .c.o \Option-f
# {CC} -c {INTERNAL_CFLAGS} $<
all \Option-f gdb MacGDB
all \Option-f gdb SiowGDB MacGDB
# @{MAKE} {FLAGS_TO_PASS} DO=all "DODIRS=`echo {SUBDIRS} | sed 's:testsuite::'`" subdir_do
# The check target can not use subdir_do, because subdir_do does not
@ -721,6 +721,35 @@ uninstall \Option-f force
:init.c \Option-f {OBS} {TSOBS}
Duplicate -d -y "{s}"mpw-init.c :init.c
:init-new.c \Option-f {OBS} {TSOBS}
Echo Making init.c
Delete -i -y init.c-tmp
Echo '/* Do not modify this file. */' >init.c-tmp
Echo '/* It is created automatically by the Makefile. */'>>init.c-tmp
Echo 'void initialize_all_files () {' >>init.c-tmp
For i in {OBS} {TSOBS}
set filename `Echo {i} | sed \Option-d
-e ',^Onindy.o,d' \Option-d
-e ',^nindy.o,d' \Option-d
-e ',ttyflush.o,d' \Option-d
-e ',xdr_ld.o,d' \Option-d
-e ',xdr_ptrace.o,d' \Option-d
-e ',xdr_rdb.o,d' \Option-d
-e ',udr.o,d' \Option-d
-e ',udip2soc.o,d' \Option-d
-e ',udi2go32.o,d' \Option-d
-e ',version.o,d' \Option-d
-e ',[a-z0-9A-Z_]*-exp.tab.o,d' \Option-d
-e 's,\.gc\.o,.c,' \Option-d
-e 's,\.c\.o,.c,'`
If {filename} != ""
sed <{s}{filename} >>init.c-tmp -n \Option-d
-e ',^_initialize_[a-z_0-9A-Z]* *(,s,^\([a-z_0-9A-Z]*\).*, {extern void \1 (); \1 ();},p'
End if
End For
Echo '}' >>init.c-tmp
Rename -y init.c-tmp init-new.c
# .PRECIOUS \Option-f "{s}"init.c
LOADLIBES = {EXTRALIBS}
@ -748,6 +777,21 @@ saber_gdb \Option-f {SFILES} {DEPFILES} "{s}"copying.c "{s}"version.c
#load `echo " "{DEPFILES} | sed -e 's:\.o:.c:g' -e 's, , ::,g'`
echo "Load "{s}".c corresponding to \Option-f " {DEPFILES}
# Version of GDB that uses the SIOW library.
SiowGDB \Option-f {OBS} {TSOBS} {ADD_DEPS} {CDEPS} "{o}"init.c.o
Delete -i -y SiowGDB
Rez -o SiowGDB {RIncludes}siow.r -append \Option-d
-d __kPrefSize=5000 -d __kMinSize=2000
Link -d -model far -o SiowGDB -t 'APPL' -c 'gdb ' \Option-d
"{o}"init.c.o {OBS} {TSOBS} {ADD_FILES} {CLIBS} \Option-d
"{CLibraries}"StdClib.o \Option-d
"{Libraries}"SIOW.o \Option-d
"{Libraries}"Runtime.o \Option-d
"{Libraries}"Interface.o
# Version of GDB that uses a real library.
MacGDB \Option-f {OBS} {TSOBS} {ADD_DEPS} {CDEPS} "{o}"init.c.o
Delete -i -y MacGDB
Rez -rd -o MacGDB "{s}"macgdb.r -append
@ -1249,12 +1293,12 @@ MAKEOVERRIDES=
"{o}"main.c.o \Option-f "{s}"main.c {bfd_h} {getopt_h} {readline_headers} "{s}"call-cmds.h \Option-d
{defs_h} {gdbcmd_h} {inferior_h} "{s}"language.h "{s}"signals.h \Option-d
{remote_utils_h}
{CC} "{srcdir}"main.c {INTERNAL_CFLAGS} {READLINE_CFLAGS} -o "{o}"main.c.o
{CC} "{srcdir}"main.c {INTERNAL_CFLAGS} {READLINE_CFLAGS} -s gdb_main -o "{o}"main.c.o
"{o}"top.c.o \Option-f "{s}"top.c {bfd_h} {getopt_h} {readline_headers} "{s}"call-cmds.h \Option-d
{defs_h} {gdbcmd_h} {inferior_h} "{s}"language.h "{s}"signals.h \Option-d
{remote_utils_h}
{CC} "{srcdir}"top.c {INTERNAL_CFLAGS} {READLINE_CFLAGS} -o "{o}"top.c.o
{CC} "{srcdir}"top.c {INTERNAL_CFLAGS} {READLINE_CFLAGS} -s gdb_top -o "{o}"top.c.o
"{o}"maint.c.o \Option-f "{s}"maint.c {defs_h} {gdbcmd_h} {gdbtypes_h} {symtab_h} "{s}"language.h \Option-d
{expression_h}

View File

@ -152,7 +152,7 @@ mac_readchar (scb, timeout)
int timeout;
{
int status, n;
/* time_t */ unsigned long starttime, now;
/* time_t */ unsigned long start_time, now;
OSErr err;
CntrlParam cb;
IOParam pb;
@ -160,7 +160,7 @@ mac_readchar (scb, timeout)
if (scb->bufcnt-- > 0)
return *scb->bufp++;
time (&starttime);
time (&start_time);
while (1)
{
@ -190,10 +190,8 @@ mac_readchar (scb, timeout)
else
{
time (&now);
if (now > starttime + timeout) {
printf_unfiltered ("start %u, now %u, timeout %d\n", starttime, now, timeout);
if (now > start_time + timeout)
return SERIAL_TIMEOUT;
}
}
}
}
@ -257,9 +255,9 @@ mac_write (scb, str, len)
OSErr err;
IOParam pb;
if (first_mac_write++ < 8)
if (first_mac_write++ < 4)
{
sleep (1);
sec_sleep (1);
}
pb.ioRefNum = output_refnum;
pb.ioBuffer = (Ptr) str;
@ -272,9 +270,22 @@ mac_write (scb, str, len)
return 0;
}
sec_sleep (int timeout)
{
unsigned long start_time, now;
time (&start_time);
while (1)
{
time (&now);
if (now > start_time + timeout)
return;
}
}
static void
mac_close (scb)
serial_t scb;
mac_close (serial_t scb)
{
if (input_refnum)
{