Re: g_spawn_async_with_pipes and child signals



On 27 October 2010 23:16, Александр Петухов <al_petukhov mail ru> wrote:
> Hello everybody,
>
> I'm spawning GDB with g_spawn_async_with_pipes in IDE extension written in GTK,
> and have a problem sending "-exec-interrupt" request to it via g_io_channel_write_chars.
> When I'm trying to do so, parent IDE process receives SIGINT even if I set "signal(SIGINT, SIG_IGN)" right before

>From the traceback below, GIO is using threads to implement
asynchronism.  Using sigprocmask and therefore signal() is undefined
in a multi-threaded program but probably defaults to applying to the
current thread only. Clearly it hasn't blocked the sigint in the
thread waiting on the pipe IO.  So that thread received the signal and
executed the default action, terminate the process :-(

Try blocking sigint very first thing in main(), before any g_* calls,
then subsequent threads will inherit the signal mask with sigint
blocked.

> calling g_io_channel_write_chars.
> If I send another command (-break-list for example) in the same situation -
> no problem, so I suppose it's related somehow to the signals GDB sends to it's parent when

GDB sends the signal to its child, ie the process its debugging, but
signals received by any member go to the whole signal group which by
default includes GDB itself and your IDE.

> interrupting debugging process, but I'm confused about how to deal with it.
> The stack trace is like that:
>

Thats the traceback, whats the error message, I'm assuming something
like sigint received??

Cheers
Lex

> #0  0xb7fe2424 in __kernel_vsyscall ()
> #1  0xb767f01b in write () from /lib/i686/cmov/libpthread.so.0
> #2  0xb7844b16 in ?? () from /lib/libglib-2.0.so.0
> #3  0xb77f529c in g_io_channel_write_chars () from /lib/libglib-2.0.so.0
> #4  0xb35dfe08 in on_send_to_gdb (src=0x84ec5c0, cond=G_IO_OUT, data=0x0) at dbm_gdm.c:331
> #5  0xb78446db in ?? () from /lib/libglib-2.0.so.0
> #6  0xb7800305 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
> #7  0xb7803fe8 in ?? () from /lib/libglib-2.0.so.0
> #8  0xb7804527 in g_main_loop_run () from /lib/libglib-2.0.so.0
> #9  0xb7d22e19 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
> #10 0x080bc845 in ?? ()
> #11 0xb7542c76 in __libc_start_main () from /lib/i686/cmov/libc.so.6
> #12 0x0805cd21 in ?? ()
>
> Thank you,
>
> Alexander
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]