-1

Background

I'm currently writing my own (retrospective) line by line debugger for cold fusion because the existing line by line debuggers don't work for our version of cold fusion with our version of Eclipse. I have (for tag format at least) got this pretty much working. It functions simply by having a java program instrumente each (valid) line with <CFDUMP var='LINENUMBER' output='D:/retrospectiveData.txt'> and then the same program interprets this output file to show a nice line by line progress through the program (even though its after the fact)

The problem

While the vast majority of tags behave such that if the tag before them is executed they are as well <cfelse> and <cfelseif> don't work this way. This means that those lines can be incorrectly shown in my debugger as being run. For example consider the following instrumented program

<CFDUMP var='1' output='D:/retrospectiveData.txt'><cfif 1=1>
<CFDUMP var='2' output='D:/retrospectiveData.txt'>     <!--- something --->
<CFDUMP var='3' output='D:/retrospectiveData.txt'><cfelseif 1=1>
<CFDUMP var='4' output='D:/retrospectiveData.txt'>     <!--- something2 --->
<CFDUMP var='5' output='D:/retrospectiveData.txt'></cfif>

The <cfelseif 1=1> will be marked as being executed when in fact it never was. Given that it evaluates to true this will make it confusing that <!--- something2 ---> never runs

The question

Is there any way to have a text file output when an or tag is executed (whether it evaluates to true or false). I know I can't simply stuff an extra tag inside the <cfelseif 1=1>.

Community
  • 1
  • 1
Richard Tingle
  • 16,906
  • 5
  • 52
  • 77
  • Very confusing, I'm not sure I understand WTF you're trying to do. Your retrospectiveData.txt file will only contain `1`,`2` and `3`... what's the big surprise? – duncan Nov 19 '14 at 09:21
  • @duncan For this program: extremely unsurprising. For 3000 line files I'm working with with nested ifs, while loops etc even the slightly buggy version I have now has vastly improved debugging – Richard Tingle Nov 19 '14 at 09:22

1 Answers1

1

Is there any way to have a text file output when an or tag is executed

Not with CFML, no.

I think your approach is fundamentally flawed - as you're finding out - because just because code execution reaches a "physical" line of code, does not mean the line of code will be executed. You might have more luck if you put the debug output at the END of the line, not the beginning (that way it'll be "inside" logic blocks, not before them. This will probably raise issues of its own though.

Can you not use the line debugger in ColdFusion Builder, instead of trying to hack together your own one?

Adam Cameron
  • 29,677
  • 4
  • 37
  • 78
  • Indeed, (although it works well for most other tags). Putting it at the end has a similar problem: If they evaluate to false then they are also not marked. Its a problem I can work around though. Buying ColdFusion Builder might end up being the way forward although paying £200 for an IDE isn't something I'm really used to. That said my hacked together version is already working relatively well – Richard Tingle Nov 19 '14 at 09:34
  • How much time have you sunk into this already? Probably more than £200 @ whatever hourly rate you, your testers, the ppl helping you on Stack Overflow charge ;-) – Adam Cameron Nov 19 '14 at 10:00
  • 2
    Ah, but its in Java which puts it squarely in the hobby column (I love java). Its a project I want to do as well as being useful. (About 4 hours on Sunday). – Richard Tingle Nov 19 '14 at 10:10
  • Keep in mind that if you upgrade ColdFusion to version 11 (even if you don't install it or upgrade your server to it right away), you get a free licence for CF Builder 3 (3 licenses with Enterprise Edition). – Carl Von Stetten Nov 19 '14 at 14:50
  • @CarlVonStetten I don't know, I suppose I just feel like after the tens of thousands of pounds the company I'm working at has spent on an enterprise edition cold fusion server they ought to be giving away the basic tools we need to develop for that server for free. Ah well – Richard Tingle Nov 19 '14 at 16:06
  • @RichardTingle well they sort of are now, if you are on current release. – Carl Von Stetten Nov 19 '14 at 16:48