From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26204 invoked by alias); 16 Oct 2003 20:24:44 -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 26193 invoked from network); 16 Oct 2003 20:24:43 -0000 Received: from unknown (HELO mx.compgen.com) (158.155.2.6) by sources.redhat.com with SMTP; 16 Oct 2003 20:24:43 -0000 Received: from bass.compgen.com (bass.compgen.com [158.155.4.59]) by mx.compgen.com (8.11.6/8.11.6) with ESMTP id h9GKQMj13212; Thu, 16 Oct 2003 16:26:22 -0400 Received: (from jlm@localhost) by bass.compgen.com (8.11.6/8.11.6) id h9GKOgV12988; Thu, 16 Oct 2003 16:24:42 -0400 X-Authentication-Warning: bass.compgen.com: jlm set sender to jesse.marlin@intec.us using -f From: Jesse Marlin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16270.65162.505380.573926@bass.compgen.com> Date: Thu, 16 Oct 2003 20:24:00 -0000 To: Jack J Cc: gdb@sources.redhat.com Subject: debug dynamically linked modules.. In-Reply-To: <20031016193935.98962.qmail@web20507.mail.yahoo.com> References: <20031016193935.98962.qmail@web20507.mail.yahoo.com> Reply-To: jesse.marlin@intec.us X-SW-Source: 2003-10/txt/msg00212.txt.bz2 Jack J writes: > Hi, > > I would like to know how to debug using gdb > (set breakpoint on routine, etc.) a dynmically linked, > relocated code. > > The platform is RH Linux 9.0. There is some > application > module compiled with -fPIC and -shared, and > -export-dynamic options. > A global structure containing functions is exported by > the DLL module. > The problem: I would like to set breakpoint on one > of the (file static) functions contained in this > structure. > > >From mainline code after call to dlsym(..) (to the > global structure), I try to set break point, and I > get error: "Function xxx not defined.". > > I do 'info shared' on gdb and do see the file being > loaded. Also I do see that "-g" option to add > debug symbols in gcc. > > Is there anything I am missing ? How does one > normally use gdb in such scenario ? > > Any tips, pointers/hints is appreciated. > > Thanks, One thing I do that is successful most of the time is place a breakpoint on a file:line instead of on a function. Try looking into these: br file:line - place a breakpoint on a file and line number. C-x SPC does this for you in (X)Emacs. info shared - shows which shared libraries are currently loaded. (gdb) help sharedlibrary Load shared object library symbols for files matching REGEXP.