diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2023-06-23 05:26:46 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2023-06-23 05:26:46 +0000 |
commit | f7f4772f644685054fd1e33f9c977ec74b57e2f6 (patch) | |
tree | 03026b8ea0eaade296a68bfe861c8932b6152a35 /lib/libc/stdlib | |
parent | 28c218ed871a65b7c20488a7df07018590a5cbbe (diff) |
Revert previous, not all platforms allow compiling
__builtin_return_address(a) with a != 0.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/malloc.3 | 26 | ||||
-rw-r--r-- | lib/libc/stdlib/malloc.c | 15 |
2 files changed, 4 insertions, 37 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3 index 855f217c276..79e85f39ee8 100644 --- a/lib/libc/stdlib/malloc.3 +++ b/lib/libc/stdlib/malloc.3 @@ -30,9 +30,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: malloc.3,v 1.134 2023/06/22 11:04:16 otto Exp $ +.\" $OpenBSD: malloc.3,v 1.135 2023/06/23 05:26:45 otto Exp $ .\" -.Dd $Mdocdate: June 22 2023 $ +.Dd $Mdocdate: June 23 2023 $ .Dt MALLOC 3 .Os .Sh NAME @@ -294,17 +294,6 @@ To record the dump: To view the leak report: .Pp .Dl $ kdump -u malloc ... -.Pp -By default, the immediate caller of a -.Nm -function will be recorded. -Use malloc options -.Cm 2 -or -.Cm 3 -to record the caller one or two stack frames deeper instead. -These malloc options imply -.Cm D . .It Cm F .Dq Freecheck . Enable more extensive double free and use after free detection. @@ -824,14 +813,3 @@ and .Fn realloc to avoid these problems on .Ox . -.Pp -The mechanism to record caller functions when using malloc options -.Cm 2 -or -.Cm 3 -is not guaranteed to work for all platforms, compilers or compilation -options, -and might even crash your program. -Use -.Em only -for debugging purposes. diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 7bc660525bd..34b2bb5e66f 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.287 2023/06/22 11:04:16 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.288 2023/06/23 05:26:45 otto Exp $ */ /* * Copyright (c) 2008, 2010, 2011, 2016, 2023 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> @@ -255,11 +255,7 @@ void malloc_dump(void); PROTO_NORMAL(malloc_dump); static void malloc_exit(void); #endif -#define CALLER ( \ - DO_STATS == 0 ? NULL : (__builtin_extract_return_addr( \ - DO_STATS == 1 ? __builtin_return_address(0) : \ - DO_STATS == 2 ? __builtin_return_address(1) : \ - DO_STATS == 3 ? __builtin_return_address(2) : NULL))) +#define CALLER (DO_STATS ? __builtin_return_address(0) : NULL) /* low bits of r->p determine size: 0 means >= page size and r->size holding * real size, otherwise low bits is the bucket + 1 @@ -369,15 +365,8 @@ omalloc_parseopt(char opt) mopts.malloc_stats = 0; break; case 'D': - case '1': mopts.malloc_stats = 1; break; - case '2': - mopts.malloc_stats = 2; - break; - case '3': - mopts.malloc_stats = 3; - break; #endif /* MALLOC_STATS */ case 'f': mopts.malloc_freecheck = 0; |