1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the sj-i/php-profiler package. |
5
|
|
|
* |
6
|
|
|
* (c) sji <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace PhpProfiler\Command\Inspector; |
15
|
|
|
|
16
|
|
|
use PhpProfiler\Command\CommandSettingsException; |
17
|
|
|
use PhpProfiler\Command\Inspector\Settings\TargetProcessSettings; |
18
|
|
|
use PhpProfiler\Lib\Elf\Parser\ElfParserException; |
19
|
|
|
use PhpProfiler\Lib\Elf\Tls\TlsFinderException; |
20
|
|
|
use PhpProfiler\Lib\PhpProcessReader\PhpGlobalsFinder; |
21
|
|
|
use PhpProfiler\Lib\Process\MemoryReader\MemoryReaderException; |
22
|
|
|
use PhpProfiler\Lib\Elf\Process\ProcessSymbolReaderException; |
23
|
|
|
use Symfony\Component\Console\Command\Command; |
|
|
|
|
24
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
|
25
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
|
|
|
26
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class GetEgAddressCommand |
30
|
|
|
* @package PhpProfiler\Command\Inspector |
31
|
|
|
*/ |
32
|
|
|
final class GetEgAddressCommand extends Command |
33
|
|
|
{ |
34
|
|
|
private PhpGlobalsFinder $php_globals_finder; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* GetEgAddressCommand constructor. |
38
|
|
|
* |
39
|
|
|
* @param PhpGlobalsFinder $php_globals_finder |
40
|
|
|
* @param string|null $name |
41
|
|
|
*/ |
42
|
|
|
public function __construct( |
43
|
|
|
PhpGlobalsFinder $php_globals_finder |
44
|
|
|
) { |
45
|
|
|
parent::__construct(); |
46
|
|
|
$this->php_globals_finder = $php_globals_finder; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function configure(): void |
50
|
|
|
{ |
51
|
|
|
$this->setName('inspector:eg_address') |
52
|
|
|
->setDescription('get EG address from an outer process or thread') |
53
|
|
|
->addOption('pid', 'p', InputOption::VALUE_REQUIRED, 'process id'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param InputInterface $input |
58
|
|
|
* @param OutputInterface $output |
59
|
|
|
* @return int |
60
|
|
|
* @throws MemoryReaderException |
61
|
|
|
* @throws ProcessSymbolReaderException |
62
|
|
|
* @throws ElfParserException |
63
|
|
|
* @throws TlsFinderException |
64
|
|
|
* @throws CommandSettingsException |
65
|
|
|
*/ |
66
|
|
|
public function execute(InputInterface $input, OutputInterface $output): int |
67
|
|
|
{ |
68
|
|
|
$target_process_settings = TargetProcessSettings::fromConsoleInput($input); |
69
|
|
|
|
70
|
|
|
$output->writeln( |
71
|
|
|
'0x' . dechex($this->php_globals_finder->findExecutorGlobals($target_process_settings->pid)) |
72
|
|
|
); |
73
|
|
|
|
74
|
|
|
return 0; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths