Debugging Using Lauterbach (Trace32)

While using tracing, I found that several functions are missing from source when trying to find them to set a breakpoint. It seems that these functions only show up when viewing the source in assembly format.

I spoke with my seniors, they told me that if any function is called only once, it will be Trace optimized and appear as inline, so it can be seen in assembly.

My questions:

  • How is this optimization done via Lauterbach?
  • It's profitable?
+2


source to share


4 answers


There are several things:

  • As far as the operator is concerned , I found that some functions are not listed in source when trying to find them to place breakpoints ", just check the Mapping file / Map file which consists of the various functions that were used in the assembly, their locations in memory etc., and if you don't find your function there, just look at the optimization [Only this could be a problem].

  • As rightly pointed out, the optimization is not done by Lauterbach, but it is done by the compiler. Generally, there are different levels of optimization [in ARM we have O0-O2] where O0 is the highest optimization, but this should only be used when the O2 optimization level should be used for debugging for debugging.

  • If you feel like a function could be optimized by the compiler, try making it volatile .

  • Another point that may not be related to this, but may help, is knowing "what memory location your file is in", since many times when you want to debug something and this page is still out of RAM, you are not will be able to set breakpoints before the moment when this page is made in RAM. [Basically, something like paging on demand if present on your system]



Hope it helps.

-hjsblogger

+5


source


Optimization is done by the compiler, not by Lauterbach. The compiler tries to optimize the assembler output, and the default settings usually include inline functions that are called only once.



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

+4


source


Function inlining that is only called once can be done by the compiler.

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

The downside is that debugging becomes more difficult because during debugging, the function will mix with the caller.

Wrt the behavior of your tracker, your question is rather unclear.

+1


source


If there is a function that you cannot find in the source code, it is unlikely that it will be due to built-in functions, for two reasons:

  • inline function calls will not appear as subroutine calls in assembly code - the code to implement the function is emitted inside the line at the point where the function call was otherwise (which is nested)

  • when the compiler builds 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 will get the code to string.

But compilers sometimes insert cryptic function calls to internal helper functions in the generated code to implement things like arithmetic operations that the CPU does not directly support (such as integer division or floating point).

What are the names of the "secret functions"?

+1


source







All Articles