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

Add debug info support #298

Merged
merged 16 commits into from
Jul 2, 2020
Merged

Add debug info support #298

merged 16 commits into from
Jul 2, 2020

Conversation

devhawk
Copy link
Contributor

@devhawk devhawk commented Jun 19, 2020

Updates neon to support debug info as described in NDX-DN11. There will be a few updates to debug info format for NEO 3 that are not yet reflected in NDX-DN11 published here

  • extension is .nefdbgnfo to mirror contract extension change to .nef
  • removal of DebugInformatiom.entrypoint
  • addition of DebugInfo.hash to hold scripthash value (i.e. same value from abi.json file)

FYI, the Neo 3 preview 2 version of this code is in my personal fork: https://github.com/devhawk/neo-devpack-dotnet/tree/devhawk/nefdbgnfo-preview2

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

The code looks well and works, but i am not able to know test if the output if the expected, could you explain how to use the .nefdbgnfo ?

@devhawk
Copy link
Contributor Author

devhawk commented Jun 23, 2020

The code looks well and works, but i am not able to know test if the output if the expected, could you explain how to use the .nefdbgnfo ?

This file is used by the neo 3 debugger to map NEF file addresses to source code spans to enable source level debugging. It is analogous to the .avmdbgnfo file that is generated by the master-2.x branch of NEON. The Debug Info format is documented in NDX-DN11 and is implemented by Neo 2 versions of NEON, Neo-boa and neo-go's smart contract compiler.

We recently released a Neo 3 preview 2 compatible version of the debugger. That release also includes a version of NEON preview 2 w/ debug info. That version of NEON was built out of my fork of devpack-dotnet since I needed to add the debug info generation in an otherwise preview 2 compatible build. The code in this PR is slightly different which reflects changes in NEON master branch since preview 2.

shargon
shargon previously approved these changes Jun 26, 2020
Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

Wait for #311

methodJson.SetDictValue("id", method.name);
methodJson.SetDictValue("name", name);
methodJson.SetDictValue("range", range);
methodJson.SetDictValue("params", ConvertParamList(method.paramtypes));
Copy link
Member

Choose a reason for hiding this comment

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

params field does not follow the specification. Either it should be parameters or specification should be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this @AnnaShaleva. The specification is correct. I will update the NEON code and I've filed neo-project/neo-debugger#64 to track fixing the neo 3 preview 2 debugger

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI, turns out the spec was out of sync w/ the implementation of NEON 2, Neo Smart Contract Debugger for Neo 2 and neo-boa for neo 2. params and return are the correct property names. Sorry for the confusion! Spec update in PR: https://github.com/ngdseattle/design-notes/pull/7

src/Neo.Compiler.MSIL/DebugExport.cs Show resolved Hide resolved
src/Neo.Compiler.MSIL/DebugExport.cs Outdated Show resolved Hide resolved
@shargon
Copy link
Member

shargon commented Jul 1, 2020

@devhawk could you fix the conflicts in order to merge it?

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

@devhawk devhawk merged commit 44fabf6 into neo-project:master Jul 2, 2020
@devhawk devhawk deleted the devhawk/nefdbgnfo branch July 2, 2020 21:38
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.

None yet

3 participants