From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24623 invoked by alias); 3 Dec 2003 18:48:38 -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 24614 invoked from network); 3 Dec 2003 18:48:36 -0000 Received: from unknown (HELO ztxmail05.ztx.compaq.com) (161.114.1.209) by sources.redhat.com with SMTP; 3 Dec 2003 18:48:36 -0000 Received: from taynzmail03.nz-tay.cpqcorp.net (taynzmail03.nz-tay.cpqcorp.net [16.47.4.103]) by ztxmail05.ztx.compaq.com (Postfix) with ESMTP id 9AB9DA45F for ; Wed, 3 Dec 2003 12:48:32 -0600 (CST) Received: from java.zko.dec.com (java.zko.dec.com [16.31.224.89]) by taynzmail03.nz-tay.cpqcorp.net (Postfix) with ESMTP id 23D642260 for ; Wed, 3 Dec 2003 13:48:23 -0500 (EST) Received: by java.zko.dec.com (8.8.8/1.1.19.2/17Jun98-0831AM) id NAA0000021363; Wed, 3 Dec 2003 13:48:20 -0500 (EST) Date: Wed, 03 Dec 2003 18:48:00 -0000 From: Bharadwaj Yadavalli To: gdb@sources.redhat.com Subject: [Q] loading a shared library at a gdb breakpoint Message-ID: <20031203184820.GC28869@java.zko.dec.com> Reply-To: Bharadwaj Yadavalli Mail-Followup-To: gdb@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.99i X-SW-Source: 2003-12/txt/msg00052.txt.bz2 Hi, How can I do the following at a breakpoint in gdb (on Linux)? - load a shared library (say libfoo.so) into the process memory; libfoo.so is not loaded by the running application being debugged. - call a function defined in libfoo.so? add-symbol-file file address doesn't seem to work. info shared does not list the library (see below) ------------- (gdb) info shared >From To Syms Read Shared Object Library 0x40017800 0x40017b04 Yes ./libentry.so 0x42015380 0x421132e8 Yes /lib/tls/libc.so.6 0x40000bd0 0x40011acf Yes /lib/ld-linux.so.2 (gdb) add-shared-symbol-file libfoo.so This command is not available in this configuration of GDB. (gdb) add-symbol-file libfoo.so 0x40018000 add symbol table from file "libfoo.so" at .text_addr = 0x40018000 (y or n) y Reading symbols from libfoo.so...done. Error in re-setting breakpoint 1: Function "main" not defined. (gdb) info shared >From To Syms Read Shared Object Library 0x40017800 0x40017b04 Yes ./libentry.so 0x42015380 0x421132e8 Yes /lib/tls/libc.so.6 0x40000bd0 0x40011acf Yes /lib/ld-linux.so.2 ----------------- Thanks in advance for your help, Bharadwaj