Debugging

From FIFE development wiki
Jump to: navigation, search

Introduction

This article is focused on how to set up a debugger on the platform of your choice to debug FIFE.

Linux

gdb

First, to load our python client into gdb:

gdb --args python scriptname.py

Next, run the client.

run

Try to reproduce the bug / event that is causing segmentation fault / crashes in the game. The debugger will stop when the program exits due to the segfault. Enter

where

to see where the fault is occuring in the source code. If you have no listings, probably you didn't compile the engine with debugging enabled. Check the source code and trace back where the fault is occuring. Many times segfaults are caused by problems with pointers, e.g. dereferencing undefined pointer, freeing an already freed pointer, or buffer overrunning the pointer size.

Usually you can use gdb's 'watch' feature, or use printf/cout debugging to check if the pointers invalid.

If you are not confident about finding the cause in the source code, please send the backtrace ( 'where' listing ) to a developer so he can help you squish the bug instead.

This howto should apply to platforms other than linux too.

Macintosh

Xcode

Win32

gdb 6.6

Download

Comes with the Win32 compile SDK.

See the Creating a custom python debug library for mingw page for more information on how to get a working debug version of FIFE compiled.

Command line

gdb --args python scriptname.py
run

(should crash now)

bt

For more details, see the Linux paragraph above. The vast majority of the information listed there applies to debugging via gdb under win32 as well.

MSVC 2005 SP1

Download

http://download.microsoft.com/download/8/3/a/83aad8f9-38ba-4503-b3cd-ba28c360c27b/ENU/vcsetup.exe