/*
Copyright (C) 2000,2005 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2008-2010 David Anderson. All Rights Reserved.
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
For further information regarding this notice, see:
*/
/* #define DWARF_SIMPLE_MALLOC 1 */
Dwarf_Debug _dwarf_get_debug(void);
/* ALLOC_AREA_INDEX_TABLE_MAX is the size of the
struct ial_s index_into_allocated array in dwarf_alloc.c
*/
/* ALLOC_AREA_REAL_TABLE_MAX is the size of the array needed
to hold pointers to dwarf alloc chunk areas.
It's smaller as some of the index_into_allocated
entries (they look like {0,1,1,0,0} )
are treated specially and don't use 'chunks'.
*/
/*
This struct is used to chain all the deallocated
structs on the free list of each chain. The structs
are chained internally, by using the memory they
contain.
*/
struct Dwarf_Free_List_s {
};
/*
This struct is used to manage all the chunks malloc'ed
for a particular alloc_type. Many of the fields are
initialized by dwarf_init().
*/
struct Dwarf_Alloc_Hdr_s {
/* Count of actual number of structs user app holds pointers to
currently. */
/*
Size of each struct that will be allocated for this alloc_type.
Initialized by dwarf_init(). */
/*
Number of structs of this alloc_type that will be contained in
each chunk that is malloc'ed. Initialized by dwarf_init(). */
/*
Number of bytes malloc'ed per chunk which is basically
(ah_bytes_one_struct+_DWARF_RESERVE) * ah_alloc_num. */
/* Count of chunks currently allocated for type. */
/*
Points to a chain of Dwarf_Alloc_Area_s structs that represent
all the chunks currently allocated for the alloc_type. */
/* Last Alloc Area that was allocated by malloc. The
free-space-search area looks here first and only if it is full
goes thru the list pointed to by ah_alloc_area_head. */
};
/*
This struct is used to manage each chunk that is
malloc'ed for a particular alloc_type. For each
allocation type, the allocation header points to
a list of all the chunks malloc'ed for that type.
*/
struct Dwarf_Alloc_Area_s {
/* Points to the free list of structs in the chunk. */
/*
Count of the number of free structs in the chunk. This includes
both those on the free list, and in the blob. */
/*
Points to the first byte of the blob from which struct will be
allocated. A struct is put on the free_list only when it
dwarf_deallocated. Initial allocations are from the blob. */
/* Points just past the last byte of the blob. */
/* Points to alloc_hdr this alloc_area is linked to: The owner, in
other words. */
/*
Used for chaining Dwarf_Alloc_Area_s atructs. Alloc areas are
doubly linked to enable deletion from the list in constant time. */
};
struct Dwarf_Error_s *_dwarf_special_no_dbg_error_malloc(void);
#ifdef DWARF_SIMPLE_MALLOC
/*
DWARF_SIMPLE_MALLOC is for testing the hypothesis that the existing
complex malloc scheme in libdwarf is pointless complexity.
DWARF_SIMPLE_MALLOC also makes it easy for a malloc-tracing
tool to verify libdwarf malloc has no botches (though of course
such does not test the complicated standard-libdwarf-alloc code).
*/
struct simple_malloc_entry_s {
unsigned long se_size;
short se_type;
};
/* we do this so dwarf_dealloc can really free everything */
struct simple_malloc_record_s {
int sr_used;
};
#endif /* DWARF_SIMPLE_MALLOC */