Why gdb may not terminate in batch mode?
Peng Yu
pengyu.ut@gmail.com
Mon Jan 25 00:07:00 GMT 2021
Hi,
I see that gdb sometimes hangs with --batch enabled. Does anybody know
how to fix the problem? Thanks.
$ cat main.c
#include <stdio.h>
int main() {
printf("Hello World!");
}
$ cat > gdb_cmd.txt <<EOF
run
quit
EOF
$ gcc -o main.exe main.c
$ gdb --batch --command=gdb_cmd.txt --args main.exe # Sometimes, this
command hangs
[New Thread 0x2b03 of process 97381]
$ gdb --version
GNU gdb (GDB) 10.1
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.
$ gcc --version
Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
--
Regards,
Peng
More information about the Gdb
mailing list