MPS issue job001669

TitleDevelopers can't debug MPS on OS X.
Statusclosed
Priorityessential
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionCannot debug MPS on OS X.

It seems that once a process on OS X has taken a barrier hit, it is
impossible to continue the process from within gdb, the debugger.

Either this really is impossible (which is essentially a bug in OS X)
or we can't figure out how to.

Here's an example gdb session:

 (gdb) run
 Starting program: /Users/drj/info.ravenbrook.com/project/mps/master/code/xci3gc/ci/amcss
 Reading symbols for shared libraries . done
 Randomizing 28358 times.
 ...........
 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_PROTECTION_FAILURE at address: 0x005df6b8
 0x000046e9 in dylan_write (addr=0x5df6ac, refs=0x61780, nr_refs=180) at fmtdytst.c:165
 165 p[i] = (mps_word_t)refs[(r >> 1) % nr_refs]; /* random ptr */

Now at this point we ought to be able to type:
handle EXC_BAD_ACCESS nostop
into gdb, and have it observe the signal, but pass it through to the process
without stopping. (We could then continue the process being debugged
with "continue") Unfortunately what happens is that the process and
the debugger enter an infinite loop.

This makes it essentially impossible to use gdb to do any debugging of
the MPS on OS X.
AnalysisThis can be solved in GDB by "set dont-handle-bad-access 1" and "handle SIGBUS pass nostop noprint" <http://stackoverflow.com/questions/204...b-set-a-breakpoint-for-a-sigbus-handler>. There does not seem to be an equivalent in LLDB. We must document this for people developing with the MPS.
How foundunknown
EvidenceSee Description.
Observed in1.107.0
Created byDavid Jones
Created on2007-07-09 16:56:34
Last modified byGareth Rees
Last modified on2012-10-22 13:03:42
History2007-07-09 DRJ Created.
2012-08-15 RB Added workaround and changed to documentation job.

Fixes

Change Effect Date User Description
180005 closed 2012-10-22 13:03:42 Gareth Rees Be clear that the "dont-handle-bad-access" workaround is Mac OS X specific.