[Patch] More responsive QUITs

Sterling Augustine
2011-07-12T22:51:57Z

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

Hello,

Enclosed is a patch that adds calls to QUIT in various places which
makes GDB more responsive to CTRL-C. In particular, reading a symbol
file at start up can now be interrupted (although perhaps still not as
responsive as one might like), as well as various other long running
operations. I know at least two GDB developers have one or another of
these on their TODO lists.

All three of these calls to QUIT have relatively close cleanup handlers:

The new call in dwarf2_build_psymtabs is cleaned up by the handlers in
the same function.
Likewise for the new call in process_type_comp_unit, which is just a
level or two down.

The new call in map_symbol_filenames_psymtab occurs in a location
where I don't believe there could be any inconsistent state.

Comments?

Sterling

=-=-=-=-=-
2011-07-12 Sterling Augustine <saugustine@google.com>

* dwarf2read.c (process_type_comp_unit): Call QUIT.
(dwarf2_build_psymtabs_hard): Likewise.
* psymtab.c (map_symbol_filenames_psymtab): Likewise.

[-- Attachment #2: quit.patch --]
[-- Type: text/x-patch, Size: 1127 bytes --]

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.550
diff -d -u -r1.550 dwarf2read.c
--- dwarf2read.c 12 Jul 2011 20:59:03 -0000 1.550
+++ dwarf2read.c 12 Jul 2011 22:18:49 -0000
@@ -3417,6 +3417,7 @@
struct objfile *objfile = (struct objfile *) info;
struct dwarf2_per_cu_data *this_cu;

+ QUIT;
this_cu = &entry->per_cu;

gdb_assert (dwarf2_per_objfile->types.readin);
@@ -3500,6 +3501,7 @@
{
struct dwarf2_per_cu_data *this_cu;

+ QUIT;
this_cu = dwarf2_find_comp_unit (info_ptr
- dwarf2_per_objfile->info.buffer,
objfile);
Index: psymtab.c
===================================================================
RCS file: /cvs/src/src/gdb/psymtab.c,v
retrieving revision 1.30
diff -d -u -r1.30 psymtab.c
--- psymtab.c 10 Jun 2011 21:48:04 -0000 1.30
+++ psymtab.c 12 Jul 2011 22:18:49 -0000
@@ -1093,6 +1093,7 @@
if (ps->readin)
continue;

+ QUIT;
fullname = psymtab_to_fullname (ps);
(*fun) (ps->filename, fullname, data);
}