Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: Klee Dienes <klee@apple.com>, Eli Zaretskii <eliz@is.elta.co.il>,
	gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Compare contents when evaluating an array watchpoint
Date: Mon, 18 Nov 2002 09:52:00 -0000	[thread overview]
Message-ID: <vt24raen5lq.fsf@zenia.red-bean.com> (raw)
In-Reply-To: <3DB49F6C.3060106@redhat.com>


Andrew Cagney <ac131313@redhat.com> writes:
> 	int a[10];
> 	int *b;
> 	(gdb) watch a
> 	(gdb) watch b
> 	(gdb) watch *b@10
> 	(gdb) watch *a@sizeof(a)
> 
> While the existing ``watch a'' might have annoying semantics, it would
> make its behavior consistent with C.  An array is converted to a
> pointer in an expression.

Well, whether arrays are coerced to pointers depends on what you're
doing with them: see ISO C 6.3.2.  In most cases they are, but if
they're an operand to & or sizeof, then they aren't.  It's a
case-by-case thing: C chooses the most useful interpretation given the
context.  It seems consistent with C for GDB to do the same.

And in fact, GDB doesn't do "the usual unary conversions" on the final
value of an expression.  That's why when you have:

    int a[10];

then GDB does this:

    (gdb) print a
    $1 = {1, 0, 1074017445, 1075174868, 1075159808, 1073833280, 1075175900, 
      1074103810, 1073933620, 1075174868}
    (gdb) 

and not:

    (gdb) print a
    $1 = (int *) 0xbfffc100
    (gdb)

So I think Klee's patch makes GDB's behavior more consistent with
itself, more useful, and is still completely consistent with C
semantics.


  parent reply	other threads:[~2002-11-18 17:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-06  2:16 Klee Dienes
2002-10-06 22:53 ` Eli Zaretskii
2002-10-06 23:12   ` Klee Dienes
2002-10-07  7:26     ` Eli Zaretskii
2002-10-07 11:50       ` Klee Dienes
2002-10-09 12:42         ` Eli Zaretskii
2002-10-21 17:44     ` Andrew Cagney
2002-11-04 18:27       ` [RFA] " Klee Dienes
2002-11-18  9:52       ` Jim Blandy [this message]
2003-01-08  0:46 ` [PATCH] " Andrew Cagney

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=vt24raen5lq.fsf@zenia.red-bean.com \
    --to=jimb@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    --cc=klee@apple.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