1

I want to MakeArray() to stack variables which can be done with IDA like so:

MakeArray to stack variables

MakeArray() Create an array.

ea - linear address

nitems - size of array in items

This function will create an array of the items with the same type as

the type of the item at 'ea'. If the byte at 'ea' is undefined, then

this function will create an array of bytes. How can I do that? Thanks.

MakeArray() works only on linear address and not on stack variables as shown above.

How can it be done? Thanks.

0

As far as I remember you need to modify stack frame of the function in order to achieve your goal.

Stack frame in IDA is represented by the structure which has its own id and type. In order to get this structure id you need you can use idc.get_frame_id
In order to get structure itself in newer API (IDA 7.0 + if I remember it correctly) you can use ida_frame.get_frame

After getting either frame id or the structure, you can modify it.

If you are working with structure, you can modify it with functions from module ida_struct.

If you are working with structure ID, you can use idc.add_struc_member.

You'll probably need to delete members of the frame occupying the required space first.

  • MakeArray() needs an ea as parameter, can it work on structure? how can I extract the ea of a struct variable? – Kinetics332 Jul 30 at 11:16
  • @Kinetics332: use the struct member id as ea – Igor Skochinsky Aug 1 at 8:21

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.