I'm writing a plugin for IDA and I need to get the line number of an instruction in the main view when someone clicks on that instruction or somewhere in the view. I noticed that there is GetLineNumber(ea) but it only gives me the line number in the source files, not the line num of the disassembled code.

  • What do you mean line number in the disassembled code? In the disassembly view IDA starts the line with the address (ea). – ebux Feb 16 '16 at 10:34
  • yeah exactly, but the ea is not what I need: imagine if the ida view was like a text editor: I need the number of the line of this "text" editor containing the instructions. I would use the ea, but the ea is not in a 1:1 relationship with the lines. EDIT: basically I need it because I have to sync the view with another custom view I create. Are there alternatives to do that? – zemnl Feb 16 '16 at 10:48
  • I don't think IDA would calculate this kind of line number. Why don't you synchronize using the ea? – ebux Feb 16 '16 at 10:52
  • my view keeps annotations for some lines of the code so the line num would be perfect since, as I said, the ea is not 1:1 with the lines (more lines may have the same ea). after having digged through the idapython source I started to suspect that IDA would not keep track of that info... I will find a way to sync with the ea. Thanks anyway. – zemnl Feb 16 '16 at 11:11

Your Answer

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

Browse other questions tagged or ask your own question.