Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: How to debug library?

  1. #1
    Join Date
    Sep 2008
    Location
    Israel
    Beans
    53
    Distro
    Ubuntu 10.04 Lucid Lynx

    How to debug library?

    I am trying to debug library libgtkspell. I have libgtkspell-dev library installed too. I can see this in synaptic.

    I use gdb:

    Code:
    (gdb) break gtkspell_set_language
    Function "gtkspell_set_language" not defined.
    Make breakpoint pending on future shared library load? (y or [n]) y
    
    Breakpoint 1 (gtkspell_set_language) pending.
    (gdb) run
    Starting program: /usr/local/bin/pidgin 
    [Thread debugging using libthread_db enabled]
    [New Thread 0xb6fea720 (LWP 9734)]
    [New Thread 0xb66b7b90 (LWP 9738)]
    [Switching to Thread 0xb6fea720 (LWP 9734)]
    
    Breakpoint 1, 0xb7e43e86 in gtkspell_set_language ()
       from /usr/lib/libgtkspell.so.0
    (gdb) n
    Single stepping until exit from function gtkspell_set_language, 
    which has no line number information.
    0xb7e41ff7 in ?? () from /usr/lib/libgtkspell.so.0
    There is no line number information.
    I can use a l command of gdb but I can not execute the code step by step. I do not see the code itself.

    What's wrong?

  2. #2
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,257
    Distro
    Kubuntu

    Re: How to debug library?

    I cannot answer your question specifically, but there are instances when libraries (and this is common) are NOT compiled with symbolic information. Otherwise, the libraries would require more storage space on your HDD (and if I remember correctly, require you to have the actual source code of the library).

    Libraries can, and occasionally do (but rarely), have bugs. If you feel that you have found one, you should report it to the maintainers of the library. Trying to debug it is worthy, but hoping to traverse the library code line-by-line may not be achievable in your particular case.
    Last edited by dwhitney67; October 22nd, 2008 at 03:49 PM.

  3. #3
    Join Date
    Sep 2008
    Location
    Israel
    Beans
    53
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to debug library?

    I am interesting in this specific library because I think I can develop some additional functionality for this library and it's simpler to understand how it works throw step by step debugging.
    Does libgtkspell-dev have symbolic information? How do I compile the project with -dev libraries? Is there some way?

  4. #4
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,257
    Distro
    Kubuntu

    Re: How to debug library?

    Quote Originally Posted by men28 View Post
    I am interesting in this specific library because I think I can develop some additional functionality for this library and it's simpler to understand how it works throw step by step debugging.
    Does libgtkspell-dev have symbolic information? How do I compile the project with -dev libraries? Is there some way?
    I do not have any notion/clue about the library you wish to use; I have never used it.

    However, if you want to debug it, or any other library, I would suggest that you download the source code, and modify the Makefile to build each module with the "-g" compiler option. This will include the symbolic information to each module.

  5. #5
    Join Date
    Aug 2006
    Location
    Omaha, NE
    Beans
    79
    Distro
    Xubuntu 6.10 Edgy

    Re: How to debug library?

    Quote Originally Posted by men28 View Post
    I am interesting in this specific library because I think I can develop some additional functionality for this library and it's simpler to understand how it works throw step by step debugging.
    Does libgtkspell-dev have symbolic information? How do I compile the project with -dev libraries? Is there some way?
    You'd have to get the source for that library, compile it with debug symbols (-g), and make your program link to it.

  6. #6
    Join Date
    Apr 2006
    Beans
    220

    Re: How to debug library?

    Some ubuntu libraries come with an -dbg package but it is not the case for libgtkspell in ubuntu 8.04 so you will have to do what the previous posters have mentioned.

    -r
    EGE::Easy Game Engine
    The programmer must rely on good code, rather than language features, to avoid problems.
    -David Chisnall

  7. #7
    Join Date
    Sep 2008
    Location
    Israel
    Beans
    53
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to debug library?

    I have downloaded sources of the library. When I try to run a make command this is an output:

    Code:
    make: *** No targets specified and no makefile found.  Stop.
    There are five files in the directory:

    Code:
    deprecated.c  gtkspell.c  gtkspell.h  Makefile.am  Makefile.in
    How to make this library with debugging information?

  8. #8
    Join Date
    Apr 2006
    Beans
    220

    Re: How to debug library?

    you may have to run "./configure" first. Could you try this please?

    -r
    EGE::Easy Game Engine
    The programmer must rely on good code, rather than language features, to avoid problems.
    -David Chisnall

  9. #9
    Join Date
    Sep 2008
    Location
    Israel
    Beans
    53
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to debug library?

    I had to install some additional -dev package with synaptic and then the configure command was succeed and have created a new Makefile.

  10. #10
    Join Date
    Sep 2008
    Location
    Israel
    Beans
    53
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to debug library?

    When I try to run a make command it didn't create an .so file - the library which I am trying to compile.

    How to build an .so file?

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •