Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Hui Zhu <teawater@gmail.com>,
	 Joel Brobecker <brobecker@adacore.com>,
	 Michael Snyder <msnyder@vmware.com>,
	 shuchang zhou <shuchang.zhou@gmail.com>,
	 paawan oza <paawan1982@yahoo.com>,
	 Tom Tromey <tromey@redhat.com>
Subject: Re: [RFC] Add support of software single step to process record
Date: Thu, 24 Dec 2009 17:38:00 -0000	[thread overview]
Message-ID: <200912241738.19780.pedro@codesourcery.com> (raw)
In-Reply-To: <daef60380912230123v3cc9bf79qcb0cd3faa84753f3@mail.gmail.com>

On Wednesday 23 December 2009 09:23:21, Hui Zhu wrote:
> +      struct gdbarch *gdbarch = target_thread_architecture (ptid);
> +
>        record_message (get_current_regcache (), signal);

>        record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1,
>                                  signal);

Why is this resume call still present?

> +
> +       if (gdbarch_software_single_step_p (gdbarch))
> +         {
> +           if (!inserted_single_step_breakpoint_p ())

Isn't this naming stale?  I thought you had renamed this.

> +             gdbarch_software_single_step (gdbarch, get_current_frame ());
> +           record_beneath_to_resume (record_beneath_to_resume_ops,
> +                                     ptid, step, signal);
> +           record_resume_step = 0;
> +         }
> +       else
> +         record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1,
> +                                   signal);
>      }
> 

You've got the predicates a bit mixed up.

 - gdbarch_software_single_step_p purpose is only "is there or
   not a gdbarch_software_single_step callback registered in
   this gdbarch"?  It returning true does not mean that
   software single-step should be used for that single-step.

 - gdbarch_software_single_step can return false, meaning,
   no software single-step needs to be used.

This is how stepping over atomic sequences is handled
currently (grep for deal_with_atomic_sequence):
gdbarch_software_single_step_p returns true, but
gdbarch_software_single_step returns false most
of the times.  See also infrun.c:maybe_software_singlestep.

I think you want this:

       if (!step
           && gdbarch_software_single_step_p (gdbarch)
           && !single_step_breakpoints_inserted ()
           && gdbarch_software_single_step (gdbarch, get_current_frame ()))
         record_resume_step = 0;
       else
         record_resume_step = 1;

       record_beneath_to_resume (record_beneath_to_resume_ops, ptid,
                                 record_resume_step, signal);

If `step' is true when record_resume is called, and so is
gdbarch_software_single_step_p, then it must be that infrun.c
already determined that gdbarch_software_single_step returns
false, otherwise, `step' would be false (maybe_software_singlestep).

If `step' is false (the user is requesting a continue), and
no single-step breakpoints are inserted yet, but,
gdbarch_software_single_step returns false, we have ourselves
an arch/target combo that only wants software single-stepping
for atomic sequences, e.g., MIPS (non-linux), or PPC.  If
so, we should force hardware single-step in the target
beneath (set record_resume_step to 1).

-- 
Pedro Alves


  parent reply	other threads:[~2009-12-24 17:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-18  8:21 Hui Zhu
2009-12-18 19:37 ` Michael Snyder
2009-12-20 13:48   ` Joel Brobecker
2009-12-23  6:38     ` Hui Zhu
2009-12-23  6:52       ` Joel Brobecker
2009-12-23  9:24         ` Hui Zhu
     [not found]           ` <8d62b6fe0912231751p1202294cw83430e8d53af0951@mail.gmail.com>
2009-12-24  1:54             ` Fwd: " shuchang zhou
2009-12-24 17:38           ` Pedro Alves [this message]
2010-01-04 14:23             ` Hui Zhu
2010-01-08 16:24               ` Pedro Alves
2010-05-25  5:14                 ` Hui Zhu
2010-05-27  6:51                   ` Hui Zhu
2010-06-11 13:55                     ` Pedro Alves
2010-06-20  7:29                       ` Hui Zhu
2010-06-22 10:13                         ` Pedro Alves
2010-07-19  7:58                           ` Hui Zhu
2009-12-22 18:23 ` Tom Tromey
2009-12-23  3:09   ` Hui Zhu

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=200912241738.19780.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    --cc=paawan1982@yahoo.com \
    --cc=shuchang.zhou@gmail.com \
    --cc=teawater@gmail.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