From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4215 invoked by alias); 9 Jun 2005 02:47:37 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 4208 invoked by uid 22791); 9 Jun 2005 02:47:34 -0000 Received: from ausmtp02.au.ibm.com (HELO ausmtp02.au.ibm.com) (202.81.18.187) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 09 Jun 2005 02:47:34 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp02.au.ibm.com (8.12.10/8.12.10) with ESMTP id j592h4ZX374212 for ; Thu, 9 Jun 2005 12:43:05 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.250.242]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j592oGn6054268 for ; Thu, 9 Jun 2005 12:50:17 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.12.11/8.13.3) with ESMTP id j592lNcO003028 for ; Thu, 9 Jun 2005 12:47:23 +1000 Received: from plinuxt18.cn.ibm.com (plinuxt18.cn.ibm.com [9.181.140.28]) by d23av01.au.ibm.com (8.12.11/8.12.11) with ESMTP id j592lK0l002995 for ; Thu, 9 Jun 2005 12:47:21 +1000 Date: Thu, 09 Jun 2005 02:47:00 -0000 From: Wu Zhou To: gdb@sources.redhat.com Subject: Re: Program terminated with SIGSEGV when trying to print an array element In-Reply-To: <20050608130715.GA4861@nevyn.them.org> Message-ID: References: <20050607131417.GB30174@nevyn.them.org> <20050608130715.GA4861@nevyn.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-06/txt/msg00078.txt.bz2 On Wed, 8 Jun 2005, Daniel Jacobowitz wrote: > On Wed, Jun 08, 2005 at 02:52:20PM +0800, Wu Zhou wrote: > > Sure. But now I am having difficulty in one problem: given an struct value > > with the type being TYPE_CODE_PTR, how to get the value of the array (or > > string or whatever) it refer to? We need to know this to go on with the > > following evaluation. I had thought that function "value_from_pointer" > > will do this, but it turn out to be false. Anyone could help on this? > > Usually, value_ind. Do you have a pointer to a TYPE_CODE_ARRAY, or has > the array decayed into a pointer (like in C)? Thank you, Daniel! "value_ind" worked. I will clean up a patch for this later and send to gdb-patches for review. BTW, to answer your question, what I have is a pointer to a value with the type being TYPE_CODE_ARRAY. It is not like that in C. Cheers - Wu Zhou