microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

Can't see OutputDebugString (Windows) output via GDB in Debug Console #3276

Closed joshgentry closed 3 years ago

joshgentry commented 5 years ago

Type: Debugger

I thought this might be related to #140 but it's been a while and seems to present somewhat differently.

The issue is that, for a Win32 GUI app, compiled via GCC (MinGW), I'm having a very hard time getting debug messages to show up in the Debug Console in any readable way while debugging with GDB.

To Reproduce Here is my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "preLaunchTask": "Build (Debug)",
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}\\build\\test.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "internalConsoleOptions": "openOnSessionStart",
            "MIMode": "gdb",
            "miDebuggerPath": "gdb.exe",
            "miDebuggerArgs": "-silent",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Reduce gdb verbosity",
                    "text": "set print thread-events off",
                    "ignoreFailures": true
                }
            ],
            "logging": {
                //"engineLogging": true
            }
        }
    ]
}

Note that with "engineLogging" set to true, the messages do show up, buried amongst many others (maybe an issue with filtering?) but they are hardly readable by being globbed together with other metadata.

Here is my tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build (Debug)",
            "type": "shell",
            "command": "gcc",
            "args": [
                "-mwindows",
                "-DUNICODE",
                "-D_UNICODE",
                "-DDEBUG",
                "-D_DEBUG",
                "-g",
                "${workspaceFolder}\\*.c",
                "-o",
                "${workspaceFolder}\\build\\test.exe"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

And here is the very simple source file, test.c, that succeeds at prompting a MessageBox and not much else:

#include <windows.h>
#include <stdio.h>

int CALLBACK WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
{
    OutputDebugString(L"This is a test of OutputDebugString");
    OutputDebugString(L"This is a test of OutputDebugString");
    OutputDebugString(L"This is a test of OutputDebugString");
    printf("This is a test to see if stdout is redirected even in Win32 app");
    MessageBox(NULL, L"Of the MessageBox", L"This is a test", 0);
    return 0;
}

With the above configuration, the minimal logging (due to -silent on gdb, and note that this has no effect on the output of the relevant logs) is:

=thread-group-added,id="i1"
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"

Thread 1 hit Breakpoint 1, 0x0000000000402ca9 in main ()
=library-unloaded,id="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",target-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",host-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",thread-group="i1"
[Inferior 1 (process 24620) exited normally]
The program 'D:\Dropbox\devel\test\build\test.exe' has exited with code 0 (0x00000000).

With expanded logging (engineLogging=true), the following is the output:

1: (80) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'

1: (90) LaunchOptions  ExePath='D:\Dropbox\devel\test\build\test.exe'

1: (90) LaunchOptions  WorkingDirectory='D:\Dropbox\devel\test'

1: (90) LaunchOptions  ExeArguments=''

1: (91) LaunchOptions  MIMode='gdb'

1: (91) LaunchOptions  MIDebuggerPath='gdb.exe'

1: (91) LaunchOptions  MIDebuggerArgs='-silent'

1: (91) LaunchOptions  WaitDynamicLibLoad='false'

1: (91) LaunchOptions  ExternalConsole='true'

1: (91) LaunchOptions>

1: (91) LaunchOptions    <SetupCommands>

1: (91) LaunchOptions        <Command IgnoreFailures='true' Description='Enable pretty-printing for gdb'>-enable-pretty-printing</Command>

1: (91) LaunchOptions        <Command IgnoreFailures='true' Description='Reduce gdb verbosity'>set print thread-events off</Command>

1: (91) LaunchOptions    </SetupCommands>

1: (91) LaunchOptions</LocalLaunchOptions>

1: (125) Starting: "C:\Users\Josh\scoop\apps\gcc\current\bin\gdb.exe" --interpreter=mi -silent

1: (130) DebuggerPid=25132

1: (192) ->=thread-group-added,id="i1"

1: (202) ->(gdb)

1: (204) <-1001-gdb-set target-async on

1: (213) ->1001^done

1: (213) ->(gdb)

1: (213) ->&"\n"

1: (213) ->^done

1: (213) ->(gdb)

1: (214) 1001: elapsed time 9

1: (219) <-1002-enable-pretty-printing

1: (224) ->1002^done

1: (224) ->(gdb)

1: (224) 1002: elapsed time 4

1: (224) ->&"\n"

1: (224) ->^done

1: (224) ->(gdb)

1: (226) <-1003-interpreter-exec console "set print thread-events off"

1: (234) ->=cmd-param-changed,param="print thread-events",value="off"

1: (234) ->1003^done

1: (234) ->(gdb)

1: (234) ->&"\n"

1: (234) ->^done

1: (234) ->(gdb)

1: (234) 1003: elapsed time 8

1: (235) <-1004-interpreter-exec console "set pagination off"

1: (245) ->=cmd-param-changed,param="pagination",value="off"

1: (245) ->1004^done

1: (245) ->(gdb)

1: (245) ->&"\n"

1: (245) ->^done

1: (245) ->(gdb)

1: (245) 1004: elapsed time 9

1: (245) <-1005-gdb-set auto-solib-add on

1: (256) ->1005^done

1: (256) ->(gdb)

1: (256) ->&"\n"

1: (256) ->^done

1: (256) ->(gdb)

1: (256) 1005: elapsed time 10

1: (257) <-1006-gdb-set solib-search-path D:\\Dropbox\\devel\\test\\build;

1: (267) ->1006^done

1: (267) ->(gdb)

1: (267) ->&"\n"

1: (267) ->^done

1: (267) ->(gdb)

1: (267) 1006: elapsed time 9

1: (268) <-1007-environment-cd D:\\Dropbox\\devel\\test

1: (278) ->1007^done

1: (278) ->(gdb)

1: (278) ->&"\n"

1: (278) ->^done

1: (278) ->(gdb)

1: (278) 1007: elapsed time 9

1: (279) <-1008-gdb-set new-console on

1: (288) ->1008^done

1: (288) ->(gdb)

1: (288) 1008: elapsed time 9

1: (288) <-1009-interpreter-exec console "show configuration"

1: (288) ->&"\n"

1: (288) ->^done

1: (288) ->(gdb)

1: (299) ->~"This GDB was configured as follows:\n   configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32\n"

1: (299) ->~"             --with-auto-load-dir=$debugdir:$datadir/auto-load\n             --with-auto-load-safe-path=$debugdir:$datadir/auto-load\n"

1: (299) ->~"             --with-expat\n"

1: (299) ->~"             --with-gdb-datadir=/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/share/gdb (relocatable)\n"

1: (299) ->~"             --with-jit-reader-dir=/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/lib/gdb (relocatable)\n"

1: (299) ->~"             --without-libunwind-ia64\n"

1: (299) ->~"             --without-lzma\n"

1: (299) ->~"             --with-python=/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/opt (relocatable)\n"

1: (300) ->~"             --without-guile\n"

1: (300) ->~"             --with-separate-debug-dir=/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/lib/debug (relocatable)\n"

1: (300) ->~"             --with-system-gdbinit=/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/etc/gdbinit (relocatable)\n"

1: (300) ->~"             --without-babeltrace\n"

1: (300) ->~"\n(\"Relocatable\" means the directory can be moved with the GDB installation\ntree, and GDB will still find it.)\n"

1: (300) ->1009^done

1: (300) ->(gdb)

1: (300) ->&"\n"

1: (301) ->^done

1: (301) ->(gdb)

1: (300) 1009: elapsed time 11

1: (303) <-1010-file-exec-and-symbols D:\\Dropbox\\devel\\test\\build\\test.exe

1: (312) ->1010^done

1: (312) ->(gdb)

1: (313) ->&"\n"

1: (313) ->^done

1: (313) ->(gdb)

1: (312) 1010: elapsed time 8

1: (313) <-1011-interpreter-exec console "show architecture"

1: (323) ->~"The target architecture is set automatically (currently i386:x86-64)\n"

1: (323) ->1011^done

1: (323) ->(gdb)

1: (323) 1011: elapsed time 9

1: (323) ->&"\n"

1: (323) ->^done

1: (323) ->(gdb)

1: (324) <-1012-break-insert -f main

1: (334) ->1012^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000402ca9",at="<main+9>",thread-groups=["i1"],times="0",original-location="main"}

1: (334) ->(gdb)

1: (334) ->&"\n"

1: (334) ->^done

1: (334) ->(gdb)

1: (337) 1012: elapsed time 12

=thread-group-added,id="i1"
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
1: (376) <-1013-exec-run

1: (392) ->=thread-group-started,id="i1",pid="5012"

1: (392) ->=thread-created,id="1",group-id="i1"

1: (394) ->=thread-created,id="2",group-id="i1"

1: (395) ->=thread-created,id="3",group-id="i1"

1: (395) ->=thread-created,id="4",group-id="i1"

1: (396) <-1014-thread-info 1

1: (397) <-1015-thread-info 2

1: (397) <-1016-thread-info 3

1: (397) <-1017-thread-info 4

1: (399) ->=library-loaded,id="C:\\WINDOWS\\SYSTEM32\\ntdll.dll",target-name="C:\\WINDOWS\\SYSTEM32\\ntdll.dll",host-name="C:\\WINDOWS\\SYSTEM32\\ntdll.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd2a3f1000",to="0x00007ffd2a5dc520"}]

