From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28108 invoked by alias); 16 Jan 2012 20:46:44 -0000 Received: (qmail 28099 invoked by uid 22791); 16 Jan 2012 20:46:43 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Mon, 16 Jan 2012 20:46:30 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0GKkTe1006008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Jan 2012 15:46:29 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0GKkSOF005237; Mon, 16 Jan 2012 15:46:28 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q0GKkQJu022711; Mon, 16 Jan 2012 15:46:27 -0500 From: Tom Tromey To: Sinbad Cc: gdb@sourceware.org Subject: Re: gdb user defined function References: Date: Mon, 16 Jan 2012 20:46:00 -0000 In-Reply-To: (Sinbad's message of "Sun, 15 Jan 2012 08:21:11 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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-01/txt/msg00054.txt.bz2 >>>>> "Sinbad" == Sinbad writes: Sinbad> i am trying to write a user-defined function in gdb. Sinbad> while analyzing the core is it possible to see if a Sinbad> pointer variable is accessible or not inside a gdb Sinbad> user-defined function. for example. Sinbad> (gdb) p *ptr Sinbad> cannot access memory at address 0x35336 Sinbad> is there any way to find this inside a gdb function. Sinbad> i need something as follows Sinbad> define sub Sinbad> is_accessible(ptr) Sinbad> end I can't think of an easy way to do this from the gdb CLI, but you can do it from Python by catching the exception. You could straightforwardly write a $is_valid function that examines a pointer for validity. Tom