diff options
Diffstat (limited to 'sys/ddb')
-rw-r--r-- | sys/ddb/db_examine.c | 8 | ||||
-rw-r--r-- | sys/ddb/db_output.c | 182 | ||||
-rw-r--r-- | sys/ddb/db_sym.c | 4 |
3 files changed, 8 insertions, 186 deletions
diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c index 9c8c21c..ce7cff6 100644 --- a/sys/ddb/db_examine.c +++ b/sys/ddb/db_examine.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_examine.c,v 1.11 1995/12/07 12:44:49 davidg Exp $ + * $Id: db_examine.c,v 1.12 1995/12/10 19:07:55 bde Exp $ */ /* @@ -127,7 +127,7 @@ db_examine(addr, fmt, count) case 'z': /* signed hex */ value = db_get_value(addr, size, TRUE); addr += size; - db_printf("%-*z", width, value); + db_printf("%+-*x", width, value); break; case 'd': /* signed decimal */ value = db_get_value(addr, size, TRUE); @@ -205,13 +205,13 @@ db_print_cmd(addr, have_addr, count, modif) db_printsym((db_addr_t)addr, DB_STGY_ANY); break; case 'r': - db_printf("%11r", addr); + db_printf("%+11n", addr); break; case 'x': db_printf("%8x", addr); break; case 'z': - db_printf("%8z", addr); + db_printf("%+8x", addr); break; case 'd': db_printf("%11d", addr); diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index 398dace..a4dfe82 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_output.c,v 1.14 1995/12/07 12:44:53 davidg Exp $ + * $Id: db_output.c,v 1.15 1995/12/10 19:08:03 bde Exp $ */ /* @@ -155,7 +155,7 @@ db_printf(const char *fmt, ...) { va_list listp; va_start(listp, fmt); - db_printf_guts (fmt, listp); + kvprintf (fmt, db_putchar, NULL, db_radix, listp); va_end(listp); } @@ -190,181 +190,3 @@ db_ksprintn(ul, base, lenp) *lenp = p - buf; return (p); } - -static void -db_printf_guts(fmt, ap) - register const char *fmt; - va_list ap; -{ - register char *p; - register int ch, n; - u_long ul; - int base, lflag, tmp, width; - char padc; - int ladjust; - int sharpflag; - int neg; - - for (;;) { - padc = ' '; - width = 0; - while ((ch = *(u_char *)fmt++) != '%') { - if (ch == '\0') - return; - db_putchar(ch); - } - lflag = 0; - ladjust = 0; - sharpflag = 0; - neg = 0; -reswitch: switch (ch = *(u_char *)fmt++) { - case '0': - padc = '0'; - goto reswitch; - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - for (width = 0;; ++fmt) { - width = width * 10 + ch - '0'; - ch = *fmt; - if (ch < '0' || ch > '9') - break; - } - goto reswitch; - case 'l': - lflag = 1; - goto reswitch; - case '-': - ladjust = 1; - goto reswitch; - case '#': - sharpflag = 1; - goto reswitch; - case 'b': - ul = va_arg(ap, int); - p = va_arg(ap, char *); - for (p = db_ksprintn(ul, *p++, NULL); *p;p--) - db_putchar(*p); - - if (!ul) - break; - - for (tmp = 0; *p;) { - n = *p++; - if (ul & (1 << (n - 1))) { - db_putchar(tmp ? ',' : '<'); - for (; (n = *p) > ' '; ++p) - db_putchar(n); - tmp = 1; - } else - for (; *p > ' '; ++p); - } - if (tmp) - db_putchar('>'); - break; - case '*': - width = va_arg (ap, int); - if (width < 0) { - ladjust = !ladjust; - width = -width; - } - goto reswitch; - case 'c': - db_putchar(va_arg(ap, int)); - break; - case 's': - p = va_arg(ap, char *); - if (p == NULL) - p = "(null)"; - width -= strlen (p); - if (!ladjust && width > 0) - while (width--) - db_putchar (padc); - for (;*p;p++) - db_putchar(*p); - if (ladjust && width > 0) - while (width--) - db_putchar (padc); - break; - case 'r': - ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); - if ((long)ul < 0) { - neg = 1; - ul = -(long)ul; - } - base = db_radix; - if (base < 8 || base > 16) - base = 10; - goto number; - case 'n': - ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); - base = db_radix; - if (base < 8 || base > 16) - base = 10; - goto number; - case 'd': - ul = lflag ? va_arg(ap, long) : va_arg(ap, int); - if ((long)ul < 0) { - neg = 1; - ul = -(long)ul; - } - base = 10; - goto number; - case 'o': - ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); - base = 8; - goto number; - case 'u': - ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); - base = 10; - goto number; - case 'z': - ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); - if ((long)ul < 0) { - neg = 1; - ul = -(long)ul; - } - base = 16; - goto number; - case 'x': - ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); - base = 16; -number: p = (char *)db_ksprintn(ul, base, &tmp); - if (sharpflag && ul != 0) { - if (base == 8) - tmp++; - else if (base == 16) - tmp += 2; - } - if (neg) - tmp++; - - if (!ladjust && width && (width -= tmp) > 0) - while (width--) - db_putchar(padc); - if (neg) - db_putchar ('-'); - if (sharpflag && ul != 0) { - if (base == 8) { - db_putchar ('0'); - } else if (base == 16) { - db_putchar ('0'); - db_putchar ('x'); - } - } - if (ladjust && width && (width -= tmp) > 0) - while (width--) - db_putchar(padc); - - for (;*p;p--) - db_putchar(*p); - break; - default: - db_putchar('%'); - if (lflag) - db_putchar('l'); - /* FALLTHROUGH */ - case '%': - db_putchar(ch); - } - } -} diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index 32975db..5859962 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_sym.c,v 1.13 1995/12/10 13:32:41 phk Exp $ + * $Id: db_sym.c,v 1.14 1995/12/10 19:08:15 bde Exp $ */ /* @@ -299,7 +299,7 @@ db_printsym(off, strategy) } db_printf("%s", name); if (d) - db_printf("+%#r", d); + db_printf("+%+#n", d); if (strategy == DB_STGY_PROC) { if (db_line_at_pc(cursym, &filename, &linenum, off)) db_printf(" [%s:%d]", filename, linenum); |