Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit f4579b2

Browse files
author
Mike McLaughlin
authored
Fix debugging on OS X Sierra (#10078) (#10205)
Issue #9730 The output of the vmmap changed between OS X versions. Changed the sscanf formatting to deal with both old/new formats.
1 parent a59b790 commit f4579b2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/pal/src/thread/process.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,6 +2666,12 @@ CreateProcessModules(
26662666
// VM_ALLOCATE 0000000105bac000-0000000105bad000 [ 4K] r--/rw- SM=SHM
26672667
// MALLOC (admin) 0000000105bad000-0000000105bae000 [ 4K] r--/rwx SM=ZER
26682668
// MALLOC 0000000105bae000-0000000105baf000 [ 4K] rw-/rwx SM=ZER
2669+
2670+
// OS X Sierra (10.12.4 Beta)
2671+
// REGION TYPE START - END [ VSIZE RSDNT DIRTY SWAP] PRT/MAX SHRMOD PURGE REGION DETAIL
2672+
// Stack 00007fff5a930000-00007fff5b130000 [ 8192K 32K 32K 0K] rw-/rwx SM=PRV thread 0
2673+
// __TEXT 00007fffa4a0b000-00007fffa4a0d000 [ 8K 8K 0K 0K] r-x/r-x SM=COW /usr/lib/libSystem.B.dylib
2674+
// __TEXT 00007fffa4bbe000-00007fffa4c15000 [ 348K 348K 0K 0K] r-x/r-x SM=COW /usr/lib/libc++.1.dylib
26692675
char *line = NULL;
26702676
size_t lineLen = 0;
26712677
int count = 0;
@@ -2686,9 +2692,8 @@ CreateProcessModules(
26862692
{
26872693
void *startAddress, *endAddress;
26882694
char moduleName[PATH_MAX];
2689-
int size;
26902695

2691-
if (sscanf(line, "__TEXT %p-%p [ %dK] %*[-/rwxsp] SM=%*[A-Z] %s\n", &startAddress, &endAddress, &size, moduleName) == 4)
2696+
if (sscanf_s(line, "__TEXT %p-%p [ %*[0-9K ]] %*[-/rwxsp] SM=%*[A-Z] %s\n", &startAddress, &endAddress, moduleName, _countof(moduleName)) == 3)
26922697
{
26932698
bool dup = false;
26942699
for (ProcessModules *entry = listHead; entry != NULL; entry = entry->Next)

0 commit comments

Comments
 (0)