public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Use "get_current_arch" instead of "get_objfile_arch" on SystemTap SDT code (and fix ARM bug)
Date: Thu, 05 Dec 2013 13:04:00 -0000	[thread overview]
Message-ID: <52A079DD.5050101@redhat.com> (raw)
In-Reply-To: <1386225226-18549-1-git-send-email-sergiodj@redhat.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

  reply	other threads:[~2013-12-05 13:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05  6:34 Sergio Durigan Junior
2013-12-05 13:04 ` Pedro Alves [this message]
2013-12-05 22:12   ` [PATCH] Sanitize gdbarch access on probe/SDT API (was: Re: [PATCH] Use "get_current_arch" instead of...) Sergio Durigan Junior
2013-12-05 23:06     ` [PATCH] Sanitize gdbarch access on probe/SDT API Sergio Durigan Junior
2013-12-05 23:30       ` Tom Tromey
2013-12-06  2:22         ` Sergio Durigan Junior
2013-12-06 13:50     ` Pedro Alves
2013-12-06 15:49       ` Sergio Durigan Junior
2013-12-06 16:00         ` Pedro Alves
2013-12-06 16:04           ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52A079DD.5050101@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).