more features
This commit is contained in:
parent
2189e55cde
commit
e8a7b96999
5 changed files with 676 additions and 0 deletions
38
src/libmach/elfnm.c
Normal file
38
src/libmach/elfnm.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <mach.h>
|
||||
#include <elf.h>
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
fprint(2, "usage: elfnm file...\n");
|
||||
exits("usage");
|
||||
}
|
||||
|
||||
void
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
ElfSym esym;
|
||||
Fhdr *fp;
|
||||
int i, j;
|
||||
|
||||
ARGBEGIN{
|
||||
default:
|
||||
usage();
|
||||
}ARGEND
|
||||
|
||||
if(argc == 0)
|
||||
usage();
|
||||
|
||||
for(i=0; i<argc; i++){
|
||||
if((fp = crackhdr(argv[i], OREAD)) == nil){
|
||||
fprint(2, "%s: %r\n", argv[i]);
|
||||
continue;
|
||||
}
|
||||
for(j=0; elfsym(fp->elf, j, &esym)>=0; j++)
|
||||
print("%s 0x%lux\n", esym.name, esym.value);
|
||||
uncrackhdr(fp);
|
||||
}
|
||||
exits(0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue