-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Windows Debug Information for local variables - prerequisite record definitions #5638
base: master
Are you sure you want to change the base?
Conversation
...src/com.oracle.objectfile/src/com/oracle/objectfile/pecoff/cv/CVSymbolSubsectionBuilder.java
Outdated
Show resolved
Hide resolved
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.
Sorry, I cannot comment on the correctness of the PECOFF record layouts or what CodeView expects. However, as far as use of the generic param info is concerned this looks ok.
6e6e24a
to
569ab0d
Compare
@@ -152,14 +191,96 @@ private void buildFunction(CompiledMethodEntry compiledEntry) { | |||
addLineNumberRecords(compiledEntry); | |||
} | |||
|
|||
void addLocals(CompiledMethodEntry primaryEntry) { |
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.
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.
@pejovica this PR is a prerequisite to adding that support. This PR mostly implements the CodeView records required, and provides a quick but working proof of concept to examine register-based function parameters. A follow up PR will extend the functionality to use DebugLocalInfo, which was not available when this code was written.
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.
@pejovica, I have modified this PR to use the actual parameter names instead of synthetic names (no more 'p1, 'p2', etc), which means this PR as is is fairly useful to Windows developers, which can now set a breakpoint at function start and examine parameters in the Visual Studio IDE. I have also merged the latest Graal head. Please have a look when you get the chance.
I continue to work on the follow-up PR, which will take full advantage of @adinn 's PR #4505.
@pejovica Is there any reason why this PR has still not been integrated? Simon (@stooke) has code already lined up that will use location info. However, that code is not included here because he was explicitly asked to implement the Windows behaviour in stages. Can we please make progress on this PR which has been sitting waiting for a final review for months? |
@adinn Sorry about that. I was interrupted by other work and this PR unfortunately fell off the radar. However, it will need a bit more work before it can be integrated. In particular, I don't think we should hardcode the same calling convention for all methods as is done in this PR because that is clearly incorrect. Instead, I think the logic in I actually expected that the API introduced in #4505 already took care of this, but that doesn't seem to be the case. As far as I can tell, when creating a synthetic location record, So I think the location info API should be fixed to use the actual calling convention (see |
Clearly? ... Err .. I mean ... Clearly, yes! of course!
I was not aware that that different compiled methods had different calling conventions (for a given architecture, that is).
Yes, for Linux If there is a need for different calling conventions according to the type of the compiled method then can you clarify 1) what OS/CPU combinations it applies for; also 2) what property of the method leads to it being compiled with a given calling convention? Is this a requirement for native image code or is it, say, only for code generated by Truffle? or some other type of generated code?
So, it seems you are suggesting that |
Looking at the code in my repo (which needs a rebase so is slightly our of date), in SubstrateCallingConventionKind.java, there are only three calling conventions - Java (needed), Native (generated by the underlying C/C++ compilers and ForwardReturnValue, which is never used, only checked for. I think it's perfectly valid, if inelegant, for the debuginfo generator to simply check that the calling convention is Java and complain otherwise. |
@pejovica Like Simon I'm also puzzled as to where you think there is a problem here. The The only place where I found the Is there some other case I have missed where a called method has a non-empty call signature that needs to be interpreted using the @olpaw are you aware of a problem here? |
@adinn @stooke There seems to be some misunderstanding about how calling from native works, but literally anything that can be called from native must be compiled with the |
@pejovica I take your point and agree that However, I don't understand why you appear to be treating that as a blocker for this patch. I don't think any of the code here will need to be changed after the above issue is fixed i.e. pushing it now does not imply rework later. I don't believe pushing the patch will risk any serious consequences, such as crashing the runtime or Windows debugger (otherwise I would expect to see the same outcome on Linux). It will mean that Windows debugger users may be misled about input arguments for a small number of methods (as currently happens on Linux). However, in the case of almost all methods the patch will provide valuable information to Windows debugger users (just as it does on Linux) and would be useful to have right now. Not only that but pushing it will also allow Simon to present the follow up patches which shodl significantly improve windows debugging. Is there a reason not to proceed with this PR that I am missing? |
@adinn Thanks, that would be great.
No, I don't think it is a blocker, but I also don't think we need another copy of code dealing with calling conventions. Note that |
@pejovica , as discussed before, this code lays the groundwork for the full implementation. The current variable information code in this PR is more a proof of concept that is still incredibly useful to Windows developers. ParamLocationProducer is only partially useful for Windows as is - the register specifications in CodeView are sensitive to type. Simply saying a short lives in r9 will not work; the correct register is 'r9w' for example. Proper modification of ParamLocationProvider is something that could happen as part of the PR to handle native code calling conventions. |
Yes, I understand that this is just laying the groundwork for a full implementation and I fully agree that it is very useful, so all I ask is that a sound foundation is laid. Note that before a proper API was introduced, this would have required direct use of our calling convention support, but even then there would be no need to duplicate any of that logic here.
This is actually another reason why I think this PR should be based on existing APIs: it will allow us to see if there are any issues that need to be addressed. Because if the existing APIs aren't sufficient to describe method parameters at their entry points, I don't see how they would be sufficient for anything more complicated. However, I don't expect this PR to address such issues, e.g., I'm fine if you leave dealing with the parameter sizes as a to-do task referencing the appropriate issue. |
…into pr-windows-varinfo
@pejovica @thomaswue any update here? |
@maxandersen No, I've been busy with support for Windows x64 unwind info, so I haven't had much chance to work on this. I plan to come back to this once I'm done with that feature, which is almost finished, so it should be soon. |
@pejovica , I have rebased the repo and tested it with the latest Graal native. There was a regression as Graal can now use more registers in x64 mode; this has been fixed. I have also update the copyright dates on the changed files. |
@stooke Thanks for the rebase and the heads-up! I'll take another look now. |
This PR implements issue #5635 by adding Windows CodeView records support to define local variables.
Method parameter variables (including 'this') are defined as a demonstration. No other local variable information is implemented by this PR as this PR is not aware of the lifetime of variables or stack frame information. Method parameter variables are available to the debugger only upon entry to a method.
There is a body of unused code (symbol record definitions) in this PR - it will be required for local variable definition in the followup PR.