Fix errors on previous commit (on file gdb-probes-based-interface-robust-2of2.patch)

This commit is contained in:
Sergio Durigan Junior 2015-09-02 17:50:44 -04:00
parent 2ef6d5f976
commit 8b367b2286
1 changed files with 22 additions and 14 deletions

View File

@ -59,30 +59,32 @@ Index: gdb-7.9.1/gdb/solib-svr4.c
=================================================================== ===================================================================
--- gdb-7.9.1.orig/gdb/solib-svr4.c --- gdb-7.9.1.orig/gdb/solib-svr4.c
+++ gdb-7.9.1/gdb/solib-svr4.c +++ gdb-7.9.1/gdb/solib-svr4.c
@@ -1769,7 +1769,7 @@ static enum probe_action @@ -1769,8 +1769,9 @@ static enum probe_action
solib_event_probe_action (struct probe_and_action *pa) solib_event_probe_action (struct probe_and_action *pa)
{ {
enum probe_action action; enum probe_action action;
- unsigned probe_argc; - unsigned probe_argc;
+ unsigned probe_argc = 0; + unsigned probe_argc = 0;
struct frame_info *frame = get_current_frame (); struct frame_info *frame = get_current_frame ();
+ volatile struct gdb_exception ex;
action = pa->action; action = pa->action;
@@ -1783,7 +1783,23 @@ solib_event_probe_action (struct probe_a if (action == DO_NOTHING || action == PROBES_INTERFACE_FAILED)
@@ -1783,7 +1784,23 @@ solib_event_probe_action (struct probe_a
arg0: Lmid_t lmid (mandatory) arg0: Lmid_t lmid (mandatory)
arg1: struct r_debug *debug_base (mandatory) arg1: struct r_debug *debug_base (mandatory)
arg2: struct link_map *new (optional, for incremental updates) */ arg2: struct link_map *new (optional, for incremental updates) */
- probe_argc = get_probe_argument_count (pa->probe, frame); - probe_argc = get_probe_argument_count (pa->probe, frame);
+ TRY + TRY_CATCH (ex, RETURN_MASK_ERROR)
+ { + {
+ probe_argc = get_probe_argument_count (pa->probe, frame); + probe_argc = get_probe_argument_count (pa->probe, frame);
+ } + }
+ CATCH (ex, RETURN_MASK_ERROR) +
+ if (ex.reason < 0)
+ { + {
+ exception_print (gdb_stderr, ex); + exception_print (gdb_stderr, ex);
+ probe_argc = 0; + probe_argc = 0;
+ } + }
+ END_CATCH
+ +
+ /* If get_probe_argument_count throws an exception, probe_argc will + /* If get_probe_argument_count throws an exception, probe_argc will
+ be set to zero. However, if pa->probe does not have arguments, + be set to zero. However, if pa->probe does not have arguments,
@ -93,7 +95,7 @@ Index: gdb-7.9.1/gdb/solib-svr4.c
if (probe_argc == 2) if (probe_argc == 2)
action = FULL_RELOAD; action = FULL_RELOAD;
else if (probe_argc < 2) else if (probe_argc < 2)
@@ -1889,7 +1905,7 @@ svr4_handle_solib_event (void) @@ -1889,10 +1906,11 @@ svr4_handle_solib_event (void)
struct probe_and_action *pa; struct probe_and_action *pa;
enum probe_action action; enum probe_action action;
struct cleanup *old_chain, *usm_chain; struct cleanup *old_chain, *usm_chain;
@ -102,41 +104,47 @@ Index: gdb-7.9.1/gdb/solib-svr4.c
CORE_ADDR pc, debug_base, lm = 0; CORE_ADDR pc, debug_base, lm = 0;
int is_initial_ns; int is_initial_ns;
struct frame_info *frame = get_current_frame (); struct frame_info *frame = get_current_frame ();
@@ -1937,7 +1953,17 @@ svr4_handle_solib_event (void) + volatile struct gdb_exception ex;
/* Do nothing if not using the probes interface. */
if (info->probes_table == NULL)
@@ -1937,7 +1955,17 @@ svr4_handle_solib_event (void)
usm_chain = make_cleanup (resume_section_map_updates_cleanup, usm_chain = make_cleanup (resume_section_map_updates_cleanup,
current_program_space); current_program_space);
- val = evaluate_probe_argument (pa->probe, 1, frame); - val = evaluate_probe_argument (pa->probe, 1, frame);
+ TRY + TRY_CATCH (ex, RETURN_MASK_ERROR)
+ { + {
+ val = evaluate_probe_argument (pa->probe, 1, frame); + val = evaluate_probe_argument (pa->probe, 1, frame);
+ } + }
+ CATCH (ex, RETURN_MASK_ERROR) +
+ if (ex.reason < 0)
+ { + {
+ exception_print (gdb_stderr, ex); + exception_print (gdb_stderr, ex);
+ val = NULL; + val = NULL;
+ } + }
+ END_CATCH
+ +
if (val == NULL) if (val == NULL)
{ {
do_cleanups (old_chain); do_cleanups (old_chain);
@@ -1968,7 +1994,18 @@ svr4_handle_solib_event (void) @@ -1968,7 +1996,20 @@ svr4_handle_solib_event (void)
if (action == UPDATE_OR_RELOAD) if (action == UPDATE_OR_RELOAD)
{ {
- val = evaluate_probe_argument (pa->probe, 2, frame); - val = evaluate_probe_argument (pa->probe, 2, frame);
+ TRY + volatile struct gdb_exception ex;
+
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ { + {
+ val = evaluate_probe_argument (pa->probe, 2, frame); + val = evaluate_probe_argument (pa->probe, 2, frame);
+ } + }
+ CATCH (ex, RETURN_MASK_ERROR) +
+ if (ex.reason < 0)
+ { + {
+ exception_print (gdb_stderr, ex); + exception_print (gdb_stderr, ex);
+ do_cleanups (old_chain); + do_cleanups (old_chain);
+ return; + return;
+ } + }
+ END_CATCH
+ +
if (val != NULL) if (val != NULL)
lm = value_as_address (val); lm = value_as_address (val);