From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21529 invoked by alias); 31 Jan 2012 16:17:17 -0000 Received: (qmail 21518 invoked by uid 22791); 31 Jan 2012 16:17:14 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from ihemail2.lucent.com (HELO ihemail2.lucent.com) (135.245.0.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Jan 2012 16:16:59 +0000 Received: from usnavsmail3.ndc.alcatel-lucent.com (usnavsmail3.ndc.alcatel-lucent.com [135.3.39.11]) by ihemail2.lucent.com (8.13.8/IER-o) with ESMTP id q0VGGvWq028185 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 31 Jan 2012 10:16:58 -0600 (CST) Received: from destgd0d00539.de.alcatel-lucent.com (destgd0d00539.de.alcatel-lucent.com [149.204.131.198]) by usnavsmail3.ndc.alcatel-lucent.com (8.14.3/8.14.3/GMO) with ESMTP id q0VGGuwQ026361 for ; Tue, 31 Jan 2012 10:16:57 -0600 To: gdb@sourceware.org Subject: Remote debugging: setting breakpoints in shared libraries Reply-To: Klaus.Zeitler@alcatel-lucent.com From: Klaus Zeitler Date: Tue, 31 Jan 2012 16:17:00 -0000 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: 2012-01/txt/msg00125.txt.bz2 Hello, I'm trying to figure out how to debug shared libraries remotely with gdbserver. My first try was on the same host: []$ gdbserver localhost:7777 test and then in gdb: (gdb) target remote localhost:7777 (gdb) b function_in_shared_lib Function "function_in_shared_lib" not defined. Make breakpoint pending on future shared library load? (y or [n]) y (gdb) c this works beautifully, i.e. the test program stops at the breakpoint. Now when I try running the same sequence with gdbserver on a remote host (and localhost replaced accordingly), gdb doesn't stop at the breakpoint. My test program doesn't stop. I found some cumbersome workaround. Put a breakpoint in test program right after the shared library (dlopen) is loaded, then I manually do: (gdb) add-symbol-file shared-lib.so
Am I missing something or is this behavior to be expected? I'm using: GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5_7.1) Thanks Klaus --=20 ------------------------------------------------------------------- | Klaus Zeitler Alcatel-Lucent | | Lorenzstrasse 10 70435 Stuttgart, Germany | | Department: Building: 005 Office: 3/171 | | Telefon: +49 711821 43898 | | Email: klaus.zeitler@alcatel-lucent.com | | | | Alcatel-Lucent Deutschland AG | | Sitz der Gesellschaft: Stuttgart =C2=B7 Amtsgericht Stuttgart HRB 4026 | | Vorsitzender des Aufsichtsrates: Michael Oppenhoff | | Vorstand: | | Alf Henryk Wulf (Vorsitzender) =C2=B7 Dr. Rainer Fechner | ------------------------------------------------------------------- --- Those who can, do. Those who can't, simulate.