about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Src/exec.c b/Src/exec.c
index a46dfd683..a147dacd5 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1069,9 +1069,14 @@ execlist(Estate state, int dont_change_job, int exiting)
 	}
 
 	if (sigtrapped[SIGDEBUG] && isset(DEBUGBEFORECMD) && !intrap) {
+	    Wordcode pc2 = state->pc;
 	    int oerrexit_opt = opts[ERREXIT];
+	    Param pm;
 	    opts[ERREXIT] = 0;
 	    noerrexit = 1;
+	    if (ltype & Z_SIMPLE) /* skip the line number */
+		pc2++;
+	    pm = setsparam("ZSH_DEBUG_CMD", getpermtext(state->prog, pc2));
 
 	    exiting = donetrap;
 	    ret = lastval;
@@ -1085,6 +1090,8 @@ execlist(Estate state, int dont_change_job, int exiting)
 	     */
 	    donedebug = isset(ERREXIT) ? 2 : 1;
 	    opts[ERREXIT] = oerrexit_opt;
+	    if (pm)
+		unsetparam_pm(pm, 0, 1);
 	} else
 	    donedebug = intrap ? 1 : 0;