How to check the version of Qt a program is built on?

If you got an app that was built with Qt lib, how do you get the version of Qt? Suppose you only have the .exe file, you have not the source code that builds the .exe, how to check the version of the Qt libs the exe was linked against? To get the qt version of the runtime lib, you can use GDB to inspect the exe. You have several methods to get the Qt version from the executable:

  • check the global variable qtHookData. This is an array which is supposed to store the addresses of some callback functions. But the third element is actually the qt version number:
    (gdb) python print(gdb.lookup_symbol('qtHookData')[0].value()[2])
    330753

    Here 330753 is 0x050c01, which means Qt version 5.12.1.

    The following GDB python API gets the same result:

    (gdb) python print(str(gdb.parse_and_eval('((void**)&qtHookData)[2]')))
    0x50c01
  • call the global function qVersion in GDB.
    (gdb) p qVersion()
    $1 = 0x668ca3e1 <qt_meta_stringdata_QPauseAnimation+225> "5.12.1"
    
    (gdb) python print(gdb.parse_and_eval("qVersion()"))
    0x668ca3e1 <qt_meta_stringdata_QPauseAnimation+225> "5.12.1"
    
    (gdb) python print(gdb.lookup_symbol("qVersion")[0].value()())
    0x668ca3e1 <qt_meta_stringdata_QPauseAnimation+225> "5.12.1"

 

If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!
Posted in

Leave a Reply