1 | /* mtrace API for `malloc'. |
2 | Copyright (C) 1991-2021 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | Written April 2, 1991 by John Gilmore of Cygnus Support. |
5 | Based on mcheck.c by Mike Haertel. |
6 | |
7 | The GNU C Library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Lesser General Public |
9 | License as published by the Free Software Foundation; either |
10 | version 2.1 of the License, or (at your option) any later version. |
11 | |
12 | The GNU C Library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Lesser General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU Lesser General Public |
18 | License along with the GNU C Library; if not, see |
19 | <https://www.gnu.org/licenses/>. */ |
20 | |
21 | #if !IS_IN (libc) |
22 | # include "mtrace-impl.c" |
23 | #else |
24 | # include <shlib-compat.h> |
25 | # include <libc-symbols.h> |
26 | #endif |
27 | |
28 | #if IS_IN (libc) && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34) |
29 | /* Compatibility symbols that were introduced to help break at allocation sites |
30 | for specific memory allocations. This is unusable with ASLR, although gdb |
31 | may allow predictable allocation addresses. Even then, gdb has watchpoint |
32 | and conditional breakpoint support which should provide the same |
33 | functionality without having this kludge. These symbols are preserved in |
34 | case some applications ended up linking against them but they don't actually |
35 | do anything anymore; not that they did much before anyway. */ |
36 | |
37 | void *mallwatch; |
38 | compat_symbol (libc, mallwatch, mallwatch, GLIBC_2_0); |
39 | |
40 | void |
41 | tr_break (void) |
42 | { |
43 | } |
44 | compat_symbol (libc, tr_break, tr_break, GLIBC_2_0); |
45 | #endif |
46 | |
47 | |
48 | void |
49 | mtrace (void) |
50 | { |
51 | #if !IS_IN (libc) |
52 | do_mtrace (); |
53 | #endif |
54 | } |
55 | |
56 | void |
57 | muntrace (void) |
58 | { |
59 | #if !IS_IN (libc) |
60 | do_muntrace (); |
61 | #endif |
62 | } |
63 | |