From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10777 invoked by alias); 30 Oct 2012 17:39:15 -0000 Received: (qmail 10552 invoked by uid 22791); 30 Oct 2012 17:39:12 -0000 X-SWARE-Spam-Status: No, hits=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Oct 2012 17:39:04 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9UHd2JB019529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Oct 2012 13:39:03 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9UHd1wk024395; Tue, 30 Oct 2012 13:39:02 -0400 Message-ID: <509010B5.6050309@redhat.com> Date: Tue, 30 Oct 2012 17:39:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: "Maucci, Cyrille" CC: "gdb@sourceware.org" Subject: Re: working around batch mode command errors References: <7D0928B9A8397D4B9E2F9E5FFFB8D860027BED37@G6W2492.americas.hpqcorp.net> In-Reply-To: <7D0928B9A8397D4B9E2F9E5FFFB8D860027BED37@G6W2492.americas.hpqcorp.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-10/txt/msg00120.txt.bz2 On 10/28/2012 10:28 PM, Maucci, Cyrille wrote: > One of the problem I have is that when frame 0 is not C++ code, "print *this" fails and the script aborts with the following error > > Error in sourced command file: > No symbol "this" in current context. > > And therefore all subsequent commands are not executed. > I wanted to know if there would be any possiblity to avoid halting on such errors. There's no try/catch mechanism in the CLI unfortunately, but I think you could come up with one in python gdb. ISTR Tromey had a python command wrapper that swallows CLI errors? > An aside question would be is there any built-in commands allowing to do something like > > for each frame do > info source > info args > info locals > info frame > info all-registers > print *this > done Nope. But could construct something like that using gdb's builtin python support. -- Pedro Alves