This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use "get_current_arch" instead of "get_objfile_arch" on SystemTap SDT code (and fix ARM bug)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]