-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Don't substract 1 from end_addr in line program writing #2174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,25 @@ fn check_wasm(wasm_path: &str, directives: &str) -> Result<()> { | |
| Ok(()) | ||
| } | ||
|
|
||
| #[allow(dead_code)] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a copy&pasted function which could be refactored. I didn't do it, because this is test-only code. If somebody objects, I'm happy to fix. |
||
| fn check_line_program(wasm_path: &str, directives: &str) -> Result<()> { | ||
| let wasm = read(wasm_path)?; | ||
| let obj_file = NamedTempFile::new()?; | ||
| let obj_path = obj_file.path().to_str().unwrap(); | ||
| compile_cranelift(&wasm, None, obj_path)?; | ||
| let dump = get_dwarfdump(obj_path, DwarfDumpSection::DebugLine)?; | ||
| let mut builder = CheckerBuilder::new(); | ||
| builder | ||
| .text(directives) | ||
| .map_err(|e| format_err!("unable to build checker: {:?}", e))?; | ||
| let checker = builder.finish(); | ||
| let check = checker | ||
| .explain(&dump, NO_VARIABLES) | ||
| .map_err(|e| format_err!("{:?}", e))?; | ||
| assert!(check.0, "didn't pass check {}", check.1); | ||
| Ok(()) | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| #[cfg(all( | ||
|
|
@@ -89,3 +108,23 @@ check: DW_AT_decl_line (10) | |
| "##, | ||
| ) | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| #[cfg(all( | ||
| any(target_os = "linux", target_os = "macos"), | ||
| target_arch = "x86_64", | ||
| target_pointer_width = "64" | ||
| ))] | ||
| fn test_debug_dwarf5_translate_lines() -> Result<()> { | ||
| check_line_program( | ||
| "tests/all/debug/testsuite/fib-wasm-dwarf5.wasm", | ||
| r##" | ||
| check: Address Line Column File ISA Discriminator Flags | ||
| check: 0x000000000000013c 15 3 1 0 0 | ||
| # The important point is that the following offset must be _after_ the `ret` instruction. | ||
| # FIXME: this +1 increment might vary on other archs. | ||
| check: 0x000000000000013d 15 3 1 0 0 end_sequence | ||
|
bjorn3 marked this conversation as resolved.
Outdated
|
||
| "##, | ||
| ) | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment similar to what we have in the test?