5dd8362a86
First, be aware that the DEBUG spoken of here has nothing whatever to do with MKDEBUG=true type builds of NetBSD. The only way to get a DEBUG shell is to build it yourself manually. That said, for non-DEBUG shells, this change makes only one slight (trivial really) difference, which should affect nothing. Previously some code was defined like ... function(args) { #ifdef DEBUG /* function code goes here */ #endif } and called like ... #ifdef DEBUG function(params); #endif resulting in several empty functions that are never called being defined in non-DEBUG shells. Those are now gone. If you can detect the difference any way other than using "nm" or similar, I'd be very surprised... For DEBUG shells, this introduces a whole new TRACE() setup to use to assist in debugging the shell. I have had this locally (uncommitted) for over a year... it helps. By itself this change is almost useless, nothing really changes, but it provides the framework to allow other TRACE() calls to be updated over time. This is why I had not committed this earlier, my previous version required a flag day, with all the shell's internal tracing being updated a once - which I had done, but that shell version has bit-rotted so badly now it is almost useless... Future updates will add the mechanism to allow the new stuff to actually be used in a productive way, and following that, over time, gradual conversion of all the shell tracing to the updated form (as required, or when I am bored...) The one useful change that we do get now is that the fd that the shell uses for tracing (which was usually 3, but not any more) is now protected from user/script interference, like all the other shell inernal fds. There is no doc (nor will there be) on any of this, if you are not reading the source code it is useless to you, if you are, you know how it works.
46 lines
1.9 KiB
C
46 lines
1.9 KiB
C
/* $NetBSD: show.h,v 1.10 2017/05/13 03:26:03 kre Exp $ */
|
|
|
|
/*-
|
|
* Copyright (c) 1995
|
|
* The Regents of the University of California. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*
|
|
* @(#)show.h 1.1 (Berkeley) 5/4/95
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
|
|
#ifdef DEBUG
|
|
union node;
|
|
void showtree(union node *);
|
|
void trace(const char *, ...);
|
|
void tracev(const char *, va_list);
|
|
void trargs(char **);
|
|
void trputc(int);
|
|
void trputs(const char *);
|
|
void opentrace(void);
|
|
#endif
|