title: JCLDebug Stack trace is missing the actual line of code that caused the error
body: <p>I am displaying a stack trace in DUnit using JCLDebug (<a href="http://blog.excastle.com/2008/04/13/dunit-tricks-getting-stack-traces-for-test-failures/" rel="nofollow">Click Here</a> for more info). See the stack trace below. </p>
  
  <p>The stack trace shows all calls up to the function <em>that calls</em> the actual function that causes the error.  Line 238 of ConvertScriptTestU calls another function called "GetDataLine" (which is missing from the stack trace) that <em>then</em> calls IntToStr (which raises EConvertError). Why does the stack trace not include <em>GetDataLine</em> ? </p>
  
  <p>This stack trace is a lot less useful as I still have to work out which line in GetDataLine is causing the EConvertError.</p>
  
  <p>I am using DUnit here but I have seen the same thing happen when using JclDebug outside DUnit.</p>
  
  <p>[THE ANSWER]</p>
  
  <p>Just add this line to your project file:</p>
  
  <pre><code>JCLdebug.JclStackTrackingOptions:=[stStack, stRawMode];
  </code></pre>
  
  <p>It turns on "Raw Mode". You might need to tweak some compiler options too (e.g. 'generate stack frames')</p>
  
  <p>[/THE ANSWER]</p>
  
  <pre><code>TestConversion: EConvertError
  at SysUtils:0 SysUtils.ConvertErrorFmt$00414A7E
  '''' is not a valid integer value
  StackTrace
  [00414A79]{ConvertDataTests.exe} SysUtils.ConvertErrorFmt
  [007E2699]{ConvertDataTests.exe} ConvertScriptTestU.ConvertDataTest.WriteDataToFile (Line 238, "ConvertDataTestU.pas")
  [007E2198]{ConvertDataTests.exe} ConvertScriptTestU.ConvertDataTest.TestConversion (Line 164, "ConvertDataTestU.pas")
  [0053C66E]{ConvertDataTests.exe} TestFramework.TTestCase.RunTest (Line 2380, "TestFrameWork.pas")
  [00537DBA]{ConvertDataTests.exe} TestFramework.TTestResult.RunTestRun (Line 1199, "TestFrameWork.pas")
  [00538078]{ConvertDataTests.exe} TestFramework.TTestResult.Run (Line 1275, "TestFrameWork.pas")
  [0053963A]{ConvertDataTests.exe} TestFramework.TAbstractTest.RunWithFixture (Line 1723, "TestFrameWork.pas")
  [0053C4DD]{ConvertDataTests.exe} TestFramework.TTestCase.RunWithFixture (Line 2363, "TestFrameWork.pas")
  </code></pre>