Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Related tickets:

Jira Legacy
serverSystem JIRA
serverId5c72af4b-e2b8-3562-b028-6bcef8f5fab0
keyNEO3-6077
(Refer to the ticket comment to enable task trace on nuttx)

Jira Legacy
serverSystem JIRA
serverId5c72af4b-e2b8-3562-b028-6bcef8f5fab0
keyNEO3-3764

...

And function names that are excluded from tracing to trace_exclude_functions.txt like below.

IFD_
TAL_get_instance

The functions begin TAL_get_instance() and the functions beginning with “IFD_“ will not be traced.

...

Code Block
#ifdef CONFIG_DEBUG_TRACE
void __attribute__((__no_instrument_function__))
__cyg_profile_func_enter(void *this_func, void *call_site)
{
    syslog(LOG_CRIT, "[Start].%p\n", this_func);
}

void __attribute__((__no_instrument_function__))
__cyg_profile_func_exit(void *this_func, void *call_site)
{
    syslog(LOG_CRIT, "[End].%p\n", this_func);
}
#endif
Info

Because the maximum syslog cache size is only 15K, the The files and functions do not need to be traced should be listed as many as possible in trace_exclude_files.txt or/and trace_exclude_functions.txt because of limited cache. The maximum syslog cache size in K5 is only 15K.

4. Use trace.py to change address to function name.

...

Output trace file tracelog_20230512-091652.txt finished.

<nuttx> is the nuttx ELF file, <syslog> is the log output on console or the syslog file saved in /var/log/sys. If you just use python trace.py without parameter, the “nuttx” and “syslog” in current directory will be the default ELF file and log file.

Below are the tool and files output from my Linux PC. Makefile and trace_exclude_xxx.txt are in k81_reader/

View file
nametrace_exclude_functions.txt
View file
nametrace_exclude_files.txt
View file
nametracelog_20230512-091652.txt
View file
nametrace.py
View file
namesyslog

\uD83D\uDCCB GCC Instrumentation-Options description

-finstrument-functions

Generate instrumentation calls for entry and exit to functions. Just after function entry and just before function exit, the following profiling functions are called with the address of the current function and its call site. (On some platforms, __builtin_return_address does not work beyond the current function, so the call site information may not be available to the profiling functions otherwise.)

Code Block
languagec
void __cyg_profile_func_enter (void *this_fn,
                               void *call_site);
void __cyg_profile_func_exit  (void *this_fn,
                               void *call_site);

The first argument is the address of the start of the current function, which may be looked up exactly in the symbol table.

This instrumentation is also done for functions expanded inline in other functions. The profiling calls indicate where, conceptually, the inline function is entered and exited. This means that addressable versions of such functions must be available. If all your uses of a function are expanded inline, this may mean an additional expansion of code size. If you use extern inline in your C code, an addressable version of such functions must be provided. (This is normally the case anyway, but if you get lucky and the optimizer always expands the functions inline, you might have gotten away without providing static copies.)A function may be given the attribute no_instrument_function, in which case this instrumentation is not done. This can be used, for example, for the profiling functions listed above, high-priority interrupt routines, and any functions from which the profiling functions cannot safely be called (perhaps signal handlers, if the profiling routines generate output or allocate memory).