VisualGDB can't debug parts of a library

Sysprogs forums Forums VisualGDB VisualGDB can't debug parts of a library

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #7437
    John24
    Participant

    Hello,

    I’m having an odd issue. In my Project I am using a couple of libraries: PCL, OpenCV and Exiv2. The project is based on the use of Raspberry Pi and the code is compiled locally on my machine and the executable is run on the Raspberry Pi.

    In particular I am actually making some changes to PCL library and what is odd that some files of the library I can amend and debug while some files I can’t. The ones I can’t breakpoints are never hit and actually I don’t think the file is even being compiled, as if I make any errors compilation still goes through.

    Would this be an issue with Visual studio 2013 or my VisualDGB setup?

     

    #7444
    support
    Keymaster

    Hi,

    Most likely you are either not deploying your library or are using the wrong symbols. Please ensure that the modified version of the library ends up both:

    • On your Raspberry Pi
    • In the sysroot directory of your toolchain. You can check the exact path by running the “info shared” command in the GDB Session window
    #7506
    John24
    Participant

    Ok I have made sure that modified library code is in both my PC and Raspberry Pi. But it seems that the project is only using already compiled library .so files instead of my changed files.

    • This reply was modified 8 years, 10 months ago by John24.
    #7513
    support
    Keymaster

    Hi,

    You can diagnose this by adding a new function to your library (e.g. testfunc()), calling it from your code and then checking whether the library on Raspberry Pi contains the new function by running the following command:

    nm <library path> | grep <function name>

    You can find out the path of the library loaded into your application by running the “info shared” command in the GDB Session window.

    #7525
    John24
    Participant

    Hi Bazis,

    Thanks for your reply 🙂

    So running “info shared” gave me the Shared Object Library locations and I found the libpcl_filters.so file.

    Running “nm libpcl_filters.so | grep TestFunc1()” gave result of “no symbols” even when I tried to find a library function I had “no symbols result”. I assume I am doing something wrong.

     

    Because I am cross compiling on my machine and sending just the binaries to the Pi I assumed that files only on my machine need to be changed.

    I do apologise if I am doing this all wrong.

     

     

    #7535
    support
    Keymaster

    Hi,

    No worries, we’ll help you get it right.

    First of all, please use just the function name without brackets (e.g. TestFunc, not TestFunc()). Then if it does not help, run “nm <library name>” without grep to see if the library symbols can be viewed at all.

    If ‘nm’ does not provide reasonable output, you can also run “objdump -t <library name>” to list the symbols using another method.

    You can also run “stat <library name>” to see the modification time of the library. If you are using the old version you should clearly see it from the modification time.

    Remember, your code inside the library must actually call the TestFunc(), as otherwise it will be discarded by the linker as an unused function.”

    If nothing helps, please share the output of the nm and objdump commands here.

    #7542
    John24
    Participant

    Hi Baxis,

     

    Thanks for the replies. Thanks to you I was able to spot what the issue was. At the end of library source files for PCL there is a #ifdef PCL_NO_PRECOMPILE statement which will not recompile the code if changed unless PCL_NO_PRECOMPILE is defined in the code.

    So it’s all good and working now 🙂 Thanks for your help, I really appreciate it!

    #7555
    support
    Keymaster

    Hi,

    Good to know it works, if you encounter any other problems, feel free to create a new topic.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.