From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5689 invoked by alias); 30 Oct 2002 20:07:25 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 5621 invoked from network); 30 Oct 2002 20:07:24 -0000 Received: from unknown (HELO pc2.dolda2000.com) (217.215.27.171) by sources.redhat.com with SMTP; 30 Oct 2002 20:07:24 -0000 Received: from pc7 (PC7.dolda2000.com [192.168.0.132]) by pc2.dolda2000.com (8.11.6/8.11.2) with SMTP id g9UK6m632404 for ; Wed, 30 Oct 2002 21:06:49 +0100 Message-ID: <005b01c28050$03991be0$8400a8c0@dolda2000.com> From: "Fredrik Tolf" To: Subject: malloc() debugging Date: Wed, 30 Oct 2002 12:07:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2002-10/txt/msg00216.txt.bz2 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 f= ront 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 st= rangest thing, as I see it, is that (at least last time it crashed from thi= s), 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 i= t'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 o= ther good tool to find these conditions? Can valgrind detect it? Fredrik Tolf