diff options
| author | Roland McGrath <[email protected]> | 2008-08-25 22:55:17 +0000 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2008-08-25 22:55:17 +0000 |
| commit | b4d6f0f8064f2b706ea9035ef0393d8299671390 (patch) | |
| tree | 58d3da51253302bc5b8f2198d8462942ff43f464 /libdwfl/dwfl_getdwarf.c | |
| parent | f729d77881262094d365d33ac51063e25a02e357 (diff) | |
Fix up bogon and missing log entries from .pmachata.threads branch.
Diffstat (limited to 'libdwfl/dwfl_getdwarf.c')
| -rw-r--r-- | libdwfl/dwfl_getdwarf.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/libdwfl/dwfl_getdwarf.c b/libdwfl/dwfl_getdwarf.c index e1c1aa76..0a0656f7 100644 --- a/libdwfl/dwfl_getdwarf.c +++ b/libdwfl/dwfl_getdwarf.c @@ -1,5 +1,5 @@ /* Iterate through modules to fetch Dwarf information. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -49,6 +49,24 @@ #include "libdwflP.h" +struct module_callback_info +{ + int (*callback) (Dwfl_Module *, void **, + const char *, Dwarf_Addr, + Dwarf *, Dwarf_Addr, void *); + void *arg; +}; + +static int +module_callback (Dwfl_Module *mod, void **userdata, + const char *name, Dwarf_Addr start, void *arg) +{ + const struct module_callback_info *info = arg; + Dwarf_Addr bias = 0; + Dwarf *dw = INTUSE(dwfl_module_getdwarf) (mod, &bias); + return (*info->callback) (mod, userdata, name, start, dw, bias, info->arg); +} + ptrdiff_t dwfl_getdwarf (Dwfl *dwfl, int (*callback) (Dwfl_Module *, void **, @@ -57,20 +75,6 @@ dwfl_getdwarf (Dwfl *dwfl, void *arg, ptrdiff_t offset) { - if (dwfl == NULL) - return -1; - - if ((size_t) offset > dwfl->nmodules) - return -1; - - while ((size_t) offset < dwfl->nmodules) - { - Dwfl_Module *mod = dwfl->modules[offset++]; - Dwarf_Addr bias = 0; - Dwarf *dw = INTUSE(dwfl_module_getdwarf) (mod, &bias); - if ((*callback) (MODCB_ARGS (mod), dw, bias, arg) != DWARF_CB_OK) - return offset; - } - - return 0; + struct module_callback_info info = { callback, arg }; + return INTUSE(dwfl_getmodules) (dwfl, &module_callback, &info, offset); } |
