Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
wiki1874: DebuggerFAQ (Version 4)

Qnx Debugger FAQ#

Q: Why debugger does not stop on breakpoints in my shared library code?#

Usually because gdb cannot load symbols for this library. To check this open Modules view and if you see your library there without a bug icon - symbols are not loaded

Q: Why debugger would not load symbols for my shared library?#

First, it needs to find this library in your shared library path on a host side. You usually have to explicitly specify this in the Shared Libraries tab in the Debug tab of the launch configuration. Second, library file name must be the same as soname with "lib" prefix. You can check soname if you open Properties view on library (.so file) or open it in Binary editor. If you have soname as aaa.so.1 and library called libaaa.so gdb cannot match it (because of extra version number). To avoid this problem for debugging purposes do not use so version number when you generate so name for your library.

Q: I tried to launch debug session from IDE and I get an error "Target is not responding (time out)". Why I cannot debug?#

Most likely when you created an image for the target board you did not include pdebug program in /usr/bin. This binary is required to be on target for remote debugging. Also make sure qconn process has permissions to run it.

Q: If IDE does not provide some of functionality that gdb has, can I use gdb command line console?#

Yes, gdb console is provided and will redirect user input to gdb command interpreter during debugging session. To access console open Console view from Windows->Show View... and click on "gdb target" of current debugging session in Debug view. Or click on Display Selected Console button (looks like a blue monitor) on a Console view and pick gdb console from the drop down list. When just type command in console, like show version. Example of such functionality would be setting address breakpoints and catchpoints.

Q: How can I attach debugger to a running process?#

First you need to create launch configuration, select Run->Debug..., then select Attach to Process and click New button (top left). Fill configuration with project and binary, select target and press Debug. It will prompt you to pick a process running on selected target, pick a process and click Ok. Debug session will be created, now you can use regular debugger commands: resume, suspend, step, etc... You can re-use same launch configuration for future runs, just re-select process id (of cause binary has to much too).

Q: Why debugger shows different value for my variable than printed on console???#

Most likely you trying to debug optimized code. This variable is been optimized as register and actual memory region never changes. To fix this use option -O0 for gcc compiler.

Q: Why console output of my program does not match when I step through the code with debugger#

Console is buffered. If you using stderr or stdout and you want to see your output immediately you have to add "\n" or flush the output. Input is always buffered, you have to press enter from console for application to get any of the data, even if you are reading one byte.

Q: Why my program output looks different when I am debugging vs running on windows?#

When you debug on windows IDE cannot allocate another console for your program output, so it gets mixed in with debugger data, and since it using specific debugger protocol, some lines of your program output can be parser as debugger command and won't be printed back. You can mitigate this by enabling verbose console for gdb in Debug tab of launch configuration.