From: Sergio Durigan Junior <sergiodj@redhat.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [PATCH] Forbid watchpoint on a constant value
Date: Thu, 20 May 2010 17:06:00 -0000 [thread overview]
Message-ID: <201005201403.07723.sergiodj@redhat.com> (raw)
In-Reply-To: <20100520164735.GA25121@host0.dyn.jankratochvil.net>
On Thursday 20 May 2010 13:47:35, Jan Kratochvil wrote:
> On Thu, 20 May 2010 18:13:01 +0200, Sergio Durigan Junior wrote:
> > On Thursday 20 May 2010 12:29:42, Jan Kratochvil wrote:
> > > On Thu, 20 May 2010 07:10:26 +0200, Sergio Durigan Junior wrote:
> > > > + case BINOP_ASSIGN:
> > > > + case BINOP_ASSIGN_MODIFY:
> > > > + case OP_FUNCALL:
> > > > + case OP_OBJC_MSGCALL:
> > > > + case OP_F77_UNDETERMINED_ARGLIST:
> > > > + case UNOP_PREINCREMENT:
> > > > + case UNOP_POSTINCREMENT:
> > > > + case UNOP_PREDECREMENT:
> > > > + case UNOP_POSTDECREMENT:
> > >
> > > This is not a `const'/`pure' function, it has some side-effect of the
> > > assignment. I do not thing they should be caught as constant.
> >
> > Sorry, I didn't understand why they can't be considered constant in the
> > context of a watchpoint.
>
> echo 'int v;main(){}'|gcc -o 1 -x c - -g;./gdb -nx -ex 'p v' -ex 'watch v=1' -ex start -ex 'p v' ./1
>
> The output of last
> -ex 'p v'
> will change if you include / not include
> -ex 'watch v=1'
> so that 'watch v=1' is not a NOP without meaning.
>
> Someone may use it in existing scripts to set variable `v' this way.
>
> I understand it is very broken idea to modify variables from watchpoint
> expression. Just I did not find it too useful to check here and when such
> patch could change the GDB behavior I find it more a disadvantage than an
> advantage.
>
> But I do not have a strong opinion on it.
Ok, now I've got it. I really wasn't considering this option because
I would never modify a variable's value this way, but you're right.
> > > > + case BINOP_VAL:
> > > > + case BINOP_INCL:
> > > > + case BINOP_EXCL:
> > > > + case UNOP_PLUS:
> > > > + case UNOP_CAP:
> > > > + case UNOP_CHR:
> > > > + case UNOP_ORD:
> > > > + case UNOP_ABS:
> > > > + case UNOP_FLOAT:
> > > > + case UNOP_MAX:
> > > > + case UNOP_MIN:
> > > > + case UNOP_ODD:
> > > > + case UNOP_TRUNC:
> > >
> > > I do not see implemented evaluation of these, also their processing should
> > > have been probably moved to some m2-* file.
> >
> > Does it mean that I have to remove them from this list?
>
> There is a problem these operators have no implementation in the current GDB
> sources. Therefore one cannot verify what they do and if they are or they are
> not constant. How did you verify BINOP_VAL does not depend on some possibly
> changing value? The comments at their definition may not be always right.
>
> As they are also not useful to be used in an expression when no processing of
> them is implemented I find more dangerous to make some - possibly invalid
> - assumptions about them (that they are constant - they possibly may be
> implemented in a non-constant way in the future).
>
> The note about move to a different file was invalid, described in the very
> last comment of my mail.
Sorry, I just blindly added those types to the list based on their comments.
I will remove them, thanks for the explanation.
> > > > + case OP_INTERNALVAR:
> > >
> > > I would guess value of some of the internal variables can change.
> >
> > Is the user allowed to put a watchpoint on an internal variable?
>
> It seems to me so:
> (gdb) watch $a
> Watchpoint 2: $a
> Although the watchpoint does not get hit when $a gets modified during inferior
> run. Unaware why.
I really didn't know you could ask GDB to trigger when an internal
variable changes. But OK, living and learning ;-).
Will send the refreshed patch later today.
Thanks,
--
Sergio Durigan Junior
Red Hat
next prev parent reply other threads:[~2010-05-20 17:03 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 17:36 Sergio Durigan Junior
2010-05-18 17:49 ` Eli Zaretskii
2010-05-18 19:24 ` Sergio Durigan Junior
2010-05-18 23:08 ` Jan Kratochvil
2010-05-18 23:50 ` Sergio Durigan Junior
2010-05-19 20:26 ` Jan Kratochvil
2010-05-20 6:21 ` Sergio Durigan Junior
2010-05-20 15:50 ` Jan Kratochvil
2010-05-20 16:24 ` Sergio Durigan Junior
2010-05-20 17:03 ` Jan Kratochvil
2010-05-20 17:06 ` Sergio Durigan Junior [this message]
2010-05-27 21:54 ` Tom Tromey
2010-05-20 23:23 ` Joel Brobecker
2010-05-20 23:31 ` Sergio Durigan Junior
2010-05-20 23:55 ` Joel Brobecker
2010-05-21 0:09 ` Sergio Durigan Junior
2010-05-21 7:05 ` Eli Zaretskii
2010-05-21 8:44 ` Jan Kratochvil
2010-05-21 21:43 ` Sergio Durigan Junior
2010-05-21 22:20 ` Sergio Durigan Junior
2010-05-29 0:04 ` Joel Brobecker
2010-06-04 13:54 ` Jan Kratochvil
2010-06-04 16:49 ` Tom Tromey
2010-06-05 5:35 ` Sergio Durigan Junior
2010-06-05 14:38 ` Jan Kratochvil
2010-06-06 0:20 ` Sergio Durigan Junior
2010-06-15 17:30 ` Tom Tromey
2010-06-16 18:33 ` Sergio Durigan Junior
2010-06-16 18:36 ` Jan Kratochvil
2010-05-28 5:12 ` Tom Tromey
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=201005201403.07723.sergiodj@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@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