public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Wu Zhou <woodzltc@cn.ibm.com>
To: gdb@sources.redhat.com
Subject: Re: Program terminated with SIGSEGV when trying to print an array element
Date: Wed, 08 Jun 2005 06:57:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.63.0506081436340.6314@plinuxt18.cn.ibm.com> (raw)
In-Reply-To: <20050607131417.GB30174@nevyn.them.org>

On Tue, 7 Jun 2005, Daniel Jacobowitz wrote:

> On Tue, Jun 07, 2005 at 04:58:10PM +0800, Wu Zhou wrote:
> > As far as I can see, the problem lies in that GDB take TYPE_CODE_PTR as
> > a function call as well.  But in the above failing testcase, "a" is a 
> > pointer to array type (Fortran treat formal parameter as pointer). Its 
> > code is TYPE_CODE_PTR indeed, but it is not a function call.  
> > 
> > So maybe we need to change the code logic above.  My thought is when the
> > code match TYPE_CODE_PTR, we first get its target_type.  If it is 
> > TYPE_CODE_ARRAY, we can goto multi_f77_subscript. If not, we can go on 
> > with the orignial path.  But I have one question on the original code: 
> > in which circumstance should a function's code return TYPE_CODE_PTR,
> > isn't the code of a function always return TYPE_CODE_FUNC? 
> > 
> > Any thought on this?  Any suggestions and comments are highly appreciated! 
> 
> You didn't mention what Fortran compiler was being used.  Probably,
> whichever one it was, it generates debug information that GDB is not
> expecting.

I used g77-3.3.3 on PPC64, and gfortran-4.0.0 on Fedora 4 test 3 on i386.  
Both failed (Illegal instruction on PPC64 and SEGV error on i386).  I had 
some look at the related debuginfo (array "a"), it is indeed an pointer 
to array on both platform. 

> It sounds like you're right; we should be checking the target type of
> the pointer.  Can we end up with a pointer to a string, too?

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? 

Thanks in advance.

Cheers
- Wu Zhou

  reply	other threads:[~2005-06-08  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-07  8:14 Wu Zhou
2005-06-07  9:03 ` Wu Zhou
2005-06-07 13:14   ` Daniel Jacobowitz
2005-06-08  6:57     ` Wu Zhou [this message]
2005-06-08 13:07       ` Daniel Jacobowitz
2005-06-09  2:47         ` Wu Zhou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.63.0506081436340.6314@plinuxt18.cn.ibm.com \
    --to=woodzltc@cn.ibm.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).