Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: 郭秋平 <guoqiuping81112@163.com>
Cc: gdb@sourceware.org
Subject: Re: How to monitor register
Date: Fri, 15 Feb 2013 15:18:00 -0000	[thread overview]
Message-ID: <83a9r5txlx.fsf@gnu.org> (raw)
In-Reply-To: <32f36d08.2667.13cde461a04.Coremail.guoqiuping81112@163.com>

> Date: Fri, 15 Feb 2013 22:33:21 +0800 (CST)
> From: 鹿霉脟茂脝陆 <guoqiuping81112@163.com>
> Cc: gdb@sourceware.org
> 
> the comand "watch $ebp" seems not work.
> i write  a simple code to test the comad like this:
> void func1(){int i = 0; i++;}
> void func2(){int i = 0; i++;}
> int main(){func1(); func2();}
> i watch $ebp while using gdb to startup the program, it will not pause when invoke func1 and func2.
> the gdb's version is 7.1

Works for me with GDB 7.5.1 (on MS-Windows):

  (gdb) start
  Temporary breakpoint 1 at 0x401342: file twatch.c, line 3.
  Starting program: D:\usr\eli\data\twatch.exe
  [New Thread 26676.0x6804]

  Temporary breakpoint 1, 0x00401342 in main () at twatch.c:3
  3       int main(){func1(); func2();}
  (gdb) watch $ebp
  Watchpoint 2: $ebp
  (gdb) c
  Continuing.
  Watchpoint 2: $ebp

  Old value = (void *) 0x22ff78
  New value = (void *) 0x22ff58
  0x004012f3 in func1 () at twatch.c:1
  1       void func1(){int i = 0; i++;}
  (gdb) c
  Continuing.
  Watchpoint 2: $ebp

  Old value = (void *) 0x22ff58
  New value = (void *) 0x22ff78
  0x00401303 in func1 () at twatch.c:1
  1       void func1(){int i = 0; i++;}
  (gdb) c
  Continuing.
  Watchpoint 2: $ebp

  Old value = (void *) 0x22ff78
  New value = (void *) 0x22ff58
  0x00401307 in func2 () at twatch.c:2
  2       void func2(){int i = 0; i++;}
  (gdb) c
  Continuing.
  Watchpoint 2: $ebp

  Old value = (void *) 0x22ff58
  New value = (void *) 0x22ff78
  0x00401317 in func2 () at twatch.c:2
  2       void func2(){int i = 0; i++;}
  (gdb) c
  Continuing.
  Watchpoint 2: $ebp

  Old value = (void *) 0x22ff78
  New value = (void *) 0x22ffb0
  0x0040134d in main () at twatch.c:3
  3       int main(){func1(); func2();}
  (gdb) c
  Continuing.
  Watchpoint 2: $ebp

  Old value = (void *) 0x22ffb0
  New value = (void *) 0x22ff68
  0x77c39de0 in msvcrt!_initterm () from C:\WINDOWS\system32\msvcrt.dll
  (gdb)


      parent reply	other threads:[~2013-02-15 15:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 13:34 Guoqiuping
     [not found] ` <83boblu1h6.fsf@gnu.org>
     [not found]   ` <32f36d08.2667.13cde461a04.Coremail.guoqiuping81112@163.com>
2013-02-15 15:18     ` Eli Zaretskii [this message]

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=83a9r5txlx.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=guoqiuping81112@163.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