2 * Copyright (c) 2014 Kai Wang
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 #include "_libdwarf.h"
29 ELFTC_VCSID("$Id: dwarf_sections.c 3226 2015-06-23 13:00:16Z emaste $");
38 dwarf_get_section_max_offsets_b(Dwarf_Debug dbg, Dwarf_Unsigned *debug_info,
39 Dwarf_Unsigned *debug_abbrev, Dwarf_Unsigned *debug_line,
40 Dwarf_Unsigned *debug_loc, Dwarf_Unsigned *debug_aranges,
41 Dwarf_Unsigned *debug_macinfo, Dwarf_Unsigned *debug_pubnames,
42 Dwarf_Unsigned *debug_str, Dwarf_Unsigned *debug_frame,
43 Dwarf_Unsigned *debug_ranges, Dwarf_Unsigned *debug_pubtypes,
44 Dwarf_Unsigned *debug_types)
51 return (DW_DLV_ERROR);
57 SET(debug_aranges, 0);
58 SET(debug_macinfo, 0);
59 SET(debug_pubnames, 0);
63 SET(debug_pubtypes, 0);
66 for (i = 0; (Dwarf_Unsigned) i < dbg->dbg_seccnt; i++) {
67 n = dbg->dbg_section[i].ds_name;
68 sz = dbg->dbg_section[i].ds_size;
69 if (!strcmp(n, ".debug_info"))
71 else if (!strcmp(n, ".debug_abbrev"))
72 SET(debug_abbrev, sz);
73 else if (!strcmp(n, ".debug_line"))
75 else if (!strcmp(n, ".debug_loc"))
77 else if (!strcmp(n, ".debug_aranges"))
78 SET(debug_aranges, sz);
79 else if (!strcmp(n, ".debug_macinfo"))
80 SET(debug_macinfo, sz);
81 else if (!strcmp(n, ".debug_pubnames"))
82 SET(debug_pubnames, sz);
83 else if (!strcmp(n, ".debug_str"))
85 else if (!strcmp(n, ".debug_frame"))
87 else if (!strcmp(n, ".debug_ranges"))
88 SET(debug_ranges, sz);
89 else if (!strcmp(n, ".debug_pubtypes"))
90 SET(debug_pubtypes, sz);
91 else if (!strcmp(n, ".debug_types"))
99 dwarf_get_section_max_offsets(Dwarf_Debug dbg, Dwarf_Unsigned *debug_info,
100 Dwarf_Unsigned *debug_abbrev, Dwarf_Unsigned *debug_line,
101 Dwarf_Unsigned *debug_loc, Dwarf_Unsigned *debug_aranges,
102 Dwarf_Unsigned *debug_macinfo, Dwarf_Unsigned *debug_pubnames,
103 Dwarf_Unsigned *debug_str, Dwarf_Unsigned *debug_frame,
104 Dwarf_Unsigned *debug_ranges, Dwarf_Unsigned *debug_pubtypes)
107 return (dwarf_get_section_max_offsets_b(dbg, debug_info, debug_abbrev,
108 debug_line, debug_loc, debug_aranges, debug_macinfo,
109 debug_pubnames, debug_str, debug_frame, debug_ranges,
110 debug_pubtypes, NULL));