Here is a new version of the patch. I have changed the command from 'set debug commandtrace' to 'set trace-commands' and adjusted the variable name to match. The source_verbose is now reset with a cleanup. The -v option is only valid before the filename. The -v option no longer applies to the --command option. This change has meant that I have had to stop main.c using source_command() and invent a new function, source_script(), for it to use. The strings are now surrounded by _(...) > You do this in a couple places, at least here and for control_level. > Given the way GDB handles errors with longjmp, this isn't safe. control_level is not a problem. It is always re-initialised whenever an 'if', 'while', or user defined command is encountered. The new code only uses it to prevent the same command getting printed more than once. This is necessary due to the way the execute_command() and execute_control_command() interact. > Another alternative would be to use the time-honored shell > syntax for this: prefix with plusses up to the nesting level, like sh > -x. What do you think? I have considered this feature in some detail. There is, of course, nothing to stop us using any string or symbol we like, but the nesting level is tricky. As it stands the code does not really know how deep it is. The control_level is not the real depth - it only really says how deep it is from the last simple command such as 'source' or a user-defined command, as opposed to control commands such 'if'. If you really want to show the depth then some more thought will be required. The depth will have to be calculated properly somehow and it will have to be exposed to top.c which prints all the top level commands and nested simple commands. What do you think? :ADDPATCH CLI: Andrew Stubbs