Last modified 2 years ago Last modified on 04/27/10 21:31:08

Linux compilation tips

*To get really useful output, you need -g (debug symbols), because otherwise information like file and linenumber is not stored.
*Make sure not to strip the binary (strip is a command to remove "unnecessary" symbols)
*On x86, do not use -fomit-frame-pointer: That will remove the capabilty to get any backtraces, even if you did not strip the binary.
*On x86_64 or ppc you can omit the frame pointer, and in fact it is enabled by default on -O1 or higher. They use a different method to build a backtrace (without a frame pointer).
*Any optimisation level (-O1 or higher and also -Os) will change the structure of the generated code, which thus may contain less useful information (like temporary variables). Sometimes such variables (or small functions, etc) are not required to determine the source of a crash, at other times they are crucial. So you better stay with -O0 when doing debug builds.

Dual displays Linux debugging

Debugging graphical application is best done using a Graphical Debugger like the kdbg application from a second display. The second display can be on a local host or remote host. For the rest of the paragraph, we have choosen the remote host for our demostrator. We will call viewer, the host displaying the kdbg window, the host running the warzone2100 application is named mywar. On mywar host, you create a terminal window, e.g. a xterm or gnome-terminal application. You give cli command "ssh -l my-user-name viewer", it will ask for password for user my-user-name on viewer host. This will create a terminal window on the display of viewer host. From this second terminal, we will start the kdbg utility, we should have a prompt like

[my-user-name@viewer ~]# kdbg

We have the kdbg utility application displaying on viewer host but running on mywar host.

Reason for doing so, is that, if both the kdbg and the warzone2100 application were running on same display, the events produced by trying to used kdbg would mess up the flow of the event loop of warzone2100. We have to pay that price for using kdbg tool.

File > Executable give you a file dialog window that will allow you to select executable, exemple /d1/wzb23/src/warzone2100.

Have fun

Category:Development ?