aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-svr4.c
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2013-12-10 23:53:25 -0200
committerSergio Durigan Junior <sergiodj@redhat.com>2013-12-10 23:59:00 -0200
commit08a6411c715c2d8bf31d5a5c8a477fa4651639aa (patch)
treeecffe8591efc5e65a3a29643bedeed22acd9ca4d /gdb/solib-svr4.c
parente7f0d979dd5cc4f8b658df892e93db69d6d660b7 (diff)
downloadgdb-08a6411c715c2d8bf31d5a5c8a477fa4651639aa.zip
gdb-08a6411c715c2d8bf31d5a5c8a477fa4651639aa.tar.gz
gdb-08a6411c715c2d8bf31d5a5c8a477fa4651639aa.tar.bz2
Sanitize access to gdbarch on the SDT probe API (and fix ARM bug)
This patch sanitizes the access to gdbarch made by various functions of the SDT probe API. Before this patch, gdbarch was being accessed via the probe's objfile; however, this proved to cause a bug on 32-bit ARM targets because during the parsing of the probe's arguments the code needed to access some pseudo-registers of the architecture, and this information is not fully correct on the objfile's gdbarch. Basically, the approach taken was to instead pass the current/selected frame to the parsing and evaluation functions, so that they can extract the gdbarch directly from the frame. It solved the ARM bug reported above, and also contributed to make the API cleaner. Tested on x86_64 and 32-bit ARM. 2013-12-11 Sergio Durigan Junior <sergiodj@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Pass selected frame to get_probe_argument_count and evaluate_probe_argument. * probe.c (get_probe_argument_count): Adjust declaration to accept frame. Pass frame to probe_ops's get_probe_argument_count. (evaluate_probe_argument): Likewise, for evaluate_probe_argument. (probe_safe_evaluate_at_pc): Pass frame to get_probe_argument_count and evaluate_probe_argument. * probe.h (struct probe_ops) <get_probe_argument_count, evaluate_probe_argument>: Adjust declarations to accept frame. (get_probe_argument_count, evaluate_probe_argument): Likewise. * solib-svr4.c (solib_event_probe_action): Get current frame. Pass it to get_probe_argument_count. (svr4_handle_solib_event): Get current frame. Pass it to get_probe_argument_count and evaluate_probe_argument. * stap-probe.c (stap_parse_probe_arguments): Adjust declaration to accept gdbarch. Do not obtain it from the probe's objfile. (stap_get_probe_argument_count): Adjust declaration to accept frame. Obtain gdbarch from the frame. Call generic can_evaluate_probe_arguments. Pass gdbarch to stap_parse_probe_arguments. (stap_get_arg): Adjust declaration to accept gdbarch. Pass it to stap_parse_probe_arguments. (stap_evaluate_probe_argument): Adjust declaration to accept frame. Obtain gdbarch from the frame. Pass gdbarch to stap_get_arg. (stap_compile_to_ax): Pass agent_expr's gdbarch to stap_get_arg. (compute_probe_arg): Obtain gdbarch from frame. Pass frame to get_probe_argument_count and evaluate_probe_argument.
Diffstat (limited to 'gdb/solib-svr4.c')
-rw-r--r--gdb/solib-svr4.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 9538af6..22c2239 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1651,6 +1651,7 @@ solib_event_probe_action (struct probe_and_action *pa)
{
enum probe_action action;
unsigned probe_argc;
+ struct frame_info *frame = get_current_frame ();
action = pa->action;
if (action == DO_NOTHING || action == PROBES_INTERFACE_FAILED)
@@ -1663,7 +1664,7 @@ solib_event_probe_action (struct probe_and_action *pa)
arg0: Lmid_t lmid (mandatory)
arg1: struct r_debug *debug_base (mandatory)
arg2: struct link_map *new (optional, for incremental updates) */
- probe_argc = get_probe_argument_count (pa->probe);
+ probe_argc = get_probe_argument_count (pa->probe, frame);
if (probe_argc == 2)
action = FULL_RELOAD;
else if (probe_argc < 2)
@@ -1772,6 +1773,7 @@ svr4_handle_solib_event (void)
struct value *val;
CORE_ADDR pc, debug_base, lm = 0;
int is_initial_ns;
+ struct frame_info *frame = get_current_frame ();
/* Do nothing if not using the probes interface. */
if (info->probes_table == NULL)
@@ -1816,7 +1818,7 @@ svr4_handle_solib_event (void)
usm_chain = make_cleanup (resume_section_map_updates_cleanup,
current_program_space);
- val = evaluate_probe_argument (pa->probe, 1);
+ val = evaluate_probe_argument (pa->probe, 1, frame);
if (val == NULL)
{
do_cleanups (old_chain);
@@ -1847,7 +1849,7 @@ svr4_handle_solib_event (void)
if (action == UPDATE_OR_RELOAD)
{
- val = evaluate_probe_argument (pa->probe, 2);
+ val = evaluate_probe_argument (pa->probe, 2, frame);
if (val != NULL)
lm = value_as_address (val);