small hidings

This commit is contained in:
rsc 2005-01-07 18:45:17 +00:00
parent 60efa1d2b9
commit 39dbe6e72b
6 changed files with 24 additions and 13 deletions

View file

@ -42,7 +42,7 @@ static int ptraceregrw(Regs*, char*, ulong*, int);
static int attachedpids[1000]; static int attachedpids[1000];
static int nattached; static int nattached;
int static int
ptraceattach(int pid) ptraceattach(int pid)
{ {
int i; int i;
@ -91,8 +91,6 @@ unmapproc(Map *map)
} }
} }
int int
mapproc(int pid, Map *map, Regs **rp) mapproc(int pid, Map *map, Regs **rp)
{ {

View file

@ -439,7 +439,7 @@ bynamecmp(const void *va, const void *vb)
} }
int int
syminit(Fhdr *hdr) symopen(Fhdr *hdr)
{ {
int i; int i;
Symbol *r, *w, *es; Symbol *r, *w, *es;
@ -474,8 +474,21 @@ syminit(Fhdr *hdr)
return 0; return 0;
} }
void
symclose(Fhdr *hdr)
{
_delhdr(hdr);
if(hdr->symclose)
hdr->symclose(hdr);
free(hdr->byname);
hdr->byname = nil;
free(hdr->sym);
hdr->sym = nil;
hdr->nsym = 0;
}
Symbol* Symbol*
addsym(Fhdr *fp, Symbol *sym) _addsym(Fhdr *fp, Symbol *sym)
{ {
Symbol *s; Symbol *s;

View file

@ -212,7 +212,7 @@ dwarfsyminit(Fhdr *fp)
case TagVariable: case TagVariable:
if(dwarftosym(fp, d, &s, &sym, 0) < 0) if(dwarftosym(fp, d, &s, &sym, 0) < 0)
continue; continue;
addsym(fp, &sym); _addsym(fp, &sym);
} }
} }
} }

View file

@ -46,7 +46,7 @@ elfsyminit(Fhdr *fp)
sym.type = 'U'; sym.type = 'U';
if(esym.bind==ElfSymBindLocal) if(esym.bind==ElfSymBindLocal)
sym.type += 'a' - 'A'; sym.type += 'a' - 'A';
addsym(fp, &sym); _addsym(fp, &sym);
} }
for(i=0; i<elf->nprog; i++){ for(i=0; i<elf->nprog; i++){
@ -60,7 +60,7 @@ elfsyminit(Fhdr *fp)
sym.hiloc = locaddr(p->vaddr+p->filesz); sym.hiloc = locaddr(p->vaddr+p->filesz);
sym.type = 'D'; sym.type = 'D';
sym.class = CDATA; sym.class = CDATA;
addsym(fp, &sym); _addsym(fp, &sym);
} }
return 0; return 0;
} }

View file

@ -196,7 +196,7 @@ stabssyminit(Fhdr *fp)
fun = nil; fun = nil;
if(stabcvtsym(&sym, &s, dir, file, i) < 0) if(stabcvtsym(&sym, &s, dir, file, i) < 0)
continue; continue;
if((fun = addsym(fp, &s)) == nil) if((fun = _addsym(fp, &s)) == nil)
goto err; goto err;
locals = 0; locals = 0;
params = 0; params = 0;
@ -249,7 +249,7 @@ stabssyminit(Fhdr *fp)
/* create new symbol, add it */ /* create new symbol, add it */
if(stabcvtsym(&sym, &s, dir, file, i) < 0) if(stabcvtsym(&sym, &s, dir, file, i) < 0)
continue; continue;
if(addsym(fp, &s) == nil) if(_addsym(fp, &s) == nil)
goto err; goto err;
break; break;
} }

View file

@ -163,9 +163,9 @@ main(int argc, char **argv)
attachargs(argc, argv, OREAD); attachargs(argc, argv, OREAD);
attachdynamic(); attachdynamic();
if(!corpid && !corhdr) // if(!corpid && !corhdr)
sysfatal("could not attach to process"); // sysfatal("could not attach to process");
//
p.pid = corpid; p.pid = corpid;
if((e = td_ta_new(&p, &ta)) != TD_OK) if((e = td_ta_new(&p, &ta)) != TD_OK)
sysfatal("td_ta_new: %s", terr(e)); sysfatal("td_ta_new: %s", terr(e));