🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by John R. Levine Wed, 24 Jan 1990 02:21
Strange System V/386 problem
#345
Author: John R. Levine
Date: Wed, 24 Jan 1990 02:21
24 lines
1621 bytes
I'm running gdb 3.4 under 386/ix 2.0.2, which is a derivative of AT&T's
Sys V/386 3.2.

On some machines, gdb crashes when it's starting up while calling the
vendor's termio tgetent() routine.  It always works when run under
itself (actually, under 3.2, it's not an infinitely recursive bug.)
After some poking around, it appears that depending on the environment
size, or whether you're running YP, or the phase of the moon or something,
the stack is not always long-aligned when main() is called, and tgetent()
takes strong offense at that.  On some machines this bug never appears, but
on those where it does, it occurs quite reliably.

If you put this:

	(void)alloca(1);

before the first executable statement in main(), alloca will, being a good
citizen, long-align the stack before it returns, after which everything
works just fine.  Note that you should use the assembler alloca() in -lPW
or the equivalent, not the clever portable malloc-based version.
-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."
Re: Strange System V/386 problem
#347
Author: John R. Levine
Date: Wed, 24 Jan 1990 03:16
15 lines
1339 bytes
In article <1990Jan24.022138.12102@esegue.segue.boston.ma.us> johnl@esegue.segue.boston.ma.us (John R. Levine) writes:
>alloca will, being a good citizen, long-align the stack before it returns,
>after which everything works just fine.  ...

Oops, I should have checked more carefully.  If you compile gdb in the
obvious way with gcc you get the builtin alloca which just subtracts its
argument from the stack pointer without trying to align it.  So try the
following at the beginning of main(), just after the "register int i;".

  i = (int)&count & 0x3;
  if(i) alloca(4-i);	/* align the stack, a gross hack */
-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads