October 19, 2010

Gustavo H Montesião de Sousa Gustavo H Montesião de Sousa
Lab Rat
28 posts

Debugging QML/C++ application in Qt Creator

Page  
1

Hi!

I’m trying to debug an application written in QML and C++ on Linux and Mac using Qt Creator 2.1 beta (2.0.92), but I’m only being able to run the C++ debugger (gdb), not the QML debugger.

After searching for a while, I’ve found that there’s an option in Projects->Run settings in Qt Creator to set the debugger languages. Setting C++ and QML and trying to start the debugger show me a popup saying: “Could not connect to QML debugger server at 127.0.0.1:3768”.

Am I missing some configuration step? Do I have to put some statement in .pro file?

Thanks

18 replies

October 20, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

Same thing happened to me on winxp. It takes a long time and finally get the same error

October 20, 2010

Alexander Kuchumov Alexander Kuchumov
Hobby Entomologist
377 posts

Do you uncomment this line in .pro file?

  1. # Define QMLJSDEBUGGER to enable basic debugging (setting breakpoints etc)
  2. DEFINES += QMLJSDEBUGGER

October 20, 2010

kkoehne kkoehne
Ant Farmer
53 posts

Also don’t forget to recompile :) Furthermore, you should check that there is only one instance of the app running (this one might block the port). If the problem persists, please also check out the application output (should contain something like “Waiting for connection on port xxxx…”).

October 25, 2010

Gustavo H Montesião de Sousa Gustavo H Montesião de Sousa
Lab Rat
28 posts

Sorry for the late reply! This time I didn’t receive an email notification, so I thought anybody had answered.

My .pro file didn’t have such a line (commented or not) when it was created by Qt Creator, but I’ve found somewhere a reference to it, and then I put it there. But the problem persists, and I’m sure there’s only one instance of the application running.

The only message shown in the process of starting the debbuger (apart from that of the popup) is: “QML Debugger connecting…” in the debugger view. My app doesn’t output anything specifically related to the debug process, but it outputs the following when it starts (on Linux; I’m not with my Mac right now to test it on there):

(6685) KSharedDataCache::Private::mapSharedMemory: Opening cache “/var/tmp/kdecache-gustavo/icon-cache.kcache” page size is 4096
(6685) KSharedDataCache::Private::mapSharedMemory: Attached to cache, determining if it must be initialized
(6685) KSharedDataCache::Private::mapSharedMemory: Cache fully initialized — attached to memory mapping
(6685) KSharedDataCache::Private::mapSharedMemory: 4329472 bytes available out of 10485760
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: Arquivo ou diretório não encontrado
QFileSystemWatcher: failed to add paths: /home/gustavo/.config/ibus/bus
Bus::open: Can not get ibus-daemon’s address.
IBusInputContext::createInputContext: no connection to ibus-daemon

Is this somehow related to the problem?

October 26, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

ok finally got a chance to try this and got this error:

  1. Project WARNING: This library requires Qt 4.7.1 or newer.
  2. Project WARNING:
  3. Project WARNING:
  4. Project ERROR: Qt version 4.7.0 too old for QmlJS Debugging. Aborting.

have to get 4.7.1 … ummm wasn’t aware of no support on 4.7.0

October 26, 2010

Gustavo H Montesião de Sousa Gustavo H Montesião de Sousa
Lab Rat
28 posts

Hmmm… no suport for qml debugging on 4.7.0? This explains why I’m not being able to use the debugger. :)

Chetan, you are using 4.7.0, right?
So, can anyone confirm this is working only on more recent versions of Qt? I didn’t find this information in any doc I’ve read so far.

Thanks!

October 27, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

Chetan, you are using 4.7.0, right?

yes as of now I’m on 4.7.0, but will try to get 4.7.1 from git today and revert if debugging works with that

October 28, 2010

Gustavo H Montesião de Sousa Gustavo H Montesião de Sousa
Lab Rat
28 posts

Ok
Thanks

October 29, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

