idapython / src

IDAPython project for Hex-Ray's IDA Pro
http://www.hex-rays.com/
Other
1.4k stars 285 forks source link

Hardcoded value without any reference, use ida_dbg.DSTATE_SUSP instead #50

Closed Harding-Stardust closed 1 year ago

Harding-Stardust commented 1 year ago

https://github.com/idapython/src/blob/caeafef297371eae1c929845385dbe5d859abade/examples/debugging/show_debug_names.py#LL19C22-L19C22

The code is much clearer in what is actually happening: if ida_dbg.get_process_state() != ida_dbg.DSTATE_SUSP:

May I also ask why you are not using ida_dbg.dbg_can_query() instead of checking both for loaded and suspended ?

0xeb commented 1 year ago

Your suggestions make sense. These are old samples and fixes / suggestions are welcome. Want to do a PR or I can fix that as well, let us know.

0xeb commented 1 year ago

@Harding-Stardust , I want to add though: it is better to check for suspended and not use can_query() in this particular case. Internally, IDA will populate debug names only when it gets suspended. Therefore, just remove the hardcoded -1 if you choose to do the PR yourself and keep the suspended check.

Harding-Stardust commented 1 year ago

My first PR :-D

https://github.com/idapython/src/pull/51

0xeb commented 1 year ago

Thanks