mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 23:35:37 +08:00
Fix missing debug link and debug option
This commit is contained in:
@@ -101,11 +101,15 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
FileSystem::createDir($target_dir);
|
FileSystem::createDir($target_dir);
|
||||||
$basename = basename($binary_path);
|
$basename = basename($binary_path);
|
||||||
$debug_file = "{$target_dir}/{$basename}" . (PHP_OS_FAMILY === 'Darwin' ? '.dwarf' : '.debug');
|
$debug_file = "{$target_dir}/{$basename}" . (PHP_OS_FAMILY === 'Darwin' ? '.dwarf' : '.debug');
|
||||||
shell()->exec(match (PHP_OS_FAMILY) {
|
if (PHP_OS_FAMILY === 'Darwin') {
|
||||||
'Darwin' => "dsymutil -f {$binary_path} -o {$debug_file}",
|
shell()->exec("dsymutil -f {$binary_path} -o {$debug_file}");
|
||||||
'Linux' => "objcopy ---only-keep-debug {$binary_path} {$debug_file}",
|
} elseif (PHP_OS_FAMILY === 'Linux') {
|
||||||
default => throw new SPCInternalException('extractDebugInfo is only supported on Linux and macOS'),
|
shell()
|
||||||
});
|
->exec("objcopy --only-keep-debug {$binary_path} {$debug_file}")
|
||||||
|
->exec("objcopy --add-gnu-debuglink={$debug_file} {$binary_path}");
|
||||||
|
} else {
|
||||||
|
throw new SPCInternalException('extractDebugInfo is only supported on Linux and macOS');
|
||||||
|
}
|
||||||
return $debug_file;
|
return $debug_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user