mirror of
https://github.com/openai/codex.git
synced 2026-10-22 17:58:46 +00:00
Fix entrypoint lookup in package debug-symbol smoke tests (#56032)
## Why Rust v0 symbols can mention `codex_code_mode_host` as the instantiating crate of a dependency's generic function, so matching the crate name alone can select the wrong function. ## What changed Demangle `nm` output and match `codex_code_mode_host::main` exactly, preserving spaces within demangled names. Include local symbols in the Linux lookup by removing `--extern-only`. GitOrigin-RevId: b4ea4face3fe861966d3643d13db168143bcefa3
This commit is contained in:
committed by
copyberry
parent
943c70d8d2
commit
004c13292f
@@ -161,7 +161,7 @@ def _code_mode_host_symbol_address(
|
||||
*arguments: str,
|
||||
) -> str:
|
||||
symbol_output = subprocess.run(
|
||||
["nm", *arguments, str(symbols)],
|
||||
["nm", "-C", *arguments, str(symbols)],
|
||||
cwd=package.directory,
|
||||
env=package.environment,
|
||||
capture_output=True,
|
||||
@@ -169,12 +169,14 @@ def _code_mode_host_symbol_address(
|
||||
check=True,
|
||||
timeout=45,
|
||||
).stdout
|
||||
# Rust v0 symbols can name this crate only as the instantiating crate of
|
||||
# a dependency's generic function. Match the demangled entrypoint instead.
|
||||
return next(
|
||||
parts[0]
|
||||
for line in symbol_output.splitlines()
|
||||
if len(parts := line.split()) == 3
|
||||
if len(parts := line.split(maxsplit=2)) == 3
|
||||
and parts[1].lower() == "t"
|
||||
and "codex_code_mode_host" in parts[2]
|
||||
and parts[2] == "codex_code_mode_host::main"
|
||||
)
|
||||
|
||||
|
||||
@@ -185,7 +187,7 @@ def test_linux_debug_symbols_resolve_packaged_code(
|
||||
) -> None:
|
||||
"""Linux host symbols resolve a packaged function and its source location."""
|
||||
address = _code_mode_host_symbol_address(
|
||||
package, code_mode_host_debug_symbols, "--defined-only", "--extern-only"
|
||||
package, code_mode_host_debug_symbols, "--defined-only"
|
||||
)
|
||||
resolved = subprocess.run(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user