1: (400) ->=library-loaded,id="C:\\WINDOWS\\System32\\kernel32.dll",target-name="C:\\WINDOWS\\System32\\kernel32.dll",host-name="C:\\WINDOWS\\System32\\kernel32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd278e1000",to="0x00007ffd2799224c"}]

1: (400) ->=library-loaded,id="C:\\WINDOWS\\System32\\KernelBase.dll",target-name="C:\\WINDOWS\\System32\\KernelBase.dll",host-name="C:\\WINDOWS\\System32\\KernelBase.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd26691000",to="0x00007ffd269222d4"}]

1: (401) ->=library-loaded,id="C:\\WINDOWS\\System32\\msvcrt.dll",target-name="C:\\WINDOWS\\System32\\msvcrt.dll",host-name="C:\\WINDOWS\\System32\\msvcrt.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd29bd1000",to="0x00007ffd29c6d4a8"}]

1: (401) ->=library-loaded,id="C:\\WINDOWS\\System32\\user32.dll",target-name="C:\\WINDOWS\\System32\\user32.dll",host-name="C:\\WINDOWS\\System32\\user32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd29881000",to="0x00007ffd29a16410"}]

1: (401) ->=library-loaded,id="C:\\WINDOWS\\System32\\win32u.dll",target-name="C:\\WINDOWS\\System32\\win32u.dll",host-name="C:\\WINDOWS\\System32\\win32u.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd26ad1000",to="0x00007ffd26aef014"}]

1: (401) ->=library-loaded,id="C:\\WINDOWS\\System32\\gdi32.dll",target-name="C:\\WINDOWS\\System32\\gdi32.dll",host-name="C:\\WINDOWS\\System32\\gdi32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd278b1000",to="0x00007ffd278d853c"}]

1: (402) ->=library-loaded,id="C:\\WINDOWS\\System32\\gdi32full.dll",target-name="C:\\WINDOWS\\System32\\gdi32full.dll",host-name="C:\\WINDOWS\\System32\\gdi32full.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd26931000",to="0x00007ffd26ac9ca4"}]

1: (402) ->=library-loaded,id="C:\\WINDOWS\\System32\\msvcp_win.dll",target-name="C:\\WINDOWS\\System32\\msvcp_win.dll",host-name="C:\\WINDOWS\\System32\\msvcp_win.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd272f1000",to="0x00007ffd2738f7ec"}]

1: (403) ->=library-loaded,id="C:\\WINDOWS\\System32\\ucrtbase.dll",target-name="C:\\WINDOWS\\System32\\ucrtbase.dll",host-name="C:\\WINDOWS\\System32\\ucrtbase.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd264e1000",to="0x00007ffd265dba70"}]

1: (467) ->1013^running

1: (467) ->*running,thread-id="all"

1: (467) 1013: elapsed time 90

1: (467) ->(gdb)

1: (470) ->=library-loaded,id="C:\\WINDOWS\\System32\\imm32.dll",target-name="C:\\WINDOWS\\System32\\imm32.dll",host-name="C:\\WINDOWS\\System32\\imm32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd276a1000",to="0x00007ffd276cd0d8"}]

1: (472) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000402ca9",at="<main+9>",thread-groups=["i1"],times="1",original-location="main"}

1: (472) ->~"\n"

1: (473) ->~"Thread 1 hit Breakpoint 1, 0x0000000000402ca9 in main ()\n"

1: (473) ->*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000402ca9",func="main",args=[]},thread-id="1",stopped-threads="all"

1: (473) ->(gdb)

1: (473) ->&"\n"

1: (473) ->^done

1: (473) ->(gdb)

1: (473) ->1014^done,threads=[{id="1",target-id="Thread 5012.0x126c",frame={level="0",addr="0x0000000000402ca9",func="main",args=[]},state="stopped"}]

1: (473) ->(gdb)

1: (473) ->&"\n"

1: (473) ->^done

1: (474) ->(gdb)

1: (474) ->1015^done,threads=[{id="2",target-id="Thread 5012.0x51a0",frame={level="0",addr="0x00007ffd2a492fe4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\WINDOWS\\SYSTEM32\\ntdll.dll"},state="stopped"}]

1: (474) ->(gdb)

1: (474) ->&"\n"

1: (474) ->^done

1: (474) ->(gdb)

1: (474) ->1016^done,threads=[{id="3",target-id="Thread 5012.0x1d50",frame={level="0",addr="0x00007ffd2a492fe4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\WINDOWS\\SYSTEM32\\ntdll.dll"},state="stopped"}]

1: (474) ->(gdb)

1: (474) ->&"\n"

1: (474) ->^done

1: (474) ->(gdb)

1: (475) ->1017^done,threads=[{id="4",target-id="Thread 5012.0x3138",frame={level="0",addr="0x00007ffd2a492fe4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\WINDOWS\\SYSTEM32\\ntdll.dll"},state="stopped"}]

1: (475) ->(gdb)

1: (475) ->&"\n"

1: (475) ->^done

1: (475) ->(gdb)

Thread 1 hit Breakpoint 1, 0x0000000000402ca9 in main ()
1: (485) <-1018-thread-info

1: (487) 1014: elapsed time 90

1: (490) 1015: elapsed time 92

1: (490) 1016: elapsed time 92

1: (490) 1017: elapsed time 92

1: (496) ->1018^done,threads=[{id="1",target-id="Thread 5012.0x126c",frame={level="0",addr="0x0000000000402ca9",func="main",args=[]},state="stopped"},{id="2",target-id="Thread 5012.0x51a0",frame={level="0",addr="0x00007ffd2a492fe4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\WINDOWS\\SYSTEM32\\ntdll.dll"},state="stopped"},{id="3",target-id="Thread 5012.0x1d50",frame={level="0",addr="0x00007ffd2a492fe4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\WINDOWS\\SYSTEM32\\ntdll.dll"},state="stopped"},{id="4",target-id="Thread 5012.0x3138",frame={level="0",addr="0x00007ffd2a492fe4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\WINDOWS\\SYSTEM32\\ntdll.dll"},state="stopped"}],current-thread-id="1"

1: (496) ->(gdb)

1: (496) 1018: elapsed time 10

1: (496) ->&"\n"

1: (497) ->^done

1: (497) ->(gdb)

1: (504) <-1019-stack-list-frames 0 1000

1: (507) ->1019^done,stack=[frame={level="0",addr="0x0000000000402ca9",func="main"}]

1: (507) ->(gdb)

1: (507) ->&"\n"

1: (507) ->^done

1: (507) ->(gdb)

1: (507) 1019: elapsed time 2

1: (512) <-1020-break-delete 1

1: (518) ->1020^done

1: (518) ->(gdb)

1: (518) ->&"\n"

1: (518) ->^done

1: (518) ->(gdb)

1: (518) 1020: elapsed time 5

1: (521) <--exec-continue

1: (529) ->^running

1: (529) ->*running,thread-id="all"

1: (529) ->(gdb)

1: (529) ->&"warning: This is a test of OutputDebugString\n"

1: (529) ->&"warning: This is a test of OutputDebugString\n"

1: (529) ->&"warning: This is a test of OutputDebugString\n"

1: (536) ->=library-loaded,id="C:\\WINDOWS\\system32\\uxtheme.dll",target-name="C:\\WINDOWS\\system32\\uxtheme.dll",host-name="C:\\WINDOWS\\system32\\uxtheme.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd24621000",to="0x00007ffd246bb1c4"}]

