home *** CD-ROM | disk | FTP | other *** search
- /* debug.c (c) Copyright 1990 H.Rogers */
-
- #ifndef DEBUG
- #define DEBUG
- #endif
-
- /* __debug(s) dumps UNIX status with title "s" */
-
- #include <string.h>
-
- #include "sys/os.h"
- #include "sys/unix.h"
- #include "sys/syslib.h"
- #include "sys/debug.h"
-
- static void
- __debugval (char *s, int i)
- {
- char *p = " ";
- int x;
-
- os_print (s);
- x = (strlen (s) & 7);
- x = x ? x : 8;
- os_print (p + x);
- os_prhex (i);
- }
-
- static void
- __debugnl (void)
- {
- os_print ("\r\n");
- }
-
- #define NL() __debugnl()
- #define VAL(s,i) __debugval(s,i)
-
- void
- __debug (char *s)
- {
- struct file *f;
- int i;
-
- NL ();
- os_print ("# ");
- if (s)
- os_print (s);
- NL ();
- VAL ("__base: ", (int) __base);
- NL ();
- VAL ("__lomem: ", (int) __lomem);
- VAL (" __himem: ", (int) __himem);
- NL ();
- VAL ("__break: ", (int) __break);
- VAL (" __stack: ", (int) __stack);
- NL ();
- VAL ("__u:", (int) __u);
- NL ();
- VAL ("argc:", __u->argc);
- VAL (" argv:", (int) __u->argv);
- NL ();
- for (i = 0; i < __u->argc; i++)
- {
- VAL ("argv[", (int) (__u->argv + i));
- VAL (" ", i);
- VAL (" ]:", (int) __u->argv[i]);
- os_print (" ");
- os_print (__u->argv[i]);
- NL ();
- }
- VAL ("argb:", (int) __u->argb);
- os_print (" ");
- os_print (__u->argb);
- NL ();
- if (f = __u->file)
- for (i = 0; i < 16; i++)
- {
- VAL ("f[", (int) (f + i));
- VAL (" ", i);
- VAL (" ].dup:", (int) f[i].dup);
- NL ();
- }
- VAL ("pid:", (int) __u->pid);
- VAL (" ppid:", (int) __u->ppid);
- NL ();
- VAL ("pproc:", (int) __u->pproc);
- VAL (" wait:", __u->wait);
- NL ();
- VAL ("flag:", __u->flag);
- VAL (" vreg:", (int) __u->vreg);
- NL ();
- NL ();
- os_get ();
- }
-