Unix Programming - debugging in linux

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2005 > debugging in linux





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author debugging in linux
ramsin.savra@gmail.com

2005-01-31, 5:55 pm

Hello,

I'm trying to debug a pre written project which currently is working
fine but need to debug part of it so when I use gdb "AppName"
everything looks good but as soon as I enter "run" it complains for
missing its library!
How can I load a prroject using gdb "also be able to load the
necessarry library" ?



Thanks,

David Resnick

2005-01-31, 5:55 pm

ramsin.savra@gmail.com wrote:

> Hello,
>
> I'm trying to debug a pre written project which currently is working
> fine but need to debug part of it so when I use gdb "AppName"
> everything looks good but as soon as I enter "run" it complains for
> missing its library!
> How can I load a prroject using gdb "also be able to load the
> necessarry library" ?
>
>
>
> Thanks,
>


You need to set the LD_LIBRARY_PATH such that it includes all of the
libraries needed by the executable prior to running gdb (you could
also set the environment variable inside gdb I guess). If you can
execute the file, you can debug it. Perhaps you are executing it by a
script that sets up the path for you? Running the command "ldd
<exename>" will give you the list of libraries needed, you just need to
find them. You will know you have the LD_LIBRARY_PATH correct when none
of the libraries say "not found"...

-David
ramsin.savra@gmail.com

2005-01-31, 5:55 pm

David,

I appreciate your help.

Russell Shaw

2005-01-31, 8:51 pm

David Resnick wrote:
> ramsin.savra@gmail.com wrote:
>
>
> You need to set the LD_LIBRARY_PATH such that it includes all of the
> libraries needed by the executable prior to running gdb (you could
> also set the environment variable inside gdb I guess). If you can
> execute the file, you can debug it. Perhaps you are executing it by a
> script that sets up the path for you? Running the command "ldd
> <exename>" will give you the list of libraries needed, you just need to
> find them. You will know you have the LD_LIBRARY_PATH correct when none
> of the libraries say "not found"...
>
> -David


If it's something that came precompiled, then it could be hard to follow
in gdb if it was optimized (-O2). Recompile the code with -O0, and the
object files will have the path to the source code there for gdb to
read automagically.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com