extract cmd in right place

This commit is contained in:
rsc 2005-01-18 20:49:11 +00:00
parent 58698c9c12
commit 1bdf170864
3 changed files with 6 additions and 6 deletions

View file

@ -6,7 +6,7 @@
static int mapelf(Fhdr *fp, ulong base, Map *map, Regs**); static int mapelf(Fhdr *fp, ulong base, Map *map, Regs**);
static int mapcoreregs(Fhdr *fp, Map *map, Regs**); static int mapcoreregs(Fhdr *fp, Map *map, Regs**);
static char *getcorecmd(Fhdr *fp, Map *map); static char *getcorecmd(Fhdr *fp);
static struct static struct
{ {
@ -141,6 +141,8 @@ crackelf(int fd, Fhdr *fp)
elf->corecmd = ctab[i].corecmd; elf->corecmd = ctab[i].corecmd;
break; break;
} }
if((fp->cmd = getcorecmd(fp)) == nil)
fprint(2, "warning: reading core command: %r");
return 0; return 0;
} }
@ -259,8 +261,6 @@ mapelf(Fhdr *fp, ulong base, Map *map, Regs **regs)
if(fp->ftype == FCORE){ if(fp->ftype == FCORE){
if(mapcoreregs(fp, map, regs) < 0) if(mapcoreregs(fp, map, regs) < 0)
fprint(2, "warning: reading core regs: %r"); fprint(2, "warning: reading core regs: %r");
if((fp->cmd = getcorecmd(fp, map)) == nil)
fprint(2, "warning: reading core command: %r");
} }
return 0; return 0;
@ -352,7 +352,7 @@ mapcoreregs(Fhdr *fp, Map *map, Regs **rp)
} }
static char* static char*
getcorecmd(Fhdr *fp, Map *map) getcorecmd(Fhdr *fp)
{ {
int i; int i;
uchar *a, *sa, *ea; uchar *a, *sa, *ea;

View file

@ -108,7 +108,7 @@ corecmdfreebsd386(Elf *elf, ElfNote *note, char **pp)
return -1; return -1;
} }
p = (Psinfo*)note->desc; p = (Psinfo*)note->desc;
print("elf name %s\nelf args %s\n", p->name, p->psargs); // print("elf name %s\nelf args %s\n", p->name, p->psargs);
t = malloc(80+1); t = malloc(80+1);
if(t == nil) if(t == nil)
return -1; return -1;

View file

@ -83,7 +83,7 @@ corecmdlinux386(Elf *elf, ElfNote *note, char **pp)
return -1; return -1;
} }
p = (Psinfo*)note->desc; p = (Psinfo*)note->desc;
print("elf name %s\nelf args %s\n", p->fname, p->psargs); // print("elf name %s\nelf args %s\n", p->fname, p->psargs);
t = malloc(80+1); t = malloc(80+1);
if(t == nil) if(t == nil)
return -1; return -1;