Why gdb may not terminate in batch mode?

Peng Yu via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CABrM6w=M9-Co2tsG_j7sWEc4XseRWfZX0NmFBYknYiTR6KJHfg@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.