public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug dap/31433] New: [gdb/dap] Cancel generates StoppedEvent with reason signal
@ 2024-02-29 11:07 vries at gcc dot gnu.org
  2024-02-29 15:45 ` [Bug dap/31433] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-29 11:07 UTC (permalink / raw)
  To: gdb-prs

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.

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

* [Bug dap/31433] [gdb/dap] Cancel generates StoppedEvent with reason signal
  2024-02-29 11:07 [Bug dap/31433] New: [gdb/dap] Cancel generates StoppedEvent with reason signal vries at gcc dot gnu.org
@ 2024-02-29 15:45 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2024-02-29 15:45 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
> 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.

FWIW we can have it do anything.  Even "signal" isn't specified
explicitly:

    reason: 'step' | 'breakpoint' | 'exception' | 'pause' | 'entry' | 'goto'
        | 'function breakpoint' | 'data breakpoint' | 'instruction breakpoint'
        | string;

That's from:

https://microsoft.github.io/debug-adapter-protocol/specification#Events_Stopped

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

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

end of thread, other threads:[~2024-02-29 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29 11:07 [Bug dap/31433] New: [gdb/dap] Cancel generates StoppedEvent with reason signal vries at gcc dot gnu.org
2024-02-29 15:45 ` [Bug dap/31433] " tromey at sourceware dot org

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).