Commit 57bff962 authored by Rob Pike's avatar Rob Pike

fix gotest by fixing nm -s to print in file order by storing a sequence number

as the .6 file is read.   now tests will be run in file order.

R=rsc
DELTA=9  (6 added, 1 deleted, 2 changed)
OCL=27542
CL=27544
parent 55faa5f1
...@@ -85,6 +85,7 @@ struct Sym ...@@ -85,6 +85,7 @@ struct Sym
char type; char type;
char *name; char *name;
char *gotype; char *gotype;
int sequence; // order in file
}; };
/* /*
* End of Plan 9 a.out.h * End of Plan 9 a.out.h
......
...@@ -185,11 +185,13 @@ cmp(void *vs, void *vt) ...@@ -185,11 +185,13 @@ cmp(void *vs, void *vt)
s = vs; s = vs;
t = vt; t = vt;
if(nflag) if(nflag) // sort on address (numeric) order
if((*s)->value < (*t)->value) if((*s)->value < (*t)->value)
return -1; return -1;
else else
return (*s)->value > (*t)->value; return (*s)->value > (*t)->value;
if(sflag) // sort on file order (sequence)
return (*s)->sequence - (*t)->sequence;
return strcmp((*s)->name, (*t)->name); return strcmp((*s)->name, (*t)->name);
} }
/* /*
...@@ -298,7 +300,6 @@ printsyms(Sym **symptr, long nsym) ...@@ -298,7 +300,6 @@ printsyms(Sym **symptr, long nsym)
char *cp; char *cp;
char path[512]; char path[512];
if(!sflag)
qsort(symptr, nsym, sizeof(*symptr), (void*)cmp); qsort(symptr, nsym, sizeof(*symptr), (void*)cmp);
wid = 0; wid = 0;
......
...@@ -108,6 +108,8 @@ static void objreset(void); ...@@ -108,6 +108,8 @@ static void objreset(void);
static void objlookup(int, char *, int, uint); static void objlookup(int, char *, int, uint);
static void objupdate(int, int); static void objupdate(int, int);
static int sequence;
int int
objtype(Biobuf *bp, char **name) objtype(Biobuf *bp, char **name)
{ {
...@@ -295,6 +297,7 @@ objlookup(int id, char *name, int type, uint sig) ...@@ -295,6 +297,7 @@ objlookup(int id, char *name, int type, uint sig)
sp->s.type = type; sp->s.type = type;
sp->s.sig = sig; sp->s.sig = sig;
sp->s.value = islocal(type) ? MAXOFF : 0; sp->s.value = islocal(type) ? MAXOFF : 0;
sp->s.sequence = sequence++;
names[id] = &sp->s; names[id] = &sp->s;
sp->next = hash[h]; sp->next = hash[h];
hash[h] = sp; hash[h] = sp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment