Attach to Remote Running Debugging Server with CDB
-
Hi,
So first I'm a bit new with the Qt environement.
I'm trying to remote debug a program that crash more or less randomly.
I managed to setup the remote cdb server following the Launching the Debugger documentation page.When I launch the server with
cdb.exe -server tcp:port=1234 <executable>
it launches and stops at initial breakpoint until I connect to it with my local Qt Creator using "Debug -> Start Debugging -> Attach to Remote CDB Session...".
Problem is; I don't want it to wait on me to connect. It would disrupt the workflow of the people using the program so I want it to launch through CDB and me to be able to connect to it if/when it crashes.So I found, following instructions on the CDB Command-Line Options documentation page, that launching cdb with -g will bypass the initial breakpoint.
The plan was for me to connect to the server using Qt Creator "Debug -> Start Debugging -> Attach to Running Debug Server...".Well long story short it doesn't work.
I end up with a process that immediatly ends and this in Debugger Log (partial extract of the log)
15:38:39.290 [32ms] sStarting debugger "CdbEngine" for ABI "x86-windows-msvc2015-pe-32bit"... t15:38:39.290 dStart parameters: 'chla.exe (Desktop Qt 5.6.3 MSVC2015 32bit)' mode: 6 dABI: x86-windows-msvc2015-pe-32bit dLanguages: c++ dExecutable: D:\Projets\chla\build\debug\chla.exe dDirectory: D:\Projets\chla\build\debug dDebugger: C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe dRemote: 192.168.1.97:1234 dSysroot: dDebug Source Location: t15:38:39.290 dDebugger settings: dUseToolTips: true (default: true) dBreakEvent: (default: ) dBreakOnCrtDbgReport: true (default: false) *** dSymbolPaths: D:\Temp\symbolcache (default: ) *** dSourcePaths: (default: ) dGdbCustomDumperCommands: (default: ) dAdditionalArguments: (default: ) dAlwaysAdjustColumnWidths: true (default: true) dExtraDumperFile: (default: ) dLogTimeStamps: true (default: false) *** dAutoQuit: false (default: false) dFontSizeFollowsEditor: false (default: false) dUseMessageBoxForSignals: true (default: true) dUseAlternatingRowColours: false (default: false) dUseDebuggingHelper: true (default: true) dUseCodeModel: true (default: true) dRaiseOnInterrupt: true (default: true) dStationaryEditorWhileStepping: false (default: false) dSwitchModeOnExit: false (default: false) dBreakpointsFullPath: false (default: false) dCloseBuffersOnExit: false (default: false) dCloseMemoryBuffersOnExit: false (default: true) *** dBreakOnAbort: false (default: false) dShowQmlObjectTree: true (default: true) dBreakOnWarning: false (default: false) dBreakOnFatal: false (default: false) dBreakOnThrow: false (default: false) dBreakOnCatch: false (default: false) dNoPluginBreakpoints: false (default: false) dSelectedPluginBreakpointsPattern: .* (default: .*) dQmlInspector.ShowAppOnTop: false (default: false) dSortStructMembers: true (default: true) dAutoDerefPointers: true (default: true) dShowQtNamespace: true (default: true) dShowQObjectNames: false (default: false) dShowStandardNamespace: true (default: true) dMaximalStackDepth: 20 (default: 20) dSelectedPluginBreakpoints: false (default: false) dAdjustBreakpointLocations: true (default: true) dAllPluginBreakpoints: true (default: true) dSkipKnownFrames: false (default: false) dEnableReverseDebugging: false (default: false) dMaximalStringLength: 10000 (default: 10000) dDisplayStringLimit: 100 (default: 100) dGdbStartupCommands: (default: ) dGdbPostAttachCommands: (default: ) dLoadGdbDumpers2: false (default: false) dAttemptQuickStart: false (default: false) dIgnoreFirstChanceAccessViolation: true (default: false) *** dLoadGdbInit: true (default: true) dCDB_Console: true (default: false) *** dBreakpointCorrection: true (default: true) dIntelFlavor: false (default: false) dIdentifyDebugInfoPackages: false (default: false) dWarnOnReleaseBuilds: true (default: true) dMultiInferior: false (default: false) dUseDynamicType: true (default: true) dTargetAsync: false (default: false) dWatchdogTimeout: 20 (default: 20) dAutoEnrichParameters: true (default: true) dUseAddressInStackView: false (default: false) dRegisterForPostMortem: false (default: false) dUseToolTipsInBreakpointsView: false (default: true) *** dUseAddressInBreakpointsView: false (default: false) dUseToolTipsInLocalsView: false (default: false) dUseToolTipsInBreakpointsView: false (default: false) dShowThreadNames: false (default: false) t15:38:39.290 dState changed from DebuggerNotReady(0) to EngineSetupRequested(1) [master] t15:38:39.290 dQUEUE: SETUP ENGINE t15:38:39.313 [23ms] dCALL: SETUP ENGINE t15:38:39.313 Launching C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe -remote 192.168.1.97:1234 -lines -G -c .idle_cmd !qtcreatorcdbext.idle -x using C:\Qt\Qt5.6.3\Tools\QtCreator\lib\qtcreatorcdbext32\qtcreatorcdbext.dll of 05.07.2016 03:16. t15:38:39.313 C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe running as 8292 t15:38:39.313 <.load qtcreatorcdbext.dll t15:38:39.313 dNOTE: ENGINE SETUP OK t15:38:39.313 dState changed from EngineSetupRequested(1) to EngineSetupOk(3) [master] t15:38:39.313 dQUEUE: SETUP INFERIOR t15:38:39.313 dState changed from EngineSetupOk(3) to InferiorSetupRequested(4) [master] t15:38:39.313 dQUEUE: SETUP INFERIOR t15:38:39.343 [30ms] dCALL: SETUP INFERIOR t15:38:39.343 <.sympath "D:\Temp\symbolcache" t15:38:39.343 <sxn 0x4000001f t15:38:39.343 <sxn ibp t15:38:39.343 <.asm source_line t15:38:39.343 <!qtcreatorcdbext.setparameter maxStringLength=10000 maxStackDepth=20 t15:38:39.343 <pid t15:38:39.359 [16ms] DebugConnect failed, Win32 error 0n87 t15:38:39.359 The parameter is incorrect. t15:38:39.359 Ensure the syntax used for the transport settings is correct. t15:38:39.359 eERROR: Process crashed t15:38:39.359 dCDB PROCESS FINISHED, status 1, exit code -2147024809 t15:38:39.359 dNOTE: ENGINE ILL ****** t15:38:39.359 dState changed from InferiorSetupRequested(4) to EngineShutdownRequested(19) [master] t15:38:39.359 dQUEUE: SHUTDOWN ENGINE t15:38:39.359 dCALL: SHUTDOWN ENGINE t15:38:39.359 dNOTE: ENGINE SHUTDOWN OK t15:38:39.374 [15ms] dState changed from EngineShutdownRequested(19) to EngineShutdownOk(21) [master] t15:38:39.374 dState changed from EngineShutdownOk(21) to DebuggerFinished(22) [master] t15:38:39.374 dQUEUE: FINISH DEBUGGER t15:38:39.374 dNOTE: FINISH DEBUGGER t15:38:39.374 dHANDLE RUNCONTROL FINISHED t15:38:39.374 sDebugger finished.
I don't know if those information are useful but I'm using
Qt Creator 4.0.3
and the kit is composed of
- Compiler: Microsoft Visual C++ Compiler 14.0 (x86)
- Debugger: CDB (x86) 10.0.20348.1
- Qt version: Qt 5.6.3 MSVC2015 32bit
- CMake Tool: Cmake 32bit
What I don't understand is that I can remote debug when using "Attach to Remote CDB Session..." and the remote debugger wait on my connection but not when the server and debugger is already running.
Is there something I didn't understand or did wrong?
Is it something that only works with GDB? (someone else manage to do it with another project using GDB).What can I do to remote debug?
Should this not be possible, is it possible to make a core dump of the program when it crashes and open it in Qt after the fact to copy the state the program was in during the crash? Is there a better way? -