CONTRIB: trace: try to display the function's return value on exit
authorWilly Tarreau <w@1wt.eu>
Tue, 24 Oct 2017 08:58:20 +0000 (10:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 24 Oct 2017 17:54:25 +0000 (19:54 +0200)
commite8f0f1265f1b68578e82ae180c4be55647ad0675
tree53166996459dc58005c3b64b397f59a8369a7684
parent1296382d0bf7e600bbb60e927e546053d381e473
CONTRIB: trace: try to display the function's return value on exit

On x86_64, when gcc instruments functions and compiles at -O0, it saves
the function's return value in register rbx before calling the trace
callback. It provides a nice opportunity to display certain useful
values (flags, booleans etc) during trace sessions. It's absolutely
not guaranteed that it will always work but it provides a considerable
help when it does so it's worth activating it. When building on a
different architecture, the value 0 is always reported as the return
value. On x86_64 with optimizations (-O), the RBX register will not
necessarily match and random values will be reported, but since it's
not the primary target it's not a problem.
contrib/trace/trace.awk
src/trace.c