source: git/omalloc/omReturn.h @ a82c308

fieker-DuValspielwiese
Last change on this file since a82c308 was a15586, checked in by Burcin Erocal <burcin@…>, 13 years ago
Remove inline assembly hacks used to get the function return address in omalloc. omalloc included inline assembly code from the dmalloc library to figure out the return address of a function in debug mode. These hacks made assumptions about the registers which break with recent GCC versions. We remove the hacks and rely on the __builtin_return_address() function provided by GCC.
  • Property mode set to 100644
File size: 2.0 KB
Line 
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 * $Id$
23 */
24
25/*
26 * This file contains the definition of the GET_RET_ADDR macro which
27 * is designed to contain the archecture/compiler specific hacks to
28 * determine the return-address from inside the malloc library.  With
29 * this information, the library can display caller information from
30 * calls that do not use the malloc_lp functions.
31 *
32 * Most of the archectures here have been contributed by other
33 * individuals and may need to be toggled a bit to remove local
34 * configuration differences.
35 *
36 * PLEASE send all submissions, comments, problems to the author.
37 *
38 * NOTE: examining the assembly code for x =
39 * __builtin_return_address(0); with gcc version 2+ should give you a
40 * good start on building a hack for your box.
41 *
42 * NOTE: the hacks mentioned above were removed in favor of the GCC macro
43 * __builtin_return_address(). Assumptions made in these hacks break for
44 * recent GCC versions.
45 */
46
47#ifndef __OM_RETURN_H__
48#define __OM_RETURN_H__
49
50
51/********************************** default **********************************/
52#ifndef GET_RET_ADDR
53
54#if __GNUC__ > 1
55#define GET_RET_ADDR(file) (file = __builtin_return_address(0))
56#else
57#define GET_RET_ADDR(file)      (file = 0)
58#endif
59#endif /* __GNUC__ > 1 */
60
61#endif /* ! __OM_RETURN_H__ */
Note: See TracBrowser for help on using the repository browser.