BelledonneCommunications / linphone-desktop

Linphone is a free VoIP and video softphone based on the SIP protocol. Mirror of git://git.linphone.org/linphone-desktop.git
https://linphone.org/
GNU General Public License v3.0
391 stars 200 forks source link

[question] How can I use the QML debugger? #849

Open Apteryks opened 1 week ago

Apteryks commented 1 week ago

Hi!

I'm trying to figure out why the QML debugger won't successfully connect to an instrumented Linphone. I'm building Linphone from source via Qt Creator (Debug profile). From the source, I understand that the QML Debugger is enabled for debug or relwithdebinfo builds, from linphone-app/CMakeLists.txt:

set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DQT_QML_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG" )

I'm using Qt with qtdeclarative 5.15.10, and I've verified that qtdeclarative is built with QML debug support and installs the qmltooling plugins.

In Qt Creator, I've made sure that both the build settings have QML debugging and profiling set to Enable, while the Run Settings debbugger settings have the C++ debugger set to enabled and the QML debugger as well, and have rebuilt the project with these settings.

Now suppose I put a breakpoint around linphone-app/ui/views/App/Main/MainWindow.qml:250, on the line var model = CallsListModel.launchChat( sipAddress,0 )

The breakpoint appears as an Unclaimed Breakpoint. When launching the debug session, it hangs waiting for the debugger to connect to the application, but it never can -- the port isn't listening (wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError).

Here's what I see in the Qt Creator debugger's log:

wNote: This log contains possibly confidential information about your machine, environment variables, in-memory data of the processes you are debugging, and more. It is never transferred over the internet by Qt Creator, and only stored to disk if you manually use the respective option from the context menu, or through mechanisms that are not under the control of Qt Creator's Debugger plugin, for instance in swap files, or other plugins you might use.
wYou may be asked to share the contents of this log when reporting bugs related to debugger operation. In this case, make sure your submission does not contain data you do not want to or you are not allowed to share.
w
sQML Debugger: Status of "QmlDebugger" Version: -1 changed to 'not connected'.
wSome breakpoints cannot be handled by the debugger languages currently active, and will be ignored.<p>Affected are breakpoints 2, 3, 4, 5<p>QML debugging needs to be enabled both in the Build and the Run settings.

dStart parameters: 'Custom Executable' mode: 1
dABI: x86-linux-generic-elf-64bit
dLanguages: qml
dExecutable: /home/maxim/src/linphone-desktop-reference/build-5.2.4/OUTPUT/bin/linphone --verbose -qmljsdebugger=port:42957,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation
dDirectory: /home/maxim/src/linphone-desktop-reference/build-5.2.4/OUTPUT
dDebugger: /gnu/store/c3ms6sds5hr795gk3rh8spw28ry4m3vi-gdb-14.2/bin/gdb
dProject: /home/maxim/src/linphone-desktop-reference
dAdditional Search Directories:
dQML server: 127.0.0.1:42957
dSysroot: 
dDebug Source Location: /usr/src/debug/qt5base/src/corelib:/usr/src/debug/qt5base/src/gui:/usr/src/debug/qt5base/src/network
dDebugger settings:
d/AdditionalArguments:   (default: )
d/AlwaysAdjustColumnWidths: true  (default: true)
d/AutoDerefPointers: true  (default: true)
d/BreakEvent:   (default: )
d/BreakOnCrtDbgReport: false  (default: false)
d/BreakpointCorrection: true  (default: true)
d/CDB_Console: false  (default: false)
d/FirstChanceExceptionTaskEntry: true  (default: true)
d/IgnoreFirstChanceAccessViolation: false  (default: false)
d/LogTimeStamps: false  (default: false)
d/SecondChanceExceptionTaskEntry: true  (default: true)
d/SortStructMembers: true  (default: true)
d/SourcePaths:   (default: )
d/SymbolPaths:   (default: )
d/UsePythonDumper: true  (default: true)
d/UseToolTipsInBreakpointsView: false  (default: false)
d/UseToolTipsInLocalsView: false  (default: false)
d/UseToolTipsInStackView: true  (default: true)
dState changed from DebuggerNotReady(0) to EngineSetupRequested(1)
dCALL: SETUP ENGINE
dNOTE: ENGINE SETUP OK
dState changed from EngineSetupRequested(1) to EngineRunRequested(3)
dCALL: RUN ENGINE
<Starting /home/maxim/src/linphone-desktop-reference/build-5.2.4/OUTPUT/bin/linphone --verbose -qmljsdebugger=port:42957,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Trying to connect ...
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::UnconnectedState 
wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError 
 QML debugging is enabled. Only use this in a safe environment.

 Warning: Setting a new default format with a different version or profile after the global shared context is created may cause issues with context sharing.
 Set TimeZone to  "America/Montreal"
 [02:48:03:890][Info]Core:linphone: QT: app/App.cpp:343: "Starting application Linphone (bin: linphone). Version:5.2.5-pre.1+ab6c9aa5 Os:guix/unknown Qt:5.15.10"
 [02:48:03:890][Info]Core:linphone: QT: app/App.cpp:348: "Use locale: en_US with language: English"
 [02:48:03:890][Info]Core:linphone: QT: app/App.cpp:351: "System timezone: code=0 / country=Default / Offset=0 / ID=America/Montreal"
 [02:48:03:921][Info]Core:linphone: QT: app/AppController.cpp:103: Available fonts :  ("DejaVu Math TeX Gyre", "DejaVu Sans", "DejaVu Sans Condensed", "DejaVu Sans Mono", "DejaVu Serif", "DejaVu Serif Condensed", "Monospace", "Noto Sans", "Noto Sans UI", "Roboto Mono", "Roboto Mono Light", "Roboto Mono Medium", "Roboto Mono Thin", "Sans Serif", "Serif")
 [02:48:03:921][Info]Core:linphone: QT: app/main.cpp:91: "Running app..."
 [02:48:03:921][Info]Core:linphone: Using (r/w) config information from /home/maxim/.config/linphone/linphonerc
 [02:48:03:922][Info]Core:linphone: Reading config information from /home/maxim/src/linphone-desktop-reference/build-5.2.4/OUTPUT/share/linphone/linphonerc-factory

 [02:48:04:051][Info]Core:linphone: QT: app/App.cpp:506: "Activated selectors:" ("custom", "en_US", "unix", "linux", "guix")
 [02:48:04:052][Info]Core:linphone: QT: app/App.cpp:743: "Registering types..."
 [02:48:04:053][Info]Core:linphone: QT: app/App.cpp:842: "Registering shared types..."
 [02:48:04:054][Info]Core:linphone: QT: app/App.cpp:864: "Registering tool types..."
 [02:48:04:054][Info]Core:linphone: QT: app/App.cpp:876: "Registering shared tool types..."

 [02:48:04:267][Info]Core:linphone: QT: app/App.cpp:564: "Loading main view..."

 [02:48:04:553][Info]Core:linphone: QT: components/core/CoreManager.cpp:261: "Launch async core creation."
 [02:48:04:554][Info]Core:linphone: Using (r/w) config information from /home/maxim/.config/linphone/linphonerc
 [02:48:04:554][Info]Core:linphone: Reading config information from /home/maxim/src/linphone-desktop-reference/build-5.2.4/OUTPUT/share/linphone/linphonerc-factory
 [02:48:04:568][Info]Core:linphone: Initializing LinphoneCore 5.3.41
 [02:48:04:568][Info]Core:linphone: Sal nat helper [enabled]

[...]

sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::UnconnectedState 
wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError 
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::UnconnectedState 
wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError 

 [...]

sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::UnconnectedState 
wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError 

 [02:48:10:285][Info]Core:linphone: No SRV results while A/AAAA fallback resulted arrived a while ago. Giving up SRV.

sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::UnconnectedState 
wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError 
 [02:48:12:845][Info]Core:linphone: Changing [client] [SUBSCRIBE] transaction [0x1bea6f0], from state [COMPLETED] to [TERMINATED]
 [02:48:12:845][Info]Core:linphone: Client SUBSCRIBE transaction [0x1bea6f0] terminated

sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::UnconnectedState 
wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError 

[repeated multiple times...]

sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState 
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState 
sQML Debugger: Socket state changed to QAbstractSocket::UnconnectedState 
wQML Debugger: Error: QAbstractSocket::ConnectionRefusedError 

dNOTE: ENGINE RUN FAILED
 Run failed.
dState changed from EngineRunRequested(3) to EngineRunFailed(4)
dState changed from EngineRunFailed(4) to EngineShutdownRequested(14)
dCALL: SHUTDOWN ENGINE
dNOTE: ENGINE SHUTDOWN FINISHED
dState changed from EngineShutdownRequested(14) to EngineShutdownFinished(15)
 Debugger finished.
dState changed from EngineShutdownFinished(15) to DebuggerFinished(16)

It looks like the argument -qmljsdebugger=port:42957,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation added by Qt Creator doesn't end up causing the 42957 port to listen for incoming connections.

Any clues about what might be going wrong?

Any pointers appreciated :-)