From 83b8d5027d2f80c4603cd706da95d6c9a09a4e16 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Thu, 16 Dec 2021 15:26:36 -0300 Subject: malloc: Remove memusage.h And use machine-sp.h instead. The Linux implementation is based on already provided CURRENT_STACK_FRAME (used on nptl code) and STACK_GROWS_UPWARD is replaced with _STACK_GROWS_UP. --- malloc/memusage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'malloc') diff --git a/malloc/memusage.c b/malloc/memusage.c index eaf4965..6391d88 100644 --- a/malloc/memusage.c +++ b/malloc/memusage.c @@ -33,8 +33,9 @@ #include #include -#include #include +#include +#include /* For _STACK_GROWS_UP */ /* Pointer to the real functions. These are determined used `dlsym' when really needed. */ @@ -155,10 +156,10 @@ update_data (struct header *result, size_t len, size_t old_len) the main thread and it is the first call to any of these functions. */ if (__glibc_unlikely (!start_sp)) - start_sp = GETSP (); + start_sp = __thread_stack_pointer (); - uintptr_t sp = GETSP (); -#ifdef STACK_GROWS_UPWARD + uintptr_t sp = __thread_stack_pointer (); +#ifdef _STACK_GROWS_UP /* This can happen in threads where we didn't catch the thread's stack early enough. */ if (__glibc_unlikely (sp < start_sp)) @@ -268,7 +269,7 @@ me (void) const char *outname; if (!start_sp) - start_sp = GETSP (); + start_sp = __thread_stack_pointer (); outname = getenv ("MEMUSAGE_OUTPUT"); if (outname != NULL && outname[0] != '\0' @@ -334,7 +335,7 @@ static void __attribute__ ((constructor)) init (void) { - start_sp = GETSP (); + start_sp = __thread_stack_pointer (); if (!initialized) me (); } -- cgit v1.1