Skip to content

Commit f6b0914

Browse files
committed
Fix missing debug link and debug option
1 parent a45f314 commit f6b0914

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/SPC/builder/unix/UnixBuilderBase.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,15 @@ public function extractDebugInfo(string $binary_path): string
101101
FileSystem::createDir($target_dir);
102102
$basename = basename($binary_path);
103103
$debug_file = "{$target_dir}/{$basename}" . (PHP_OS_FAMILY === 'Darwin' ? '.dwarf' : '.debug');
104-
shell()->exec(match (PHP_OS_FAMILY) {
105-
'Darwin' => "dsymutil -f {$binary_path} -o {$debug_file}",
106-
'Linux' => "objcopy ---only-keep-debug {$binary_path} {$debug_file}",
107-
default => throw new SPCInternalException('extractDebugInfo is only supported on Linux and macOS'),
108-
});
104+
if (PHP_OS_FAMILY === 'Darwin') {
105+
shell()->exec("dsymutil -f {$binary_path} -o {$debug_file}");
106+
} elseif (PHP_OS_FAMILY === 'Linux') {
107+
shell()
108+
->exec("objcopy --only-keep-debug {$binary_path} {$debug_file}")
109+
->exec("objcopy --add-gnu-debuglink={$debug_file} {$binary_path}");
110+
} else {
111+
throw new SPCInternalException('extractDebugInfo is only supported on Linux and macOS');
112+
}
109113
return $debug_file;
110114
}
111115

0 commit comments

Comments
 (0)