This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4]: Handle SIGINT under Python by raising KeyboardInterrupt

>>>>> "Yit" == Khoo Yit Phang <> writes:

Yit> diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
Yit> --- a/gdb/python/python-internal.h
Yit> +++ b/gdb/python/python-internal.h
Yit> @@ -102,8 +102,11 @@
Yit>  #include "command.h"
Yit>  #include "breakpoint.h"
Yit> +#include "defs.h"

I think this should not be needed.  It ought to be in each individual .c

Yit> +static sig_t gdbpy_saved_sigint_handler;

Rather than use a global, it seems a bit better to me to store the old
signal handler in the python_env, and then restore it from there.

Yit> +static void
Yit> +gdbpy_handle_sigint (int sig)

All new functions need an introductory comment.
In cases like these the comment can be reasonably short.

Yit> +{
Yit> +  PyErr_SetInterrupt ();

The gdb style seems to be to reinstall the signal handler here:

  signal (sig, gdbpy_handle_sigint);
  PyErr_SetInterrupt ();

I guess this is for safety on SysV-like systems.
I have no idea whether this is still relevant, but it seems harmless.

Yit> +      gdbpy_suspend_sigint_handler ();

This addition handles one instance of the python->gdb transition, but
there are many more to fix.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]