How to debug into a library's source file in GDB

This is a discussion on How to debug into a library's source file in GDB within the C++ Programming forums, part of the General Programming Boards category; Hi, I was wondering how to specify the source files directory of a library to GDB so that I can ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    159

    How to debug into a library's source file in GDB

    Hi,
    I was wondering how to specify the source files directory of a library to GDB so that I can step into the library source. Thanks!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If the library is compiled with debug info, it should happen by "automagic" - if it's not compiled with debug info, there's not much you can do other than recompile the library WITH debug info.

    There are also some settings in GDB that needs to be correct to allow it to find source-code, but this only really makes a difference if you have MOVED the source after you first built it [or you have a ready-built library that doesn't have the source in the same place].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    159
    Thanks! What are the "settings in GDB"?

  4. #4
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    Some more specific information on GDB files within the GDB program
    http://sourceware.org/gdb/current/on...17.html#SEC164

    Try typing "help" within the debugger and see what more information you can dig up that way as well.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Class methods in header or source file?
    By TriKri in forum C++ Programming
    Replies: 13
    Last Post: 09-17-2007, 06:23 AM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05:54 PM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  5. Replies: 3
    Last Post: 03-04-2005, 02:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21