public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1
@ 2020-10-22  9:11 liqingqing
  2020-10-26 13:32 ` liqingqing
  2020-10-30 18:54 ` DJ Delorie
  0 siblings, 2 replies; 3+ messages in thread
From: liqingqing @ 2020-10-22  9:11 UTC (permalink / raw)
  To: libc-alpha, carlos, dj, siddhesh; +Cc: Liusirui, Hushiyuan

malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1.

this is because commit e9c4fe93b3855239752819303ca377dff0ed0553 has 
change the struct malloc_chunk's member "size" to "mchunk_size".

the reproduction is like that:
setp1: modify related Makefile.
vim ../glibc/malloc/Makefile
CPPFLAGS-malloc.o += -DMALLOC_DEBUG=2

step2: ../configure --prefix=/usr
        make -j32

this will cause the compile error:
/home/liqingqing/glibc_upstream/buildglibc/malloc/malloc.o
In file included from malloc.c:1899:0:
arena.c: In function ‘dump_heap’:
arena.c:422:58: error: ‘struct malloc_chunk’ has no member named ‘size’
        fprintf (stderr, "chunk %p size %10lx", p, (long) p->size);
                                                           ^~
arena.c:428:17: error: ‘struct malloc_chunk’ has no member named ‘size’
        else if (p->size == (0 | PREV_INUSE))
---
  malloc/arena.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/malloc/arena.c b/malloc/arena.c
index cecdb7f4c4..202daf15b0 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -419,13 +419,13 @@ dump_heap (heap_info *heap)
                     ~MALLOC_ALIGN_MASK);
    for (;; )
      {
-      fprintf (stderr, "chunk %p size %10lx", p, (long) p->size);
+      fprintf (stderr, "chunk %p size %10lx", p, (long) 
chunksize_nomask(p));
        if (p == top (heap->ar_ptr))
          {
            fprintf (stderr, " (top)\n");
            break;
          }
-      else if (p->size == (0 | PREV_INUSE))
+      else if (chunksize_nomask(p) == (0 | PREV_INUSE))
          {
            fprintf (stderr, " (fence)\n");
            break;
-- 
2.19.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1
  2020-10-22  9:11 [PATCH] malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1 liqingqing
@ 2020-10-26 13:32 ` liqingqing
  2020-10-30 18:54 ` DJ Delorie
  1 sibling, 0 replies; 3+ messages in thread
From: liqingqing @ 2020-10-26 13:32 UTC (permalink / raw)
  To: libc-alpha, carlos, dj, siddhesh; +Cc: Liusirui, Hushiyuan

ping again.

On 2020/10/22 17:11, liqingqing wrote:
> malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1.
> 
> this is because commit e9c4fe93b3855239752819303ca377dff0ed0553 has 
> change the struct malloc_chunk's member "size" to "mchunk_size".
> 
> the reproduction is like that:
> setp1: modify related Makefile.
> vim ../glibc/malloc/Makefile
> CPPFLAGS-malloc.o += -DMALLOC_DEBUG=2
> 
> step2: ../configure --prefix=/usr
>         make -j32
> 
> this will cause the compile error:
> /home/liqingqing/glibc_upstream/buildglibc/malloc/malloc.o
> In file included from malloc.c:1899:0:
> arena.c: In function ‘dump_heap’:
> arena.c:422:58: error: ‘struct malloc_chunk’ has no member named ‘size’
>         fprintf (stderr, "chunk %p size %10lx", p, (long) p->size);
>                                                            ^~
> arena.c:428:17: error: ‘struct malloc_chunk’ has no member named ‘size’
>         else if (p->size == (0 | PREV_INUSE))
> ---
>   malloc/arena.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/malloc/arena.c b/malloc/arena.c
> index cecdb7f4c4..202daf15b0 100644
> --- a/malloc/arena.c
> +++ b/malloc/arena.c
> @@ -419,13 +419,13 @@ dump_heap (heap_info *heap)
>                      ~MALLOC_ALIGN_MASK);
>     for (;; )
>       {
> -      fprintf (stderr, "chunk %p size %10lx", p, (long) p->size);
> +      fprintf (stderr, "chunk %p size %10lx", p, (long) 
> chunksize_nomask(p));
>         if (p == top (heap->ar_ptr))
>           {
>             fprintf (stderr, " (top)\n");
>             break;
>           }
> -      else if (p->size == (0 | PREV_INUSE))
> +      else if (chunksize_nomask(p) == (0 | PREV_INUSE))
>           {
>             fprintf (stderr, " (fence)\n");
>             break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1
  2020-10-22  9:11 [PATCH] malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1 liqingqing
  2020-10-26 13:32 ` liqingqing
@ 2020-10-30 18:54 ` DJ Delorie
  1 sibling, 0 replies; 3+ messages in thread
From: DJ Delorie @ 2020-10-30 18:54 UTC (permalink / raw)
  To: liqingqing; +Cc: libc-alpha


liqingqing <liqingqing3@huawei.com> writes:
> malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1.

Thanks!  Pushed.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-30 18:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22  9:11 [PATCH] malloc debug: fix compile error when enable macro MALLOC_DEBUG > 1 liqingqing
2020-10-26 13:32 ` liqingqing
2020-10-30 18:54 ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).