This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: debug dynamically linked modules..


yep, I have tried all these, but nothing worked.

I am wondering is this because the main routine
calls the DLL routine via function pointers
stored in structure ?

When I do:

(gdb) dir ~/dll-directory
Source directories searched:
~/dll-directory:$cdir:$cwd
(gdb) l foo_test.c:10
No source file named foo_test.c.

Actually foo_test.c is part of dll-directory.
Doing 'info shared', I do see that dll is loaded.

Thanks,


--- Jesse Marlin <jesse.marlin@intec.us> wrote:
> 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.
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]