My Project
Loading...
Searching...
No Matches
omReturn.h
Go to the documentation of this file.
1/* slightly changed for use by omalloc.h */
2/*
3 * defines to get the return-address for non-dmalloc_lp malloc calls.
4 *
5 * Copyright 2000 by Gray Watson
6 *
7 * This file is part of the dmalloc package.
8 *
9 * Permission to use, copy, modify, and distribute this software for
10 * any purpose and without fee is hereby granted, provided that the
11 * above copyright notice and this permission notice appear in all
12 * copies, and that the name of Gray Watson not be used in advertising
13 * or publicity pertaining to distribution of the document or software
14 * without specific, written prior permission.
15 *
16 * Gray Watson makes no representations about the suitability of the
17 * software described herein for any purpose. It is provided "as is"
18 * without express or implied warranty.
19 *
20 * The author may be contacted via http://dmalloc.com/
21 *
22 */
23
24/*
25 * This file contains the definition of the GET_RET_ADDR macro which
26 * is designed to contain the archecture/compiler specific hacks to
27 * determine the return-address from inside the malloc library. With
28 * this information, the library can display caller information from
29 * calls that do not use the malloc_lp functions.
30 *
31 * Most of the archectures here have been contributed by other
32 * individuals and may need to be toggled a bit to remove local
33 * configuration differences.
34 *
35 * PLEASE send all submissions, comments, problems to the author.
36 *
37 * NOTE: examining the assembly code for x =
38 * __builtin_return_address(0); with gcc version 2+ should give you a
39 * good start on building a hack for your box.
40 *
41 * NOTE: the hacks mentioned above were removed in favor of the GCC macro
42 * __builtin_return_address(). Assumptions made in these hacks break for
43 * recent GCC versions.
44 */
45
46#ifndef __OM_RETURN_H__
47#define __OM_RETURN_H__
48
49
50/********************************** default **********************************/
51#ifndef GET_RET_ADDR
52
53#if __GNUC__ > 1
54#ifdef OM_GET_RETURN_ADDR_WORKS
55#define GET_RET_ADDR(file) (file = __builtin_return_address(0))
56#else
57#define GET_RET_ADDR(file) (file = 0)
58#endif
59#else
60#define GET_RET_ADDR(file) (file = 0)
61#endif
62#endif /* __GNUC__ > 1 */
63
64#endif /* ! __OM_RETURN_H__ */