bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gdb handling of Mach exceptions


From: Brent W. Baccala
Subject: gdb handling of Mach exceptions
Date: Sun, 20 Nov 2016 22:03:51 -1000

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

[Prev in Thread] Current Thread [Next in Thread]