You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would like to support good backtraces for bytecode functions. This means that the existing backtrace machinery for native code needs to be extended so it can also handle bytecode functions.
The idea we've come with to support this is to make VM frames work a little more like native frames, by pushing the IP to the VM stack just before a call. The caller does not actually need this address to return, like you would natively, but its presence on the stack can be used to get the chain of function calls and make a backtrace.
In order to present any useful information we would also need DWARF-like line tables (#1449).
The text was updated successfully, but these errors were encountered:
To reconstruct a backtrace, we would follow these steps:
Get a system backtrace containing return PC addresses using the C backtrace(void **buffer, int size) function.
We get a VM backtrace containing return IP values using our own backtrace_vm function. To achieve this, we will have to push/pop the IP within bytecode_vm every time we call from the VM. We must also maintain a linked list of VM frame pointers on the VM stack.
We search for return PC addresses that fall within the bytecode_vm function executable code.
For each bytecode_vm return PC address, we look in the VM stack for the corresponding IP value.
There needs to be a one-to-one correspondence between bytecode_vm PC addresses and IP addresses. This will be violated if an error occurs when we are within the bytecode_vm function. If we could get retain perfect debug information of the IP register within the bytecode_vm function we could recover the IP wherever we are within the bytecode_vm function.
With an IP backtrace, we can use DWARF-like line tables that our bytecode compiler will generate to convert IP addresses to source information. When our bytecode compiler generates these line tables along with the bytecode modules, it will register the bytecode line tables with clasp's runtime just like we register object files generated by llvm.
We would like to support good backtraces for bytecode functions. This means that the existing backtrace machinery for native code needs to be extended so it can also handle bytecode functions.
The idea we've come with to support this is to make VM frames work a little more like native frames, by pushing the IP to the VM stack just before a call. The caller does not actually need this address to return, like you would natively, but its presence on the stack can be used to get the chain of function calls and make a backtrace.
In order to present any useful information we would also need DWARF-like line tables (#1449).
The text was updated successfully, but these errors were encountered: