This is a detailed test on how the log message goes with gdb-mi.
Create a simple wxWidgets application, by default, it was a GUI application, so no console window will show when the app runs.
Put the code in the app's init stage
wxLog::SetActiveTarget(new wxLogStderr());
Put the code in one event handler of the wxFrame:
wxLogMessage(wxT("HI from wxLogMessage"));
wxPuts(wxT("HI from wxPuts"));
Here are the test and result:
Set the project as a "GUI" project, build, run app under CodeblocksCase one:Run: no console was created, no "HI" messages.
Case two:Run under gdb-mi debugger plugin: no console was created, and the "HI from wxLogMessage" will shown in the gdb-mi console, the log looks like:
[debug]unparsable_output==>&"warning: 16:47:44: HI from wxLogMessage\r\n"
[debug]unparsable_output==>&"\n"
Set the project as a "console" project, build, run app under CodeblocksCase three:Run: console window was show, and both messages were shown in the console like below:
16:58:42: HI from wxLogMessage
HI from wxPuts
Case four:Run under gdb-mi plugin: The same as Case three, besides that, the gdb-mi also receive the wxLogMessage like case Two.
Set the project as a "console" project, build, run app under Windows Shell gdb command line.Case five:Start the gdb like:
E:\code\cb\test_code\wxLogMessageVswxPuts\bin\Debug>gdb.exe --interpreter=mi wxLogMessageVswxPuts.exe
Then hit "r" command, there will be three message show in the gdb's console
17:05:10: HI from wxLogMessage
&"warning: 17:05:10: HI from wxLogMessage\r\n"
&"\n"
HI from wxPuts
Case six:Start the gdb like:
E:\code\cb\test_code\wxLogMessageVswxPuts\bin\Debug>gdb.exe --interpreter=mi wxLogMessageVswxPuts.exe
Then enter "-gdb-set new-console on", then "r" command
The result is:
17:11:32: HI from wxLogMessage
HI from wxPuts
the above message will go to the new-console, and the gdb-mi console will still receive an ugly message:
&"warning: 17:11:32: HI from wxLogMessage\r\n"
&"\n
So, as a conclusion:
1, I prefer use wxPuts if I would like to debug under gdb-mi, otherwise, those "warnings" are annoying.
2, I use "-gdb-set new-console on", this is currently the only way to create a new console under gdb-mi.