-
Notifications
You must be signed in to change notification settings - Fork 10
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
[llvm-context,solidity] Generate debug-info location information. #43
Conversation
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.
Code wise looks good overall, thanks! However applying -g
on the Baseline.sol
contract invalidates the LLVM module. It might be a good idea to enable debug info generation by default when compiling integration tests with the revive_solidity::test_utils
? This should give us reasonable test coverage.
I think it'd also be worthwhile to add a simple test case to explicitly test the information generated, just to be sure that the feature works as intended in principle. Doesn't have to be fancy, could be a rudimentary contract already in the integration test suite, where we just assert to find the correct line and object for some variable in a simply Solidity. WDYT?
Apparently only reproducible when the solc optimizer is disabled ( |
The problem seems to be with some debug locations getting out of sync with the function definitions they appear in. |
I see, thanks for looking into this!
Do you have any idea why this happens? Is it a bug in |
Add command line option '-g' to generate source level debug information in the output code. This only works with the LLVM-IR code generator. Add flag 'emit_debug_info' to the llvm-context optimizer/code-gen settings structure, to record the setting of the '-g' CLI option.
When debug-info generation is enabled, construct a DebugInfo instance. Add a namespace stack to the DebugInfo structure to keep track of the names of named scopes, such as namespaces, objects and functions, enclosing a construct. Generate source level debug information for the functions defined when YUL is lowered to LLVM-IR. This includes the deploy_code and runtime functions generated by the compiler. Generate debug-location information for other constructs that may appear in a contract.
Add option '--emit-llvm-ir' to output LLVM-IR for each contract. This is only available in debug builds. It cannot be used with '--asm' or '--bin'.
Can you please not force push an open PR? It makes it hard to review the changes. |
I forgot this PR was still open. The branch isn't ready to merge yet so I'll close it and open a new PR later. |
Generate source level debug information for the functions defined when generating LLVM-IR. This includes the deploy_code and runtime functions generated by the compiler.
Also generate debug-location information for other constructs that may appear.