Closed jansorg closed 12 months ago
I just pulled the code and tried this. It works great!
I will merge this, but I'd greatly appreciate another PR with a test in it.
Currently, I am seeing integration tests fail due to the fragileness of the tests.
Zshdb doesn't have an equivalent of $BASH_ARGC and $BASH_ARGV.
I recall around 20 years ago beefing up debugging support in Bash. The same could be done for zsh. My last experience with those folks was pretty positive (although this was a while back). Sometime in 2024 I will have more time to explore stuff like this, to look into adding whatever is need to get arguments of previous frames.
This PR adds support for
info args
.AFAIK it's not possible to retrieve the arguments passed to previous frames on the call stack. Zshdb doesn't have an equivalent of
$BASH_ARGC
and$BASH_ARGV
. For BashSupport Pro, I at least wanted to support arguments for the top frame instead of showing nothing at all.I couldn't find a solution to emulate this with zshdb's hook function because the DEBUG trap is only called on entry and there's no other trap handler when a function is exited. Without a return handler it's not possible to remove the exited function's arguments from the array used to emulate
$BASH_ARGC
/$BASH_ARGV
.I removed
_Dbg_arg
from hook.sh because it's unused and could be confusing with the new variable.If this PR seems like the right direction, then I'll try to add tests :)