====== Debugging Posadis tools ====== If you find that Posadis has problems such as crashing, stopping the answering of queries, or starting a large number of threads, you can help fixing the problem by debugging it. You won't need programming experience; just follow the crash course presented here. ===== Debugging under Windows ===== To debug Posadis under Windows, you will need to have a debug build of Posadis. Normal Posadis releases are not debug builds; it's best to ask me, for example on the forum, to make a debug build for you. If you have a debug build, all you need to do install a so-called //Just in Time Debugger//, called [[http://jrfonseca.dyndns.org/projects/gnu-win32/software/drmingw/|Dr. Mingw]]. Nowadays, Dr. Mingw is part of the [[http://www.mingw.org/|Mingw]] utils package, but you can get a standalone version [[http://www.posadis.org/files/drmingw.exe|here]]. Install Dr. Mingw by running drmingw -i This should give a message indicating that Dr. Mingw was succesfully installed. See the [[http://jrfonseca.dyndns.org/projects/gnu-win32/software/drmingw/|Dr. Mingw website]] for more info. Next time Posadis crashes, the familiar Windows crash dialog will have an option to debug the program, after which Dr. Mingw is run, which will give information on the problem; e-mail that to me and you've helped me debugging the program. Alternately, you can attach to a running Posadis by finding out its Process ID (PID) through the task manager, and run drmingw -p where '''' is the PID of the Posadis process. ===== Unix ===== For Unix (and Windows too, as a matter of fact), you can make your own debug build of Posadis programs using the ''--enable-debug'' configuration option; see [[building]] for more information. To make the debugging information more useful, you should also run a debugging version of [[:Poslib]]. You can make Posadis dump debug information when it crashes by enabeling the core dump functionality of your OS; how to do this may differ between Unices, but it may be something like: ulimit -c unlimited Next time, Posadis will leave a file with ''core'' in its name in the working directory it was started from (usually, a message like "Segmentation fault (core dumped)" will be displayed. Say the file is called ''core.1'', you can then run ''gdb'': gdb core.1 From GDB, enter ''thread apply all bt'' and post the output here (see [[:Documentation]] for more information on filing bugs). Alternately, to attach to a running Posadis, you can find out its PID using something like ''ps ax'', and then attach to it using gdb attach where '''' is the PID of the Posadis process. In GDB, enter the ''run'' command with any arguments you want to pass to Posadis. When Posadis has stopped reponding or started taking up 100% CPU, press ''CTRL-C'' and, as above, post the output of ''thread apply all bt''.