From: bkerin <bkerin@fastmail.fm>
To: linux-c-programming@vger.kernel.org
Subject: malloc interposition how?
Date: Wed, 16 Jul 2008 20:55:20 -0700 (PDT) [thread overview]
Message-ID: <18501119.post@talk.nabble.com> (raw)
I'm trying to do these things simultaneously:
use glib
use gc (Hans-Boehm)
use my own library of random code
I dont want to have to do manual garbage collection at least in the
prototype stage.
However, I haven't found a way to link the above together that works.
I use the set_vtable function in glib to hopefully make it use the GC_malloc
etc. from gc
I include fcnts malloc/free/realloc in my library and the compiler/linker
doesn't complain
(presumably libc contains some special goop to not complain about these
getting redefined
in client code). My malloc etc. of course just call GC_* fctns.
I believe I have all the right -I -L -Wl,-rpath etc. crud.
When I look at bins and my .so file with ldd everything appears to look for
the correct libraries.
When I use nm on my .so I see symbols like malloc supposedly in the text
secion (marked with T).
When I step with the debugger and a breakpoint in malloc (or realloc etc.) I
always end up in the malloc
in my library, not the system malloc.
And yet, the program always seg faults eventually in a GC_malloc.
Any ideas what I'm missing, or is the whole approach somehow fatally flawed?
I've also tried using --wrap linker option, but it seemed to only map
function defined in the source files being linked and
didn't affect the use of malloc etc. by depended-on libraries (I ultimately
need this to work for gsl (GNU scientific library as well not only glib
which provides the set_vtable functionality).
Thanks,
Britton
--
View this message in context: http://www.nabble.com/malloc-interposition-how--tp18501119p18501119.html
Sent from the linux-c-programming mailing list archive at Nabble.com.
next reply other threads:[~2008-07-17 3:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-17 3:55 bkerin [this message]
2008-07-17 7:39 ` malloc interposition how? Leslie P. Polzer
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=18501119.post@talk.nabble.com \
--to=bkerin@fastmail.fm \
--cc=linux-c-programming@vger.kernel.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 NNTP newsgroup(s).