summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3f80f20)
for "<address>=<format>" command
SCCS-vsn: old/dbx/vax.c 1.6
/* Copyright (c) 1982 Regents of the University of California */
/* Copyright (c) 1982 Regents of the University of California */
-static char sccsid[] = "@(#)vax.c 1.5 %G%";
+static char sccsid[] = "@(#)vax.c 1.6 %G%";
/*
* Target machine dependent stuff.
/*
* Target machine dependent stuff.
+private Format *findformat(s)
+String s;
+{
+ register Format *f;
+
+ f = &fmt[0];
+ while (f->name != nil and not streq(f->name, s)) {
+ ++f;
+ }
+ if (f->name == nil) {
+ error("bad print format \"%s\"", s);
+ }
+ return f;
+}
+
public Address printdata(lowaddr, highaddr, format)
Address lowaddr;
Address highaddr;
public Address printdata(lowaddr, highaddr, format)
Address lowaddr;
Address highaddr;
if (lowaddr > highaddr) {
error("first address larger than second");
}
if (lowaddr > highaddr) {
error("first address larger than second");
}
- f = &fmt[0];
- while (f->name != nil and not streq(f->name, format)) {
- ++f;
- }
- if (f->name == nil) {
- error("bad print format \"%s\"", format);
- }
+ f = findformat(format);
n = 0;
value = 0;
for (addr = lowaddr; addr <= highaddr; addr += f->length) {
n = 0;
value = 0;
for (addr = lowaddr; addr <= highaddr; addr += f->length) {
if (count <= 0) {
error("non-positive repetition count");
}
if (count <= 0) {
error("non-positive repetition count");
}
- f = &fmt[0];
- while (f->name != nil and not streq(f->name, format)) {
- ++f;
- }
- if (f->name == nil) {
- error("bad print format \"%s\"", format);
- }
+ f = findformat(format);
isstring = (Boolean) streq(f->name, "s");
n = 0;
addr = startaddr;
isstring = (Boolean) streq(f->name, "s");
n = 0;
addr = startaddr;
+/*
+ * Print out a value according to the given format.
+ */
+
+public printvalue(v, format)
+long v;
+String format;
+{
+ Format *f;
+ char *p, *q;
+
+ f = findformat(format);
+ if (streq(f->name, "s")) {
+ putchar('"');
+ p = (char *) &v;
+ q = p + sizeof(v);
+ while (p < q) {
+ printchar(*p);
+ ++p;
+ }
+ putchar('"');
+ } else {
+ printf(f->printfstring, v);
+ }
+ putchar('\n');
+}
+
/*
* Print out an execution time error.
* Assumes the source position of the error has been calculated.
/*
* Print out an execution time error.
* Assumes the source position of the error has been calculated.
-private printloc()
-{
- if (curline > 0) {
- if (nlhdr.nfiles > 1) {
- printf("at line %d in file %s", curline, cursource);
- } else {
- printf("at line %d", curline);
- }
- } else {
- printf("in ");
- printname(stdout, curfunc);
- printf(" at 0x%x", pc);
- }
-}
-
/*
* Note the termination of the program. We do this so as to avoid
* having the process exit, which would make the values of variables
/*
* Note the termination of the program. We do this so as to avoid
* having the process exit, which would make the values of variables
- iread(&save, addr, sizeof(addr));
+ iread(&save, addr, sizeof(save));
newsave = new(Savelist);
newsave->location = addr;
newsave->save = save;
newsave = new(Savelist);
newsave->location = addr;
newsave->save = save;