Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Peter Vreman
>>>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.
>>
>>
>> Clever! But won't the compiler care if a line gets too long?
>
> No. The compiler itself doesn't care about line length.

Only you'll get wrong values for the column if the line is longer than
65535 chars.



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Peter Vreman
>> gcc docs mainly (stabs)
>
> Thank you, also Florian and Peter, of course. It seems that I have more
> than
> enough options :-)

For an simple stabs parser see rtl/inc/lineinfo.pp




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Nico Aragón
El Viernes, 3 de Junio de 2005 11:44, Marco van de Voort escribió:
> > El Viernes, 3 de Junio de 2005 09:56, Marco van de Voort escribi?:
> > > If you have a preprocessor, you will also need a binary postprocessor
> > > to edit the linenumbers.
> >
> > In the executable? Isn't there any previous step to "hook into"?
>
> Yes. The generated assembler.
>
> > Anyway, where could I find information about the structures that should
> > be edited?
>
> gcc docs mainly (stabs)

Thank you, also Florian and Peter, of course. It seems that I have more than 
enough options :-)


-- 
saludos,

Nico Aragón

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Florian Klaempfl
Nico Aragón wrote:

> El Viernes, 3 de Junio de 2005 09:12, Florian Klaempfl escribió:
> 
>>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.
> 
> 
> Clever! But won't the compiler care if a line gets too long?

No. The compiler itself doesn't care about line length.

> 
> I should still change the file name.
> 


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Marco van de Voort
> El Viernes, 3 de Junio de 2005 09:56, Marco van de Voort escribi?:
> > If you have a preprocessor, you will also need a binary postprocessor to
> > edit the linenumbers.
> 
> In the executable? Isn't there any previous step to "hook into"? 

Yes. The generated assembler.

> Anyway, where could I find information about the structures that should be
> edited?

gcc docs mainly (stabs)

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Nico Aragón
El Viernes, 3 de Junio de 2005 09:56, Marco van de Voort escribió:
> If you have a preprocessor, you will also need a binary postprocessor to
> edit the linenumbers.

In the executable? Isn't there any previous step to "hook into"? Anyway, where 
could I find information about the structures that should be edited? 

-- 
saludos,

Nico Aragón

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Nico Aragón
El Viernes, 3 de Junio de 2005 09:12, Florian Klaempfl escribió:
> 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.

Clever! But won't the compiler care if a line gets too long?

I should still change the file name.

-- 
saludos,

Nico Aragón

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Marco van de Voort
> 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?

If you have a preprocessor, you will also need a binary postprocessor to edit 
the linenumbers.

IOW the preprocessor should keep track that original.pas:21 becomes 
processed.pas:25, and your binary
postprocessor should parse all stabs and patch these occurances.

Maybe you need a few dummy units with the same names as the included ones to
create entries for these units.

However a binary postprocessor is a bit complicated.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-03 Thread Florian Klaempfl
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.


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to manually control debug information

2005-06-02 Thread Peter Vreman

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


Peter


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] How to manually control debug information

2005-06-02 Thread Nico Aragón
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?

-- 
saludos,

Nico Aragón

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel