This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to monitor register


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]