mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
New file, made out of files from libiberty in binutils.
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
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
8967b3148c
commit
6c7afad3ff
39
testelf.c
39
testelf.c
@ -1,24 +1,37 @@
|
||||
#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 ()
|
||||
{
|
||||
int i;
|
||||
|
||||
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));
|
||||
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < 50000; ++i)
|
||||
#endif
|
||||
{
|
||||
ElfParser *elf = elf_parser_new (
|
||||
g_mapped_file_get_contents (libgtk),
|
||||
g_mapped_file_get_length (libgtk));
|
||||
|
||||
elf_parser_lookup_symbol (elf, 1000);
|
||||
}
|
||||
check (elf, 0x3e7ef20); /* gtk_handle_box_end_drag */
|
||||
check (elf, 0x3e7ef25); /* same */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user