From cd4d498b81456365b6bf87ae6cd435ffa2d7a151 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 8 Dec 2024 09:33:51 -0500 Subject: [PATCH] Small steps towards Bug1 of #53 --- command/backtrace.sh | 4 +--- lib/file.sh | 14 +++++++------- lib/hook.sh | 3 ++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/command/backtrace.sh b/command/backtrace.sh index 69c933ee..4e1564c8 100644 --- a/command/backtrace.sh +++ b/command/backtrace.sh @@ -2,7 +2,7 @@ # gdb-like "backtrace" debugger command # # Copyright (C) 2002-2006, 2008, 2010-2011, 2018-2019 -# Rocky Bernstein +# 2024 Rocky Bernstein # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -153,8 +153,6 @@ function _Dbg_do_backtrace { adjusted_pos=$(_Dbg_frame_adjusted_pos $i) _Dbg_msg_nocr $(_Dbg_frame_prefix $i)$i ${FUNCNAME[$adjusted_pos-1]} - typeset parms='' - # Print out parameter list. if (( 0 != ${#BASH_ARGC[@]} )) ; then _Dbg_frame_fn_param_str diff --git a/lib/file.sh b/lib/file.sh index fb239e78..0ba4d367 100644 --- a/lib/file.sh +++ b/lib/file.sh @@ -105,14 +105,14 @@ function _Dbg_resolve_expand_filename { typeset -i n=${#_Dbg_dir[@]} typeset -i i for (( i=0 ; i < n; i++ )) ; do - typeset basename="${_Dbg_dir[i]}" - if [[ "$basename" == '\$cdir' ]] ; then - basename=$_Dbg_cdir - elif [[ "$basename" == '\$cwd' ]] ; then - basename=$(pwd) + typeset dirname="${_Dbg_dir[i]}" + if [[ "$dirname" == '\$cdir' ]] ; then + dirname=$_Dbg_cdir + elif [[ "$dirname" == '\$cwd' ]] ; then + dirname=$(pwd) fi - if [[ -f "$basename/$find_file" ]] ; then - echo "$basename/$find_file" + if [[ -f "$dirname/$find_file" ]] ; then + echo "$dirname/$find_file" return 0 fi done diff --git a/lib/hook.sh b/lib/hook.sh index 6653cd53..df77e79a 100644 --- a/lib/hook.sh +++ b/lib/hook.sh @@ -2,7 +2,7 @@ # hook.sh - Debugger trap hook # # Copyright (C) 2002-2011, 2014, 2017-2019 -# Rocky Bernstein +# 2024 Rocky Bernstein # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -150,6 +150,7 @@ _Dbg_debug_trap_handler() { _Dbg_full_filename=$(_Dbg_is_file "$_Dbg_frame_last_filename") if [[ -r "$_Dbg_full_filename" ]] ; then _Dbg_file2canonic["$_Dbg_frame_last_filename"]="$_Dbg_full_filename" + _Dbg_file2canonic["${BASH_SOURCE[1]}"]="$_Dbg_full_filename" fi # Run applicable action statement