* builtins.def (BUILT_IN_LABS, BUILT_IN_LLABS, BUILT_IN_IMAXABS):
[official-gcc.git] / boehm-gc / dbg_mlc.h
blob6abeda8a611a9479a0eadae6cf01f7888abd3867
1 /*
2 * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3 * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
4 * Copyright (c) 1997 by Silicon Graphics. All rights reserved.
5 * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
18 * This is mostly an internal header file. Typical clients should
19 * not use it. Clients that define their own object kinds with
20 * debugging allocators will probably want to include this, however.
21 * No attempt is made to keep the namespace clean. This should not be
22 * included from header filrd that are frequently included by clients.
25 #ifndef _DBG_MLC_H
27 #define _DBG_MLC_H
29 # define I_HIDE_POINTERS
30 # include "gc_priv.h"
31 # ifdef KEEP_BACK_PTRS
32 # include "backptr.h"
33 # endif
35 # define START_FLAG ((word)0xfedcedcb)
36 # define END_FLAG ((word)0xbcdecdef)
37 /* Stored both one past the end of user object, and one before */
38 /* the end of the object as seen by the allocator. */
41 /* Object header */
42 typedef struct {
43 # ifdef KEEP_BACK_PTRS
44 ptr_t oh_back_ptr;
45 # define MARKED_FOR_FINALIZATION (ptr_t)(-1)
46 /* Object was marked because it is finalizable. */
47 # define MARKED_FROM_REGISTER (ptr_t)(-2)
48 /* Object was marked from a rgister. Hence the */
49 /* source of the reference doesn't have an address. */
50 # ifdef ALIGN_DOUBLE
51 word oh_dummy;
52 # endif
53 # endif
54 char * oh_string; /* object descriptor string */
55 word oh_int; /* object descriptor integers */
56 # ifdef NEED_CALLINFO
57 struct callinfo oh_ci[NFRAMES];
58 # endif
59 word oh_sz; /* Original malloc arg. */
60 word oh_sf; /* start flag */
61 } oh;
62 /* The size of the above structure is assumed not to dealign things, */
63 /* and to be a multiple of the word length. */
65 #define DEBUG_BYTES (sizeof (oh) + sizeof (word))
66 #define USR_PTR_FROM_BASE(p) ((ptr_t)(p) + sizeof(oh))
68 /* There is no reason to ever add a byte at the end explicitly, since we */
69 /* already add a guard word. */
70 #undef ROUNDED_UP_WORDS
71 #define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1)
73 #ifdef SAVE_CALL_CHAIN
74 # define ADD_CALL_CHAIN(base, ra) GC_save_callers(((oh *)(base)) -> oh_ci)
75 # define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
76 #else
77 # ifdef GC_ADD_CALLER
78 # define ADD_CALL_CHAIN(base, ra) ((oh *)(base)) -> oh_ci[0].ci_pc = (ra)
79 # define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
80 # else
81 # define ADD_CALL_CHAIN(base, ra)
82 # define PRINT_CALL_CHAIN(base)
83 # endif
84 #endif
86 # ifdef GC_ADD_CALLER
87 # define OPT_RA ra,
88 # else
89 # define OPT_RA
90 # endif
93 /* Check whether object with base pointer p has debugging info */
94 /* p is assumed to point to a legitimate object in our part */
95 /* of the heap. */
96 GC_bool GC_has_debug_info(/* p */);
98 /* Store debugging info into p. Return displaced pointer. */
99 /* Assumes we don't hold allocation lock. */
100 ptr_t GC_store_debug_info(/* p, sz, string, integer */);
102 #endif /* _DBG_MLC_H */