0

enter image description here

In debugger, the string variable is not showing me concise value I want to make debugger show me like 'test' = "aabb"

In someone else's debugger it`s showing exactly like that ('test' = "aabb") but mine not showing as like that..

please help me

user117474
  • 39
  • 1
  • 7
  • 1
    `sting` is a complicated little beastie and by default gdb shows *everything*. Assuming Visual Studio Code is sitting atop gdb for debugging, you're looking for what's called a "Pretty Printer". – user4581301 Aug 03 '21 at 16:40
  • How to not using gdb...? instead using what...? – user117474 Aug 03 '21 at 16:43
  • Using GDB is ok, you need to enable "pretty printing" in it. Where did you install it from? Different distributions can behave slightly different in this regard. – HolyBlackCat Aug 03 '21 at 16:44
  • I`m installed using MinGW installation Manager! I`m so sorry about to asking this but i don`t know how to enable pretty printing.. – user117474 Aug 03 '21 at 16:47
  • 1
    probably want to upvote this issue: https://github.com/microsoft/vscode-cpptools/issues/3423 – Alan Birtles Aug 03 '21 at 16:49
  • There are many MinGW distributions. From what link did you download yours? – HolyBlackCat Aug 03 '21 at 16:51
  • https://sourceforge.net/projects/mingw/ I was using this – user117474 Aug 03 '21 at 16:53
  • With Marking mingw-developer-toolkit mingw32-base mingw32-gcc-g++ msys-base – user117474 Aug 03 '21 at 17:00
  • 2
    The plain MinGW is bad for several reasons (no multithreading support, etc). https://www.msys2.org/ (or some other MinGW-w64 variant) is better. Last time I checked, in MSYS2 pretty-printing could be enabled with `python register_libstdcxx_printers(None)`. (In VSC you need to prepend `-exec ` to the command and run it in the debug console, I think). – HolyBlackCat Aug 03 '21 at 17:01
  • 1
    If you have no loyalty to a tool chain or requirement to use a tool chain, consider using Visual Studio ([Community edition is "free"](https://visualstudio.microsoft.com/free-developer-offers/)). Because Microsoft runs the ecosystem pretty much end-to-end, they can make sure all of the pieces fit. When you have a generalist program like VS Code the Pretty Printers can't easily keep up with all of the different the compilers and library revisions. – user4581301 Aug 03 '21 at 17:02
  • Please begin your comments with `@username`, otherwise we don't get notifications. – HolyBlackCat Aug 03 '21 at 17:02
  • @user4581301 VSC doesn't provide pretty printers. They normally come with MinGW itself, but sometimes need to be manually enabled. – HolyBlackCat Aug 03 '21 at 17:03
  • @HolyBlackCat Doesn't surprise me. If you can't keep up, the only sane option is not try and go with something that ALWAYS works. – user4581301 Aug 03 '21 at 17:04
  • @HolyBlackCat Thanks I`m considering uninstall mingw and reinstalling this version https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download is this will be fix the problem? – user117474 Aug 03 '21 at 17:07
  • 1
    Its better to use msys2 to provide mingw. https://www.msys2.org/ – drescherjm Aug 03 '21 at 17:07
  • @user4581301 Thanks but theme of vscode is soooo good – user117474 Aug 03 '21 at 17:08
  • @drescherjm there is so many version of mingw... – user117474 Aug 03 '21 at 17:09
  • 1
    msys2 provides a current version of mingw and also comes with a package manager that will make installing and updating many open source packages very easily. This is why I recommend it if you need to use mingw instead of msvc on windows. – drescherjm Aug 03 '21 at 17:10
  • @drescherjm Okay i will trust you instead of installing https://sourceforge.net/projects/mingw-w64/ – user117474 Aug 03 '21 at 17:12
  • 1
    Joining in on the recommendation of msys2. The ecosystem of libraries it has will save you from a LOT of library compiling and wrangling when your programs get more complicated. – user4581301 Aug 03 '21 at 17:13
  • Thank you all who ever is helped me even my english is worse (I`m not native speaker of english) – user117474 Aug 03 '21 at 17:13
  • 1
    Here is a good set of msys2 installation instructions: [How to install MinGW-w64 and MSYS2?](https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2) – user4581301 Aug 03 '21 at 17:14

0 Answers0