1

I have an idapython script which automatically defines bytes as code by a predefined configuration.
The problem is that when it defines the block of bytes as code (by idc.create_insn) it does not define references automatically.

For example, this is the outcome of the function:
enter image description here

And this is the expected result:
enter image description here

If 0x80004F0 cannot be defined automatically as offset, how can I programatically (with idapython) set it to be so?

1

Red highlight usually means that the address is not valid. You need to create a segment covering the target address range for it to be shown as a label.

| improve this answer | |
  • This is a code example which exists in the same IDB, which means if in the bottom picture the address is valid then it should have been so in the top picture. my question is why was it highlighed as red? – toothpick Jun 19 at 22:05
  • can't say without the idb... the values do seem to match – Igor Skochinsky Jun 19 at 22:08
1

I managed to solve the issue by using the following idapython code:

operand_value = get_operand_value(address, 1)
for segment in Segments():
    if operand_value >= segment and operand_value <= SegEnd(segment):
        op_hex(address, 1)
        op_offset(address, 1, idaapi.REF_OFF32, -1, 0, 0)
| improve this answer | |

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.