-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Tom G. Christensen on 9/2/2008 9:28 AM:
>> So, with my typo fixed, can you once again try those debugging steps, to
>> see if the breakpoint in overflow_handler trips?
>>
> It does not.

Which means I think we have isolated the bug to the recurse function.
Gnulib's version must be doing something that actually manages to recurse
with p == 0 in the final stack frame, then segv's dereferencing NULL
rather than triggering stack overflow:

static long
recurse (char *p)
{
  char array[500];
  array[0] = 1;
  return *p + recurse (array);
}

Whereas libsigsegv's version goes to greater lengths to try to force a
pure stack overflow:

volatile int *
recurse_1 (int n, volatile int *p)
{
  if (n < INT_MAX)
    *recurse_1 (n + 1, p) += n;
  return p;
}

int
recurse (volatile int n)
{
  return *recurse_1 (n, &n);
}

I wonder if switching to libsigsegv's version will solve it.  In the
meantime, I would be curious to see the disassembly of recurse, to see if
anything obvious appears as to why p==0 rather than a valid stack address
before the final stack frame.  In gdb, you can get this with 'disas recurse'.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAki9kgsACgkQ84KuGfSFAYCWewCgyWhATWUWKLkMsCwi1XczSO0j
PSUAn2Fyt5z4o5MeMAzx6r8RYvS0ps+r
=EDOX
-----END PGP SIGNATURE-----


Reply via email to