mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
2006-08-20 Soren Sandmann <sandmann@redhat.com> * Makefile.am, demangle.c: New file, made out of files from libiberty in binutils. * binfile.c: Use the new sysprof_cplus_demangle() function * elfparser.[ch]: Add code to lookup symbols. Add demangling function * testelf.c: Various tests
38 lines
703 B
C
38 lines
703 B
C
#include <glib.h>
|
|
#include "elfparser.h"
|
|
|
|
static void
|
|
check (ElfParser *elf, gulong addr)
|
|
{
|
|
const ElfSym *sym = elf_parser_lookup_symbol (elf, addr);
|
|
|
|
g_print ("%p => ", addr);
|
|
|
|
if (sym)
|
|
{
|
|
g_print ("found: %s (%p)\n",
|
|
elf_sym_get_name (sym),
|
|
elf_sym_get_address (sym));
|
|
}
|
|
else
|
|
{
|
|
g_print ("not found\n");
|
|
}
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
GMappedFile *libgtk = g_mapped_file_new ("/usr/lib/libgtk-x11-2.0.so",
|
|
FALSE, NULL);
|
|
ElfParser *elf = elf_parser_new (
|
|
g_mapped_file_get_contents (libgtk),
|
|
g_mapped_file_get_length (libgtk));
|
|
|
|
check (elf, 0x3e7ef20); /* gtk_handle_box_end_drag */
|
|
check (elf, 0x3e7ef25); /* same */
|
|
|
|
return 0;
|
|
}
|
|
|