Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mihai Basa <Mihai.Basa@NUIGALWAY.IE>
To: gdb@sources.redhat.com
Subject: Array-of-structures slices
Date: Tue, 02 Dec 2003 20:55:00 -0000	[thread overview]
Message-ID: <3FCC10B6@bodkin.nuigalway.ie> (raw)

Hello,


GDB can "display" values from a slice of an array (using the @ operator) - IF 
that array is made up of base datatypes. It cannot plot slices if the array is 
made of structures, and I believe it would be really useful if it could...
    
As an example, assume we have an array A[100] made up of structures like this:
    typedef struct {
        int x;
        int y;
    };
    
I think it would be good if GDB could print/display the string of 100 A.x 'es. 
The syntax describing this might be something like:

                      display (A[0]@100).x

which currently just displays A[0].x. This means reading an array of 100 
elements, starting from A[0] with a stride equal to sizeof(A[0]). Currently 
GDB can only read with a stride of sizeof(x), if we were to say (A[0].x)@100, 
which reads alternating x'es and y'es.

If this were possible quick visual comparison of a string of related variables 
stored in structures could be made. Another reason why I see this as useful is 
because if this were possible one could use the DDD front-end to plot 
in-program results, even from structures.


Regards,
Mihai Basa


             reply	other threads:[~2003-12-02 20:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-02 20:55 Mihai Basa [this message]
2003-12-02 20:57 ` Daniel Jacobowitz

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=3FCC10B6@bodkin.nuigalway.ie \
    --to=mihai.basa@nuigalway.ie \
    --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