Re: [RFA] let record_resume fail immediately on error

Hui Zhu
2009-11-03T02:17:59Z

[-- Attachment #1: Type: text/plain, Size: 2138 bytes --]

Hi Michael,

Now we have a lot of patch in running.
Could you please help me review this patch first?

Thanks,
Hui

2009-11-03 Hui Zhu <teawater@gmail.com>

* record.c (record_resume_error): Deleted.
(record_resume): Call record_message.
(record_wait): Deleted record_resume_error.
Set status when do_record_message need stop the inferior.

---
record.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)

--- a/record.c
+++ b/record.c
@@ -954,7 +954,6 @@ record_close (int quitting)
}

static int record_resume_step = 0;
-static int record_resume_error;

/* "to_resume" target method. Resume the process record target. */

@@ -966,15 +965,11 @@ record_resume (struct target_ops *ops, p

if (!RECORD_IS_REPLAY)
{
- if (do_record_message (get_current_regcache (), signal))
- {
- record_resume_error = 0;
- }
- else
- {
- record_resume_error = 1;
- return;
- }
+ struct record_message_args args;
+
+ args.regcache = get_current_regcache ();
+ args.signal = signal;
+ record_message (&args);
record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1,
signal);
}
@@ -1038,14 +1033,6 @@ record_wait (struct target_ops *ops,

if (!RECORD_IS_REPLAY && ops != &record_core_ops)
{
- if (record_resume_error)
- {
- /* If record_resume get error, return directly. */
- status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = TARGET_SIGNAL_ABRT;
- return inferior_ptid;
- }
-
if (record_resume_step)
{
/* This is a single step. */
@@ -1091,7 +1078,11 @@ record_wait (struct target_ops *ops,
Therefore we will not return to gdb.
Record the insn and resume. */
if (!do_record_message (regcache, TARGET_SIGNAL_0))
- break;
+ {
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_0;
+ break;
+ }

record_beneath_to_resume (record_beneath_to_resume_ops,
ptid, 1,

[-- Attachment #2: prec-fix-error-handler.txt --]
[-- Type: text/plain, Size: 1797 bytes --]

---
record.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)

--- a/record.c
+++ b/record.c
@@ -954,7 +954,6 @@ record_close (int quitting)
}

static int record_resume_step = 0;
-static int record_resume_error;

/* "to_resume" target method. Resume the process record target. */

@@ -966,15 +965,11 @@ record_resume (struct target_ops *ops, p

if (!RECORD_IS_REPLAY)
{
- if (do_record_message (get_current_regcache (), signal))
- {
- record_resume_error = 0;
- }
- else
- {
- record_resume_error = 1;
- return;
- }
+ struct record_message_args args;
+
+ args.regcache = get_current_regcache ();
+ args.signal = signal;
+ record_message (&args);
record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1,
signal);
}
@@ -1038,14 +1033,6 @@ record_wait (struct target_ops *ops,

if (!RECORD_IS_REPLAY && ops != &record_core_ops)
{
- if (record_resume_error)
- {
- /* If record_resume get error, return directly. */
- status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = TARGET_SIGNAL_ABRT;
- return inferior_ptid;
- }
-
if (record_resume_step)
{
/* This is a single step. */
@@ -1091,7 +1078,11 @@ record_wait (struct target_ops *ops,
Therefore we will not return to gdb.
Record the insn and resume. */
if (!do_record_message (regcache, TARGET_SIGNAL_0))
- break;
+ {
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_0;
+ break;
+ }

record_beneath_to_resume (record_beneath_to_resume_ops,
ptid, 1,