I have code that obfuscated with jump table calls.
IDA don’t recognize the pattern so I “specify switch idiom”.
Jumps are marked as cases and if the next jump is a const, IDA will analyze it, if not, its just
If I have a jump map(obtained from debugger), how can I force IDA to take the “right path” in the psuedo code? I tried ida_xref.add_cref but it only marks jumps in graph view.
Thannks
Thank you for the idb. I was able to produce a switch using these parameters:
For 11D3A4:
address of jump table: 0x1896B0
number of elements = 4
start of switch idiom: 0x11D394 (CMP X8, #3)
input register: X8
Bu default, you get somewhat ugly switch ( (unsigned __int64)jpt_11D334[v0] ), caused by the reuse of X8 for the indirect jump. To fix it, mark the table load (LDR X8, [X20,X8,LSL#3]) as skippable (switch) instruction.
Alas, xrefs are not enough; you’d need to patch the code with unconditional jumps. Perhaps a plugin/script with ev_ana_insn hook could work, where you return a B loc_XXXX instead of the original BR X8 for cases where you know the destination.
It doesn’t actually solve anything. I still need to manually mark each jump(somehow the api marks all correct tables and refs but IDA fails to create the actual switches) but it also creates switches for the number of functions in the jump table per jump.
Bu default, you get somewhat ugly switch ( (unsigned __int64)jpt_11D334[v0] ), caused by the reuse of X8 for the indirect jump. To fix it, mark the table load (LDR X8, [X20,X8,LSL#3]) as skippable (switch) instruction.
Can you please post the pseudo code of this that you get?