diff options
author | rsc <devnull@localhost> | 2005-01-23 22:51:46 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-01-23 22:51:46 +0000 |
commit | d925d643cba25a7a3b7f530a42fb8dbc4e2f176e (patch) | |
tree | d7b4f8acea11b08e074508f6b4aade3dd3a700c8 /src/cmd/core.c | |
parent | 95f5b525d2eecb5ea90a056cff47f3bf946540aa (diff) | |
download | plan9port-d925d643cba25a7a3b7f530a42fb8dbc4e2f176e.tar.gz plan9port-d925d643cba25a7a3b7f530a42fb8dbc4e2f176e.tar.bz2 plan9port-d925d643cba25a7a3b7f530a42fb8dbc4e2f176e.zip |
sort cores; print stack as command
Diffstat (limited to 'src/cmd/core.c')
-rw-r--r-- | src/cmd/core.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/cmd/core.c b/src/cmd/core.c index 94a38bbc..a0021a0a 100644 --- a/src/cmd/core.c +++ b/src/cmd/core.c @@ -43,6 +43,20 @@ coredir(void) return dir; } +int +timecmp(const void *va, const void *vb) +{ + Dir *a, *b; + + a = (Dir*)va; + b = (Dir*)vb; + if(a->mtime < b->mtime) + return 1; + if(a->mtime > b->mtime) + return -1; + return 0; +} + void coreall(char *name) { @@ -62,6 +76,7 @@ coreall(char *name) return; } n = dirreadall(fd, &d); + qsort(d, n, sizeof(d[0]), timecmp); for(i=0; i<n; i++){ p = smprint("%s/%s", name, d[i].name); if(p == nil) @@ -97,12 +112,6 @@ corefile(char *name, int explicit) fprint(2, "%s: not a core file\n", name); return; } - print("acid %s # %s %s\n", name, t, hdr->cmd); - - /* - * To do: look at command line to determine binary. - * Print stack. - */ + print("stack %s\n\t# %s\n\t# %s\n", name, t, hdr->cmdline); uncrackhdr(hdr); } - |