Is there a way in JDB to inspect the operand stack and local variable array of the current frame? The help
command says that there's a locals
command that can be used to list the local variables but with some classes it says Local variable information not available. Compile with -g to generate variable information
. It makes sense that the variable names might not be available if they weren't included during compile time, but what if I just want to reference local variables by their index in the array? That seems like it shouldn't require any special compile time configuration. The help
command also doesn't seem to have anything that shows the operand stack. If JDB can't do this, is there another free (preferable command-line) tool that can do this? Thanks.
Asked
Active
Viewed 187 times
1

John Stanford
- 993
- 1
- 7
- 18
-
1Afaik, it’s the HotspotJVM itself that doesn’t support inspecting local variables when the class file doesn’t have the local variable table. I encountered the issue with all debuggers I’ve ever used. When generating an artificial local variable table, they all suddenly work. See also [Debugging ASM-generated bytecode with JDB (or similar)](https://stackoverflow.com/q/49385759/2711488)… – Holger Nov 20 '20 at 17:21