In order to get the length of functions, I'm using empty functions to mark where each function ends, like so:
void f()
{
printf("ooga\n");
}
__declspec(noinline, naked) void f_end() { __asm { nop } };
To get the length of f, I just subtract f_end - f, decrementing for any INT3 used as padding.
But if I add another function:
void g()
{
printf("booga\n");
}
__declspec(noinline, naked) void g_end() { __asm { nop } };
the f_end() and g_end() appears to be merged into one single function (verified by looking at the disassembly in OllyDbg). If I make each function unique it won't happen, but I'll be needing a ton of these.
Is there any optimization switch I can flick to prevent this from happening?
I've skimmed through the settings available in the Visual Studio menus (had to set /OPT:NOREF in order for the f_end and g_end to not be skipped altogether) and tried optimize("", off) to no avail.
Thanks