GCC (I am using GCC-4.8.5) has the concepts of prologue and epilogue, which are used to generate codes at the beginning and end of each function. I am wondering how to insert my own code into the prologue and epilogue. I tried to search "prologue/epilogue" in the gcc source code, but still do not have any idea(I am new to compiler). Can anyone tell me how to achieve this in detail (e.g. which function in gcc shall I look for, and etc.).
Someone asked a similar question here, but the answers there were not helpful.