From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20323 invoked by alias); 25 Feb 2008 12:08:13 -0000 Received: (qmail 20314 invoked by uid 22791); 25 Feb 2008 12:08:12 -0000 X-Spam-Check-By: sourceware.org Received: from fmmailgate04.web.de (HELO fmmailgate04.web.de) (217.72.192.242) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 25 Feb 2008 12:07:54 +0000 Received: from web.de by fmmailgate04.web.de (Postfix) with SMTP id A211E49DEDDD for ; Mon, 25 Feb 2008 13:04:14 +0100 (CET) Received: from [62.245.203.10] by freemailng1004.web.de with HTTP; Mon, 25 Feb 2008 13:04:12 +0100 Date: Mon, 25 Feb 2008 12:15:00 -0000 Message-Id: <1015843957@web.de> MIME-Version: 1.0 From: Steve Kreyer To: gdb@sourceware.org Subject: Using dlopen and remote debugging Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00207.txt.bz2 Hi, I have the following problem: I would like to debug a program on a remote target. This program loads a shared library with the dlopen call, but if the library is loaded, gdb on host-side doesn't find the appropriate debugging symbols of this library. I've also tried to make use of the solib-search-path and solib-absolute-path settings but without success. Both, the application and the library, which is loaded via dlopen, are compiled using the -g switch of gcc. I've issued the following steps: On target side: $ gdbserver foo:1234 a.out On host side: $ sh4-linux-uclibc-gcc -g test2.c -ldl -Wall $ sh4-linux-uclibc-gcc -g -shared libtest.c -o libtest.so $ /opt/sh4-linux-uclibc/bin/sh4-linux-uclibc-gdb a.out (gdb) set solib-search-path /home/skreyer (gdb) target remote 192.168.1.201:1234 Remote debugging using 192.168.1.201:1234 (gdb) b main Breakpoint 1 at 0x400608: file test2.c, line 12. (gdb) c Continuing. Breakpoint 1, main () at test2.c:12 12 lib_handle = dlopen("/libtest.so", RTLD_NOW); (gdb) n 13 foop = dlsym(lib_handle, "foo"); (gdb) n 15 erg = foop(1, 2); (gdb) p foo No symbol "foo" in current context. The source code: test2.c: #include #include typedef int (*funcp)(int, int); int main() { void *lib_handle; funcp foop; int erg; lib_handle = dlopen("/libtest.so", RTLD_NOW); foop = dlsym(lib_handle, "foo"); erg = foop(1, 2); printf("%d\n", erg); dlclose(lib_handle); return 0; } libtest.c: #include int foo(int a, int b) { int erg; erg = a + b; return erg; } Can someone give me a hint on this issue? TIA, Steve _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066