Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Fredrik Tolf <fredrik@dolda2000.cjb.net>
Cc: gdb@sources.redhat.com
Subject: Re: malloc() debugging
Date: Wed, 30 Oct 2002 12:11:00 -0000	[thread overview]
Message-ID: <20021030201137.GA31064@nevyn.them.org> (raw)
In-Reply-To: <005b01c28050$03991be0$8400a8c0@dolda2000.com>

On Wed, Oct 30, 2002 at 09:07:46PM +0100, Fredrik Tolf wrote:
> I'm trying to make a multithreaded program, but I've run into some
> problems. It appears as I am somehow modifying malloc's data
> structures (those in front of the allocated chunk, I'm using glibc),
> and thus the program crashes sometimes when the malloc related are
> called, most usually in free. The strangest thing, as I see it, is
> that (at least last time it crashed from this), the first word of
> that structure (prev_size) wasn't modified, but only the second word
> (size). The most probable reason I can see for an error of this kind
> would otherwise be a buffer overflow from the chunk before. Anyhow,
> the reason that I'm mailing to this list is that I'm wondering if
> it's possible to configure gdb to break whenever one of these
> structures is modified by an instruction outside the address range of
> the malloc related functions. If noone knows how this would be done,
> could you notify of any other good tool to find these conditions? Can
> valgrind detect it?

Nope, GDB can't do this.  You may want to try either Electric Fence or
dmalloc; dmalloc does work in multithreaded programs (although it needs
a little coaxing).

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-10-30 20:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-30 12:07 Fredrik Tolf
2002-10-30 12:11 ` Daniel Jacobowitz [this message]
2002-10-30 12:17   ` Fredrik Tolf
2002-10-30 12:26     ` Daniel Jacobowitz
2002-10-30 22:06       ` Eli Zaretskii
2002-10-30 22:05     ` Eli Zaretskii

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=20021030201137.GA31064@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=fredrik@dolda2000.cjb.net \
    --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