GDB зависает, пытаясь открыть файл / proc на bash на Windows на Ubuntu 16.04.2 LTS [закрыт]

Я установил Ubuntu 16.04.2 LTS на свою Windows 10 и получил проблему, когда GDB зависает, пытаясь вызвать popen:

$ sudo gdb out GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 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-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 linx.out...done. (gdb) r Starting program: /bin/x64/Debug/out warning: unable to open /proc file '/proc/2710/status' warning: unable to open /proc file '/proc/2710/status' Program terminated with signal SIGKILL, Killed. The program no longer exists.

Все нормально, когда вы вызываете из оболочки.

main.cpp код:

#include <iostream> #include <string> using namespace std; int main(int, char*[]) { char buffer[1024]; FILE* f = popen("ls -la", "r"); if (f != nullptr) { while (!feof(f)) { if (fgets(buffer, 1024, f) != nullptr) { cout << buffer; } } pclose(f); } return 0; }

команда компиляции с информацией об отладке:

g++ -g main.cpp -o out

и без:

g++ main.cpp -o out

Версия для Windows:

C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version" OS Name: Microsoft Windows 10 Pro OS Version: 10.0.15063 N/A Build 15063

Linux-версии:

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial $ gdb --version GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. $ g++ --version g++ (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04) 6.3.0 20170519 Copyright (C) 2016 Free Software Foundation, Inc.

Любые предложения, как это решить?

1
задан 1 July 2017 в 11:17

0 ответов

Другие вопросы по тегам:

Похожие вопросы: