public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17024] New: SIGSTOP handling is counterintuitive
@ 2014-06-04 21:16 dje at google dot com
  2014-06-04 21:17 ` [Bug gdb/17024] " dje at google dot com
  2014-06-04 21:25 ` dje at google dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dje at google dot com @ 2014-06-04 21:16 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 17024
           Summary: SIGSTOP handling is counterintuitive
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

Run the attached program until it sends itself a SIGSTOP.
Then attach to it from gdb.

When I do "continue", gdb continually "resumes" the inferior by passing it
SIGSTOP, and thus "continue" becomes useless (set debug infrun 1 to see this).
I can resume the inferior with "signal 0", but I fear one thread may actually
be stopped on a signal I don't want it to ignore.
Plus I have to keep doing that until all threads are walked passed their
SIGSTOP.
It makes it hard to script gdb to "attach, thread apply all bt, continue &,
detach" (target-async of course).

I can also walk the threads passed their SIGSTOP by first "handle SIGSTOP
nopass".  I can also get the inferior going again with "shell kill -CONT <pid>"
(btw, gdb should have an easier way to write that).

I can imagine gdb is trying to do the right thing here.
If someone outside of gdb sends SIGSTOP then someone also needs to explicitly
send SIGCONT.  Plus if one wants to detach gdb leaving the inferior in the
state it was found, how does one do that? (if one does something different than
what gdb current does).  But the current behaviour isn't confusion-free.  We
need to add some clarity here.

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


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

* [Bug gdb/17024] SIGSTOP handling is counterintuitive
  2014-06-04 21:16 [Bug gdb/17024] New: SIGSTOP handling is counterintuitive dje at google dot com
@ 2014-06-04 21:17 ` dje at google dot com
  2014-06-04 21:25 ` dje at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dje at google dot com @ 2014-06-04 21:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from dje at google dot com ---
Created attachment 7628
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7628&action=edit
example program

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


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

* [Bug gdb/17024] SIGSTOP handling is counterintuitive
  2014-06-04 21:16 [Bug gdb/17024] New: SIGSTOP handling is counterintuitive dje at google dot com
  2014-06-04 21:17 ` [Bug gdb/17024] " dje at google dot com
@ 2014-06-04 21:25 ` dje at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dje at google dot com @ 2014-06-04 21:25 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from dje at google dot com ---
Data point: The first "continue" does resume with signal 0 (normal resume). 
Then it gets stuck in a loop of getting SIGSTOP, sending SIGSTOP.

(gdb) set debug infrun 1
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (Thread 0x7f7ce3193700 (LWP 17102))
infrun: clear_proceed_status_thread (Thread 0x7f7ce2942700 (LWP 17103))
infrun: clear_proceed_status_thread (Thread 0x7f7ce20f1700 (LWP 17104))
infrun: clear_proceed_status_thread (Thread 0x7f7ce18a0700 (LWP 17105))
infrun: clear_proceed_status_thread (Thread 0x7f7ce416f740 (LWP 17100))
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=0)
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread
[Thread 0x7f7ce416f740 (LWP 17100)] at 0x7f7ce31c90dd
infrun: target_wait (-1, status) =
infrun:   17100 [Thread 0x7f7ce3193700 (LWP 17102)],
infrun:   status->kind = stopped, signal = GDB_SIGNAL_STOP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x7f7ce31c90dd
infrun: context switch
infrun: Switching context from Thread 0x7f7ce416f740 (LWP 17100) to Thread
0x7f7ce3193700 (LWP 17102)
infrun: random signal (GDB_SIGNAL_STOP)

Program received signal SIGSTOP, Stopped (signal).
infrun: stop_waiting
[Switching to Thread 0x7f7ce3193700 (LWP 17102)]
0x00007f7ce31c90dd in nanosleep () from /usr/grte/v3/lib64/libc.so.6
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (Thread 0x7f7ce3193700 (LWP 17102))
infrun: clear_proceed_status_thread (Thread 0x7f7ce2942700 (LWP 17103))
infrun: clear_proceed_status_thread (Thread 0x7f7ce20f1700 (LWP 17104))
infrun: clear_proceed_status_thread (Thread 0x7f7ce18a0700 (LWP 17105))
infrun: clear_proceed_status_thread (Thread 0x7f7ce416f740 (LWP 17100))
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=0)
infrun: resume (step=0, signal=GDB_SIGNAL_STOP), trap_expected=0, current
thread [Thread 0x7f7ce3193700 (LWP 17102)] at 0x7f7ce31c90dd
infrun: target_wait (-1, status) =
infrun:   17100 [Thread 0x7f7ce3193700 (LWP 17102)],
infrun:   status->kind = stopped, signal = GDB_SIGNAL_STOP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x7f7ce31c90dd
infrun: random signal (GDB_SIGNAL_STOP)

Program received signal SIGSTOP, Stopped (signal).
infrun: stop_waiting
0x00007f7ce31c90dd in nanosleep () from /usr/grte/v3/lib64/libc.so.6
...

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


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

end of thread, other threads:[~2014-06-04 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-04 21:16 [Bug gdb/17024] New: SIGSTOP handling is counterintuitive dje at google dot com
2014-06-04 21:17 ` [Bug gdb/17024] " dje at google dot com
2014-06-04 21:25 ` dje at google dot com

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