Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to monitor register
@ 2013-02-15 13:34 Guoqiuping
       [not found] ` <83boblu1h6.fsf@gnu.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Guoqiuping @ 2013-02-15 13:34 UTC (permalink / raw)
  To: gdb

Hi: 
i have a question about gdb usage. 
i know that the watch command that can set watchpoint for expressions.

 i want to know how to watch the
 change of some register (for example ebp) ,that to say i want to monitor the change of ebp, but i have no idea, please help me.  thanks a lot 
Regards!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to monitor register
       [not found]   ` <32f36d08.2667.13cde461a04.Coremail.guoqiuping81112@163.com>
@ 2013-02-15 15:18     ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2013-02-15 15:18 UTC (permalink / raw)
  To: 郭秋平; +Cc: gdb

> 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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-15 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15 13:34 How to monitor register Guoqiuping
     [not found] ` <83boblu1h6.fsf@gnu.org>
     [not found]   ` <32f36d08.2667.13cde461a04.Coremail.guoqiuping81112@163.com>
2013-02-15 15:18     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox