We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm writing an application in which I want to obtain the code of a particular function during runtime. Obtaining the code of a function is not a problem, as I just used function pointer to obtain the start address of the function. However, I'm not able to determine the end of the function. I can solve this if I can obtain the size of the function and store it at a known memory location.
Is it possible to accomplish the above using:
1. ASSEMBLY: Use labels in assembly code to find the size of the function. 2. LINKER SCRIPT/SCATTER FILES: Use linker scripts or scatter files to find the size of the function.
Any help in this regard is highly appreciated.
I'd use assembler, least then you have some handle on the call tree too. Watch the function size, and those of any literals used, and where the literal pool is placed.
You could parse the .MAP files, or .HTM? The object files would also contain useful data.
You could use scatter files and sections to park specific functions in a specific region.
Thanks, I'll look into .MAP file. Can you give some more details on how to do it in assembly?