Skip to content

Commit 78df459

Browse files
achartrePeter Zijlstra
authored andcommitted
objtool: Disassemble exception table alternatives
When using the --disas option, also disassemble exception tables (EX_TABLE). 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-23-alexandre.chartre@oracle.com
1 parent 15e7ad8 commit 78df459

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

tools/objtool/disas.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,26 @@ static int disas_alt_add_insn(struct disas_alt *dalt, int index, char *insn_str,
639639
return 0;
640640
}
641641

642+
/*
643+
* Disassemble an exception table alternative.
644+
*/
645+
static int disas_alt_extable(struct disas_alt *dalt)
646+
{
647+
struct instruction *alt_insn;
648+
char *str;
649+
650+
alt_insn = dalt->alt->insn;
651+
str = strfmt("resume at 0x%lx <%s+0x%lx>",
652+
alt_insn->offset, alt_insn->sym->name,
653+
alt_insn->offset - alt_insn->sym->offset);
654+
if (!str)
655+
return -1;
656+
657+
disas_alt_add_insn(dalt, 0, str, 0);
658+
659+
return 1;
660+
}
661+
642662
/*
643663
* Disassemble an alternative and store instructions in the disas_alt
644664
* structure. Return the number of instructions in the alternative.
@@ -790,12 +810,16 @@ static void *disas_alt(struct disas_context *dctx,
790810
}
791811

792812
/*
793-
* Only group alternatives are supported at the moment.
813+
* Only group alternatives and exception tables are
814+
* supported at the moment.
794815
*/
795816
switch (dalt->alt->type) {
796817
case ALT_TYPE_INSTRUCTIONS:
797818
count = disas_alt_group(dctx, dalt);
798819
break;
820+
case ALT_TYPE_EX_TABLE:
821+
count = disas_alt_extable(dalt);
822+
break;
799823
default:
800824
count = 0;
801825
}

0 commit comments

Comments
 (0)