From: Hui Zhu <teawater@gmail.com>
To: Tom Tromey <tromey@redhat.com>,
Joel Brobecker <brobecker@adacore.com>,
Michael Snyder <msnyder@vmware.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] let record_resume fail immediately on error
Date: Sat, 12 Dec 2009 08:41:00 -0000 [thread overview]
Message-ID: <daef60380912120040g2a0494b4x4163df4eccb85f82@mail.gmail.com> (raw)
In-Reply-To: <daef60380912011922y563919ffx871d8e3b30d8ad25@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6474 bytes --]
Ping.
Thanks,
Hui
On Wed, Dec 2, 2009 at 11:22, Hui Zhu <teawater@gmail.com> wrote:
> Thanks Tom,
>
> I make a new patch according it. Please help me review it.
>
> Thanks,
> Hui
>
> 2009-12-02 Hui Zhu <teawater@gmail.com>
>
> * record.c (record_message): Change argument.
> (record_message_wrapper): New function.
> (do_record_message): Change it name to
> "record_message_wrapper_safe".
> Let it call "record_message_wrapper".
> (record_resume_error): Deleted.
> (record_resume): Call "record_message".
> (record_wait): Deleted record_resume_error.
> Call "record_message_wrapper_safe".
> Set status when do_record_message need stop the inferior.
> 2009-12-02 Hui Zhu <teawater@gmail.com>
>
> * gdb.reverse/sigall-reverse.exp: Adjust.
>
> ---
> record.c | 70 ++++++++++++++-----------------
> testsuite/gdb.reverse/sigall-reverse.exp | 2
> 2 files changed, 34 insertions(+), 38 deletions(-)
>
> --- a/record.c
> +++ b/record.c
> @@ -572,17 +572,11 @@ record_arch_list_cleanups (void *ignore)
> record the running message of inferior and set them to
> record_arch_list, and add it to record_list. */
>
> -struct record_message_args {
> - struct regcache *regcache;
> - enum target_signal signal;
> -};
> -
> static int
> -record_message (void *args)
> +record_message (struct regcache *regcache, enum target_signal signal)
> {
> int ret;
> - struct record_message_args *myargs = args;
> - struct gdbarch *gdbarch = get_regcache_arch (myargs->regcache);
> + struct gdbarch *gdbarch = get_regcache_arch (regcache);
> struct cleanup *old_cleanups = make_cleanup (record_arch_list_cleanups, 0);
>
> record_arch_list_head = NULL;
> @@ -616,18 +610,18 @@ record_message (void *args)
> if (record_list != &record_first) /* FIXME better way to check */
> {
> gdb_assert (record_list->type == record_end);
> - record_list->u.end.sigval = myargs->signal;
> + record_list->u.end.sigval = signal;
> }
>
> - if (myargs->signal == TARGET_SIGNAL_0
> + if (signal == TARGET_SIGNAL_0
> || !gdbarch_process_record_signal_p (gdbarch))
> ret = gdbarch_process_record (gdbarch,
> - myargs->regcache,
> - regcache_read_pc (myargs->regcache));
> + regcache,
> + regcache_read_pc (regcache));
> else
> ret = gdbarch_process_record_signal (gdbarch,
> - myargs->regcache,
> - myargs->signal);
> + regcache,
> + signal);
>
> if (ret > 0)
> error (_("Process record: inferior program stopped."));
> @@ -648,15 +642,29 @@ record_message (void *args)
> return 1;
> }
>
> +struct record_message_args {
> + struct regcache *regcache;
> + enum target_signal signal;
> +};
> +
> static int
> -do_record_message (struct regcache *regcache,
> - enum target_signal signal)
> +record_message_wrapper (void *args)
> +{
> + struct record_message_args *record_args = args;
> +
> + return record_message (record_args->regcache, record_args->signal);
> +}
> +
> +static int
> +record_message_wrapper_safe (struct regcache *regcache,
> + enum target_signal signal)
> {
> struct record_message_args args;
>
> args.regcache = regcache;
> args.signal = signal;
> - return catch_errors (record_message, &args, NULL, RETURN_MASK_ALL);
> +
> + return catch_errors (record_message_wrapper, &args, NULL, RETURN_MASK_ALL);
> }
>
> /* Set to 1 if record_store_registers and record_xfer_partial
> @@ -983,7 +991,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. */
>
> @@ -995,15 +1002,7 @@ 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;
> - }
> + record_message (get_current_regcache (), signal);
> record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1,
> signal);
> }
> @@ -1067,14 +1066,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. */
> @@ -1130,8 +1121,13 @@ record_wait (struct target_ops *ops,
> {
> /* This must be a single-step trap. Record the
> insn and issue another step. */
> - if (!do_record_message (regcache, TARGET_SIGNAL_0))
> - break;
> + if (!record_message_wrapper_safe (regcache,
> + TARGET_SIGNAL_0))
> + {
> + status->kind = TARGET_WAITKIND_STOPPED;
> + status->value.sig = TARGET_SIGNAL_0;
> + break;
> + }
>
> record_beneath_to_resume (record_beneath_to_resume_ops,
> ptid, 1,
> --- a/testsuite/gdb.reverse/sigall-reverse.exp
> +++ b/testsuite/gdb.reverse/sigall-reverse.exp
> @@ -262,7 +262,7 @@ gdb_test "continue" \
> "get signal TERM"
> gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
>
> -gdb_test "continue" "Program received .*" "continue to sigall exit" \
> +gdb_test "continue" "\[process \[0-9\]+ .*" "continue to sigall exit" \
> "The next instruction is syscall exit_group.* program...y. or n. " \
> "yes"
>
[-- Attachment #2: prec-fix-error-handler.txt --]
[-- Type: text/plain, Size: 4755 bytes --]
---
record.c | 70 ++++++++++++++-----------------
testsuite/gdb.reverse/sigall-reverse.exp | 2
2 files changed, 34 insertions(+), 38 deletions(-)
--- a/record.c
+++ b/record.c
@@ -572,17 +572,11 @@ record_arch_list_cleanups (void *ignore)
record the running message of inferior and set them to
record_arch_list, and add it to record_list. */
-struct record_message_args {
- struct regcache *regcache;
- enum target_signal signal;
-};
-
static int
-record_message (void *args)
+record_message (struct regcache *regcache, enum target_signal signal)
{
int ret;
- struct record_message_args *myargs = args;
- struct gdbarch *gdbarch = get_regcache_arch (myargs->regcache);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct cleanup *old_cleanups = make_cleanup (record_arch_list_cleanups, 0);
record_arch_list_head = NULL;
@@ -616,18 +610,18 @@ record_message (void *args)
if (record_list != &record_first) /* FIXME better way to check */
{
gdb_assert (record_list->type == record_end);
- record_list->u.end.sigval = myargs->signal;
+ record_list->u.end.sigval = signal;
}
- if (myargs->signal == TARGET_SIGNAL_0
+ if (signal == TARGET_SIGNAL_0
|| !gdbarch_process_record_signal_p (gdbarch))
ret = gdbarch_process_record (gdbarch,
- myargs->regcache,
- regcache_read_pc (myargs->regcache));
+ regcache,
+ regcache_read_pc (regcache));
else
ret = gdbarch_process_record_signal (gdbarch,
- myargs->regcache,
- myargs->signal);
+ regcache,
+ signal);
if (ret > 0)
error (_("Process record: inferior program stopped."));
@@ -648,15 +642,29 @@ record_message (void *args)
return 1;
}
+struct record_message_args {
+ struct regcache *regcache;
+ enum target_signal signal;
+};
+
static int
-do_record_message (struct regcache *regcache,
- enum target_signal signal)
+record_message_wrapper (void *args)
+{
+ struct record_message_args *record_args = args;
+
+ return record_message (record_args->regcache, record_args->signal);
+}
+
+static int
+record_message_wrapper_safe (struct regcache *regcache,
+ enum target_signal signal)
{
struct record_message_args args;
args.regcache = regcache;
args.signal = signal;
- return catch_errors (record_message, &args, NULL, RETURN_MASK_ALL);
+
+ return catch_errors (record_message_wrapper, &args, NULL, RETURN_MASK_ALL);
}
/* Set to 1 if record_store_registers and record_xfer_partial
@@ -983,7 +991,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. */
@@ -995,15 +1002,7 @@ 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;
- }
+ record_message (get_current_regcache (), signal);
record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1,
signal);
}
@@ -1067,14 +1066,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. */
@@ -1130,8 +1121,13 @@ record_wait (struct target_ops *ops,
{
/* This must be a single-step trap. Record the
insn and issue another step. */
- if (!do_record_message (regcache, TARGET_SIGNAL_0))
- break;
+ if (!record_message_wrapper_safe (regcache,
+ TARGET_SIGNAL_0))
+ {
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_0;
+ break;
+ }
record_beneath_to_resume (record_beneath_to_resume_ops,
ptid, 1,
--- a/testsuite/gdb.reverse/sigall-reverse.exp
+++ b/testsuite/gdb.reverse/sigall-reverse.exp
@@ -262,7 +262,7 @@ gdb_test "continue" \
"get signal TERM"
gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
-gdb_test "continue" "Program received .*" "continue to sigall exit" \
+gdb_test "continue" "\[process \[0-9\]+ .*" "continue to sigall exit" \
"The next instruction is syscall exit_group.* program...y. or n. " \
"yes"
next prev parent reply other threads:[~2009-12-12 8:41 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-08 4:03 Michael Snyder
2009-09-08 5:00 ` Hui Zhu
2009-09-08 6:59 ` Joel Brobecker
2009-09-08 7:23 ` Hui Zhu
2009-09-08 7:25 ` Hui Zhu
2009-09-08 7:53 ` Hui Zhu
2009-09-08 16:57 ` Michael Snyder
2009-09-09 2:05 ` Hui Zhu
2009-09-12 2:40 ` Hui Zhu
2009-09-24 3:10 ` Hui Zhu
2009-09-26 18:35 ` Michael Snyder
2009-09-27 2:51 ` Hui Zhu
2009-09-28 9:27 ` Hui Zhu
2009-09-28 18:12 ` Joel Brobecker
2009-09-29 2:33 ` Hui Zhu
2009-09-29 21:29 ` Joel Brobecker
2009-09-29 23:57 ` Hui Zhu
2009-10-14 2:10 ` Joel Brobecker
2009-10-14 2:28 ` Hui Zhu
2009-10-14 2:42 ` Joel Brobecker
2009-10-15 4:38 ` Hui Zhu
2009-10-15 4:58 ` Joel Brobecker
2009-10-15 7:17 ` Hui Zhu
2009-10-15 16:23 ` Joel Brobecker
2009-10-15 17:18 ` Michael Snyder
2009-10-16 3:37 ` Hui Zhu
2009-10-20 3:17 ` Hui Zhu
2009-10-23 7:29 ` Hui Zhu
2009-11-03 2:17 ` Hui Zhu
2009-11-03 18:57 ` Michael Snyder
2009-11-04 5:15 ` Hui Zhu
2009-11-10 7:02 ` Hui Zhu
2009-11-10 22:05 ` Tom Tromey
2009-11-11 0:55 ` Hui Zhu
2009-11-24 6:16 ` Hui Zhu
2009-11-24 17:14 ` Tom Tromey
2009-11-25 2:00 ` Hui Zhu
2009-11-25 16:25 ` Joel Brobecker
2009-11-25 17:59 ` Tom Tromey
2009-11-26 6:40 ` Hui Zhu
2009-11-28 0:29 ` Hui Zhu
2009-12-01 22:27 ` Tom Tromey
2009-12-02 3:23 ` Hui Zhu
2009-12-07 15:01 ` Hui Zhu
2009-12-12 8:41 ` Hui Zhu [this message]
2009-12-21 20:45 ` Tom Tromey
2009-12-22 3:18 ` Hui Zhu
2009-09-08 16:54 ` Michael Snyder
2009-09-08 16:52 ` Michael Snyder
2009-09-08 16:50 ` Michael Snyder
2009-09-08 17:05 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=daef60380912120040g2a0494b4x4163df4eccb85f82@mail.gmail.com \
--to=teawater@gmail.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox