in reply to Re^2: debugging perl module written in C
in thread debugging perl module written in C
Hi, -g adds information to the compiled objects/libraries in order to allow a debugger
(gdb, ddd, Emacs gdb-mode, etc.) to align the op-codes currently executed with the source code
lines to be displayed, to find symbols (subroutines, variables), their values, and the like.
You might need to
tell your debugger where to find the sources explicitly (gdb: -d switch).
It is important to switch off optimisation (-O0) because the compiler might re-arrange
instructions in order to optimise for speed and/or memory consumption. So, as a result of optimisation the debuggers task to align source code lines (C/C++) with what is executed might fail resulting in confusing output.
Thus, you need to re-configure your module for debugging or manually edit CFLAGS in the current Makefile. This implies that you have to download the sources and to re-compile a new version of the module in question for debugging purpose. Then follow the steps rg0now has described.
Personally, I would first (ok, after reading the modules documentation, esp. the TO DO and BUGS section) run the tests (see t/ directory) and scrutinise every warning or error related to your specific problem, possibly replacing input data for a test-case by data that caused your problem. That might be more
effective than single-stepping through an external module... and it doesn't
require you to compile a special debug-version of the module.
I've the impression, you're looking for a single tool/debugger that allows you to step through a Perl program (source) and through the C sources of an XSS module simultaneously? AFIK, there is no such tool since there are two stand-alone debuggers involved. So you have to decide for a given run: do I want to use the IDE to debug the Perl part of my program or do I want to use gdb/ddd/... to debug the XSS part of the module(s) my Perl program loads and executes?
|
|---|