Debugging C++ in Visual Studio Code

0

I just want to learn how to debug in Visual Studio Code as i do not want to download a heavier IDE as VS2019 for example. Here is the simple program i want to debug without any breakpoints whatsoever.

#include <iostream>   
void print(std::string arg){
  std::cout << arg << std::endl;
}

int main(){
  std::string name = "Name";
  print(name);
  return 0;
}

It "debugs" but i don't see anything as i expected to see. No memory no outputs just this in terminal:

Name [1] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-ycr78o29.7j7" 1>"/tmp/Microsoft-MIEngine-Out-epnjc9my.6yh"

And this in debug console:

=thread-group-added,id="i1"
GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.

Breakpoint 1, 0x00005555555552c4 in main ()
Loaded '/lib/x86_64-linux-gnu/libstdc++.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libgcc_s.so.1'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libc.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libm.so.6'. Symbols loaded.
[Inferior 1 (process 6126) exited normally]
The program '/home/user/Desktop/home' has exited with code 0 (0x00000000).

I understand that the first part is literally a license but i just don't get if this is supposed to be like this? I thought we were supposed to see line by line what is happening and this finished in seconds.

Thanks.

c++
debugging
visual-studio-code
gdb
asked on Stack Overflow Aug 18, 2020 by logoslavikus

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0