From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2623 invoked by alias); 17 Mar 2005 12:45:50 -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 2414 invoked from network); 17 Mar 2005 12:45:32 -0000 Received: from unknown (HELO webmail.streamline-computing.com) (82.133.39.164) by sourceware.org with SMTP; 17 Mar 2005 12:45:32 -0000 Received: from [82.133.39.162] (helo=delmo.priv.wark.uk.streamline-computing.com) by webmail.streamline-computing.com with esmtp (Exim 3.35 #1 (Debian)) id 1DBuNv-0007yg-00 for ; Thu, 17 Mar 2005 12:45:55 +0000 Subject: LD_PRELOAD, SIGTRAP and step/next From: David Lecomber To: gdb Content-Type: text/plain Date: Thu, 17 Mar 2005 12:45:00 -0000 Message-Id: <1111063455.8222.23.camel@delmo.priv.wark.uk.streamline-computing.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00165.txt.bz2 Dear all, I am debugging using a memory checking library -- dmalloc -- this does the usual things via an LD_PRELOAD over the malloc. I am getting SIGTRAP when trying to call a function in this library -- but only after a step or a next; after a user-defined breakpoint behaviour is correct! Can anyone explain/resolve the behaviour: (gdb) set environment LD_PRELOAD=lib/libdmalloc.so (gdb) b main (gdb) run Starting program: /home/david/projects/code/ddt/examples/a.out Breakpoint 1, main (argc=1, argv=0xbffff604, environ=0xbffff60c) at hello.c:65 65 int tag = 50; /* Tag for messages */ (gdb) print dmalloc_message("hello")ne} void (gdb) step 79 t2 = malloc(sizeof(typeThree)); (gdb) p dmalloc_message ("ho") Program received signal SIGTRAP, Trace/breakpoint trap. 0xb7f831c3 in dmalloc_message (format=0x0) at malloc.c:2079 2079 { The program being debugged was signaled while in a function called from GDB. GDB remains in the frame where the signal was received. To change this behavior use "set unwindonsignal on" Evaluation of the expression containing the function (dmalloc_message) [..] Very odd indeed! d. -- David Lecomber