I am running a third-party python script which launches gdb
with my cpp
executable. I believe the script launches gdb
as a child process. I would like to disable or redirect the output from the python script while keeping the output from gdb
.
Is there anyway to do this from the command line? When I pipe the script into /dev/null
, even the gdb
output is removed.
Modifying the python script is an option, but one I'd rather avoid as it's not very portable.
I would like to disable or redirect the output from the python script while keeping the output from
gdb
.
In this particular case you can save gdb output to a file (by default to gdb.txt
).
gdb$ set logging on
Copying output to gdb.txt.
gdb$
You can add this command to .gdbinit
- gdb initialization script. This allows you not to modify python script. Than you can pipe python script output to /dev/null
while gdb output will be saved to a file ( gdb.txt
by default).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.