This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: How to monitor register
- From: Eli Zaretskii <eliz at gnu dot org>
- To: 郭秋平 <guoqiuping81112 at 163 dot com>
- Cc: gdb at sourceware dot org
- Date: Fri, 15 Feb 2013 17:17:46 +0200
- Subject: Re: How to monitor register
- References: <b5wp0oy8rlf6e4onksrrmu0b.1360934881385@email.android.com> <83boblu1h6.fsf@gnu.org> <32f36d08.2667.13cde461a04.Coremail.guoqiuping81112@163.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> 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)