Permanently configuring LLDB (in Xcode 4.3.2) not to stop on signals

In case anyone else ever has this question, I finally solved it by adding a breakpoint in NSApplicationMain() (for plain C programs, main() would of course work as well). I set the breakpoint action to process handle SIGUSR2 -n true -p true -s false, and enabled the “Automatically continue after evaluating” option. If anyone has … Read more

Python: How to prevent subprocesses from receiving CTRL-C / Control-C / SIGINT

Somebody in the #python IRC-Channel (Freenode) helped me by pointing out the preexec_fn parameter of subprocess.Popen(…): If preexec_fn is set to a callable object, this object will be called in the child process just before the child is executed. (Unix only) Thus, the following code solves the problem (UNIX only): import subprocess import signal def … Read more

Python: Catch Ctrl-C command. Prompt “really want to quit (y/n)”, resume execution if no

The python signal handlers do not seem to be real signal handlers; that is they happen after the fact, in the normal flow and after the C handler has already returned. Thus you’d try to put your quit logic within the signal handler. As the signal handler runs in the main thread, it will block … Read more

How does sig_atomic_t actually work?

sig_atomic_t is not an atomic data type. It is just the data type that you are allowed to use in the context of a signal handler, that is all. So better read the name as “atomic relative to signal handling”. To guarantee communication with and from a signal handler, only one of the properties of … Read more

Capture SIGINT in Java

The way to handle this would be to register a shutdown hook. If you use (SIGINT) kill -2 will cause the program to gracefully exit and run the shutdown hooks. Registers a new virtual-machine shutdown hook. The Java virtual machine shuts down in response to two kinds of events: The program exits normally, when the … Read more

Segmentation fault handling

The default action for things like SIGSEGV is to terminate your process but as you’ve installed a handler for it, it’ll call your handler overriding the default behavior. But the problem is segfaulting instruction may be retried after your handler finishes and if you haven’t taken measures to fix the first seg fault, the retried … Read more

Python: What is the default handling of SIGTERM?

Building on the answer of Thomas Wouters, python does not register a handler for the SIGTERM signal. We can see this by doing: In[23]: signal.SIG_DFL == signal.signal(signal.SIGTERM,signal.SIG_DFL) Out[23]: True That means that the system will take the default action. On linux, the default action (according to the signal man page) for a SIGTERM is to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)