Trepan-Debuggers / zshdb

gdb-like "trepan" debugger for zsh
GNU General Public License v3.0
293 stars 23 forks source link

Prompt and commands not redirected to --tty option #24

Closed bitwranglr closed 4 years ago

bitwranglr commented 4 years ago

When using the --tty option to redirect debugger commands to another terminal, the prompt and commands remain in the original terminal while stack and annotations appear in the --tty terminal.

This behavior is unlike bashdb where everything debugger related, including prompt and inputted commands, are redirected to the --tty terminal.

The zshdb behavior makes it impossible to separate out the debuggee's output from the debugger's. I'm assuming it's a bug because it makes no sense to design it this way, or am I missing something? Hope to see this fixed, thanks.

rocky commented 4 years ago

terminal, the prompt and commands remain in the original terminal

I believe [this line](terminal, the prompt and commands remain in the original termina) is doing that

              vared -e -h -p "$_Dbg_prompt" line <&${_Dbg_fdi} || break

Of course this is specific to zsh (and the bashdb equivalent is bash-specifc too I think.)

Hope to see this fixed, thanks.

Are you up to working up a fix and a PR?

bitwranglr commented 4 years ago

I've got a working solution with the prompt and typed debugger commands now nicely appearing in the other tty. Replace the line:

vared -e -h -p "$_Dbg_prompt" line <&${_Dbg_fdi} || break

with:

print -u${_Dbg_fdi} -n "$_Dbg_prompt"
read line <&${_Dbg_fdi} || break

I'm not sure how to do a pull request...

rocky commented 4 years ago

The above should only be done if the tty option is set. For interactive use, I think vared is preferred since that allows for command editing and history retrieval.

I'm not sure how to do a pull request...

https://www.google.com/search?q=how+to+do+a+github+pr