[fpc-pascal] How to get address of MyFunction in MyFunction?

Žilvinas Ledas zilvinas.ledas at dict.lt
Sun Jul 18 14:49:35 CEST 2010



On 2010-07-18 15:42, Jonas Maebe wrote:
> On 18 Jul 2010, at 13:14, Žilvinas Ledas wrote:
>
>    
>> I want to use it this way:
>> 1) Gel all @unitname.function addresses.
>> 2) Use disassembler to find nearest next RET.
>> 3) Then I assume that I have start and end of the function in the binary file.
>>
>> It works at least for the concept-showing app with some functions and enabled optimizations when compiling. Do I have some conceptual flaw?
>>      
> Yes: there is no guarantee that a function will contain only one "ret" (it is that way currently for compiler-generated code, but that can change at any time).
>    
I understand that there can be more than one "ret" and I know current 
version of compiler generates only one so at least for now I am OK.
Thanks Jonas for your answers!

P. S. I was unable to get any info with "nm" utility from MinGW.

Regards
Žilvinas



More information about the fpc-pascal mailing list