Debugging using Lauterbach (Trace32)

By : pdssn

While using trace, I found that a few functions are not listed in the source while trying to find them in order to put a breakpoint. These functions seems to appear only when I view the source in assembly format.

I spoke to my seniors, they told me if any function is only called once, it will be optimised by Trace and will appear as inline, hence can be seen in assembly.

My questions are:

  1. How does this optimization happens through Lauterbach?
  2. Is this advantageous??
By : pdssn


Inlining a function that only is called once may be done by the compiler.

The advantage is that it saves the overhead of a function call (runtime, code space and stack space), and you can still write the code in a nice modular way as several functions.

The disadvantage is that debugging becomes harder, because during debugging function is mixed up with the caller.

W.r.t. the behavior of your trace tool your question is rather unclear.

By : starblue

If there's a function being called that you can't find in your source code it's unlikely to be because of inlined functions for 2 reasons:

  1. inlined function calls won't show up as subroutine calls in the assembly code - the code to implement the function is emitted inline at the point where the function call would otherwise be (that's what inlining is)

  2. when the compiler inlines your function calls, the function name (if you could see it in the assembly output) would still be part of your source code - that's where the compiler would be getting the code to inline.

But, compilers sometimes insert mysterious function calls to internal helper functions into the generated code to implement things like arithmetic operations that the CPU doesn't directly support (integer division or floating point operations for example).

What are the names of the 'mystery functions'?

The optimization is done by the compiler, not by the Lauterbach. The compiler tries to optimize its assembly language output, and the default settings typically will inline functions that are only called once.

To override these optimizations for test purposes, you can use the compiler flag --no_inline.

By : Brent

This video can help you solving your question :)
By: admin