6

I have an instructions defined from address+1 onward and a byte at address. I'd like to undefine the instructions from address+1 onward and redefine them from address using MakeCode or something similar.

So far I have not found any functions to undefine instructions. Any pointers on where I should be looking?

2

1 Answer 1

5

Here is a POC from some code I wrote a while back.

def fixTheJmpCalls():
    # kind of slow to loop through all the functions and instructions but it works 
    # flaw: only defined functions will be traversed.this. 
    for funcea in Functions( SegStart( here() ), SegEnd( here() ) ):
        for eai in FuncItems(funcea):
            if GetMnem(eai) == "jmp" or GetMnem(eai) == "call":
                if GetDisasm(eai)[-2:-1] == "+" and GetDisasm(eai)[-1:].isdigit():
                    print "Broken Instruction: %X"%eai, GetDisasm(eai)
                    code_addr = GetOperandValue(eai, 0) 
                    fix_addr = code_addr -1 
                    MakeUnkn(fix_addr,1)
                    MakeCode(code_addr)
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.