dbug bugs
Fred Fish
fnf at unisoft.UUCP
Tue Jan 1 11:02:28 AEST 1985
There were a couple of minor bugs in the "dbug" package I
recently posted to net.sources. Specifically,
(1) There was some problems with _db_file_
being used as a global in dbug.c as the
current output stream, and in dbug.h
as a place on the stack to stash a pointer
to the previous file name. The output
stream usage is now "_db_fp_".
PS, was typo in dbug.h where "_db_file"
should have been "_db_file_".
(2) The output stream "_db_fp_" is now
now used by dbug.c, rather than
"stack -> out_file". This makes
DBUG_FILE macro work correctly.
(3) There was a minor problem with the
Makefile not knowing about .c~ to .c
conversion.
(4) The lint library file llib-ldbug.c
had the functions named "_dbug_xxxxx_"
rather than "_db_xxxxx_".
Contextual diffs follow:
==================== CUT HERE ======================
diff -c dbug/Makefile newdbug/Makefile
*** dbug/Makefile Mon Dec 31 16:39:52 1984
--- newdbug/Makefile Mon Dec 31 16:29:44 1984
***************
*** 5,11
#
# SCCS ID
#
! # @(#)Makefile 1.4 12/31/84
#
# DESCRIPTION
#
--- 5,11 -----
#
# SCCS ID
#
! # @(#)Makefile 1.5 12/31/84
#
# DESCRIPTION
#
***************
*** 40,46
LINT1 = /usr/lib/lint1
RANLIB = ranlib
! .SUFFIXES: .r~ .r
.r~.r:
$(GET) $(GFLAGS) -p $< >$*.r
--- 40,49 -----
LINT1 = /usr/lib/lint1
RANLIB = ranlib
! .SUFFIXES: .r .r~ .c .c~
!
! .c~.c:
! $(GET) $(GFLAGS) -p $< >$*.c
.r~.r:
$(GET) $(GFLAGS) -p $< >$*.r
diff -c dbug/dbug.c newdbug/dbug.c
*** dbug/dbug.c Mon Dec 31 16:39:56 1984
--- newdbug/dbug.c Mon Dec 31 16:29:48 1984
***************
*** 24,30
*
* SCCS
*
! * @(#)dbug.c 1.2 12/31/84
*
* DESCRIPTION
*
--- 24,30 -----
*
* SCCS
*
! * @(#)dbug.c 1.3 12/31/84
*
* DESCRIPTION
*
***************
*** 101,107
* be accessed via the macro package facilities.
*/
! EXPORT FILE *_db_file_ = stderr; /* Output stream, default stderr */
EXPORT char *_db_process_ = "dbug"; /* Pointer to process name; argv[0] */
EXPORT int _db_on_ = FALSE; /* TRUE if debugging currently on */
--- 101,107 -----
* be accessed via the macro package facilities.
*/
! EXPORT FILE *_db_fp_ = stderr; /* Output stream, default stderr */
EXPORT char *_db_process_ = "dbug"; /* Pointer to process name; argv[0] */
EXPORT int _db_on_ = FALSE; /* TRUE if debugging currently on */
***************
*** 354,359
discard = stack;
if (discard != NULL && discard -> next_state != NULL) {
stack = discard -> next_state;
if (discard -> keywords != NULL) {
FreeList (discard -> keywords);
}
--- 354,360 -----
discard = stack;
if (discard != NULL && discard -> next_state != NULL) {
stack = discard -> next_state;
+ _db_fp_ = stack -> out_file;
if (discard -> keywords != NULL) {
FreeList (discard -> keywords);
}
***************
*** 425,432
if (DoTrace ()) {
DoPrefix (_line_);
Indent (stack -> level);
! fprintf (stack -> out_file, ">%s\n", func);
! fflush (stack -> out_file);
}
}
--- 426,433 -----
if (DoTrace ()) {
DoPrefix (_line_);
Indent (stack -> level);
! fprintf (_db_fp_, ">%s\n", func);
! fflush (_db_fp_);
}
}
***************
*** 463,470
_db_push_ ("");
}
if (stack -> level != *_slevel_ && (TRACING || DEBUGGING)) {
! fprintf (stack -> out_file, MSG1, _db_process_, func);
! fflush (stack -> out_file);
} else if (DoTrace ()) {
DoPrefix (_line_);
Indent (stack -> level);
--- 464,471 -----
_db_push_ ("");
}
if (stack -> level != *_slevel_ && (TRACING || DEBUGGING)) {
! fprintf (_db_fp_, MSG1, _db_process_, func);
! fflush (_db_fp_);
} else if (DoTrace ()) {
DoPrefix (_line_);
Indent (stack -> level);
***************
*** 468,475
} else if (DoTrace ()) {
DoPrefix (_line_);
Indent (stack -> level);
! fprintf (stack -> out_file, "<%s\n", func);
! fflush (stack -> out_file);
}
stack -> level = *_slevel_ - INDENT;
func = *_sfunc_;
--- 469,476 -----
} else if (DoTrace ()) {
DoPrefix (_line_);
Indent (stack -> level);
! fprintf (_db_fp_, "<%s\n", func);
! fflush (_db_fp_);
}
stack -> level = *_slevel_ - INDENT;
func = *_sfunc_;
***************
*** 526,532
if (TRACING) {
Indent (stack -> level + INDENT);
} else {
! fprintf (stack -> out_file, "%s: ", func);
}
fprintf (stack -> out_file, "%s: ", keyword);
fprintf (stack -> out_file, format, a0, a1, a2, a3, a4, a5, a6,
--- 527,533 -----
if (TRACING) {
Indent (stack -> level + INDENT);
} else {
! fprintf (_db_fp_, "%s: ", func);
}
fprintf (_db_fp_, "%s: ", keyword);
fprintf (_db_fp_, format, a0, a1, a2, a3, a4, a5, a6,a7, a8,
***************
*** 528,538
} else {
fprintf (stack -> out_file, "%s: ", func);
}
! fprintf (stack -> out_file, "%s: ", keyword);
! fprintf (stack -> out_file, format, a0, a1, a2, a3, a4, a5, a6,
! a7, a8, a9, a10, a11);
! fprintf (stack -> out_file, "\n");
! fflush (stack -> out_file);
}
}
--- 529,539 -----
} else {
fprintf (_db_fp_, "%s: ", func);
}
! fprintf (_db_fp_, "%s: ", keyword);
! fprintf (_db_fp_, format, a0, a1, a2, a3, a4, a5, a6,a7, a8,
! a9, a10, a11);
! fprintf (_db_fp_, "\n");
! fflush (_db_fp_);
}
}
***************
*** 792,799
}
}
buffer[count] = EOS;
! fprintf (stack -> out_file, buffer);
! fflush (stack -> out_file);
}
--- 793,800 -----
}
}
buffer[count] = EOS;
! fprintf (_db_fp_, buffer);
! fflush (_db_fp_);
}
***************
*** 885,891
int _line_;
{
if (stack -> flags & PROCESS_ON) {
! fprintf (stack -> out_file, "%s: ", _db_process_);
}
if (stack -> flags & FILE_ON) {
fprintf (stack -> out_file, "%14s: ", file);
--- 886,892 -----
int _line_;
{
if (stack -> flags & PROCESS_ON) {
! fprintf (_db_fp_, "%s: ", _db_process_);
}
if (stack -> flags & FILE_ON) {
fprintf (_db_fp_, "%14s: ", file);
***************
*** 888,894
fprintf (stack -> out_file, "%s: ", _db_process_);
}
if (stack -> flags & FILE_ON) {
! fprintf (stack -> out_file, "%14s: ", file);
}
if (stack -> flags & LINE_ON) {
fprintf (stack -> out_file, "%5d: ", _line_);
--- 889,895 -----
fprintf (_db_fp_, "%s: ", _db_process_);
}
if (stack -> flags & FILE_ON) {
! fprintf (_db_fp_, "%14s: ", file);
}
if (stack -> flags & LINE_ON) {
fprintf (_db_fp_, "%5d: ", _line_);
***************
*** 891,897
fprintf (stack -> out_file, "%14s: ", file);
}
if (stack -> flags & LINE_ON) {
! fprintf (stack -> out_file, "%5d: ", _line_);
}
if (stack -> flags & DEPTH_ON) {
fprintf (stack -> out_file, "%4d: ", stack -> level / INDENT);
--- 892,898 -----
fprintf (_db_fp_, "%14s: ", file);
}
if (stack -> flags & LINE_ON) {
! fprintf (_db_fp_, "%5d: ", _line_);
}
if (stack -> flags & DEPTH_ON) {
fprintf (_db_fp_, "%4d: ", stack -> level / INDENT);
***************
*** 894,900
fprintf (stack -> out_file, "%5d: ", _line_);
}
if (stack -> flags & DEPTH_ON) {
! fprintf (stack -> out_file, "%4d: ", stack -> level / INDENT);
}
fflush (stack -> out_file);
}
--- 895,901 -----
fprintf (_db_fp_, "%5d: ", _line_);
}
if (stack -> flags & DEPTH_ON) {
! fprintf (_db_fp_, "%4d: ", stack -> level / INDENT);
}
fflush (_db_fp_);
}
***************
*** 896,902
if (stack -> flags & DEPTH_ON) {
fprintf (stack -> out_file, "%4d: ", stack -> level / INDENT);
}
! fflush (stack -> out_file);
}
--- 897,903 -----
if (stack -> flags & DEPTH_ON) {
fprintf (_db_fp_, "%4d: ", stack -> level / INDENT);
}
! fflush (_db_fp_);
}
***************
*** 924,931
if (name != NULL) {
if (strcmp (name, "-") == 0) {
! _db_file_ = stdout;
! stack -> out_file = stdout;
} else {
fp = fopen (name, "a");
if (fp == NULL) {
--- 925,932 -----
if (name != NULL) {
if (strcmp (name, "-") == 0) {
! _db_fp_ = stdout;
! stack -> out_file = _db_fp_;
} else {
fp = fopen (name, "a");
if (fp == NULL) {
***************
*** 929,935
} else {
fp = fopen (name, "a");
if (fp == NULL) {
! fprintf (stack -> out_file, MSG2, _db_process_, name);
perror ("");
fflush (stack -> out_file);
} else {
--- 930,936 -----
} else {
fp = fopen (name, "a");
if (fp == NULL) {
! fprintf (_db_fp_, MSG2, _db_process_, name);
perror ("");
fflush (_db_fp_);
} else {
***************
*** 931,937
if (fp == NULL) {
fprintf (stack -> out_file, MSG2, _db_process_, name);
perror ("");
! fflush (stack -> out_file);
} else {
_db_file_ = fp;
stack -> out_file = fp;
--- 932,938 -----
if (fp == NULL) {
fprintf (_db_fp_, MSG2, _db_process_, name);
perror ("");
! fflush (_db_fp_);
} else {
_db_fp_ = fp;
stack -> out_file = _db_fp_;
***************
*** 933,940
perror ("");
fflush (stack -> out_file);
} else {
! _db_file_ = fp;
! stack -> out_file = fp;
}
}
}
--- 934,941 -----
perror ("");
fflush (_db_fp_);
} else {
! _db_fp_ = fp;
! stack -> out_file = _db_fp_;
}
}
}
***************
*** 965,971
if (fclose (fp) == 0) {
fprintf (stderr, MSG3, _db_process_);
perror ("");
! fflush (stack -> out_file);
}
}
}
--- 966,972 -----
if (fclose (fp) == 0) {
fprintf (stderr, MSG3, _db_process_);
perror ("");
! fflush (_db_fp_);
}
}
}
diff -c dbug/dbug.h newdbug/dbug.h
*** dbug/dbug.h Mon Dec 31 16:39:58 1984
--- newdbug/dbug.h Mon Dec 31 16:29:49 1984
***************
*** 28,34
*
* SCCS ID
*
! * @(#)dbug.h 1.2 12/31/84
*
* DESCRIPTION
*
--- 28,34 -----
*
* SCCS ID
*
! * @(#)dbug.h 1.3 12/31/84
*
* DESCRIPTION
*
***************
*** 67,73
#ifndef DBUG_OFF
extern int _db_on_; /* TRUE if debug currently enabled */
! extern FILE *_db_file_; /* Current debug output stream */
extern char *_db_process_; /* Name of current process */
extern int _db_keyword_ (); /* Accept/reject keyword */
extern void _db_push_ (); /* Push state, set up new state */
--- 67,73 -----
#ifndef DBUG_OFF
extern int _db_on_; /* TRUE if debug currently enabled */
! extern FILE *_db_fp_; /* Current debug output stream */
extern char *_db_process_; /* Name of current process */
extern int _db_keyword_ (); /* Accept/reject keyword */
extern void _db_push_ (); /* Push state, set up new state */
***************
*** 108,114
# define DBUG_FILE (stderr)
# else
# define DBUG_ENTER(a) \
! auto char *_db_func_, *_db_file; \
int _db_level_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_)
# define DBUG_LEAVE \
--- 108,114 -----
# define DBUG_FILE (stderr)
# else
# define DBUG_ENTER(a) \
! auto char *_db_func_, *_db_file_; \
int _db_level_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_)
# define DBUG_LEAVE \
***************
*** 129,133
# define DBUG_PUSH(a1) _db_push_ (a1)
# define DBUG_POP() _db_pop_ ()
# define DBUG_PROCESS(a1) (_db_process_ = a1)
! # define DBUG_FILE (_db_file_)
# endif
--- 129,133 -----
# define DBUG_PUSH(a1) _db_push_ (a1)
# define DBUG_POP() _db_pop_ ()
# define DBUG_PROCESS(a1) (_db_process_ = a1)
! # define DBUG_FILE (_db_fp_)
# endif
diff -c dbug/llib-ldbug.c newdbug/llib-ldbug.c
*** dbug/llib-ldbug.c Mon Dec 31 16:40:05 1984
--- newdbug/llib-ldbug.c Mon Dec 31 16:28:52 1984
***************
*** 24,30
*
* SCCS ID
*
! * @(#)llib-ldbug.c 1.2 12/31/84
*
* DESCRIPTION
*
--- 24,30 -----
*
* SCCS ID
*
! * @(#)llib-ldbug.c 1.3 12/31/84
*
* DESCRIPTION
*
***************
*** 41,49
#define VOID void
#define FALSE 0
! FILE *_dbug_file = stderr;
! char *_dbug_who = "dbug";
! int _dbug_on = FALSE;
VOID _dbug_push_ (control)
char *control;
--- 41,49 -----
#define VOID void
#define FALSE 0
! int _db_on = FALSE;
! FILE *_db_fp_ = stderr;
! char *_db_process_ = "dbug";
VOID _db_push_ (control)
char *control;
***************
*** 45,51
char *_dbug_who = "dbug";
int _dbug_on = FALSE;
! VOID _dbug_push_ (control)
char *control;
{
}
--- 45,51 -----
FILE *_db_fp_ = stderr;
char *_db_process_ = "dbug";
! VOID _db_push_ (control)
char *control;
{
}
***************
*** 50,56
{
}
! VOID _dbug_pop ()
{
}
--- 50,56 -----
{
}
! VOID _db_pop_ ()
{
}
***************
*** 54,60
{
}
! VOID _dbug_enter_ (_func_, _file_, _line_, _sfunc_, _sfile_, _slevel_)
char *_func_;
char *_file_;
int _line_;
--- 54,60 -----
{
}
! VOID _db_enter_ (_func_, _file_, _line_, _sfunc_, _sfile_, _slevel_)
char *_func_;
char *_file_;
int _line_;
***************
*** 64,70
{
}
! VOID _dbug_return_ (_line_, _sfunc_, _sfile_, _slevel_)
int _line_;
char **_sfunc_;
char **_sfile_;
--- 64,70 -----
{
}
! VOID _db_return_ (_line_, _sfunc_, _sfile_, _slevel_)
int _line_;
char **_sfunc_;
char **_sfile_;
***************
*** 73,79
}
/*VARARGS3*/
! VOID _dbug_printf_ (_line_, keyword, format,
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
int _line_;
char *keyword, *format;
--- 73,79 -----
}
/*VARARGS3*/
! VOID _db_printf_ (_line_, keyword, format,
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
int _line_;
char *keyword, *format;
***************
*** 81,87
{
}
! int _dbug_keyword_ (keyword)
char *keyword;
{
return (0);
--- 81,87 -----
{
}
! int _db_keyword_ (keyword)
char *keyword;
{
return (0);
More information about the Comp.sources.bugs
mailing list