[fpc-devel] How to manually control debug information

Florian Klaempfl florian at freepascal.org
Fri Jun 3 09:12:08 CEST 2005


Peter Vreman wrote:
> At 19:36 2-6-2005, you wrote:
> 
>> Hello,
>>
>> I'm writting a custom preprocessor and I would like that the line number
>> information maps to the original file. An example (not real, only an
>> example):
>>
>>   ...original.pas...
>>   21 procedure AddFive(var a, b: Integer);
>>   22 begin
>>   23   a := ++b;
>>   24 end;
>>
>> After preprocessor:
>>
>>   ...processed.pas...
>>   25 procedure AddFive(var a, b: Integer);
>>   26 begin
>>   27   Inc(b);
>>   28   a := b;
>>   29 end;
>>
>> I would like that stepping in the debugger through AddFive showed
>> original.pas
>> in lines 21 to 24, not processed.pas in lines 25 to 29.
>>
>> How could I do that?
> 
> 
> That is not possible with fpc

Since preprocessed code isn't read by human, why don't change it into

procedure AddFive(var a, b: Integer);
begin
  Inc(b); a := b;
end;

The compiler don't care and you get correct line numbers.





More information about the fpc-devel mailing list