public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "John S. Yates, Jr." <jyates@netezza.com>
To: "gdb" <gdb@sources.redhat.com>
Subject: malloc in inferior
Date: Thu, 29 May 2003 13:51:00 -0000	[thread overview]
Message-ID: <0eb201c325e9$5fb63450$1400a8c0@astral> (raw)

I have finally figured out that the reason gdb
keeps crashing my embedded system is that it
tries to call malloc at the drop of a hat.

There are various contexts in our code where
performing a memory allocation is disallowed.
This is enforced by our allocation primitives.

Our system does not uses malloc.  The malloc
that is part of the c-runtime calls through a
null function pointer, triggering a machine
reset.  So something as simple as

(gdb) print "foo"

causes a crash.

Why can gdb not allocate values within its own
address space?

I understand that to support calling functions
in the inferior gdb may have to materialize
values there.  But these should be pushed into
the inferior once it is clear that they need to
exist there.

And how can gdb possibly debug a multi-threaded
application with a thread-safe malloc?

One possibility would be to add malloc and free
messages to the remote protocol.  Then a stub
could allocation memory in the proper address
space without interacting with the inferior's
environment.

Another would be to have a stub provide a block
of memory.  A query would determine the address
and size of this block.  Then gdb could manage
the memory entirely on its own.

/john
--
John S. Yates, Jr.   508 665-6897 (voice)
Netezza Inc          508 665-6811 (fax)
200 Crossing Blvd.   Framingham, MA 01701

             reply	other threads:[~2003-05-29 13:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-29 13:51 John S. Yates, Jr. [this message]
2003-05-29 15:27 ` Daniel Jacobowitz
2003-05-29 16:00   ` John S. Yates, Jr.
2003-05-29 16:09     ` Daniel Jacobowitz
2003-05-29 17:18       ` John S. Yates, Jr.
2003-05-29 17:24         ` Daniel Jacobowitz
2003-05-29 18:18           ` Andrew Cagney
2003-05-29 18:34           ` Alain Magloire
2003-05-30 13:12           ` John S. Yates, Jr.
     [not found]     ` <16086.16988.657059.717389@pkoning.dev.equallogic.com>
2003-05-30 13:03       ` John S. Yates, Jr.
2003-05-29 16:42   ` Andrew Cagney

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='0eb201c325e9$5fb63450$1400a8c0@astral' \
    --to=jyates@netezza.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).