diff options
| author | Alexandre Chartre <alexandre.chartre@oracle.com> | 2025-11-21 10:53:27 +0100 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2025-11-21 15:30:12 +0100 |
| commit | 5f326c88973691232c0e56ced83c199d53d86766 (patch) | |
| tree | a2d8f50bad1c11aeaa6eb876f664f583889f41d7 /tools/objtool/disas.c | |
| parent | c3b7d044fc5ac99a31ce9420431b90e21ed55503 (diff) | |
objtool: Add the --disas=<function-pattern> action
Add the --disas=<function-pattern> actions to disassemble the specified
functions. The function pattern can be a single function name (e.g.
--disas foo to disassemble the function with the name "foo"), or a shell
wildcard pattern (e.g. --disas foo* to disassemble all functions with a
name starting with "foo").
Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/20251121095340.464045-18-alexandre.chartre@oracle.com
Diffstat (limited to 'tools/objtool/disas.c')
| -rw-r--r-- | tools/objtool/disas.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c index b53be240825d..9cc952e03c35 100644 --- a/tools/objtool/disas.c +++ b/tools/objtool/disas.c @@ -4,6 +4,7 @@ */ #define _GNU_SOURCE +#include <fnmatch.h> #include <objtool/arch.h> #include <objtool/check.h> @@ -556,3 +557,29 @@ void disas_warned_funcs(struct disas_context *dctx) disas_func(dctx, sym); } } + +void disas_funcs(struct disas_context *dctx) +{ + bool disas_all = !strcmp(opts.disas, "*"); + struct section *sec; + struct symbol *sym; + + for_each_sec(dctx->file->elf, sec) { + + if (!(sec->sh.sh_flags & SHF_EXECINSTR)) + continue; + + sec_for_each_sym(sec, sym) { + /* + * If the function had a warning and the verbose + * option is used then the function was already + * disassemble. + */ + if (opts.verbose && sym->warned) + continue; + + if (disas_all || fnmatch(opts.disas, sym->name, 0) == 0) + disas_func(dctx, sym); + } + } +} |