1: (540) ->=library-loaded,id="C:\\WINDOWS\\System32\\combase.dll",target-name="C:\\WINDOWS\\System32\\combase.dll",host-name="C:\\WINDOWS\\System32\\combase.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd27a51000",to="0x00007ffd27d7c43c"}]

1: (546) ->=library-loaded,id="C:\\WINDOWS\\System32\\rpcrt4.dll",target-name="C:\\WINDOWS\\System32\\rpcrt4.dll",host-name="C:\\WINDOWS\\System32\\rpcrt4.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd29a31000",to="0x00007ffd29b51790"}]

1: (552) ->=library-loaded,id="C:\\WINDOWS\\System32\\bcryptprimitives.dll",target-name="C:\\WINDOWS\\System32\\bcryptprimitives.dll",host-name="C:\\WINDOWS\\System32\\bcryptprimitives.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd275a1000",to="0x00007ffd2761d460"}]

1: (558) ->=library-loaded,id="C:\\WINDOWS\\System32\\msctf.dll",target-name="C:\\WINDOWS\\System32\\msctf.dll",host-name="C:\\WINDOWS\\System32\\msctf.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd27731000",to="0x00007ffd278992a0"}]

1: (563) ->=library-loaded,id="C:\\WINDOWS\\System32\\oleaut32.dll",target-name="C:\\WINDOWS\\System32\\oleaut32.dll",host-name="C:\\WINDOWS\\System32\\oleaut32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd27e21000",to="0x00007ffd27eea994"}]

1: (570) ->=library-loaded,id="C:\\WINDOWS\\system32\\dwmapi.dll",target-name="C:\\WINDOWS\\system32\\dwmapi.dll",host-name="C:\\WINDOWS\\system32\\dwmapi.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd24951000",to="0x00007ffd2497d14c"}]

1: (575) ->=library-loaded,id="C:\\WINDOWS\\System32\\crypt32.dll",target-name="C:\\WINDOWS\\System32\\crypt32.dll",host-name="C:\\WINDOWS\\System32\\crypt32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd27391000",to="0x00007ffd2756ae4c"}]

1: (581) ->=library-loaded,id="C:\\WINDOWS\\System32\\msasn1.dll",target-name="C:\\WINDOWS\\System32\\msasn1.dll",host-name="C:\\WINDOWS\\System32\\msasn1.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd26471000",to="0x00007ffd26481018"}]

1: (586) ->=library-loaded,id="C:\\WINDOWS\\System32\\cryptsp.dll",target-name="C:\\WINDOWS\\System32\\cryptsp.dll",host-name="C:\\WINDOWS\\System32\\cryptsp.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd264c1000",to="0x00007ffd264d6138"}]

1: (592) ->=library-loaded,id="C:\\WINDOWS\\System32\\kernel.appcore.dll",target-name="C:\\WINDOWS\\System32\\kernel.appcore.dll",host-name="C:\\WINDOWS\\System32\\kernel.appcore.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd26451000",to="0x00007ffd26460094"}]

1: (605) ->=library-loaded,id="C:\\WINDOWS\\System32\\TextInputFramework.dll",target-name="C:\\WINDOWS\\System32\\TextInputFramework.dll",host-name="C:\\WINDOWS\\System32\\TextInputFramework.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd13e81000",to="0x00007ffd13f14fb0"}]

1: (611) ->=library-loaded,id="C:\\WINDOWS\\System32\\sechost.dll",target-name="C:\\WINDOWS\\System32\\sechost.dll",host-name="C:\\WINDOWS\\System32\\sechost.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd27d81000",to="0x00007ffd27e1d340"}]

1: (618) ->=library-loaded,id="C:\\WINDOWS\\System32\\CoreMessaging.dll",target-name="C:\\WINDOWS\\System32\\CoreMessaging.dll",host-name="C:\\WINDOWS\\System32\\CoreMessaging.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd240d1000",to="0x00007ffd241b1c88"}]

1: (624) ->=library-loaded,id="C:\\WINDOWS\\System32\\CoreUIComponents.dll",target-name="C:\\WINDOWS\\System32\\CoreUIComponents.dll",host-name="C:\\WINDOWS\\System32\\CoreUIComponents.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd13a11000",to="0x00007ffd13d311ac"}]

