Skip to content

Conversation

@Kamirus
Copy link
Contributor

@Kamirus Kamirus commented Jun 23, 2025

Instructions how to run it and how I've verified it when testing the motoko_debugger:

  • Switch to this branch in the motoko repo and execute nix develop (this will put the locally build moc in the PATH)
  • Have the motoko-core repo checkout on the branch kamil/experiment-debugger-manual-test next to this repo, go there: cd ../motoko-core (here we have the test files we would like to debug)
  • Clone and build the motoko_debugger
  • make -C ../motoko/src moc && moc $(mops sources) -o MoDe.wasm -g --legacy-persistence test/List.test.mo && ~/motoko_debugger/target/release/debugger MoDe.wasm. It builds the moc compiler and then compiles the problematic List test file, and finally runs the debugger on it. It should start and run to the end without problems now.

The debug line section in DWARF can be verified with

  • make -C ../motoko/src moc && moc $(mops sources) -o MoDe.wasm -g --legacy-persistence test/List.test.mo && llvm-dwarfdump --debug-line MoDe.wasm > out
  • open the out file in the editor and look for the File column, the file indices should not exceed the number of files

The only relevant changes are in the src/wasm-exts/customModuleEncode.ml file. The other changes (compared with master) are due to an unrelated issue. I'll change the target of the branch to the branch related to that fix to limit the number of changes files in this PR. Do not merge

@Kamirus Kamirus changed the base branch from master to kamil/avoid-unused-internal-imports June 23, 2025 09:12
@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2025

Comparing from c850d22 to 34b3fd0:
The produced WebAssembly code seems to be completely unchanged.

@ggreif ggreif changed the title Experiment: Fix debugger DWARF file indicies Experiment: Fix debugger DWARF file indices Jun 25, 2025
Base automatically changed from kamil/avoid-unused-internal-imports to master June 30, 2025 15:24
@hapeeeeee
Copy link

hi bro, after clone this repo, and run `sudo nix --extra-experimental-features 'nix-command flakes' develop
i got

error: input 'https://github.com/viperproject/viperserver/releases/download/v.22.11-release/viperserver.jar' is unsupported`

how can i fix it?

@Kamirus
Copy link
Contributor Author

Kamirus commented Jul 14, 2025

hi bro, after clone this repo, and run `sudo nix --extra-experimental-features 'nix-command flakes' develop i got

error: input 'https://github.com/viperproject/viperserver/releases/download/v.22.11-release/viperserver.jar' is unsupported`

how can i fix it?

Sorry for late reply I was on vacation. Here is the link how to do the setup. Did you followed it and still encountered this issue?

@Kamirus Kamirus marked this pull request as ready for review July 15, 2025 15:40
@Kamirus Kamirus requested a review from a team as a code owner July 15, 2025 15:40
@Kamirus Kamirus changed the title Experiment: Fix debugger DWARF file indices feat: fix DWARF file indices in the debug_line section Jul 15, 2025
@Kamirus Kamirus changed the title feat: fix DWARF file indices in the debug_line section fix: fix DWARF file indices in the debug_line section Jul 15, 2025
@hapeeeeee
Copy link

Here is the link how to do the setup. Did you followed it and still encountered this issue?

yes, it still exist.
image

@Kamirus
Copy link
Contributor Author

Kamirus commented Jul 16, 2025

Here is the link how to do the setup. Did you followed it and still encountered this issue?

yes, it still exist. image

Maybe the issue is installing and using nix via sudo? I have no idea otherwise, I've asked internally the team if they are aware how to fix your issue

@hapeeeeee
Copy link

Could you share a precompiled moc binary (x86_64-linux) in which the “file index too high” issue has already been fixed?
I’d like to use it to check whether the “file index: out of bound” problem mentioned in scalebit/motoko_debugger#4 still exists.

Or, if you have already tested it, are there any other issues remaining?

@Kamirus
Copy link
Contributor Author

Kamirus commented Jul 16, 2025

I've tested it and updated my findings in caffeinelabs/motoko-core#327.
Together with the fix to moc (this PR) and the resolved File not found I think the debugger works pretty well!

Copy link
Contributor

@crusso crusso left a comment

Choose a reason for hiding this comment

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

Looks ok to me. I guess it would be slightly better if this list was populated from the code generators, and not here, but it's fine.

@Kamirus Kamirus added the automerge-squash When ready, merge (using squash) label Jul 16, 2025
@mergify mergify bot merged commit e05f64a into master Jul 16, 2025
26 checks passed
@mergify mergify bot deleted the kamil/experiment-fix-debugger branch July 16, 2025 11:31
@mergify mergify bot removed the automerge-squash When ready, merge (using squash) label Jul 16, 2025
@Kamirus
Copy link
Contributor Author

Kamirus commented Jul 21, 2025

Could you share a precompiled moc binary (x86_64-linux) in which the “file index too high” issue has already been fixed? I’d like to use it to check whether the “file index: out of bound” problem mentioned in scalebit/motoko_debugger#4 still exists.

Or, if you have already tested it, are there any other issues remaining?

You can grab the precompiled moc from this draft release

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.

4 participants