It is trivial to do it with Alt+G command from GUI.

However, when I set multiple breakpoints programmatically, IDA doesn't recognize them as "thumb" mode ones and sets T value at breakpoint address to 0. When IDA tries to use ARM mode instead of Thumb, it is guaranteed to crash.

Setting T value 50 times manually is supposed to be too slow.

So, I try to set T = 1 programmatically.

However, I have no idea how to do that.

I tried this:

idaapi.set_sreg_at_next_code(function_pointer, function_pointer + 2, idaapi.str2reg("T"), 1)

And this:

idaapi.set_default_sreg_value(idaapi.getseg(function_pointer), idaapi.str2reg("T"), 1)

IDA simply ignores both calls, no error occurs, but T value doesn't change.

Does anyone know how to change virtual T segment register value with IDAPython in ARM mode?

1 Answer 1


I found solution myself. Correct code follows:

idaapi.split_sreg_range(instruction_pointer, idaapi.str2reg("T"), required_t_value, idaapi.SR_user)

where instruction_pointer is instruction address which mode you want to change, and required_t_value is new mode (1 for Thumb, 0 for ARM), and

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.