Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Q: Bug in comment/code in record_full_resume?
@ 2014-12-10 19:13 Andreas From
  2014-12-11 10:45 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas From @ 2014-12-10 19:13 UTC (permalink / raw)
  To: gdb

Hi,

I am thinking this is a bug - in the comment or in the code. Either way, 
I am confused about this code.

At the first assignment - 'step = 1' - as indicated by the comment on 
the line above, a normal continue should mean having step == 0. At the 
second step assignment the comment and the assignment match in content.

BR,
Andreas


static void
record_full_resume (struct target_ops *ops, ptid_t ptid, int step,
                     enum gdb_signal signal)
{
   record_full_resume_step = step;
   record_full_resumed = 1;
   record_full_execution_dir = execution_direction;

   if (!RECORD_FULL_IS_REPLAY)
     {
       struct gdbarch *gdbarch = target_thread_architecture (ptid);

       record_full_message (get_current_regcache (), signal);

       if (!step)
         {
           /* This is not hard single step.  */
           if (!gdbarch_software_single_step_p (gdbarch))
             {
               /* This is a normal continue.  */
               step = 1;
             }
           else
             {
               /* This arch support soft sigle step.  */
               if (thread_has_single_step_breakpoints_set 
(inferior_thread ()))
                 {
                   /* This is a soft single step.  */
                   record_full_resume_step = 1;
                 }
               else
                 {
                   /* This is a continue.
                      Try to insert a soft single step breakpoint.  */
                   if (!gdbarch_software_single_step (gdbarch,
                                                      get_current_frame ()))
                     {
                       /* This system don't want use soft single step.
                          Use hard sigle step.  */
                       step = 1;
                     }
                 }
             }
         }

...


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Q: Bug in comment/code in record_full_resume?
  2014-12-10 19:13 Q: Bug in comment/code in record_full_resume? Andreas From
@ 2014-12-11 10:45 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2014-12-11 10:45 UTC (permalink / raw)
  To: Andreas From, gdb

On 12/10/2014 07:13 PM, Andreas From wrote:
> Hi,
> 
> I am thinking this is a bug - in the comment or in the code. Either way, 
> I am confused about this code.
> 
> At the first assignment - 'step = 1' - as indicated by the comment on 
> the line above, a normal continue should mean having step == 0. At the 
> second step assignment the comment and the assignment match in content.

Recording works by forcing the target to single-step all the way,
and recording side effects at each single-step.

So here:

>        if (!step)

... GDB core told the target to continue ...

>          {
>            /* This is not hard single step.  */
>            if (!gdbarch_software_single_step_p (gdbarch))

... and the target/arch doesn't need software single-step, so ...

>              {
>                /* This is a normal continue.  */
>                step = 1;

... we can ask the target to do the single-step for us.  "step" is
passed to the target beneath a bit further below:

      ops->beneath->to_resume (ops->beneath, ptid, step, signal);

>              }

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-11 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10 19:13 Q: Bug in comment/code in record_full_resume? Andreas From
2014-12-11 10:45 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox