summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-03-01 19:35:09 +0000
committerGreg Clayton <gclayton@apple.com>2012-03-01 19:35:09 +0000
commit3442d46eac424f1f3d4e67f00b1ac390f152ce94 (patch)
tree58443b332ceb12fe2c3d153c6a78baf74701c49b /lldb/tools/debugserver/source
parent896cd1d3e675b1c7be05be9975b09df1bafca9eb (diff)
downloadbcm5719-llvm-3442d46eac424f1f3d4e67f00b1ac390f152ce94.tar.gz
bcm5719-llvm-3442d46eac424f1f3d4e67f00b1ac390f152ce94.zip
<rdar://problem/10963899>
Allow debugserver to be built on a newer kernel and still allow debugging on older kernels. llvm-svn: 151827
Diffstat (limited to 'lldb/tools/debugserver/source')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachException.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.cpp b/lldb/tools/debugserver/source/MacOSX/MachException.cpp
index 2d0e055bb0e..24206a99adb 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachException.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachException.cpp
@@ -465,16 +465,42 @@ MachException::Data::Dump() const
}
}
+#define PREV_EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \
+ EXC_MASK_BAD_INSTRUCTION | \
+ EXC_MASK_ARITHMETIC | \
+ EXC_MASK_EMULATION | \
+ EXC_MASK_SOFTWARE | \
+ EXC_MASK_BREAKPOINT | \
+ EXC_MASK_SYSCALL | \
+ EXC_MASK_MACH_SYSCALL | \
+ EXC_MASK_RPC_ALERT | \
+ EXC_MASK_MACHINE)
+
kern_return_t
MachException::PortInfo::Save (task_t task)
{
- count = (sizeof (ports) / sizeof (ports[0]));
DNBLogThreadedIf(LOG_EXCEPTIONS | LOG_VERBOSE, "MachException::PortInfo::Save ( task = 0x%4.4x )", task);
+ // Be careful to be able to have debugserver built on a newer OS than what
+ // it is currently running on by being able to start with all exceptions
+ // and back off to just what is supported on the current system
DNBError err;
- err = ::task_get_exception_ports (task, EXC_MASK_ALL, masks, &count, ports, behaviors, flavors);
+
+ exception_mask_t exception_mask = EXC_MASK_ALL;
+
+ count = (sizeof (ports) / sizeof (ports[0]));
+ err = ::task_get_exception_ports (task, exception_mask, masks, &count, ports, behaviors, flavors);
if (DNBLogCheckLogBit(LOG_EXCEPTIONS) || err.Fail())
- err.LogThreaded("::task_get_exception_ports ( task = 0x%4.4x, mask = 0x%x, maskCnt => %u, ports, behaviors, flavors )", task, EXC_MASK_ALL, count);
+ err.LogThreaded("::task_get_exception_ports ( task = 0x%4.4x, mask = 0x%x, maskCnt => %u, ports, behaviors, flavors )", task, exception_mask, count);
+
+ if (err.Error() == KERN_INVALID_ARGUMENT && exception_mask != PREV_EXC_MASK_ALL)
+ {
+ exception_mask = PREV_EXC_MASK_ALL;
+ count = (sizeof (ports) / sizeof (ports[0]));
+ err = ::task_get_exception_ports (task, exception_mask, masks, &count, ports, behaviors, flavors);
+ if (DNBLogCheckLogBit(LOG_EXCEPTIONS) || err.Fail())
+ err.LogThreaded("::task_get_exception_ports ( task = 0x%4.4x, mask = 0x%x, maskCnt => %u, ports, behaviors, flavors )", task, exception_mask, count);
+ }
if (err.Fail())
count = 0;
return err.Error();
OpenPOWER on IntegriCloud