aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-loop.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-08-04 20:09:46 +0000
committerPedro Alves <palves@redhat.com>2011-08-04 20:09:46 +0000
commite0dd0826e246e3d39081881db7bcc69ca5ec77a2 (patch)
tree6b3c3ee78337912f4a3becc0ee70162a6d21386b /gdb/event-loop.c
parent79a45e254f090b628473614054ed318d70409239 (diff)
downloadgdb-e0dd0826e246e3d39081881db7bcc69ca5ec77a2.zip
gdb-e0dd0826e246e3d39081881db7bcc69ca5ec77a2.tar.gz
gdb-e0dd0826e246e3d39081881db7bcc69ca5ec77a2.tar.bz2
2011-08-04 Pedro Alves <pedro@codesourcery.com>
* event-loop.c (gdb_do_one_event): Remove `data' parameter. (start_event_loop): Use TRY_CATCH instead of catch_errors. * event-loop.h (gdb_do_one_event): Remove `data' parameter. * top.c (gdb_readline_wrapper): Adjust. * tui/tui-interp.c (tui_command_loop): (_initialize_tui_interp): Don't install it.
Diffstat (limited to 'gdb/event-loop.c')
-rw-r--r--gdb/event-loop.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index b6702f8..ea69ccf 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -410,11 +410,10 @@ process_event (void)
/* Process one high level event. If nothing is ready at this time,
wait for something to happen (via gdb_wait_for_event), then process
it. Returns >0 if something was done otherwise returns <0 (this
- can happen if there are no event sources to wait for). If an error
- occurs catch_errors() which calls this function returns zero. */
+ can happen if there are no event sources to wait for). */
int
-gdb_do_one_event (void *data)
+gdb_do_one_event (void)
{
static int event_source_head = 0;
const int number_of_sources = 3;
@@ -478,30 +477,30 @@ gdb_do_one_event (void *data)
void
start_event_loop (void)
{
- /* Loop until there is nothing to do. This is the entry point to the
- event loop engine. gdb_do_one_event, called via catch_errors()
- will process one event for each invocation. It blocks waits for
- an event and then processes it. >0 when an event is processed, 0
- when catch_errors() caught an error and <0 when there are no
- longer any event sources registered. */
+ /* Loop until there is nothing to do. This is the entry point to
+ the event loop engine. gdb_do_one_event will process one event
+ for each invocation. It blocks waiting for an event and then
+ processes it. */
while (1)
{
- int gdb_result;
+ volatile struct gdb_exception ex;
+ int result = 0;
- gdb_result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL);
- if (gdb_result < 0)
- break;
-
- /* If we long-jumped out of do_one_event, we probably
- didn't get around to resetting the prompt, which leaves
- readline in a messed-up state. Reset it here. */
-
- if (gdb_result == 0)
+ TRY_CATCH (ex, RETURN_MASK_ALL)
{
+ result = gdb_do_one_event ();
+ }
+ if (ex.reason < 0)
+ {
+ exception_print (gdb_stderr, ex);
+
/* If any exception escaped to here, we better enable
stdin. Otherwise, any command that calls async_disable_stdin,
and then throws, will leave stdin inoperable. */
async_enable_stdin ();
+ /* If we long-jumped out of do_one_event, we probably didn't
+ get around to resetting the prompt, which leaves readline
+ in a messed-up state. Reset it here. */
/* FIXME: this should really be a call to a hook that is
interface specific, because interfaces can display the
prompt in their own way. */
@@ -517,6 +516,8 @@ start_event_loop (void)
/* Maybe better to set a flag to be checked somewhere as to
whether display the prompt or not. */
}
+ if (result < 0)
+ break;
}
/* We are done with the event loop. There are no more event sources