From: Tom Tromey <tom@tromey.com>
To: Johan Sternerup <johan.sternerup@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Handle DAP "stepOut" request in outermost frame
Date: Thu, 25 Apr 2024 11:52:39 -0600 [thread overview]
Message-ID: <87jzklgwig.fsf@tromey.com> (raw)
In-Reply-To: <20240425172019.863412-1-johan.sternerup@gmail.com> (Johan Sternerup's message of "Thu, 25 Apr 2024 19:20:19 +0200")
>>>>> "Johan" == Johan Sternerup <johan.sternerup@gmail.com> writes:
Johan> Previously a "stepOut" request when in the outermost frame would result
Johan> in a sucessful response even though gdb internally would reject the
Johan> associated "finish" request, which means no stoppedEvent would ever be
Johan> sent back to the client. Thus the client would believe the inferior was
Johan> still running and as a consequence reject subsequent "next" and "stepIn"
Johan> requests from the user.
Thanks for the patch.
Johan> The solution here is to make the same check that is made in
Johan> 'infcmd.c/finish_command()' to make sure we're not in the outermost
Johan> frame, but now we do it _before_ actually running the "finish" command
Johan> so that we can send an error response immediately.
Johan> -@request("stepOut", response=False)
... I guess the reason this doesn't "just work" is that response=False
means the exception propagation doesn't really work.
Johan> +@request("stepOut", on_dap_thread=True)
Johan> def step_out(*, threadId: int, singleThread: bool = False, **args):
Johan> - _handle_thread_step(threadId, singleThread, True)
Johan> - exec_and_expect_stop("finish")
Johan> + if not gdb.selected_frame().older():
Johan> + raise DAPException("\"finish\" not meaningful in the outermost frame.")
gdb.* APIs can only be used on the gdb thread, so this placement isn't
correct.
Johan> + send_gdb_with_response(lambda: _handle_thread_step(threadId, singleThread))
Maybe one way forward would be a new helper function to be run on the
gdb thread, that incorporates the new check.
Johan> +if {[dict get $response success] == "true"} {
Johan> + fail "stepOut from outermost frame should not succeed"
Johan> +} else {
Johan> + pass "stepOut from outermost frame failed like it should"
Johan> +}
Johan> +
Johan> +dap_check_request_and_response "still stopped and may request backtrace" \
Johan> + stackTrace {o threadId [i 1]}
Indentation here & before the 'fail' looks wrong.
Tom
next prev parent reply other threads:[~2024-04-25 17:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 17:20 Johan Sternerup
2024-04-25 17:52 ` Tom Tromey [this message]
2024-04-25 18:05 ` Tom Tromey
2024-04-26 18:32 ` Johan Sternerup
2024-04-26 20:28 ` Tom Tromey
2024-04-27 8:24 ` Johan Sternerup
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=87jzklgwig.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=johan.sternerup@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).