Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Aug 18, 2025

The v8 bug that made this necessary was fixed in 2019: https://crbug.com/v8/9172

From running some tests I confirmed the node v12 and newer work fine without the offset converter. Older node versions such as v10 will show a warning about the legacy backtrace format and will not see symbol names in their backtraces (when using ASAN etc).

Fixes: #24587

@sbc100 sbc100 requested review from RReverser and kripken August 18, 2025 22:00
@RReverser
Copy link
Collaborator

Don't have time to do a thorough review right now, but looks like a nice cleanup!

var match;
if (match = /^\s+at .*\.wasm\.(.*) \(.*\)$/.exec(frame)) {
name = match[1];
} else if (match = /^\s+at (.*) \(.*\)$/.exec(frame)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we used two completely different mechanism for getting the functions name:

  1. For JS functions to match against the line in the backtrace.
  2. For native functions we rely on wasmOffsetConverter.

However as @RReverser pointed out in #24587, there is no need to do that now that the v8 bug has been fixed, and we can use the same approach for both native and JS functions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, ok.

I spent a little time trying to figure out what these two lines (249 and 251) accept and reject, and I think I get it now. Perhaps add some comments though? I mean something like saying on the first, "this is the pattern emitted by [..], which looks like [example]" etc.

@sbc100 sbc100 force-pushed the remove_offset_coverter branch 3 times, most recently from 806478e to b3a1d6f Compare August 18, 2025 23:20
@sbc100 sbc100 force-pushed the remove_offset_coverter branch 2 times, most recently from d6cfa63 to ab6ab74 Compare August 18, 2025 23:37
if (!wasmOffsetConverter.isSameFunc(offset, normalized)) {
return null;
}
#endif
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this bit of code was supposed to be doing. It looks like its an early exit if the "normalized" is not in the same function as the original offset.

It was added in #8711, but the code also has to work in the absence of USE_OFFSET_CONVERTER.. so I'm tempted to say that if the tests pass we should just land this.

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise

@sbc100 sbc100 enabled auto-merge (squash) August 19, 2025 00:33
The v8 bug that made this necessary was fixed in 2019: https://crbug.com/v8/9172

From running some tests I confirmed the node v12 and newer work fine
without the offset converter.  Older node versions such as v10 will show
a warning about the legacy backtrace format and will not see symbol
names in their backtraces (when using ASAN etc).

Fixes: emscripten-core#24587
@sbc100 sbc100 disabled auto-merge August 19, 2025 00:34
@sbc100 sbc100 force-pushed the remove_offset_coverter branch from ab6ab74 to a895413 Compare August 19, 2025 00:40
@sbc100 sbc100 merged commit 95c65e9 into emscripten-core:main Aug 19, 2025
1 of 13 checks passed
@sbc100 sbc100 deleted the remove_offset_coverter branch August 19, 2025 00:40
sbc100 added a commit that referenced this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate WasmOffsetConverter?

3 participants