From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UalCr-0000d1-2O for qemu-devel@nongnu.org; Fri, 10 May 2013 07:09:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UalCp-0001vZ-RE for qemu-devel@nongnu.org; Fri, 10 May 2013 07:09:45 -0400 Received: from mail-qc0-x231.google.com ([2607:f8b0:400d:c01::231]:53287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UalCp-0001v2-Mp for qemu-devel@nongnu.org; Fri, 10 May 2013 07:09:43 -0400 Received: by mail-qc0-f177.google.com with SMTP id e1so2146376qcy.8 for ; Fri, 10 May 2013 04:09:43 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <518CB8E4.5090305@profihost.ag> References: <518C8FD7.9080201@profihost.ag> <20130510074217.GB1500@stefanha-thinkpad.redhat.com> <518CB8E4.5090305@profihost.ag> Date: Fri, 10 May 2013 13:09:43 +0200 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] kvm process disappears List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Priebe - Profihost AG Cc: qemu-devel , "pve-devel@pve.proxmox.com" On Fri, May 10, 2013 at 11:07 AM, Stefan Priebe - Profihost AG wrote: > Am 10.05.2013 09:42, schrieb Stefan Hajnoczi: >> On Fri, May 10, 2013 at 08:12:39AM +0200, Stefan Priebe - Profihost AG wrote: >> 3. Either use gdb or an LD_PRELOAD library that catches exit(3) and >> _exit(2) and dumps core using abort(3). Make sure core dumps are >> enabled. > > LD_PRELOAD sounds good can you point me to such a lib? $ cat /tmp/catchexit.c #include #include void exit(int status) { const char msg[] = "*** CAUGHT EXIT, DUMPING CORE ***\n"; write(2, msg, sizeof msg); abort(); } void _exit(int status) __attribute__((alias("exit"))); $ gcc -o catchexit.so -shared -fPIC -std=gnu99 catchexit.c $ LD_PRELOAD=/tmp/catchexit.so x86_64-softmmu/qemu-system-x86_64 -m 1024 -enable-kvm -cpu host -vga asdf Unknown vga type: asdf *** CAUGHT EXIT, DUMPING CORE *** Aborted (core dumped) Make sure to give the absolute path to catchexit.so. Also keep in mind that this does not catch a normal return from main() or possibly other ways of terminating the process. You can hook more library functions, if necessary. Stefan