From: Michael Chastain <mec.gnu@mindspring.com>
To: cmarkle@sendmail.com
Cc: gdb@sources.redhat.com
Subject: Re: calling glibc mallinfo() from GDB after attaching to a process?
Date: Tue, 31 Aug 2004 17:14:00 -0000 [thread overview]
Message-ID: <4134B1E6.nailHTK111G2B@mindspring.com> (raw)
In-Reply-To: <4134A25C.4020700@sendmail.com>
Chris Markle <cmarkle@sendmail.com> wrote:
> I am getting exactly this seg fault when calling mallinfo(). Do later
> versions of gdb deal better with this?
No, they don't. I'm getting this seg fault with both gdb 6.2 and
gdb HEAD 2004-08-30.
This happens even when I use the debug version of glibc
with LD_LIBRARY_PATH=/usr/lib/debug.
However, this works:
(gdb) print __libc_mallinfo()
Looking at "readelf -w /usr/lib/libc.so.6", there is a subprogram
named "__libc_mallinfo", but no subprogram named mallinfo. "mallinfo"
is actually just a weak alias for "__libc_mallinfo".
It looks like gdb doesn't pick up the type information for "mallinfo".
That causes gdb to believe that "mallinfo" is a function that takes no
arguments and returns an integer. So when gdb makes the call, it
neglects to use the struct return-value convention and mallinfo dies in
the assembly code that copies the struct return-value back to the
caller-specified area.
I have an old glibc: red hat linux 8, glibc 2.2.93-5-rh.
I don't know if this is better with newer glibc's.
Michael
next prev parent reply other threads:[~2004-08-31 17:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-31 2:09 Chris Markle
2004-08-31 3:58 ` Eli Zaretskii
2004-08-31 5:25 ` Chris Markle
2004-08-31 15:20 ` Michael Chastain
2004-08-31 16:07 ` Chris Markle
2004-08-31 17:14 ` Michael Chastain [this message]
2004-08-31 9:26 ` Andreas Schwab
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=4134B1E6.nailHTK111G2B@mindspring.com \
--to=mec.gnu@mindspring.com \
--cc=cmarkle@sendmail.com \
--cc=gdb@sources.redhat.com \
/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