From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22412 invoked by alias); 10 Nov 2010 14:57:55 -0000 Received: (qmail 22403 invoked by uid 22791); 10 Nov 2010 14:57:54 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-pz0-f41.google.com (HELO mail-pz0-f41.google.com) (209.85.210.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Nov 2010 14:57:49 +0000 Received: by pzk32 with SMTP id 32so154883pzk.0 for ; Wed, 10 Nov 2010 06:57:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.112.12 with SMTP id k12mr6775587wfc.188.1289401068250; Wed, 10 Nov 2010 06:57:48 -0800 (PST) Received: by 10.143.33.8 with HTTP; Wed, 10 Nov 2010 06:57:48 -0800 (PST) In-Reply-To: <372C920CA9488345BDECCD4B62FF71D00F717855E5@DEWDFECCR08.wdf.sap.corp> References: <372C920CA9488345BDECCD4B62FF71D00F717855E5@DEWDFECCR08.wdf.sap.corp> Date: Wed, 10 Nov 2010 14:57:00 -0000 Message-ID: Subject: Re: Detecting when gdb is attached From: Steffen Dettmer To: "gdb@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 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/msg00044.txt.bz2 On Thu, Nov 4, 2010 at 2:40 PM, Gruenhagen, Andreas wrote: > 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 thing? how should the application know whether to enter the wait loop until gdb is attached or run as usual? > I thought of having some sort of action which is executed when > the gdb is attached and detached, this could be for example > used to switch a static flag in the debugee. Is something like > this possible ? via ~/.gdbinit for example you could simply try: print some_sort_of_action() to invoke the function some_sort_of_action in the application maybe? oki, Steffen