More mac fixups.

This commit is contained in:
Ben Vanik
2014-07-29 20:29:50 -07:00
parent 0c5110ac3e
commit d56ae60460
18 changed files with 165 additions and 70 deletions

29
src/poly/debugging_mac.cc Normal file
View File

@@ -0,0 +1,29 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <poly/debugging.h>
#include <sys/sysctl.h>
#include <unistd.h>
namespace poly {
namespace debugging {
bool IsDebuggerAttached() {
// https://developer.apple.com/library/mac/qa/qa1361/_index.html
kinfo_proc info;
info.kp_proc.p_flag = 0;
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()};
size_t size = sizeof(info);
sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0);
return (info.kp_proc.p_flag & P_TRACED) != 0;
}
} // namespace debugging
} // namespace poly