Fix runtime stack trace computation - #11581
Merged
Merged
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
❌ @paperdave, your commit has failing tests :( 💻 1 failing tests Darwin x64 baseline
💻 1 failing tests Darwin x64
🪟💻 4 failing tests Windows x64 baseline
🪟💻 3 failing tests Windows x64
|
Contributor
Author
Contributor
Author
| int32_t column_stop; | ||
| int32_t expression_start; | ||
| int32_t expression_stop; | ||
| WTF::OrdinalNumber line; |
Collaborator
There was a problem hiding this comment.
Is it safe to use WTF::OrdinalNumber here? It won't be initialized as an C++ WTF::OrdinalNumber in Zig. I think this should be stored as an int32_t and then a method could be added to convert it to a WTF::OrdinalNumber.
Contributor
Author
There was a problem hiding this comment.
yeah lets do this
| int32_t expression_stop; | ||
| WTF::OrdinalNumber line; | ||
| WTF::OrdinalNumber column; | ||
| int byte_position; |
Collaborator
There was a problem hiding this comment.
Let's be more specific so there's no ambiguity:
Suggested change
| int byte_position; | |
| int32_t byte_position; |
| typedef struct ZigStackTrace { | ||
| BunString* source_lines_ptr; | ||
| int32_t* source_lines_numbers; | ||
| OrdinalNumber* source_lines_numbers; |
Collaborator
There was a problem hiding this comment.
We can't share C++ classes in Zig
Suggested change
| OrdinalNumber* source_lines_numbers; | |
| int32_t* source_lines_numbers; |
Jarred-Sumner
left a comment
Collaborator
There was a problem hiding this comment.
A couple nitpicky comments but this is a good improvement and once the tests pass & the comments are addressed, we should merge
Jarred-Sumner
marked this pull request as ready for review
June 5, 2024 00:25
|
|
||
| pos.column_zero_based = pos.column_zero_based - amount; | ||
| if (pos.column_zero_based < 0) { | ||
| auto source = code->source().provider()->source(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| auto source = code->source().provider()->source(); | |
| const auto *provider = code->source().provider(); | |
| if (UNLIKELY(!provider)) { | |
| return; | |
| } | |
| const auto& source = provider->source(); |
This was referenced Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #9302
Fixes #8880
After the previous adventure of source-mapping related issues, it seems the big issue blocking sourcemaps from working is simply our code reading line+column numbers from JavaScriptCore.
The original code
Is an alright idea, but the code that handles fixing this raw info does not work, with cases as simple as:
Instead we will simply use
expressionInfoForBytecodeIndexon the linked code block to retrive all of the computed offsets.+auto expr = m_codeBlock->expressionInfoForBytecodeIndex(bytecodeOffset);And to prevent zero-based vs one-based, I am using
OrdinalNumberpractically everywhere to ensure these numbers are interpretted correctly.Draft PR because there are surely test failures which will need to be corrected with proper location info, but I am noticing some potential mistakes in regards to oneBasedInt and zeroBasedInt