This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use "get_current_arch" instead of "get_objfile_arch" on SystemTap SDT code (and fix ARM bug)
- From: Pedro Alves <palves at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 05 Dec 2013 13:04:29 +0000
- Subject: Re: [PATCH] Use "get_current_arch" instead of "get_objfile_arch" on SystemTap SDT code (and fix ARM bug)
- Authentication-results: sourceware.org; auth=none
- References: <1386225226-18549-1-git-send-email-sergiodj at redhat dot com>
On 12/05/2013 06:33 AM, Sergio Durigan Junior wrote:
> While implementing another patch and testing things on ARM, I found a
> strange bug (at least initially). There was an expression on some
> probe's argument that did a displacement of the "fp" register (i.e.,
> "[fp, #-8]"). However, during the evaluation of the parsed expression
> GDB got confused and could not access the "fp" register due to an
> invalid address being returned.
Adding get_current_arch calls outside initial command evaluation
raises eyebrows.
/* Return "current" architecture. If the target is running, this is the
architecture of the selected frame. Otherwise, the "current" architecture
defaults to the target architecture.
This function should normally be called solely by the command interpreter
routines to determine the architecture to execute a command in. */
extern struct gdbarch *get_current_arch (void);
struct value *
probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
{
...
return evaluate_probe_argument (probe, n);
}
FRAME here is the context the probe is being evaluated
in (get_current_frame(), the frame/thread that hit the event,
passed from infrun.) It'd be better to use the frame's arch
explicitly (that is, pass down the frame or arch to
evaluate_probe_argument).
--
Pedro Alves