Revision 14717
Added by Aaron Marcuse-Kubitza about 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
301 | 301 |
alias get_stack_frame='declare func file line && "get_stack_frame"' |
302 | 302 |
# && instead of ; so it can be used as a while cond |
303 | 303 |
|
304 |
format_stack_frame() # usage: "$(func=__ file=__ line=__ format_stack_frame)"
|
|
304 |
format_stack_frame() #usage: "$(func=_ file=_ line=_ format_stack_frame [args])"
|
|
305 | 305 |
{ |
306 | 306 |
file="$(canon_rel_path "$file")" || return |
307 | 307 |
local caller="$file:$line" |
308 | 308 |
local func_loc; func_loc="$(func_loc "$func")" || return |
309 | 309 |
func_loc="${func_loc#$file:}" # include just line # if file same |
310 |
echo "$func() $(plain "@$caller -> $func_loc")"
|
|
310 |
echo "$(esc "$func" "$@") $(plain "@$caller -> $func_loc")"
|
|
311 | 311 |
} |
312 | 312 |
|
313 | 313 |
stack_trace() # usage: "$([i=#] stack_trace)" # or use print_stack_trace |
Also available in: Unified diff
lib/sh/util.sh: format_stack_frame(): support including args