Re: Program terminated with SIGSEGV when trying to print an array element

Wu Zhou
2005-06-09T02:47:37Z

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