2

How is possible to debug a shared object on a remote target? The sources of the library are known, but not the sources of the application that loads the library. The compiler for the dynamic library is the arm-linux-gnueabihf-gcc and debugger the gdb-multiarch.

I have tried to use Eclipse CDT, debug configuration is "C/C++ Attach to application". I am able to connect to target but not step through the code of the shared library.

.gdbinit:

set architecture arm
set breakpoint pending on

Information to the used systems:

  • Target/Remote System: Raspberry Pi 3 (ARM Cortex A53/Raspbian) with running gdb-server
  • Host system: Linux/Ubuntu with Eclipse and gdb-multiarch
  • Connection: TCP

I know that it is possible to do debugging and compilation native on the Raspberry Pi. But later on our shared object will be used on a board that uses similiar processor architecture, but with limited ressources. At this point the target system just offers the gdb-server and we are forced to use cross compiling and cross debugging.

regs15
  • 21
  • 2
  • 1
    Q: is possible to debug a shared object on a remote target? A: Yes. But please clarify what you mean by "remote". Is your workstation a Windpws PC? Are you running Eclipse as a cross-compiler on that Windows PC? Where is your "gdbserver" running? What exactly is your "target"? Physical hardware, or a VM? Etc. Please update your post and describe your environment in better detail. – paulsm4 Mar 03 '18 at 17:57
  • I have added the systems informationen. – regs15 Mar 03 '18 at 18:13
  • Now I have tried to debug the shared library directly on the Raspberry Pi using gdb console. The application stops inside the shared lib, but I am not able to step through it. I can only use continue but from this point he application ignore the breakpoint inside the shared library but from console output I can see that the functions in the lib are called correctly. For compilation of the lib I used the -g3 flag. – regs15 Mar 06 '18 at 05:56
  • See if these links help: [Debugging shared libraries with gdbserver](https://stackoverflow.com/questions/8611194/debugging-shared-libraries-with-gdbserver/45252113) and [Remote Debugging of Raspberry Pi Applications From Eclipse](http://hertaville.com/remote-debugging.html) – paulsm4 Mar 06 '18 at 07:31
  • Thank you, the first link helped me a lot. Now I am able to debug the shared library via gdbserver using gdb-multiarch on the host machine. The only problem is that **stop-on-solib-events** doesn't work. So I have to stop the programm manually after loading the dynamic loading, load the symbols of *.so, set breakpoint and continue application. Also pending breakpoint doesn't work. Is there another possibility to set breakpoints before the library is loaded? I assume this is a problem by using gdbserver. – regs15 Mar 06 '18 at 19:19

0 Answers0