I was not able to find an API function to get the CPU architecture of the loaded binary. In idaapi.py, there is a function def set_processor_type(*args) but no equivalent such as get_processor_type.

I don't want to fall back to running some additional (python) tool such as file, readelf or a python ELF parser. I also don't like the idea of parsing the strings displayed at the beginning of the IDA assembly listing.

There must be a way to use idc.py, idaapi.py or idautils.py for this.

  • Sorry for resurrecting this old thread, but for reasons I'm unable to figure out, both info.is_64bit() and info.is_32bit() are not working for me. I'm using IDA C++ SDK v7.1. Even if the executable in the database is 64-bit, it still goes through the 32-bit check. Any idea why this is happening?
    – Pocanatos
    Commented Feb 26, 2020 at 16:20
  • 1
    If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – knx
    Commented Feb 27, 2020 at 8:58

3 Answers 3


You can get the name of the processor from the idainfo struct:

import idaapi

info = idaapi.get_inf_structure()

if info.is_64bit():
    bits = 64
elif info.is_32bit():
    bits = 32
    bits = 16

    is_be = info.is_be()
    is_be = info.mf
endian = "big" if is_be else "little"

print 'Processor: {}, {}bit, {} endian'.format(info.procName, bits, endian)
# Result: Processor: mipsr, 32bit, big endian

Still haven't found the endian, though.

EDIT: Endian can be determined by processor name. For example, mipsr is big endian, and mipsrl is little endian.

Added a proper endian check (mf == MSB First). Based on this answer.

Since IDA7 beta 3 (170724), idainfo.mf was removed, and idainfo.is_be() must be used. Based on keypatch


Not all processor name has endian information. Generally it can be determinded as:

BIG_ENDIAN if _idaapi.cvar.inf.mf else LITTLE_ENDIAN

This is definitely not exact answer, but probably you could make use of


Returns the list of register names as defined in the processor module

Different platforms has different register sets, and if you will not find your solution about exact cpu you can give it a try. This function exists in IDA 6.8.

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.