From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16874 invoked by alias); 13 Jul 2006 16:47:06 -0000 Received: (qmail 16863 invoked by uid 22791); 13 Jul 2006 16:47:05 -0000 X-Spam-Check-By: sourceware.org Received: from service.anykey.de (HELO service.anykey.de) (213.168.80.18) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Jul 2006 16:47:00 +0000 Received: from eu.main.anykey (eu.main.anykey [192.168.200.17]) by service.anykey.de (anykey GmbH) with ESMTP id 3A9FE1399E for ; Thu, 13 Jul 2006 18:46:58 +0200 (CEST) Received: by eu.main.anykey (Postfix, from userid 96) id 2E720D4363; Thu, 13 Jul 2006 18:46:58 +0200 (CEST) Received: from eu.main.anykey (localhost [127.0.0.1]) by eu.main.anykey (Postfix) with ESMTP id 142C2D4363 for ; Thu, 13 Jul 2006 18:46:58 +0200 (CEST) Message-ID: <6780801.1152809218081.OPEN-XCHANGE.WebMail.wwwrun@eu.main.anykey> Date: Thu, 13 Jul 2006 16:47:00 -0000 From: Thomas Ackermann To: gdb@sourceware.org Subject: Help with debugging LD_PRELOADed shared C libraries Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: OPEN-XCHANGE 0.8.0 - WebMail 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/msg00062.txt.bz2 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?