Skip to content

Commit

Permalink
Merge pull request #33 from sj-i/fix-proc-maps-reader
Browse files Browse the repository at this point in the history
fix a problem that ProcessMemoryMapParser can't parse proc/<pid>maps when device major has 3 digits
  • Loading branch information
sj-i committed Sep 19, 2020
2 parents 9f65417 + 96c42c3 commit 2f47fdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Lib/Process/MemoryMap/ProcessMemoryMapParser.php
Expand Up @@ -57,7 +57,7 @@ private function parseLine(string $line): ?ProcessMemoryArea
$matches = [];
preg_match(
// phpcs:ignore Generic.Files.LineLength.TooLong
'/([0-9a-f]{12,16})-([0-9a-f]{12,16}) ([r\-][w\-][x\-][p\-]) ([0-9a-f]{8}) ([0-9][0-9]:[0-9][0-9]) ([0-9]+) +([^ ]+)/',
'/([0-9a-f]{12,16})-([0-9a-f]{12,16}) ([r\-][w\-][x\-][p\-]) ([0-9a-f]{8}) ([0-9][0-9][0-9]?:[0-9][0-9]) ([0-9]+) +([^ ]+)/',
$line,
$matches
);
Expand Down
3 changes: 2 additions & 1 deletion tests/Lib/Process/MemoryMap/ProcessMemoryMapReaderTest.php
Expand Up @@ -26,7 +26,8 @@ public function testRead()
$result = (new ProcessMemoryMapReader())->read(getmypid());
$first_line = strtok($result, "\n");
$this->assertMatchesRegularExpression(
'/[0-9a-f]{12,16}-[0-9a-f]{12,16} [r\-][w\-][x\-][p\-] [0-9a-f]{8} [0-9][0-9]:[0-9][0-9] [0-9]+ +[^ ]+/',
// phpcs:ignore Generic.Files.LineLength.TooLong
'/[0-9a-f]{12,16}-[0-9a-f]{12,16} [r\-][w\-][x\-][p\-] [0-9a-f]{8} [0-9][0-9][0-9]?:[0-9][0-9] [0-9]+ +[^ ]+/',
$first_line
);
}
Expand Down

0 comments on commit 2f47fdf

Please sign in to comment.