dwarf_alloc.h revision 49d3bc91e27cd871b950d56c01398fa2f2e12ab4
/*
Copyright (C) 2000 Silicon Graphics, Inc. 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., 59 Temple Place - Suite 330, Boston MA 02111-1307,
USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
For further information regarding this notice, see:
*/
Dwarf_Debug _dwarf_get_debug(void);
typedef struct Dwarf_Alloc_Area_s *Dwarf_Alloc_Area;
typedef struct Dwarf_Free_List_s *Dwarf_Free_List;
#define ALLOC_AREA_INDEX_TABLE_MAX 42
#define ALLOC_AREA_REAL_TABLE_MAX 31
/*
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;
};
#define DSM_BLOCK_COUNT (1000)
/* we do this so dwarf_dealloc can really free everything */
struct simple_malloc_record_s {
struct simple_malloc_record_s *sr_next;
int sr_used;
};
#endif /* DWARF_SIMPLE_MALLOC */