On Thu, 15 Oct 2026 12:28:14 GMT, Long Yang <[email protected]> wrote:

>> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64CFrame.java
>>  line 100:
>> 
>>> 98:           }
>>> 99:         }
>>> 100:       }
>> 
>> Could we honor the CIE return-address column in both the stack lookup and 
>> the register fallback? GCC's `__riscv_save_*` helpers use x5, while 
>> `getReturnAddressOffsetFromCFA()` still queries x1. Depending on where the 
>> thread stops, this can throw or skip the helper's immediate caller.
>
> Thanks, pushed.

Thanks! The helper's own return address is correct now, but the walk still 
stops at the helper's caller, whether or not the helper has executed `sd ra`. 
The caller frame is created with `ra == null`, and at PC-1 (the `call t0, 
__riscv_save_N` at its entry) its CFI has no rule for x1 yet, so 
`getSenderPC()` returns null. The caller's return address is in the helper's x1 
slot (CFA - 8) once `sd ra` has executed, and only in the live x1 before that. 

For reference, in #33025 I handled this in 
[`sender()`](https://github.com/openjdk/jdk/blob/9afa204c5b0f6c06a50bc5ead60ca091a30b1c9b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64CFrame.java#L244-L261):
 when the current frame's return column differs from the sender's and the 
sender's return address has no rule, the current frame's CFI is used to find 
the sender's return column, falling back to the live x1 captured in 
[`getFrameFromReg()`](https://github.com/openjdk/jdk/blob/9afa204c5b0f6c06a50bc5ead60ca091a30b1c9b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/riscv64/LinuxRISCV64CFrame.java#L91).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/33374#discussion_r4284507317

Reply via email to