这是我要设置的代码部分:
void *sync(void *ptr) {
vector<short> gen = generate_sygnal();
我用调试标志构建我的程序,这是我在 gdb 中所做的:
(gdb) break daemon.cxx:sync
break daemon.cxx:sync
Breakpoint 1 at 0x804d080: file /home/username/projects/armd/complex/daemon/daemon.cxx, line 160.
(gdb) watch gen
watch gen
No symbol "gen" in current context.
(gdb) run
run
Starting program: /home/username/projects/armd/complex/build/daemon/daemon
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
2012/05/02 11:00:32 error: Cannot open configuration file /home/username/projects/armd/complex/build/daemon/armd.conf
[New Thread 0xb7fe7b40 (LWP 4329)]
2012/05/02 11:00:32 info: Listening on port 2000
/dev/ttyS0 port opened!
[New Thread 0xb77e6b40 (LWP 4330)]
[Switching to Thread 0xb77e6b40 (LWP 4330)]
Breakpoint 1, sync (ptr=0x8055108)
at /home/username/projects/armd/complex/daemon/daemon.cxx:160
160 void *sync(void *ptr) {
(gdb) watch gen
watch gen
No symbol "gen" in current context.
(gdb)
那么如何使用 gdb 检查我的 gen 值呢?即使我需要完整的向量值堆栈。