libdwarf_arange.c (6cec9cad762b6476313fb1f8e931a1647822db6b) libdwarf_arange.c (cf781b2e16c26535788abe648f5917f4db09c123)
1/*-
2 * Copyright (c) 2009-2011 Kai Wang
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

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
24 * SUCH DAMAGE.
25 */
26
27#include "_libdwarf.h"
28
1/*-
2 * Copyright (c) 2009-2011 Kai Wang
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

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
24 * SUCH DAMAGE.
25 */
26
27#include "_libdwarf.h"
28
29ELFTC_VCSID("$Id: libdwarf_arange.c 2070 2011-10-27 03:05:32Z jkoshy $");
29ELFTC_VCSID("$Id: libdwarf_arange.c 3029 2014-04-21 23:26:02Z kaiwang27 $");
30
31void
32_dwarf_arange_cleanup(Dwarf_Debug dbg)
33{
34 Dwarf_ArangeSet as, tas;
35 Dwarf_Arange ar, tar;
36
37 STAILQ_FOREACH_SAFE(as, &dbg->dbg_aslist, as_next, tas) {

--- 24 unchanged lines hidden (view full) ---

62 int i, ret;
63
64 ret = DW_DLE_NONE;
65
66 if ((ds = _dwarf_find_section(dbg, ".debug_aranges")) == NULL)
67 return (DW_DLE_NONE);
68
69 if (!dbg->dbg_info_loaded) {
30
31void
32_dwarf_arange_cleanup(Dwarf_Debug dbg)
33{
34 Dwarf_ArangeSet as, tas;
35 Dwarf_Arange ar, tar;
36
37 STAILQ_FOREACH_SAFE(as, &dbg->dbg_aslist, as_next, tas) {

--- 24 unchanged lines hidden (view full) ---

62 int i, ret;
63
64 ret = DW_DLE_NONE;
65
66 if ((ds = _dwarf_find_section(dbg, ".debug_aranges")) == NULL)
67 return (DW_DLE_NONE);
68
69 if (!dbg->dbg_info_loaded) {
70 ret = _dwarf_info_load(dbg, 1, error);
70 ret = _dwarf_info_load(dbg, 1, 1, error);
71 if (ret != DW_DLE_NONE)
72 return (ret);
73 }
74
75 offset = 0;
76 while (offset < ds->ds_size) {
77
78 if ((as = malloc(sizeof(struct _Dwarf_ArangeSet))) == NULL) {

--- 53 unchanged lines hidden (view full) ---

132 ar->ar_range = range;
133 STAILQ_INSERT_TAIL(&as->as_arlist, ar, ar_next);
134 dbg->dbg_arange_cnt++;
135 }
136 }
137
138 /* Build arange array. */
139 if (dbg->dbg_arange_cnt > 0) {
71 if (ret != DW_DLE_NONE)
72 return (ret);
73 }
74
75 offset = 0;
76 while (offset < ds->ds_size) {
77
78 if ((as = malloc(sizeof(struct _Dwarf_ArangeSet))) == NULL) {

--- 53 unchanged lines hidden (view full) ---

132 ar->ar_range = range;
133 STAILQ_INSERT_TAIL(&as->as_arlist, ar, ar_next);
134 dbg->dbg_arange_cnt++;
135 }
136 }
137
138 /* Build arange array. */
139 if (dbg->dbg_arange_cnt > 0) {
140 if ((dbg->dbg_arange_array = malloc(dbg->dbg_arange_cnt *
141 sizeof(struct _Dwarf_Arange))) == NULL) {
140 if ((dbg->dbg_arange_array = malloc(dbg->dbg_arange_cnt *
141 sizeof(Dwarf_Arange))) == NULL) {
142 DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
143 ret = DW_DLE_MEMORY;
144 goto fail_cleanup;
145 }
146
147 i = 0;
148 STAILQ_FOREACH(as, &dbg->dbg_aslist, as_next) {
149 STAILQ_FOREACH(ar, &as->as_arlist, ar_next)

--- 111 unchanged lines hidden ---
142 DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
143 ret = DW_DLE_MEMORY;
144 goto fail_cleanup;
145 }
146
147 i = 0;
148 STAILQ_FOREACH(as, &dbg->dbg_aslist, as_next) {
149 STAILQ_FOREACH(ar, &as->as_arlist, ar_next)

--- 111 unchanged lines hidden ---