public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Omair Javaid <omair.javaid@linaro.org>
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 12:48:00 -0000	[thread overview]
Message-ID: <861si4dgfh.fsf@gmail.com> (raw)
In-Reply-To: <CANW4E-1ek1OE0u-zPcZhkKoY8qaEnO4hsq_qGEx1SVK-4oxsiw@mail.gmail.com>	(Omair Javaid's message of "Wed, 31 Jan 2018 22:00:36 +0500")

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?

-- 
Yao (齐尧)

  reply	other threads:[~2018-02-01 12:48 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 [this message]
2018-02-01 15:56       ` Omair Javaid
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=861si4dgfh.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=omair.javaid@linaro.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).