On Dec 6, 2007, at 20:30, David Nicol wrote:

I'm sort of stuck on how much records of line numbers of expanded rewrites to keep and how to encode them into the "filename" portion of the #line comment.


In practice, debugging macros is maddening if you can't locate where the macro is being used and where it was defined. Sometimes the macro definition is at fault, and sometimes it's being used incorrectly.

Filter::Template (source code filter for macros) does it this way:

# line $line_number "template $name (defined in $template_file at line $template_def_line) invoked from $filename"

Every line of the expanded template is preceded by a "# line $invocation_line" entry, which ensures that a warn() or die() messages are nice, but totally mucks with Perl's debugger. The problem there is that Perl stores the source code as an array using line numbers as offsets. Only the last line at a particular line number will display in the debugger.

Around the time I wrote this, I kinda wished for non-integer line numbers. A 10-line expansion could have line numbers 14.1 through 14.10, with the original invocation as a comment on 14.0.

--
Rocco Caputo - [EMAIL PROTECTED]

Reply via email to