I'm using the following code to get the address of the selected function/variable:
hightlight = idaapi.get_highlight(idaapi.get_current_viewer())
screen_ea = idaapi.get_screen_ea()
ea = idaapi.get_name_ea(screen_ea, name)
It works like a charm except until you meet demangled name in IDA View :(
For example, for this line
.text:00406744 call KBTickCount(void)
idaapi.get_name_ea call would never return the proper address, because the real name is ?KBTickCount@@YIJXZ.
I know that I can just change demangled names representation in IDA Pro, but I'm working on a public plugin and I'm thinking about end users.
And I also want to make it work in Pseudocode view, where all names are demangled.
Any ideas on how to get the address of the selected function/variable for a particular line?