mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
debug.sh add DebugAdd
Sometimes it is desirable while debugging one script for it to enable debugging of a child. We can do that with $DEBUG_DO DebugAdd tag to add tag to DEBUG_SH but only when we are already debugging.
This commit is contained in:
parent
f6197f2bc0
commit
02653835cd
2 changed files with 30 additions and 2 deletions
|
|
@ -9,6 +9,7 @@
|
|||
# DebugOn [-eo] "tag" ...
|
||||
# DebugOff [-eo] [rc="rc"] "tag" ...
|
||||
# Debugging
|
||||
# DebugAdd "tag"
|
||||
# DebugEcho ...
|
||||
# DebugLog ...
|
||||
# DebugShell "tag" ...
|
||||
|
|
@ -39,6 +40,9 @@
|
|||
# default of 0. Thus if DebugOff is the last operation in a
|
||||
# function, "rc" will be the return code of that function.
|
||||
#
|
||||
# DebugAdd allows adding a "tag" to "DEBUG_SH" to influence
|
||||
# later events, possibly in a child process.
|
||||
#
|
||||
# DebugEcho is just shorthand for:
|
||||
#.nf
|
||||
# $DEBUG_DO echo "$@"
|
||||
|
|
@ -74,7 +78,7 @@
|
|||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: debug.sh,v 1.40 2024/09/09 20:06:00 sjg Exp $
|
||||
# $Id: debug.sh,v 1.41 2024/10/22 17:57:22 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1994-2024 Simon J. Gerraty
|
||||
#
|
||||
|
|
@ -167,6 +171,21 @@ _debugOff() {
|
|||
DEBUG_X=
|
||||
}
|
||||
|
||||
##
|
||||
# DebugAdd tag
|
||||
#
|
||||
# Add tag to DEBUG_SH
|
||||
#
|
||||
DebugAdd() {
|
||||
DEBUG_SH=${DEBUG_SH:+$DEBUG_SH,}$1
|
||||
export DEBUG_SH
|
||||
}
|
||||
|
||||
##
|
||||
# DebugEcho message
|
||||
#
|
||||
# Output message if we are debugging
|
||||
#
|
||||
DebugEcho() {
|
||||
$DEBUG_DO echo "$@"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
.\" Please send copies of changes and bug-fixes to:
|
||||
.\" sjg@crufty.net
|
||||
.\"
|
||||
.Dd January 31, 2024
|
||||
.Dd October 22, 2024
|
||||
.Dt DEBUG.SH 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -30,6 +30,8 @@
|
|||
.It
|
||||
.Ic Debugging
|
||||
.It
|
||||
.Ic DebugAdd Ar tag
|
||||
.It
|
||||
.Ic DebugEcho Op Ar message
|
||||
.It
|
||||
.Ic DebugLog Op Ar message
|
||||
|
|
@ -110,6 +112,13 @@ It is useful for bounding complex debug actions, rather than
|
|||
using lots of
|
||||
.Ic $DEBUG_DO
|
||||
lines.
|
||||
.It Ic DebugAdd Ar tag
|
||||
Add
|
||||
.Ar tag
|
||||
to
|
||||
.Va DEBUG_SH
|
||||
to influence later output,
|
||||
possibly in a child process.
|
||||
.It Ic DebugEcho
|
||||
is just shorthand for:
|
||||
.Bd -literal -offset indent
|
||||
|
|
|
|||
Loading…
Reference in a new issue