-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mach-engine: Don't allow --pid, format
- Loading branch information
1 parent
bcc1b5d
commit 7ae72b7
Showing
1 changed file
with
26 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,13 +198,17 @@ class MachEngine : public IEngine | |
// From IEngine | ||
virtual int registerBreakpoint(unsigned long addr) override | ||
{ | ||
uint32_t data; | ||
uint32_t data = 0; | ||
|
||
// There already? | ||
if (m_instructionMap.find(addr) != m_instructionMap.end()) | ||
return 0; | ||
|
||
data = peekWord(getAligned(addr)); | ||
if (IConfiguration::getInstance().keyAsInt("running-mode") != | ||
IConfiguration::MODE_REPORT_ONLY) | ||
{ | ||
data = peekWord(getAligned(addr)); | ||
} | ||
m_instructionMap[addr] = data; | ||
m_pendingBreakpoints.insert(addr); | ||
|
||
|
@@ -216,6 +220,13 @@ class MachEngine : public IEngine | |
{ | ||
m_listener = &listener; | ||
|
||
if (IConfiguration::getInstance().keyAsInt("attach-pid") != 0) | ||
{ | ||
error("the mach-engine does not support --pid (on OSX)"); | ||
exit(1); | ||
} | ||
|
||
|
||
posix_spawnattr_t attr; | ||
|
||
auto rv = posix_spawnattr_init(&attr); | ||
|
@@ -234,7 +245,7 @@ class MachEngine : public IEngine | |
} | ||
|
||
// Fork the process, in suspended mode | ||
auto &conf = IConfiguration::getInstance(); | ||
auto& conf = IConfiguration::getInstance(); | ||
auto argv = conf.getArgv(); | ||
rv = posix_spawn(&m_pid, argv[0], nullptr, &attr, (char* const*)argv, environ); | ||
if (rv != 0) | ||
|
@@ -251,15 +262,18 @@ class MachEngine : public IEngine | |
auto kcov_path = get_real_path(conf.keyAsString("kcov-binary-path")); | ||
|
||
error("task_for_pid failed with %d\n" | ||
"\n" | ||
"This usually means that the kcov binary needs to be signed with codesign, when\n" | ||
"not running as root. See https://github.com/SimonKagstrom/kcov/blob/master/INSTALL.md\n" | ||
"for instructions on how to do that.\n" | ||
"\n" | ||
"Then run\n" | ||
"\n" | ||
" codesign -s \"Apple Development: [email protected] (XXXXXXXXX)\" --entitlements <kcov-source>/osx-entitlements.xml -f %s" | ||
, kret, kcov_path.c_str()); | ||
"\n" | ||
"This usually means that the kcov binary needs to be signed with codesign, when\n" | ||
"not running as root. See " | ||
"https://github.com/SimonKagstrom/kcov/blob/master/INSTALL.md\n" | ||
"for instructions on how to do that.\n" | ||
"\n" | ||
"Then run\n" | ||
"\n" | ||
" codesign -s \"Apple Development: [email protected] (XXXXXXXXX)\" " | ||
"--entitlements <kcov-source>/osx-entitlements.xml -f %s", | ||
kret, | ||
kcov_path.c_str()); | ||
|
||
exit(1); | ||
return false; | ||
|