Skip to content

Commit 31075c4

Browse files
authored
Fix EMPROFILE=1 toolchain profiler to not break if user passes an incorrect @rsp (#25125)
Fix EMPROFILE=1 toolchain profiler to not break if user passes an incorrect @rsp file, but profile that command line as-is. This way the incorrect @rsp file error will be properly raised from within emcc, and not the toolchain profiler.
1 parent e57726c commit 31075c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/toolchain_profiler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ def record_process_exit():
188188

189189
@staticmethod
190190
def record_subprocess_spawn(process_pid, process_cmdline):
191-
expanded_cmdline = response_file.substitute_response_files(process_cmdline)
191+
try:
192+
expanded_cmdline = response_file.substitute_response_files(process_cmdline)
193+
except OSError:
194+
# If user is passing a malformed input command line, then the toolchain profiler should not
195+
# throw an exception, but profile the bad input command line as-is
196+
expanded_cmdline = process_cmdline
192197

193198
with ToolchainProfiler.log_access() as f:
194199
f.write(',\n{"pid":' + ToolchainProfiler.mypid_str + ',"subprocessPid":' + str(os.getpid()) + ',"op":"spawn","targetPid":' + str(process_pid) + ',"time":' + ToolchainProfiler.timestamp() + ',"cmdLine":["' + '","'.join(ToolchainProfiler.escape_args(expanded_cmdline)) + '"]}')

0 commit comments

Comments
 (0)