Hi -

I've been trying to use gdb on ext2fs when it runs out of disk space and
starts generating memory access exceptions.

It doesn't behave right.  The memory faults get reported as unknown signals
and the program can't be restarted:

Program received signal ?, Unknown signal.
[Switching to Thread 812.8]
0x080eca46 in memcpy ()
(gdb) cont
Continuing.
warning: Signal ? does not exist on this system.
warning: Pid 812 died with unknown exit status, using SIGKILL.

Program terminated with signal SIGKILL, Killed.
The program no longer exists.
(gdb)

I've tracked the problem down to the file gdb/common/signals.c in the gdb
source tree.  This file includes a lot of statements like this:

  /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
  if (hostsig == _NSIG + EXC_BAD_ACCESS)
    return GDB_EXC_BAD_ACCESS;
#endif

The problem is that mach/exception.h isn't included at this point, so
EXC_BAD_ACCESS isn't defined and this code isn't included.

I've added #include <mach/exception.h> to signals.c, and produced a working
gdb:

Program received signal EXC_BAD_ACCESS, Could not access memory.
[Switching to Thread 769.8]
0x080eca46 in memcpy ()
(gdb) cont
Continuing.

Obviously, tacking a Mach-specific include into signals.c isn't the right
solution, so can somebody suggest a proper fix?

Otherwise, I'll dig into it some more and eventually propose something
myself.

    agape
    brent

Reply via email to