From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9980 invoked by alias); 4 Nov 2010 13:40:36 -0000 Received: (qmail 9864 invoked by uid 22791); 4 Nov 2010 13:40:35 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from smtpgw03.sap-ag.de (HELO smtpgw.sap-ag.de) (155.56.66.98) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Nov 2010 13:40:31 +0000 From: "Gruenhagen, Andreas" To: "gdb@sourceware.org" Date: Thu, 04 Nov 2010 13:40:00 -0000 Subject: Detecting when gdb is attached Message-ID: <372C920CA9488345BDECCD4B62FF71D00F717855E5@DEWDFECCR08.wdf.sap.corp> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00023.txt.bz2 Dear gdb community, I'm developing an application which cannot be started from within the gdb. = Therefore, I have the start the application and attach the gdb afterwards. = In some cases it would be nice to have the application wait in a spin loop = until the debugger is attached. Is there any way of accomplishing such a th= ing?=20=20 I certainly can program the spin loop myself, attach the debugger, and then= manually change a variable from within the debugger to end the loop. But, = obviously, this is not an elegant solution (lots of manual work, code has t= o be changed and it has to be recompiled,and eventually, I might forget to = delete the spin loop after debugging). I thought of having some sort of action which is executed when the gdb is a= ttached and detached, this could be for example used to switch a static fla= g in the debugee. Is something like this possible ? Best regards Andreas