Is there a way to force emitting of stack frame for a specific function?

Andrey Zherikov andrey.zherikov at
Thu Oct 8 08:48:45 UTC 2020

I'm trying to implement some mix of native and custom stack trace 
dump for exception logging: I want to print custom text instead 
of some stack frames. To clarify more: I have a function that I 
want to substitute with other text in stack dump and this 
function has to be in stack dump to make this working.

The problem I faced is that dmd might not generate stack frame 
for a function - I don't know its logic but it depends on the 
complexity of the function itself and its caller.
I tried '-gs' dmd option and seems it solved the issue but it 
forces compiler to generate stack frames for all functions which 
seems overhead for me. I also tried putting "pragma(inline, 
false)" into my function but it doesn't guarantee that stack 
frame is generated for it.

I'm wondering whether there is a way to explicitly tell compiler 
"please always generate stack frame code for this function".

More information about the Digitalmars-d-learn mailing list