diff options
| author | Ulrich Drepper <[email protected]> | 2007-03-13 06:22:40 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2007-03-13 06:22:40 +0000 |
| commit | 6258e7486eb3eed6e50005946795c5fbf73aa106 (patch) | |
| tree | 669a314f55739470bd3dbe1220088b43485f58c6 /tests/dwflmodtest.c | |
| parent | 8b383101ca9c958e27175a0b77b6c227c08386eb (diff) | |
propagate from branch 'com.redhat.elfutils.roland.pending' (head e0c7abd450c9e49093cfae30af8a22782a74a403)
to branch 'com.redhat.elfutils' (head 2c784d50eee72e33972c333138a3a28df304da63)
Diffstat (limited to 'tests/dwflmodtest.c')
| -rw-r--r-- | tests/dwflmodtest.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c index 7e454e47..c34cac42 100644 --- a/tests/dwflmodtest.c +++ b/tests/dwflmodtest.c @@ -1,5 +1,5 @@ /* Test program for libdwfl basic module tracking, relocation. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -163,6 +163,25 @@ print_func (Dwarf_Die *func, void *arg) } static int +list_module (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name, Dwarf_Addr base, + void *arg __attribute__ ((unused))) +{ + Dwarf_Addr start; + Dwarf_Addr end; + const char *file; + const char *debug; + if (dwfl_module_info (mod, NULL, &start, &end, + NULL, NULL, &file, &debug) != name + || start != base) + abort (); + printf ("module: %30s %08" PRIx64 "..%08" PRIx64 " %s %s\n", + name, start, end, file, debug); + return DWARF_CB_OK; +} + +static int print_module (Dwfl_Module *mod __attribute__ ((unused)), void **userdata __attribute__ ((unused)), const char *name, Dwarf_Addr base, @@ -252,11 +271,24 @@ main (int argc, char **argv) ptrdiff_t p = 0; do + p = dwfl_getmodules (dwfl, &list_module, NULL, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + do p = dwfl_getdwarf (dwfl, &print_module, &show_functions, p); while (p > 0); if (p < 0) error (2, 0, "dwfl_getdwarf: %s", dwfl_errmsg (-1)); + p = 0; + do + p = dwfl_getmodules (dwfl, &list_module, NULL, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + dwfl_end (dwfl); return 0; |
