-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Debug Info: gdb breakpoint not properly set in partially unrolled loop #4379
Comments
Passing Indeed inspecting the backtrace reported by
which shows that the breakpoint was set in the inlined code of Removing the concatenation makes things even more weird from the user's perspective. Running without Given that when using |
@zakkak I believe this can be fixed. At present flag the debug info generator responds to flag Unfortunately, this simply means that those ranges are no longer associated with any file and line. When the loop body contains a call or something else like an allocation that gets translated to inline code then a line break point in the loop body may not hit anything. Depending on how the loop gets peeled, it may hit an initial one or more breaks but miss other breaks. What the generator ought to do is emit information for the inline range but remap it's file and line to the point in the top level method where the call it sits under was inlined and remap its method to the top level method. There is no need to worry about generating multiple inline ranges with the same file and line as they get merged by the consumer of the line info stream. This problem has been avoided in the new version of the generator I am working on in my local vars branch. That version drives generation off a tree that includes a single top level caller node for the full range of the underlying inline tree. When inline info is omitted a location (line info) record is generated for the top level caller node only. So, while it is possible to fix this it is not really necessary so long as we get the local vars patch in in time for the next release. |
Further investigating this I found another issue that persists even when using It appears that
22.0.0.2In 22.0.0.2 we get away with this because we inline code and the inlined code comes in different DIEs than the
So we get a breakpoint in
Inspecting the decoded line info with
22.2-dev6e56ec841912c7497bb523f086de8c3be0c03221After 22.0.0.2 (this is reproducible in 22.1-dev as well), we see a similar amount of mappings from
But, setting a breakpoint to line 4 of
Inspecting the DIEs of the generated binary and looking for ranges containing the above addresses we see that they all fall in the
which explains why So this leaves us with the following open questions:
|
Describe the issue
Compiling a loop with debug info enabled and setting a breakpoint inside the loop doesn't set the breakpoint properly if the loop gets unrolled.
For instance compiling the following Java program:
and setting the breakpoint at line 4 results in
gdb
breaking the execution only for the first print, the rest of the program continues uninterrupted.Inspecting the generated code we observe that the first iteration is moved out of the loop while the rest iterations are executed in a loop. When setting the breakpoint, however,
gdb
sets it only in the first iteration (i.e. not inside the actual loop):As a result after
continuing
execution the breakpoint is never hit again.Steps to reproduce the issue
The application reaches completion while it should stop in the second print.
Describe GraalVM and your environment:
More details
The corresponding disassembly looks like this:
The text was updated successfully, but these errors were encountered: