From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26864 invoked by alias); 29 Apr 2004 13:15:49 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26855 invoked from network); 29 Apr 2004 13:15:46 -0000 Received: from unknown (HELO diplodocus.quadrics.com) (194.202.174.2) by sources.redhat.com with SMTP; 29 Apr 2004 13:15:46 -0000 Received: from exch01.quadrics.com (exch01 [194.202.174.9]) by diplodocus.quadrics.com (8.9.3/8.9.3) with SMTP id OAA20895 for ; Thu, 29 Apr 2004 14:15:45 +0100 (BST) Received: from pc82.quadrics.com ([194.202.174.82]) by exch01.quadrics.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 29 Apr 2004 14:15:37 +0100 Subject: patch: Clean shutdown if still attached at exit in batch mode From: Ashley Pittman To: gdb-patches@sources.redhat.com Content-Type: text/plain Message-Id: <1083244544.10141.209.camel@ashley> Mime-Version: 1.0 Date: Thu, 29 Apr 2004 13:15:00 -0000 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Apr 2004 13:15:37.0125 (UTC) FILETIME=[0FA57550:01C42DEC] X-SW-Source: 2004-04/txt/msg00666.txt.bz2 Hi, I've been hitting some problems running gdb against live processes on ia64 nodes, often stack traces are incomplete due to signal handler issues or such like. If running gdb interactively then gdb drops back to the prompt and everything is fine but if run in batch mode it stops parsing the batch file and exits. The problem here is that it does not detach before quiting so the process becomes a zombie. Attached is a patch to prevent this. I'm not cc'd to this list so please include me on any replies. Ashley, *** gdb-6.1/gdb/main.c 2004-02-18 00:21:00.000000000 +0000 --- gdb-6.1-modified/gdb/main.c 2004-04-29 14:10:17.000000000 +0100 *************** *** 736,742 **** init_history (); if (batch) ! { /* We have hit the end of the batch file. */ exit (0); } --- 736,752 ---- init_history (); if (batch) ! { ! if ( attach_flag) { ! /* If there is a problem executing the command in the batch file ! * then we might not have parsed all of it and might be attached. ! * Simply calling exit() would leave zombies so be nice and detach ! * but let the user know that there was a problem. ! */ ! target_detach(NULL,0); ! exit(1); ! } ! /* We have hit the end of the batch file. */ exit (0); }