public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* problem seeing arrays in structs
@ 2004-05-10 14:14 Lester Ingber
  2004-05-10 17:13 ` Keith Seitz
  0 siblings, 1 reply; 2+ messages in thread
From: Lester Ingber @ 2004-05-10 14:14 UTC (permalink / raw)
  To: insight

I'm having a problem trying to seeing arrays in structs in simple C code
under Cygwin, compiled with or without -mno-cygwin.

For example, I might have a struct
  typedef struct {
    double *myarray;
 } MYSTRUCT;

In main() I create memory for mystruct,
  MYSTRUCT *mystruct;
and I crate memory and stored info for *array, say of dimension 3.

I then pass mystruct to myfunction,
 void myfunction (MYSTRUCT *mystruct) {...}

I set a breakpoint under insight to view the Local Variables in
myfunction().  I can see all variables in mystruct that are not arrays,
but for arrays like myarray[], I only see the pointer defined.  I also
can see all the info in arrays local to myfunction().

I hope I've conveyed the problem in this simple description.

Thanks.

Lester


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: problem seeing arrays in structs
  2004-05-10 14:14 problem seeing arrays in structs Lester Ingber
@ 2004-05-10 17:13 ` Keith Seitz
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Seitz @ 2004-05-10 17:13 UTC (permalink / raw)
  To: Lester Ingber; +Cc: insight

On Mon, 2004-05-10 at 07:14, Lester Ingber wrote:
> For example, I might have a struct
>   typedef struct {
>     double *myarray;
>  } MYSTRUCT;

myarray is not an array. You've explicitly defined it as a pointer. In
the debug information that gcc outputs, it describes myarray as a
pointer, so that is what it knows.

Yes, technically, it doesn't matter, but the debugger doesn't know any
better. 

Unfortunately, I know of no way to deal with this situation right now.
We do not have a "view as" option for the watch window, and the variable
cannot be cast.

The only thing I can think of doing is opening a memory window to view
the actual array. (And there are bugs with this -- you'll have to open
it manually: it doesn't like the idea of opening a struct member).

Sorry,
Keith

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-10 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-10 14:14 problem seeing arrays in structs Lester Ingber
2004-05-10 17:13 ` Keith Seitz

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).