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?


In reply to Re^3: debugging perl module written in C by Perlbotics
in thread debugging perl module written in C by chuckd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.