pub struct Trace {
pub early: &'static str,
pub late: &'static str,
pub fentry: bool,
}Expand description
What a profiler’s hook at the top of every function is called on this platform.
A profiler wants to know which function called which and how often, and the only place a
compiler can tell it that is the moment a function is entered. So -pg puts a call there, and
what it calls is a routine the runtime provides rather than anything the program wrote.
Two of them, because there are two conventions for the same job and they disagree about where the call goes as well as what it is called. The older one runs once the frame is taken, so the hook can walk back through the frame pointer, which is why it needs one. The newer one runs before the prologue has done anything at all, which is what makes the return address the top thing on the stack and the arguments still in the registers they arrived in, and that is what lets a tracer replace the call with something else while the program runs. Linux’s ftrace is built on exactly that, and it is why every kernel is built with the newer one.
A convention that answers None is one this compiler has no hook for, and a command line that
asks for one on such a target is told so rather than quietly given an unprofiled program.
Fields§
§early: &'static strWhat is called in front of the prologue, which is what -mfentry asks for.
late: &'static strWhat is called once the frame is taken, which is what -mno-fentry asks for.
fentry: boolWhich of the two a command line that named neither gets.