]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
patch ../102426972.patch
authorDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:30 +0000 (12:00 -0800)
committerDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:30 +0000 (12:00 -0800)
README.google
gdb/defs.h
gdb/dwarf2read.c
gdb/extension.c
gdb/psymtab.c
gdb/python/python.c
gdb/utils.c

index d26e0a726e3252c46ade50466b6495f8def63fb1..244874ee5e2c566c41830537676c74118106c804 100644 (file)
@@ -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.
index ccdab18677c1167cf7bb47326eb17b4563b72c28..314a0f5d1767c356096e6d8c3dfc8272717f0d9f 100644 (file)
@@ -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);
 
index 5cb988b983f6b73e5f5dcacc00419630e901e0a4..48b65e063a54cdeb15de8871fe5b5810a66be81b 100644 (file)
@@ -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);
index dac203b0dd2b5cb9b72e41537bcae7db672faa70..0f426ccada3b74d94aa831cd02d33dc694e3e6c5 100644 (file)
@@ -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)
index ba677bcdbe682a355ca1d9285eeff2fe7ebf284b..cfc642ab237f20745d4585ba0c5d45f1344b5993 100644 (file)
@@ -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);
     }
index 4f88b0e26b5d4b0531271810d6d497be4258a2f5..5f03720d3084edd7b3903d882959904be771a218 100644 (file)
@@ -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 ();
 }
 
index ffac4eea19a7d3b1d3de3db2fabc81849f005233..f32a1f349db035ac9b24a44e8409dc9dc718861c 100644 (file)
@@ -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.)  */