Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Mar 2018 13:27:22 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330374 - head/sys/ddb
Message-ID:  <201803041327.w24DRMBI040714@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Sun Mar  4 13:27:21 2018
New Revision: 330374
URL: https://svnweb.freebsd.org/changeset/base/330374

Log:
  db_script_exec: use a saved script name when reporting commands executed
  
  Before executing a command in a ddb script ddb prints an information
  line of the form:
    db:1:my-script> command
  where 1 is the script's depth level, "my-script" is the scipt's name,
  and "command" is the current command in the script.
  db_script_exec() uses its 'scriptname' parameter to produce that string.
  In the case when db_script_exec() is called from db_run_cmd() the
  argument points to db_tok_string that is a global variable used for
  command parsing.  So, its value changes with every command executed.
  
  This commit changes the code to use the script's name stored in
  ds_scriptname to print the line.
  
  MFC after:	2 weeks

Modified:
  head/sys/ddb/db_script.c

Modified: head/sys/ddb/db_script.c
==============================================================================
--- head/sys/ddb/db_script.c	Sun Mar  4 08:00:07 2018	(r330373)
+++ head/sys/ddb/db_script.c	Sun Mar  4 13:27:21 2018	(r330374)
@@ -296,7 +296,7 @@ db_script_exec(const char *scriptname, int warnifnotfo
 	buffer = drd->drd_buffer;
 	strcpy(buffer, dsp->ds_script);
 	while ((command = strsep(&buffer, ";")) != NULL) {
-		db_printf("db:%d:%s> %s\n", db_recursion, scriptname,
+		db_printf("db:%d:%s> %s\n", db_recursion, dsp->ds_scriptname,
 		    command);
 		db_command_trim(&command);
 		prev_jb = kdb_jmpbuf(jb);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803041327.w24DRMBI040714>