This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] record.c: Add signal handler to record_wait record part
- From: Hui Zhu <teawater at gmail dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Fri, 4 Jun 2010 13:44:08 +0800
- Subject: [PATCH] record.c: Add signal handler to record_wait record part
Hi,
I got some error with prec:
(top-gdb) start
Temporary breakpoint 3 at 0x8053bf8: file ../../src/gdb/gdb.c, line 29.
Starting program: /home/teawater/gdb/bgdbno/gdb/gdb
[Thread debugging using libthread_db enabled]
Temporary breakpoint 3, main (argc=
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x8053bf3.
1, argv=0xbffff594) at ../../src/gdb/gdb.c:29
29 memset (&args, 0, sizeof args);
(top-gdb) record
(top-gdb) c
Continuing.
warning: Process record ignores the memory change of instruction at
address 0xb7c0b2e0 because it can't get the value of the segment
register.
Quit
(top-gdb) si
Cannot execute this command while the selected thread is running.
This is because after gdb output, the signal handler switch to gdb
part. So this ctrl-c make inferior stop not right.
So I make a patch that move the replay patch out of check to handle record too.
Thanks,
Hui
2010-06-04 Hui Zhu <teawater@gmail.com>
* record.c (record_wait): Move signal out of replay code.
---
record.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/record.c
+++ b/record.c
@@ -1069,6 +1069,9 @@ record_wait (struct target_ops *ops,
"record_resume_step = %d\n",
record_resume_step);
+ record_get_sig = 0;
+ signal (SIGINT, record_sig_handler);
+
if (!RECORD_IS_REPLAY && ops != &record_core_ops)
{
if (record_resume_step)
@@ -1088,6 +1091,9 @@ record_wait (struct target_ops *ops,
ret = record_beneath_to_wait (record_beneath_to_wait_ops,
ptid, status, options);
+ if (record_resume_step)
+ return ret;
+
/* Is this a SIGTRAP? */
if (status->kind == TARGET_WAITKIND_STOPPED
&& status->value.sig == TARGET_SIGNAL_TRAP)
@@ -1183,8 +1189,6 @@ record_wait (struct target_ops *ops,
}
}
- record_get_sig = 0;
- signal (SIGINT, record_sig_handler);
/* If GDB is in terminal_inferior mode, it will not get the signal.
And in GDB replay mode, GDB doesn't need to be in terminal_inferior
mode, because inferior will not executed.
@@ -1298,8 +1302,6 @@ Process record: hit hw watchpoint.\n");
}
while (continue_flag);
- signal (SIGINT, handle_sigint);
-
replay_out:
if (record_get_sig)
status->value.sig = TARGET_SIGNAL_INT;
@@ -1312,6 +1314,8 @@ replay_out:
discard_cleanups (old_cleanups);
}
+ signal (SIGINT, handle_sigint);
+
do_cleanups (set_cleanups);
return inferior_ptid;
}