New dwarf: pfunct, see it in action:

[acme@newtoy net-2.6]$ pfunct ~acme/work/atag/atag | grep LRMI
void * LRMI_alloc_real(int size);
void LRMI_free_real(void * m);
int LRMI_init(void);
void set_regs(struct LRMI_regs * r);
void get_regs(struct LRMI_regs * r);
int LRMI_call(struct LRMI_regs * r);
int LRMI_int(int i, struct LRMI_regs * r);
[acme@newtoy net-2.6]$

[acme@newtoy net-2.6]$ pfunct kernel/sched.o task_running
int task_running(struct rq * rq, struct task_struct * p);
[acme@newtoy net-2.6]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2006-10-28 19:07:45 -03:00
parent d0df41c935
commit e038f068b1
2 changed files with 46 additions and 1 deletions

View File

@ -17,14 +17,18 @@ INSTALL = cp
binprefix =
PAHOLE_OBJECTS = pahole.o classes.o
PFUNCT_OBJECTS = pfunct.o classes.o
all: pahole
all: pahole pfunct
default: $(TARGETS)
pahole: $(PAHOLE_OBJECTS)
$(CC) $(CFLAGS) -o $@ $(PAHOLE_OBJECTS) $(LDFLAGS)
pfunct: $(PFUNCT_OBJECTS)
$(CC) $(CFLAGS) -o $@ $(PFUNCT_OBJECTS) $(LDFLAGS)
install: all
$(INSTALL) pahole $(bindir)/pahole

41
pfunct.c Normal file
View File

@ -0,0 +1,41 @@
/*
Copyright (C) 2006 Mandriva Conectiva S.A.
Copyright (C) 2006 Arnaldo Carvalho de Melo <acme@mandriva.com>
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
*/
#include <stdio.h>
#include <dwarf.h>
#include <stdlib.h>
#include "classes.h"
int main(int argc, char *argv[])
{
if (argc == 0) {
puts("usage: "
"pfunct <elf_file_with_debug_info> {<function_name>}");
return EXIT_FAILURE;
}
if (classes__load(argv[1]) != 0) {
fprintf(stderr, "pfunct: couldn't load DWARF info from %s\n",
argv[1]);
return EXIT_FAILURE;
}
if (argc == 2)
classes__print(DW_TAG_subprogram);
else {
struct class *class = classes__find_by_name(argv[2]);
if (class != NULL)
class__print(class);
else
printf("function %s not found!\n", argv[2]);
}
return EXIT_SUCCESS;
}