mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
7f12eb53ca
brk value. * mmcheck.c (mmcheckf): Renamed from mmcheck and new FORCE argument added. Replaced hack that always allowed checking routines to be installed and enforce restriction that they have to be installed prior to allocating any memory on the used heap or the FORCE argument has to be non-NULL. (mmcheck): New function that calls mmcheckf with FORCE set to zero, for backwards compatibility. * mmalloc.c (malloc): Store result in local variable before returning it. Makes debugging much easier at negligible cost. * mmalloc.h (mmcheckf): Declare. * attach.c (reuse): Call mmcheckf rather than mmcheck. * mmap-sup.c (__mmalloc_mmap_morecore): Improve to allow mmap to select a base mapping address if none is otherwise given. (mmalloc_findbase): New function that user can call to find an available mapping address of a given size.
62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
#ifndef MMALLOC_H
|
|
#define MMALLOC_H 1
|
|
|
|
/* FIXME: If <stddef.h> doesn't exist, you'll need to do something
|
|
to define size_t before including this file. Like upgrading
|
|
to a system with an ANSI C environment. */
|
|
|
|
#ifdef HAVE_STDDEF_H
|
|
# include <stddef.h>
|
|
#endif
|
|
|
|
#include "ansidecl.h"
|
|
|
|
/* Allocate SIZE bytes of memory. */
|
|
|
|
extern PTR mmalloc PARAMS ((PTR, size_t));
|
|
|
|
/* Re-allocate the previously allocated block in PTR, making the new block
|
|
SIZE bytes long. */
|
|
|
|
extern PTR mrealloc PARAMS ((PTR, PTR, size_t));
|
|
|
|
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
|
|
|
|
extern PTR mcalloc PARAMS ((PTR, size_t, size_t));
|
|
|
|
/* Free a block allocated by `mmalloc', `mrealloc' or `mcalloc'. */
|
|
|
|
extern void mfree PARAMS ((PTR, PTR));
|
|
|
|
/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */
|
|
|
|
extern PTR mmemalign PARAMS ((PTR, size_t, size_t));
|
|
|
|
/* Allocate SIZE bytes on a page boundary. */
|
|
|
|
extern PTR mvalloc PARAMS ((PTR, size_t));
|
|
|
|
/* Activate a standard collection of debugging hooks. */
|
|
|
|
extern int mmcheck PARAMS ((PTR, void (*) (void)));
|
|
|
|
extern int mmcheckf PARAMS ((PTR, void (*) (void), int));
|
|
|
|
/* Pick up the current statistics. (see FIXME elsewhere) */
|
|
|
|
extern struct mstats mmstats PARAMS ((PTR));
|
|
|
|
extern PTR mmalloc_attach PARAMS ((int, PTR));
|
|
|
|
extern PTR mmalloc_detach PARAMS ((PTR));
|
|
|
|
extern int mmalloc_setkey PARAMS ((PTR, int, PTR));
|
|
|
|
extern PTR mmalloc_getkey PARAMS ((PTR, int));
|
|
|
|
extern int mmalloc_errno PARAMS ((PTR));
|
|
|
|
extern int mmtrace PARAMS ((void));
|
|
|
|
#endif /* MMALLOC_H */
|