-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Debugger can't pass certain point in my program, while debugging under visual-studio-code. If I run the session in terminal (outside of IDE) everything works normal. In simplified version debugger crashes only when entering the problem function. Here is output from VS code debug console:
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 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-pc-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".
Stopped due to shared library event (no libraries added or removed)
Breakpoint 1, main () at main.cpp:18
18 std::cout << "Test!" << std::endl;
Breakpoint 2, main () at main.cpp:26
26 read_record(dataset);
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
Breakpoint 3, main () at main.cpp:27
27 return 0;
Kill the program being debugged? (y or n) [answered Y; input not from terminal]
The program '/home/pa/work/vsc-test/a.out' has exited with code 0 (0x00000000).
Here is simplified self contained code (test.txt must contain at least 4 bytes):
#include <iostream>
#include <fstream>
#include <vector>
std::vector<uint8_t> read_record( std::istream & stream )
{
if (!stream)
return std::vector<uint8_t>();
std::vector<uint8_t> result(4);
stream.read(reinterpret_cast<char *>(result.data()), 4);
return std::move(result);
}
int main()
{
std::cout << "Test!" << std::endl;
char const * file_name = "test.txt";
std::ifstream dataset(file_name);
if (!dataset)
throw std::runtime_error(std::string(file_name) + ": error: can't open dataset!");
read_record(dataset);
return 0;
}Problem function: read_record
System Arch Linux 4.6.3-1
Visual Studio Code 1.3.1
C/C++ extension 0.7.1
g++ (GCC) 6.1.1 20160602
rutsky, guusw, BrianSipple, darzu and Domest0s