home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/sys/c/RCS/debug,v $
- * $Date: 1996/10/30 21:59:00 $
- * $Revision: 1.3 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: debug,v $
- * Revision 1.3 1996/10/30 21:59:00 unixlib
- * Massive changes made by Nick Burret and Peter Burwood.
- *
- * Revision 1.2 1996/05/06 09:03:14 unixlib
- * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
- * Saved for 3.7a release.
- *
- * Revision 1.1 1996/04/19 21:34:24 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: debug,v 1.3 1996/10/30 21:59:00 unixlib Rel $";
-
- #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);
- NL ();
- VAL ("signal_exit:", (int) __u->status.signal_exit);
- NL ();
- VAL ("core_dump:", (int) __u->status.core_dump);
- NL ();
- VAL ("stopped:", (int) __u->status.stopped);
- NL ();
- VAL ("signal:", (int) __u->status.signal);
- NL ();
- VAL ("return_code:", (int) __u->status.return_code);
- NL ();
- VAL (" vreg:", (int) __u->vreg);
- NL ();
- NL ();
- /* os_get (); */
- }
-