使 valgrind 能够在 C++ 需要时读取用户输入

Dan*_*iel 5 c++ valgrind user-input

我正在尝试使用 valgrind 运行我的 C++ 程序,但是我在程序中有一些需要用户从 stdin 输入的点,但是当我使用 valgrind 运行时,它不会让用户为程序输入任何内容,有没有办法解决这个问题?

四处寻找,但没有找到答案。

Fre*_*son 3

我还没有尝试过,但我在手册页中找到了这个:

--input-fd=<number> [default: 0, stdin]
              Specify the file descriptor to use for reading  input  from  the
              user.  This  is  used whenever valgrind needs to prompt the user
              for a decision.
Run Code Online (Sandbox Code Playgroud)

如果您为 valgrind 指定不同的 fd(例如 3)用于输入,会发生什么情况?