admin管理员组文章数量:1125805
It seems in my environment (Linux On Power) there are issues when I try to run a linux command in gdb. Using less
prints the whole file to stdout rather than running less
. Vim tells me the output is not a terminal. Spawning a new xterm window in gdb is linked to the gdb process and closes when I close gdb.
gdb version:
: gdb --version
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-19.el8
I tried doing the following:
(gdb) !less some_file.txt
Rather than opening the file up in the less
process, it just prints the whole file to stdout.
If I use vim in gdb, I get the following message:
(gdb) !vim some_file.txt
Vim: Warning: Output is not to a terminal
But after a couple of seconds, it will open vim up and allow me to navigate through the file.
One final weird thing that hasn't happened before that might be a hint to what is going on. I use xterm. So let's say I open up a new xterm window in gdb:
(gdb) !xterm &
A new window pops up. Now let's say I quit gdb:
(gdb) q
A debugging session is active.
Inferior 1 [process 1027212] will be killed.
Quit anyway? (y or n) y
When I hit y
, it will stay stuck like that until I either close the new xterm window, or I hit Control-C. If I hit Control-C, gdb terminates, but then the new xterm window closes.
So it seems somehow the processes that are being spawned in gdb aren't behaving correctly.
It seems in my environment (Linux On Power) there are issues when I try to run a linux command in gdb. Using less
prints the whole file to stdout rather than running less
. Vim tells me the output is not a terminal. Spawning a new xterm window in gdb is linked to the gdb process and closes when I close gdb.
gdb version:
: gdb --version
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-19.el8
I tried doing the following:
(gdb) !less some_file.txt
Rather than opening the file up in the less
process, it just prints the whole file to stdout.
If I use vim in gdb, I get the following message:
(gdb) !vim some_file.txt
Vim: Warning: Output is not to a terminal
But after a couple of seconds, it will open vim up and allow me to navigate through the file.
One final weird thing that hasn't happened before that might be a hint to what is going on. I use xterm. So let's say I open up a new xterm window in gdb:
(gdb) !xterm &
A new window pops up. Now let's say I quit gdb:
(gdb) q
A debugging session is active.
Inferior 1 [process 1027212] will be killed.
Quit anyway? (y or n) y
When I hit y
, it will stay stuck like that until I either close the new xterm window, or I hit Control-C. If I hit Control-C, gdb terminates, but then the new xterm window closes.
So it seems somehow the processes that are being spawned in gdb aren't behaving correctly.
1 Answer
Reset to default 0Apparently this behavior occurs when piping gdb to a file with tee
. I had not noticed it initially because I was calling gdb from a script, obfuscating the pipe to tee
. Thanks to @Andrew and @Barmar for helping me sort this out.
本文标签: linuxshell processes spawned in gdb aren39t behaving correctlyStack Overflow
版权声明:本文标题:linux - shell processes spawned in gdb aren't behaving correctly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736675314a1947152.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
less
disables its interactive mode. You can see this confirmed in the warning message fromvim
. – Barmar Commented 2 days ago