From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5286 invoked by alias); 14 Jul 2006 01:22:43 -0000 Received: (qmail 5270 invoked by uid 22791); 14 Jul 2006 01:22:43 -0000 X-Spam-Check-By: sourceware.org Received: from whirlwind.netspace.net.au (HELO mail.netspace.net.au) (203.10.110.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 14 Jul 2006 01:22:38 +0000 Received: from [192.168.0.10] (220-253-49-148.VIC.netspace.net.au [220.253.49.148]) by mail.netspace.net.au (Postfix) with ESMTP id 5323E1322A9 for ; Fri, 14 Jul 2006 11:22:33 +1000 (EST) Message-ID: <44B6F1D8.7000209@netspace.net.au> Date: Fri, 14 Jul 2006 01:22:00 -0000 From: Russell Shaw User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205 Debian/1.7.12-1.1 MIME-Version: 1.0 CC: gdb@sourceware.org Subject: Re: Help with debugging LD_PRELOADed shared C libraries References: <6780801.1152809218081.OPEN-XCHANGE.WebMail.wwwrun@eu.main.anykey> In-Reply-To: <6780801.1152809218081.OPEN-XCHANGE.WebMail.wwwrun@eu.main.anykey> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00077.txt.bz2 Thomas Ackermann wrote: > Hello, > at first i asked at gcc-help, but it seems to be gdb-related: > > I have a problem to debug my shared C libary which i use to fix an > existing binary. > I am loading this library via LD_PRELOAD variable, but sometimes the > programm crashes. Now i wan to find and fix the problem with gdb. > > Regardless how i prelaod the library for the gdb session, gdb always > only gives "Cannot access memory at address ..." messages. > > I tried "export LD_PRELOAD=/.../mylib.so" and then started "gdb mybin > core" or tried to set it within gdb: "set environment > LD_PRELOAD /.../mylib.so" and then continue with "file mybin" and "core > core", but: > > Program terminated with signal 11, Segmentation fault. > #0 0x400cc9b8 in ?? () > #0 0x400cc9b8 in ?? () > End of crash report > > That should be outputs from "bt", "info locals", "info > sharedlibrary" and "info frame". > > Here in detail: > > gdb mybin core > <...> > Program terminated with signal 11, Segmentation fault. > Cannot access memory at address 0x4001738c > #0 0x400cc9b8 in ?? () > (gdb) bt > #0 0x400cc9b8 in ?? () > Cannot access memory at address 0xbfffeddc > (gdb) info locals > No symbol table info available. > > Both binary mybin and library mylib DO contain symbolic information as > confirmed via "nm". > > The library was created with: "gcc -g3 -Wall -Wuninitialized > -D_GNU_SOURCE -fPIC -shared -ldl -o mylib.so mylib.c" > > Can anybody give me a hint? Whenever i've got a segfault that showed question marks: > #0 0x400cc9b8 in ?? () > #0 0x400cc9b8 in ?? () i just restarted ddd/gdb, and then doing the same run will result in meaningful function names.