There must be a simple solution to this, but I do not see it. I have this file:
Code:
Is
this
a bug
or not
??
and I want to read it with this program:
Code:
#include <fstream>
#include <iostream>
int main() {
std::string line;
std::ifstream lund("testStreamInGdb");
while ( std::getline(lund,line) ) {
std::cout << line << std::endl;
}
}
And of course it works:
Code:
omittedPrompt:> g++ -g gdbTest.cc -o gdbTest
omittedPrompt:> gdbTest
Is
this
a bug
or not
??
omittedPrompt:>
but NOT in gdb, no sir, not at all:
Code:
omittedPrompt:> gdb gdbTest
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
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"...
Reading symbols from gdbTest...
(gdb) run
Starting program: omittedDir/gdbTest
[Inferior 1 (process 10191) exited normally]
(gdb) quit
omittedPrompt:>
It looks like opening the file simply fails.
Could somebody please help and tell me what am I missing? I have a similUbuntu in WSL2, inside Windows 10.
Thank you all for reading this.