lks9 / src-tracer

Other
0 stars 0 forks source link

Return instrumentation can be at an unexpected place ... #16

Closed lks9 closed 11 months ago

lks9 commented 1 year ago

... when we have a function call in the return statement like this

int foo(void) {
    return 0;
}
int main(int argc, char **argv) {
    return foo();
}

then we actually get the trace

F2 main
R
F1 foo
R

instead of:

F2 main
|  F1 foo
|  R
R

The reason is that the instrumentation currently produces

  _RETURN
  return foo();

instead of:

  auto result = foo(); 
  _RETURN
  return result;

We will not change the instrumentation because

  1. it would be an unnecessary refactoring step and
  2. it would remove the tail recursion in the instrumented code. This can affect the performance of the instrumented code. In trace mode, the performance is crucial.
lks9 commented 1 year ago

Maybe there is still some hope that this one could be solved after #45.

lks9 commented 11 months ago

Removed as duplate of #45.