I’m having serious issues trying to download the 4.7.1 from repository :( … unsuccessful past 2 days, keeps disconnecting or timing out and just aborts. will try again over weekend.

meanwhile, saw this video [youtube.com] on youtube

November 6, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

finally got to the master branch without issues, the qml observer works fine as shown in the youtube video but not able to debug qml apps properly … still trying further

November 6, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

I guess we have to wait for more stable release of this feature. Keep getting this error when I try to debug qml …

Maybe some Troll can throw more light on this dump from the debugger log…

  1. >&"warning: QDeclarativeDebugServer: Connection established\n"
  2.  QDeclarativeDebugServer: Connection established
  3.  
  4. >&"\n"
  5. sQmlJSDebugger: Connected to debug service 'QDeclarativeObserverMode'.
  6. sQmlJSDebugger: Connected to debug service 'JSDebugger'.
  7. sQmlJSDebugger: connected.
  8. s
  9. sQmlJSDebugger: Not connected to debug service 'JSDebugger'.
  10. sQML Debugger connected.
  11. dNOTE: ENGINE RUN AND INFERIOR RUN OK
  12. dState changed from InferiorRunOk(10) to InferiorRunRequested(9).
  13. dState changed BY FORCE from InferiorRunOk(10) to InferiorRunOk(10).
  14. dNOTE: INFERIOR RUN OK
  15. dState changed from InferiorRunRequested(9) to InferiorRunOk(10).
  16. dState changed BY FORCE from InferiorRunOk(10) to InferiorRunOk(10).
  17. eQmlJSDebugger: Error: (-1) Unknown error
  18. sQmlJSDebugger: connected.

Also found this strange message:

  1. set substitute-path C:/qt-greenhouse/Trolltech/Code_less_create_more/Trolltech/Code_less_create_more/Troll/4.6/qt C:/qt/chetan-chetans-qt-master/chetans-qt
  2. set substitute-path C:/iwmake/build_mingw_opensource C:/qt/chetan-chetans-qt-master/chetans-qt

Code has some hardcoded paths to qt-greenhouse :)

November 8, 2010

Gustavo H Montesião de Sousa Gustavo H Montesião de Sousa
Lab Rat
28 posts

Sadly, as it´s a very usefull feature…

November 8, 2010

Gustavo H Montesião de Sousa Gustavo H Montesião de Sousa
Lab Rat
28 posts

I will try to do the same at home later, on my Linux machine, to see if I get a better result.

November 18, 2010

kkoehne kkoehne
Ant Farmer
53 posts

@chetankjain: I’m pretty sure QtCreator doesn’t contain any references to qt-greenhouse :)

Anyhow, the debugger log looks indeed strange: What happens is that a connection to the client program was established, and both services (QDeclarativeObserverMode, JSDebugger) are found. However, afterwards the JSDebugger becomes unavailable again. This could happen e.g. because the QmlEngine on the client side is destroyed … Can you tell exactly with which QtCreator version / Qt branch this happened? Or could you try with finalized 4.7.1 and latest QtCreator 2.1 ? Preferably as a bug report at bugreports.qt.nokia.com. Thanks in advance!

November 18, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

kkoehne wrote:
@chetankjain: I’m pretty sure QtCreator doesn’t contain any references to qt-greenhouse :)

Anyhow, the debugger log looks indeed strange: What happens is that a connection to the client program was established, and both services (QDeclarativeObserverMode, JSDebugger) are found. However, afterwards the JSDebugger becomes unavailable again. This could happen e.g. because the QmlEngine on the client side is destroyed … Can you tell exactly with which QtCreator version / Qt branch this happened? Or could you try with finalized 4.7.1 and latest QtCreator 2.1 ? Preferably as a bug report at bugreports.qt.nokia.com. Thanks in advance!

Hi Koehne, thanks for the reply.
yes the latest creator doesn’t have any references to qt-greenhouse, its cleaned up now :)

I tried on the final Qt 4.7.1 and Creator 2.1 itself. I’ll log a bug

Page  
1

  ‹‹ How to embed QTableView to QML-based GUI      ListView + ScrollBar performance ››

You must log in to post a reply. Not a member yet? Register here!