public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/27806] free(): invalid pointer during gdb.ada/fixed_cmp.exp
Date: Fri, 30 Apr 2021 13:19:22 +0000	[thread overview]
Message-ID: <bug-27806-4717-rfBKRIPboH@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27806-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27806

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, so it seems to be related to this bit of code in gdb_mpz::safe_export:
...
147       gdb::unique_xmalloc_ptr<void> exported
148         (mpz_export (NULL, &word_countp, -1 /* order */, buf.size () /*
size */,
149                      endian, 0 /* nails */, exported_val.val));
...

The gdb::unique_xmalloc_ptr<void> makes sure that free is called on
exported.get ().

But when I step into the allocation:
...
(gdb) s
__gmpz_export (data=0x0, countp=0x7fffffffcee8, order=-1, size=4, endian=-1,
nail=0, z=0x7fffffffcef0) at mpz/export.c:50
Downloading source file /usr/src/debug/gmp-6.2.1-3.1.x86_64/mpz/export.c...
  ...
79          data = (*__gmp_allocate_func) (count*size);
...
it seems that it uses a garbage-collect malloc from libguile:
...
(gdb) s
custom_gmp_malloc (alloc_size=4) at numbers.c:240
Downloading source file
/usr/src/debug/guile-3.0.5-2.4.x86_64/libguile/numbers.c...
240       return scm_gc_malloc_pointerless (alloc_size, "GMP");
(gdb) s
scm_gc_malloc_pointerless (size=4, what=0x7ffff7ee970f "GMP") at
gc-malloc.c:210
Downloading source file
/usr/src/debug/guile-3.0.5-2.4.x86_64/libguile/gc-malloc.c...
210       return do_gc_malloc_atomic (size, what);
(gdb) s
do_gc_malloc_atomic (what=0x7ffff7ee970f "GMP", size=4) at gc-malloc.c:92
92        return GC_MALLOC_ATOMIC (size ? size : sizeof (void *));
(gdb) s
0x00007ffff7e2c2e8 in GC_malloc_atomic@plt () from /usr/lib64/libguile-3.0.so.1
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-04-30 13:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 12:49 [Bug gdb/27806] New: " vries at gcc dot gnu.org
2021-04-30 12:50 ` [Bug gdb/27806] " vries at gcc dot gnu.org
2021-04-30 12:52 ` vries at gcc dot gnu.org
2021-04-30 13:19 ` vries at gcc dot gnu.org [this message]
2021-04-30 13:48 ` vries at gcc dot gnu.org
2021-04-30 14:00 ` vries at gcc dot gnu.org
2021-04-30 14:09 ` simark at simark dot ca
2021-04-30 14:13 ` vries at gcc dot gnu.org
2021-04-30 14:26 ` vries at gcc dot gnu.org
2021-04-30 14:29 ` vries at gcc dot gnu.org
2021-04-30 14:35 ` vries at gcc dot gnu.org
2021-04-30 14:37 ` simark at simark dot ca
2021-04-30 14:42 ` vries at gcc dot gnu.org
2021-04-30 14:56 ` vries at gcc dot gnu.org
2021-05-03  8:39 ` [Bug guile/27806] " vries at gcc dot gnu.org
2021-05-03  8:55 ` vries at gcc dot gnu.org
2021-05-04  8:26 ` cvs-commit at gcc dot gnu.org
2021-05-04  8:28 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27806-4717-rfBKRIPboH@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).