Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Omair Javaid <omair.javaid@linaro.org>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix for GDB failing to interrupt after run when no PID issued by stub
Date: Thu, 01 Feb 2018 15:56:00 -0000	[thread overview]
Message-ID: <CANW4E-3x1NL_wMGMnNPnc0fOhxFd+XL_Cp9fjW87jsWv_erYTw@mail.gmail.com> (raw)
In-Reply-To: <861si4dgfh.fsf@gmail.com>

On 1 February 2018 at 17:48, Yao Qi <qiyaoltc@gmail.com> wrote:

> Omair Javaid <omair.javaid@linaro.org> writes:
>
> > Heres the gdb log with run (no other command b/w connection and run):
> > https://paste.ubuntu.com/26496015/
> >
>
> One thing suspicious to me is an empty reply to qXfer:threads:read
>
> w $qXfer:threads:read::0,fff#03
> r $l<?xml version="1.0"?>\n<threads>\n</threads>\n#02
>
> OpenOCD claims support "qXfer:threads:read+;", but such reply above may
> confuse GDB.  In OpenOCD source, I find OpenOCD supports qXfer:threads
> unconditionally, but I think it should be changed to support it when
> "target->rtos != NULL".  This may don't matter.
>
> > Heres the gdb log with continue + run (after we issue a
> > continue/interrupt cycle where inferior PID is set and
> > inferior->control.stop_soon = NO_STOP_QUIETLY;)
> > https://paste.ubuntu.com/26496048/
> >
>
> >
> > The situation with OpenOCD happens because we ran and set inferior pid
> > to null hoping to update it. Later in extended_remote_create_inferior
> > called buy run command thread pid gets assigned but we are checking
> > inferior->control.stop_soon just before we update the pid and thus it
> > remains to STOP_QUIETLY for lifetime of the inferior as this flag is
> > only altered by attach command handlers or during call of
> > clear_proceed_status
>
> I still don't understand why inferior->control.stop_soon remains
> "STOP_QUIETLY", inferior::control::stop_soon is initialized to
> NO_STOP_QUIETLY.  I even don't see where it is changed to STOP_QUIETLY.
>
> I can understand that GDB check inferior_ptid (try to set
> inferior->control.stop_soon) first [1], and then update inferior_ptid
> later [2],
>
>   if (!have_inferiors ())
>     {
>       /* Clean up from the last time we ran, before we mark the target
>          running again.  This will mark breakpoints uninserted, and
>          get_offsets may insert breakpoints.  */
>       init_thread_list ();
>       init_wait_for_inferior ();  <-- [1]
>     }
>
>   /* vRun's success return is a stop reply.  */
>   stop_reply = run_worked ? rs->buf : NULL;
>   add_current_inferior_and_thread (stop_reply);  <-- [2]
>
> However, current_inferior_ isn't changed at all, and
> current_inferior_->control.stop_soon is not changed either
> (NO_STOP_QUIETLY).  Could you show me where inf->control.stop_soon is
> changed from NO_STOP_QUIETLY?
>
>
Here is the sequence of change to inf->control.stop_soon

gdb) tar ext :3333

infrun.c clear_proceed_status () line: 2903 (inferior->control.stop_soon =
NO_STOP_QUIETLY;)

infrun.c start_remote () line:3223 (inferior->control.stop_soon =
STOP_QUIETLY_REMOTE;)

gdb) run

infcmd.c:575 calls run_command_1 call () which sets PID to null

Further more if we do a continue after connection a call to
clear_proceed_status
with a valid PID will set inferior->control.stop_soon = NO_STOP_QUIETLY;


--
> Yao (齐尧)
>


  reply	other threads:[~2018-02-01 15:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 10:44 Omair Javaid
2018-01-31 16:41 ` Yao Qi
2018-01-31 17:01   ` Omair Javaid
2018-02-01 12:48     ` Yao Qi
2018-02-01 15:56       ` Omair Javaid [this message]
2018-02-06 14:47         ` Yao Qi
2018-02-08 10:09           ` Omair Javaid
2018-02-15 15:06             ` Yao Qi

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=CANW4E-3x1NL_wMGMnNPnc0fOhxFd+XL_Cp9fjW87jsWv_erYTw@mail.gmail.com \
    --to=omair.javaid@linaro.org \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.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