2

In IDAPython, what is the ea_t data type? It is used in the set_debug_name() function as follows:

bool set_debug_name(ea, name)

If I have a 64-bits address, can it be represented by the ea_t data type ?

For example, in this Python script:

line = "ffffffff81000000 T startup_64"
addr = int(line[:16],16)
name = line[19:]
idaapi.set_debug_name(addr,name)

I receive this error while executing the IDA Python script:

TypeError: Expected an ea_t type

from IDA Pro:

Python> from idaapi import *
Python> line="ffffffff81000000 T startup_64"
Python> addr=int(line[:16],16)
Python> name=line[19:]
Python> print "addr: %x" %(addr)
addr: ffffffff81000000
Python> print name
startup_64
Python> set_debug_name(addr,name)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "X\IDA Pro\IDA61\python\idaapi.py", line 23612, in set_debug_name
    return _idaapi.set_debug_name(*args)
TypeError: Expected an ea_t type

Are the idaapi.py files different for 32-bits and 64-bits IDA Pro versions?

I am using a 32-bits version of IDAPro.

3

From pro.h:

#ifdef __EA64__
  typedef uint64 ea_t;      // effective address

Yes also in python it can represent a 64-bit address

32-bit and 64-bit files are the same (they're is only 1 file)

The following very basic script works fine for me on notepad.exe using 64-bit IDA;

Python>from idaapi import *
Python>ea = 0x0000000100003590L
Python>hex(get_byte(ea))
0x48

-edit-

Updated to show your script working in 32-bit IDA:

Python>print sys.version
2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
Python>line="ffffffff81000000 T startup_64"
Python>addr=int(line[:16],16)
Python>type(addr)
<type 'long'>
Python>set_debug_name(addr,"bla")
True
Python>name=line[19:]
Python>set_debug_name(addr,name)
True

Did you try updating your idapython with a 'newer' version from Google code? http://code.google.com/p/idapython/

  • Thanks. I have updated my question with the Python script and the error message that I receive. addr stores a 64 bit address. – Neon Flash Aug 22 '13 at 11:12
  • Please note that I am using 32 bit version of IDA, will it still work? – Neon Flash Aug 22 '13 at 11:18
  • See my updated answer. For me your script also works in a 32-bit IDA instance – ixje Aug 22 '13 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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