diff options
author | Doug Evans <dje@google.com> | 2015-12-10 12:00:30 -0800 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2015-12-10 12:00:30 -0800 |
commit | f31f92104eb8e2f7a2db987880cbeb3c5504926d (patch) | |
tree | 3a657353340555cf491479753c881282394203bd | |
parent | b8f344199d9d4cc8ac27a956037d38ef0d848b8a (diff) | |
download | fsf-binutils-gdb-f31f92104eb8e2f7a2db987880cbeb3c5504926d.zip fsf-binutils-gdb-f31f92104eb8e2f7a2db987880cbeb3c5504926d.tar.gz fsf-binutils-gdb-f31f92104eb8e2f7a2db987880cbeb3c5504926d.tar.bz2 |
patch ../102426972.patch
-rw-r--r-- | README.google | 15 | ||||
-rw-r--r-- | gdb/defs.h | 3 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 6 | ||||
-rw-r--r-- | gdb/extension.c | 6 | ||||
-rw-r--r-- | gdb/psymtab.c | 5 | ||||
-rw-r--r-- | gdb/python/python.c | 4 | ||||
-rw-r--r-- | gdb/utils.c | 28 |
7 files changed, 66 insertions, 1 deletions
diff --git a/README.google b/README.google index d26e0a7..244874e 100644 --- a/README.google +++ b/README.google @@ -106,3 +106,18 @@ they are an ongoing maintenance burden. + (symbol_info_typedef_print): Declare. + * symtab.c: #include "typeprint.h". + (print_symbol_info): Call them. +--- README.google 2015-09-05 16:18:05.000000000 -0700 ++++ README.google 2015-09-05 16:20:56.000000000 -0700 ++ ++2015-09-05 Doug Evans <dje@google.com> ++ ++ * defs.h (begin_uninterruptible_section): Declare. ++ (defer_quit): Declare. ++ * utils.c (defer_quit): New global. ++ (end_uninterruptible_cleanup): New function. ++ (begin_uninterruptible_cleanup): New function. ++ * extension.c (check_quit_flag): Check it. [revised from original] ++ * dwarf2read.c (dw2_instantiate_symtab): Mark symtab expansion as ++ uninterruptible. ++ * psymtab.c (psymtab_to_symtab): Ditto. ++ * python/python.c (check_quit_flag): Ditto. @@ -141,11 +141,14 @@ extern void clear_quit_flag (void); extern int check_quit_flag (void); /* * Set the quit flag. */ extern void set_quit_flag (void); +/* Indicate entering an uninterruptible region of code. */ +struct cleanup *begin_uninterruptible_section (void); /* Flag that function quit should call quit_force. */ extern volatile int sync_quit_force_run; extern int immediate_quit; +extern int defer_quit; extern void quit (void); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 5cb988b..48b65e0 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2718,7 +2718,13 @@ dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu) if (!per_cu->v.quick->compunit_symtab) { struct cleanup *back_to = make_cleanup (free_cached_comp_units, NULL); + increment_reading_symtab (); + /* We call out to routines that can call QUIT (which we shouldn't). + E.g., dwarf2_compute_name calls c_print_type. + Defer QUIT processing to ensure the symtab isn't left in + a half-completed state. */ + begin_uninterruptible_section (); dw2_do_instantiate_symtab (per_cu); process_cu_includes (); do_cleanups (back_to); diff --git a/gdb/extension.c b/gdb/extension.c index dac203b..0f426cc 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -833,6 +833,12 @@ check_quit_flag (void) int i, result = 0; const struct extension_language_defn *extlang; + /* GOOGLE LOCAL */ + /* Are we in an uninterruptible section? */ + if (defer_quit) + return 0; + /* END GOOGLE LOCAL */ + ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang) { if (extlang->ops->check_quit_flag != NULL) diff --git a/gdb/psymtab.c b/gdb/psymtab.c index ba677bc..cfc642a 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -787,6 +787,11 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) { struct cleanup *back_to = increment_reading_symtab (); + /* Some debug info readers like dwarf2read.c call out to routines that + call QUIT. Defer QUIT processing to ensure the symtab isn't left in + a half-completed state. */ + begin_uninterruptible_section (); + (*pst->read_symtab) (pst, objfile); do_cleanups (back_to); } diff --git a/gdb/python/python.c b/gdb/python/python.c index 4f88b0e..5f03720 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -290,6 +290,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang) static int gdbpy_check_quit_flag (const struct extension_language_defn *extlang) { + /* Are we in an uninterruptible section? */ + if (defer_quit) + return 0; + return PyOS_InterruptOccurred (); } diff --git a/gdb/utils.c b/gdb/utils.c index ffac4ee..f32a1f3 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -55,7 +55,6 @@ #include "top.h" #include "main.h" #include "solist.h" - #include "inferior.h" /* for signed_pointer_to_address */ #include "gdb_curses.h" @@ -122,6 +121,33 @@ int job_control; int immediate_quit; +/* Nonzero means GDB is in a critical section that cannot be interrupted. + This is the case, for example, when expanding symtabs. + TODO(dje): Symtab expansion should be interruptible. */ + +int defer_quit; + +/* Cleanup to decrement defer_quit. */ + +static void +end_uninterruptible_cleanup (void *ignore) +{ + --defer_quit; + gdb_assert (defer_quit >= 0); +} + +/* Indicate GDB cannot be interrupted. + The result is a cleanup to be called when SIGINTs can be handled + again. */ + +struct cleanup * +begin_uninterruptible_section (void) +{ + ++defer_quit; + gdb_assert (defer_quit > 0); + return make_cleanup (end_uninterruptible_cleanup, NULL); +} + /* Nonzero means that strings with character values >0x7F should be printed as octal escapes. Zero means just print the value (e.g. it's an international character, and the terminal or window can cope.) */ |