public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug dap/31433] New: [gdb/dap] Cancel generates StoppedEvent with reason signal
Date: Thu, 29 Feb 2024 11:07:38 +0000	[thread overview]
Message-ID: <bug-31433-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=31433

            Bug ID: 31433
           Summary: [gdb/dap] Cancel generates StoppedEvent with reason
                    signal
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dap
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider this bit from gdb.dap/pause.exp dap.log:
...
READ: <<<{"seq": 6, "type": "request", "command": "pause", "arguments":
{"threadId": 1}}>>>
WROTE: <<<{"request_seq": 6, "type": "response", "command": "pause", "success":
true}>>>
WROTE: <<<{"type": "event", "event": "module", "body": {"reason": "new",
"module": {"id": "/lib64/ld-linux-x86-64.so.2", "name":
"/lib64/ld-linux-x86-64.so.2", "path": "/lib64/ld-linux-x86-64.so.2"}}}>>>
WROTE: <<<{"type": "event", "event": "module", "body": {"reason": "new",
"module": {"id": "system-supplied DSO at 0x7ffff7fcf000", "name":
"system-supplied DSO at 0x7ffff7fcf000"}}}>>>
_suppress_cont case
+++ interrupt -a
entering _on_stop: <gdb.SignalEvent object at 0x7f947089c708>
   details: {'reason': 'signal-received', 'signal-name': 'SIGINT',
'signal-meaning': 'Interrupt'}
WROTE: <<<{"type": "event", "event": "stopped", "body": {"threadId": 1,
"allThreadsStopped": true, "reason": "pause"}}>>>
...

So the client requests a pause, which is translated into an "interrupt -a". 
When the interrupt arrives, it's processed by _on_stop, and generates a stopped
event with reason "pause".

Now consider:
...
READ: <<<{"seq": 8, "type": "request", "command": "evaluate", "arguments":
{"expression": "continue", "context": "repl"}}>>>
WROTE: <<<{"type": "event", "event": "continued", "body": {"threadId": 1,
"allThreadsContinued": true}}>>>
READ: <<<{"seq": 9, "type": "request", "command": "cancel", "arguments":
{"requestId": 8}}>>>
WROTE: <<<{"type": "event", "event": "module", "body": {"reason": "new",
"module": {"id": "/lib64/libm.so.6", "name": "/lib64/libm.so.6", "path":
"/lib64/libm.so.6"}}}>>>
WROTE: <<<{"type": "event", "event": "module", "body": {"reason": "new",
"module": {"id": "/lib64/libc.so.6", "name": "/lib64/libc.so.6", "path":
"/lib64/libc.so.6"}}}>>>
entering _on_stop: <gdb.SignalEvent object at 0x7f947089c708>
   details: {'reason': 'signal-received', 'signal-name': 'SIGINT',
'signal-meaning': 'Interrupt'}
WROTE: <<<{"type": "event", "event": "stopped", "body": {"threadId": 1,
"allThreadsStopped": true, "reason": "signal"}}>>>
WROTE: <<<{"request_seq": 8, "type": "response", "command": "evaluate", "body":
{"result": "Continuing.\n", "variablesReference": 0}, "success": true}>>>
WROTE: <<<{"request_seq": 9, "type": "response", "command": "cancel",
"success": true}>>>
...

The client requests a continue, followed by a cancel.  The cancel is translated
into a gdb.interrupt.  When the interrupt arrives, it's processed by _on_stop,
and generates a stopped event with reason "signal".

I wonder if the reason should be "cancel" or some such, to allow the client to
differentiate between events generated by a cancel, and external signal events.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2024-02-29 11:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 11:07 vries at gcc dot gnu.org [this message]
2024-02-29 15:45 ` [Bug dap/31433] " tromey at sourceware dot org

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=bug-31433-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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).