sort cores; print stack as command
This commit is contained in:
parent
95f5b525d2
commit
d925d643cb
1 changed files with 16 additions and 7 deletions
|
|
@ -43,6 +43,20 @@ coredir(void)
|
||||||
return dir;
|
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
|
void
|
||||||
coreall(char *name)
|
coreall(char *name)
|
||||||
{
|
{
|
||||||
|
|
@ -62,6 +76,7 @@ coreall(char *name)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
n = dirreadall(fd, &d);
|
n = dirreadall(fd, &d);
|
||||||
|
qsort(d, n, sizeof(d[0]), timecmp);
|
||||||
for(i=0; i<n; i++){
|
for(i=0; i<n; i++){
|
||||||
p = smprint("%s/%s", name, d[i].name);
|
p = smprint("%s/%s", name, d[i].name);
|
||||||
if(p == nil)
|
if(p == nil)
|
||||||
|
|
@ -97,12 +112,6 @@ corefile(char *name, int explicit)
|
||||||
fprint(2, "%s: not a core file\n", name);
|
fprint(2, "%s: not a core file\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
print("acid %s # %s %s\n", name, t, hdr->cmd);
|
print("stack %s\n\t# %s\n\t# %s\n", name, t, hdr->cmdline);
|
||||||
|
|
||||||
/*
|
|
||||||
* To do: look at command line to determine binary.
|
|
||||||
* Print stack.
|
|
||||||
*/
|
|
||||||
uncrackhdr(hdr);
|
uncrackhdr(hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue