Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Florent Defay <spira.inhabitant@gmail.com>
To: jeremy.bennett@embecosm.com
Cc: gdb@sourceware.org
Subject: Re: Problem with "watch" on a new port.
Date: Tue, 07 Jul 2009 12:29:00 -0000	[thread overview]
Message-ID: <8502af3c0907070528i1c8cc003lc57006828eb4bde3@mail.gmail.com> (raw)
In-Reply-To: <1246550027.21485.30.camel@thomas>

Hi,
Thank you very much to all for the answers.

I am still in trouble with the "watch" issue.

I give you a concrete example of the problem bellow.
I debug main.c with the target-gdb (remote protocol) in two different ways.

main.c
---------
void foo ()
{
}

int main ()
{
  int a = 1;
  int i;

  for (i = 0; i < 10; i++)
  {
    if (i == 5)
    {
      a = 2;
    }
  }

  for (i = 0; i < 10; i++)
  {
    if (i == 5)
    {
      foo();
      a = 3;
    }
  }

  return 0;
}
-----------------------------------------------------------


behavior 1
--------------
Breakpoint 1, main () at main.c:8
warning: Source file is more recent than executable.
8         int a = 1;
(gdb) watch a
Hardware watchpoint 2: a
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at main.c:11
11        for (i = 0; i < 10; i++)
(gdb) p i
$1 = 5
(gdb) p a
$2 = 1
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at main.c:11
11        for (i = 0; i < 10; i++)
(gdb) p i
$3 = 5
(gdb) p a
$4 = 2
(gdb) c
Continuing.
//// nothing happens, infinite waiting
-----------------------------------------------------------

behavior 2
--------------
Breakpoint 1, main () at main.c:8
8         int a = 1;
(gdb) set can-use-hw-watchpoints 0
(gdb) watch a
Watchpoint 2: a
(gdb) c
Continuing.
Watchpoint 2: a

Old value = 2
New value = 1
main () at main.c:11
11        for (i = 0; i < 10; i++)
(gdb) c
Continuing.
Watchpoint 2: a

Old value = 1
New value = 2
main () at main.c:11
11        for (i = 0; i < 10; i++)
(gdb) p i
$1 = 5
(gdb) c
Continuing.

Watchpoint 2 deleted because the program has left the block in
which its expression is valid.
0x0000004e in foo () at main.c:4
4       }
-----------------------------------------------------------

My conclusion :
In behavior 1, Hardware watchpoint is used. The problem is
1- There are no info about old and new value.
2- The statement a = 3; is not detected.

In behavior 2, Software watchpoint is used. The problem is
1- It cannot be a final solution because it is very slow.
2- "Watchpoint 2 deleted because the program has left the block in
which its expression is valid."
is not a good behavior. The call to foo has a secondary unexpected
effect (it is the same behavior every time a function is called).

The simulator (sid) seems to receive Z/z packets well. It may be due
to a mistake in t-dep or something missing but I do not know what.
Plus, step, next, breakpoints, finish work very well.

Thank you.

Regards,

Florent.


  reply	other threads:[~2009-07-07 12:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02 15:11 Florent DEFAY
2009-07-02 15:42 ` Vladimir Prus
2009-07-02 15:55 ` Jeremy Bennett
2009-07-07 12:29   ` Florent Defay [this message]
2009-07-07 15:19     ` Jeremy Bennett
  -- strict thread matches above, loose matches on Subject: below --
2009-07-01  9:10 Florent DEFAY
2009-07-01  9:51 ` Vladimir Prus

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=8502af3c0907070528i1c8cc003lc57006828eb4bde3@mail.gmail.com \
    --to=spira.inhabitant@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=jeremy.bennett@embecosm.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