Skip to content
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

addr2line command for inverse source mapping #741

Merged
merged 1 commit into from
Feb 11, 2022
Merged

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Feb 4, 2022

This PR adds inverse source code mapping, i.e. addr2line utility.
It improves the source mapping format by adding paths of downloaded dependencies to it.

Usage example:

$ forc build -p example_project/fuel_project/ -o fp.bin -g fp.map.json
...
  Compiled script "Fuel example project".
  Bytecode size is 180 bytes.
$ forc addr2line -s example_project -g fp.map.json -i 6
  --> "example_project/fuel_project/src/main.sw":25:14
   |
23 |
24 | fn main() {
25 |   let a = f0(0);
   |              - note: here
26 | }
   |
$ forc addr2line -s example_project -g fp.map.json -i 28 -c 5
  --> "/home/user/.forc/7786363458449203048/default/FuelLabs-sway-lib-core-87138fb/src/ops.sw":13:27
   |
 8 |     fn add(self, other: Self) -> Self;
 9 | }
10 |
11 | impl Add for u64 {
12 |     fn add(self, other: Self) -> Self {
13 |         asm(r1: self, r2: other, r3) {
   |                           ----- note: here
14 |             add r3 r2 r1;
15 |             r3: u64
16 |         }
17 |     }
18 | }
   |

@Dentosal Dentosal added the enhancement New feature or request label Feb 4, 2022
@Dentosal Dentosal requested a review from sezna February 4, 2022 07:15
@Dentosal Dentosal self-assigned this Feb 4, 2022
@Dentosal Dentosal force-pushed the inverse-source-mapping branch 2 times, most recently from 2b29497 to e84c8d8 Compare February 4, 2022 07:22
Copy link
Contributor

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

Exciting stuff!

sway-core/Cargo.toml Outdated Show resolved Hide resolved
@sezna sezna merged commit 0b1d0e1 into master Feb 11, 2022
@sezna sezna deleted the inverse-source-mapping branch February 11, 2022 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants