我使用POCO库的ServerApplication类,并使用“--daemon”选项启动程序。我发现我可以为运行应用程序的控制台生成核心转储文件,但是无法为此守护程序应用程序执行此操作。
答案 0 :(得分:0)
看看Net / samples / TimeServer / src / TimeServer.cpp 它可以生成核心文件
[root@slayer src]# pwd
/root/cppstuff/poco-1.4.5-all/Net/samples/TimeServer/src
[root@slayer src]# g++ TimeServer.cpp -lPocoUtil -lPocoNet -g -o tsev
[root@slayer src]# ls
tcln.py TimeServer.cpp tsev tsev.properties
[root@slayer src]# ulimit -c unlimited
[root@slayer src]# ./tsev --daemon
[root@slayer src]# ps aux | grep tsev | grep -v grep
root 13498 0.0 0.5 60680 2160 ? Ssl 16:18 0:00 ./tsev --daemon
[root@slayer src]# gcore 13498
[Thread debugging using libthread_db enabled]
[New Thread 0x2ad7c2c36940 (LWP 13501)]
[New Thread 0x2ad7c2235940 (LWP 13500)]
[New Thread 0x2ad7c1834940 (LWP 13499)]
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff935fd000
0x000000346a230898 in do_sigwait () from /lib64/libc.so.6
Saved corefile core.13498
[root@slayer src]# ls
core.13498 tcln.py TimeServer.cpp tsev tsev.properties