Root > Solving bugs in your code > Bug reports > Call Stack section > How to read call stacks > Include files and generics

Include files and generics

Previous pageReturn to chapter overviewNext page   

EurekaLog supports source code with include files and generics.

 

 

Include Files

Suppose you have such code:

 

Unit1.pas:

procedure TForm1.Button1Click(Sender: TObject);
begin
  // some code
 
  {$I code.inc} // <- this is line  #55
 
  // some code
end;

 

code.inc:

// some code
 
  raise ECrash.Create('Kaboom!'); // <- this is line #2
 
// some code

 

EurekaLog will show such information for this exception:

 

 

Nested code generates two lines in call stack

 

Call Stack Information:

----------------------------------------------------------------------------------

|Methods |Stack   |Address |Source      |Unit    |Class   |Procedure/Method|Line |

----------------------------------------------------------------------------------

|7FFFFFFE|00000000|0053220F|code.inc    |Unit1   |TForm1  |Button1Click    |2[1] |

|7FFFFFFE|00000000|0053220F|Unit1.pas   |Unit1   |TForm1  |Button1Click    |55[1]|

|00000060|0019F100|004FC632|Controls.pas|Controls|TControl|Click           |     |

|00000020|0019F108|004F6668|StdCtrls.pas|StdCtrls|TButton |Click           |     |

.....

 

 

As you can see: EurekaLog will indicate that exception was raised on line #2 of code.inc, and that this .inc file was used in line #55 of Unit1.pas. In other words, each location inside include file will produce two entries in call stack for the same address.

 

Note: it is not always possible to determine exact source line in the master .pas file. The results can also vary depending on content of your .inc file, if it ends with line break or not, what linker version is used.

 

 

Generics

Suppose you have such code:

 

unit Unit3;
 
interface
 
type
  TMyClass<T> = class
    class procedure DoSomething(Arg: T);
  end;
 
implementation
 
uses
  System.SysUtils;
 
{ TMyClass<T> }
 
class procedure TMyClass<T>.DoSomething(Arg: T);
begin
  raise Exception.Create('Error Message'); // <- this is line #19
end;
 
end.

 

 

unit Unit2;
 
interface
 
// ....
 
implementation
 
uses
  Unit3;
 
procedure TForm2.Button1Click(Sender: TObject);
begin
  TMyClass<Integer>.DoSomething(5); // <- this is line #31
end;
 
end.

 

EurekaLog will show such information for this exception:

 

 

Generics in call stack

 

Call Stack Information:

-------------------------------------------------------------------------------------------------------------------

|Methods |Stack   |Address |Source          |Unit        |Class                          |Procedure/Method|Line   |

-------------------------------------------------------------------------------------------------------------------

|7FFFFFFE|00000000|0071A93D|Unit3.pas       |Unit2       |{Unit3}TMyClass<System.Integer>|DoSomething     |19[1]  |

|00000060|0019F348|0071A826|Unit2.pas       |Unit2       |TForm2                         |Button1Click    |31[1]  |

|00000060|0019F358|00648FE7|Vcl.Controls.pas|Vcl.Controls|TControl                       |Click           |7442[9]|

|00000020|0019F364|00660896|Vcl.StdCtrls.pas|Vcl.StdCtrls|TCustomButton                  |Click           |5441[3]|

.....

 

As you can see: EurekaLog will show a source code of generic class, as well as used type (Integer instead of T).

 

 

See also:




Send feedback... Build date: 2023-09-11
Last edited: 2023-07-18
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/includes.php