blob: a5565c693857115eae9d9fe7bc114c33cee7d8ca [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001/* Iterate through DWARF compilation units across all modules.
2 Copyright (C) 2005 Red Hat, Inc.
3
4 This program is Open Source software; you can redistribute it and/or
5 modify it under the terms of the Open Software License version 1.0 as
6 published by the Open Source Initiative.
7
8 You should have received a copy of the Open Software License along
9 with this program; if not, you may obtain a copy of the Open Software
10 License version 1.0 from http://www.opensource.org/licenses/osl.php or
11 by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
12 3001 King Ranch Road, Ukiah, CA 95482. */
13
14#include "libdwflP.h"
15
16Dwarf_Die *
17dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias)
18{
19 if (dwfl == NULL)
20 return NULL;
21
22 struct dwfl_cu *cu = (struct dwfl_cu *) lastcu;
23 Dwfl_Module *mod;
24
25 if (cu == NULL)
26 {
27 mod = dwfl->modulelist;
28 goto nextmod;
29 }
30 else
31 mod = cu->mod;
32
33 Dwfl_Error error;
34 while ((error = __libdwfl_nextcu (mod, cu, &cu)) == DWFL_E_NOERROR)
35 {
36 if (cu != NULL)
37 {
38 *bias = mod->debug.bias;
39 return &cu->die;
40 }
41
42 mod = mod->next;
43
44 nextmod:
45 if (mod == NULL || INTUSE(dwfl_module_getdwarf) (mod, bias) == NULL)
46 return NULL;
47 }
48
49 __libdwfl_seterrno (error);
50 return NULL;
51}
52INTDEF (dwfl_nextcu)