bashsupport-pro icon indicating copy to clipboard operation
bashsupport-pro copied to clipboard

Error in debug mode

Open wellic opened this issue 1 year ago • 4 comments

I always get an error if I have a custom error handler in my code when debugging,:

 IDE: PyCharm
File: $HOME/.local/share/JetBrains/PyCharm2024.2/bashsupport-pro/bashdb/5.2/share/bashdb/lib/hook.sh
Func: _Dbg_debug_trap_handler
Line: 79
69	_Dbg_debug_trap_handler() {
70	
71	    ### The below is also copied below in _Dbg_sig_handler...
72	    ### Should put common stuff into a function.
73	
74	    # Consider putting the following line(s) in a routine.
75	    # Ditto for the restore environment
76	    typeset -i _Dbg_debugged_exit_code=$?
77	    _Dbg_old_set_opts=$-
78	    set +e
79	    shopt nullglob > /dev/null
80	    typeset -i _Dbg_old_set_nullglob=$?
81	    shopt -u nullglob
82	    shopt -s extdebug

I tried to fix the code, but I couldn't.

The structure of my script:

#!/bin/bash

set -uEeo pipefail

on_exit() {...}
on_error_exit() {...}
on_break_exit() {...}

trap on_exit EXIT
trap on_break_exit SIGINT SIGTERM SIGHUP SIGQUIT
trap 'on_error_exit $LINENO' ERR
...

If I commented the line with the error handler

# trap 'on_error_exit $LINENO' ERR

the debugger works without errors.


What recommendations would you recommend?

wellic avatar Sep 02 '24 20:09 wellic