On Thu, 23 Oct 2025 00:38:11 +0900
"Masami Hiramatsu (Google)" <[email protected]> wrote:

> @@ -554,7 +556,29 @@ static int function_stat_show(struct seq_file *m, void 
> *v)
>               return 0;
>  #endif
>  
> -     kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
> +     if (tr->trace_flags & TRACE_ITER(PROF_TEXT_OFFSET)) {
> +             long offset;
> +
> +             if (core_kernel_text(rec->ip)) {
> +                     refsymbol = "_text";
> +                     offset = rec->ip - (unsigned long)_text;
> +             } else {
> +                     struct module *mod;
> +
> +                     guard(rcu)();
> +                     mod = __module_text_address(rec->ip);
> +                     if (mod) {
> +                             refsymbol = mod->name;
> +                             /* Calculate offset from module's text entry 
> address. */
> +                             offset = rec->ip - (unsigned 
> long)mod->mem[MOD_TEXT].base;
> +                     }
> +             }
> +             if (refsymbol)
> +                     snprintf(str, sizeof(str), "  %s%+ld", refsymbol, 
> offset);

Let's be consistent as offsets are printed as hex every place else:

                        snprintf(str, sizeof(str), "  %s+%#lx", refsymbol, 
offset);

Also, did you mean to add the '+' after the '%'?

-- Steve


> +     }
> +     if (!refsymbol)
> +             kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
> +
>       seq_printf(m, "  %-30.30s  %10lu", str, rec->counter);
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER

Reply via email to