-
gitomat
[illumos-gate] 16634 nvme: nvme_cq_t.ncq_tail is unused -- Andy Fiddaman <illumos⊙fn>
-
gwr
Assuming I don't have an easy way to call libproc stuff or run commands (just libc calls) what's the simplest way to make a process put itself to sleep like "pstop" would? suggestions?
-
gwr
kill(0, ... ) maybe? but I need to be able continue it once I attach with a debugger.
-
rmustacc
SIGSTOP?
-
rmustacc
Are you from outside the process?
-
rmustacc
It's not really the same as pstop under the hood, but semantically probably close.
-
gwr
I'll try that.
-
gwr
kill(0, SIGSTOP)
-
rmustacc
Otherwise, you can just use the stable /proc APIs.
-
gwr
I think I had trouble getting the debugger to connect though, last time I tried that.
-
rmustacc
Do you need to know synchronously that this has happened?
-
gwr
Nah, this is just a startup hack.
-
gwr
Yeah, I remember running into this previously. gdb gets confused trying to continue a process that we attach to after it does 'kill(0, SIGSTOP)' to itself.
-
gwr
I guess it sorta works to: (1) attach gdb, (2) outside of gdb do "kill -CONT $pid", (3) in gdb "continue"
-
gwr
But gdb seems to be still confused. I think maybe I need to tell gdb to leave SIGCONT alone.
-
gwr
bummer. gdb is hopelessly confused. Keeps continuing the program with SIGSTOP.
-
gitomat
[illumos-gate] 16606 Add support for additional log pages to SATL -- Jason King <jason.brian.king⊙gc>
-
richlowe
I have been having issues with gcc and signals on omnios bloody
-
richlowe
sorry, _gdb_ and signals
-
richlowe
so many issues, so many matching /g../
-
richlowe
I haven't been able to figure out any better what's actually happening though, just "very weird" and "signals"
-
richlowe
(it crashes at the end, rather than misbehaving though)
-
gwr
My program seems to restart the: kill(0, SIGSTOP)
-
gwr
I'm not sure how to avoid that. I wonder if pause(2) would work?
-
rmustacc
Is this basically a you want the process to stop running until you attach with gdb?
-
rmustacc
And is modding the target allowed?
-
gwr
right.
-
richlowe
gwr: so my problem is that if I send SIGINT, I receive SIGINT in a loop until I crash
-
richlowe
are you saying you receive SIGSTOP more than once, by any chance?
-
rmustacc
Just do the dumb thing of while (var) { sleep(1s); }' and mod var?
-
gwr
I can attach, but continue leave it continually SIGCONT itself. (Not sure if gdb does that or if the restarts the kill call)
-
gwr
Yes, gdb keeps reporting SIGSTOP
-
richlowe
huh, that's at least similar in spirit to wwhat's screwing me
-
richlowe
-
gwr
I wonder if pstop would work? but I don't have libproc is this monster.
-
gwr
is/in
-
gwr
-
gwr
Looking at the gdb code, STOP_QUIETLY_NO_SIGSTOP is supposed to deal with this.
-
jclulow
gwr: Might be fun to implement phang(1)!
-
gwr
I should probably file a bug somewhere about gdb. That's supposed to work (attaching to a process that was stopped with SIGSTOP)
-
jbk
surely you mean it might be phun? :)
-
gwr
Yeah, maybe I'll go work on that next time I'm bored.
-
gwr
I haven't tried yet, but I think if we attach to a process that has stopped with kill(0, SIGSTOP), this code will continue it with that signal forever more. right? See proc_run_process in
sourceware.org/git/?p=binutils-gdb.…63e5dbb99cbfdd1c5385e53ed031ff#l923
-
gwr
@richlowe might be interested
-
gwr
Maybe attaching to a process that's stopped that way needs special handling.
-
gwr
And maybe on detach, offer to leave it stopped, but I don't care about that :)