This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: gdb help needed


On Fri, Jun 01, 2001 at 04:35:38PM -0700, Tan, Eugene wrote:
> 
> Question 1: 
> After I start gdb 4x, "gdb my_program", which command I can use to set the
> path (like setenv $LD_LIBRARY_PATH) so that when I enter "run", my_program
> can find the shared libraries?


You would run the gdb command: set env LD_LIBRARY_PATH

Sometimes I find that even that does not work.  The trick around
it I have found is to set my LD_LIBRARY_PATH in
my $HOME/.cshrc file (if using tcsh shell), my $HOME/.bashrc
file (if using the bash shell), or the equivalent initialization
file for whatever shell I am using.

You need to set your LD_LIBRARY_PATH in the initialization file
that is called upon the invocation of every sub-shell, not just
the init file that is called for a "login" shell. 
 
> Question 2: 
> After I start gdb 4x, "gdb my_program", how can I load in the shared library
> source table information so that if I enter "info sources" I can view the
> shared library information? (Is it possible to do so before "run"
> my_program?)

What I normally do is, I set the breakpoint to the first line in
main.  Then I run the program.  The shared libraries will be loaded
and then I can do "info sources".

> Question 3: 
> After I start gdb 4x, "gdb my_program", how can I set a break point in a
> shared library .cpp file, before I "run" my_program?

I haven't been successful at doing this.  I do the same thing which
I mentioned before...set the breakpoint in main, then run the program.
The libraries will get loaded.  When you hit the breakpoint in main,
you will then be able to set breakpoints in routines in the shared
library.

-- 
Craig Rodrigues        
http://www.gis.net/~craigr    
rodrigc@mediaone.net          


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