1: (630) ->=library-loaded,id="C:\\WINDOWS\\SYSTEM32\\ntmarta.dll",target-name="C:\\WINDOWS\\SYSTEM32\\ntmarta.dll",host-name="C:\\WINDOWS\\SYSTEM32\\ntmarta.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd254c1000",to="0x00007ffd254f0214"}]

1: (636) ->=library-loaded,id="C:\\WINDOWS\\System32\\SHCore.dll",target-name="C:\\WINDOWS\\System32\\SHCore.dll",host-name="C:\\WINDOWS\\System32\\SHCore.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd280b1000",to="0x00007ffd281572b4"}]

1: (643) ->=library-loaded,id="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",target-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",host-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd1fc41000",to="0x00007ffd1fd926f4"}]

1: (649) ->=library-loaded,id="C:\\WINDOWS\\System32\\advapi32.dll",target-name="C:\\WINDOWS\\System32\\advapi32.dll",host-name="C:\\WINDOWS\\System32\\advapi32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd2a1b1000",to="0x00007ffd2a25280c"}]

1: (659) ->=library-loaded,id="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",target-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",host-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x0000000004111000",to="0x00000000042626f4"}]

1: (665) ->=library-unloaded,id="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",target-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",host-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",thread-group="i1"

=library-unloaded,id="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",target-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",host-name="C:\\WINDOWS\\SYSTEM32\\WinTypes.dll",thread-group="i1"
1: (2262) ->=library-loaded,id="C:\\WINDOWS\\System32\\ole32.dll",target-name="C:\\WINDOWS\\System32\\ole32.dll",host-name="C:\\WINDOWS\\System32\\ole32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffd2a261000",to="0x00007ffd2a3b4130"}]

1: (2262) ->=thread-exited,id="4",group-id="i1"

1: (2262) ->=thread-exited,id="2",group-id="i1"

1: (2262) ->=thread-exited,id="3",group-id="i1"

1: (2262) ->~"[Inferior 1 (process 5012) exited normally]\n"

1: (2263) ->=thread-exited,id="1",group-id="i1"

1: (2263) ->=thread-group-exited,id="i1",exit-code="0"

1: (2263) ->*stopped,reason="exited-normally"

1: (2263) ->(gdb)

[Inferior 1 (process 5012) exited normally]
1: (2264) ->&"\n"

1: (2264) ->^done

1: (2264) ->(gdb)

1: (2267) <-logout

The program 'D:\Dropbox\devel\test\build\test.exe' has exited with code 0 (0x00000000).

1: (2273) <--gdb-exit

As you can see, the messages are there, just buried and not quite what you'd expect from a debug output (ie. in Visual Studio, these messages are logged directly to the output). Here is the snippet of relevance:

1: (529) ->&"warning: This is a test of OutputDebugString\n"

1: (529) ->&"warning: This is a test of OutputDebugString\n"

1: (529) ->&"warning: This is a test of OutputDebugString\n"

I've been disappointingly scratching my head for a while at this and not sure where to go from here. Appreciate any help and happy to answer any questions.

WardenGnaw commented 5 years ago

It looks like GDB is outputting these strings as log-stream output so you will need to have engineLogging enabled. There is no good way for us to only have DebugOutputStrings shown.

log-stream-output →
"&" c-string nl

From https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax

Also, is there a reason why you are using gcc and gdb instead of cl and the windows c++ debugger?

joshgentry commented 5 years ago

@WardenGnaw, thanks for the response. I prefer to use gcc and gdb because this project builds across platforms and is developed with the same stack on each (Linux / OSX / Windows all using GCC and GDB for debugging).

Is there a way, that I might have missed in my searches, to filter the output with a RegEx or based on log type?

edit: I realize the example using OutputDebugString is odd given the cross-platform build desire, but there are Windows-specific chunks of code locked in #ifdef blocks that occasionally leverage this function (for now).

github-actions[bot] commented 3 years ago

This issue has been closed automatically because it's labeled as 'by design'.

ARNik commented 1 year ago

@joshgentry have you managed to solve this issue? I have the same problem now. And do not want to change the toolchain.