Mirror of the gdb-patches mailing list
 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>, Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH] Sanitize gdbarch access on probe/SDT API
Date: Fri, 06 Dec 2013 16:00:00 -0000	[thread overview]
Message-ID: <52A1F482.5010405@redhat.com> (raw)
In-Reply-To: <m3txemf08w.fsf@redhat.com>

On 12/06/2013 03:49 PM, Sergio Durigan Junior wrote:
>> > With that out of the way, would it work to pass the frame pointer down
>> >instead of the gdbarch?
> You mean that the callers should pass the frame pointers, instead of the
> relying on the callees to get it by themselves?

Something like that.  I meant, the patch added a gdbarch parameter to
a few functions, and then passes get_frame_arch (frame) down.

 fetch_probe_arguments (struct value **arg0, struct value **arg1)
 {
   struct frame_info *frame = get_selected_frame (_("No frame selected"));
+  struct gdbarch *gdbarch = get_frame_arch (frame);
   CORE_ADDR pc = get_frame_pc (frame);
   struct probe *pc_probe;
   const struct sym_probe_fns *pc_probe_fns;
...
+    *arg0 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 0, gdbarch);
+  *arg1 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 1, gdbarch);

etc. etc.  I'm wondering whether after making that spot discussed
use the probe's obfile's arch, which I think already it has handy
through the probe pointer, we can pass down the frame pointer instead
of the gdbarch pointer:

 fetch_probe_arguments (struct value **arg0, struct value **arg1)
 {
   struct frame_info *frame = get_selected_frame (_("No frame selected"));
   CORE_ADDR pc = get_frame_pc (frame);
   struct probe *pc_probe;
   const struct sym_probe_fns *pc_probe_fns;
...
+    *arg0 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 0, frame);
+  *arg1 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 1, frame);

etc.  That would make the intention of the code clearer, I think, as
that way we don't need to explain that much what the gdbarch is for,
and where it must come from.

-- 
Pedro Alves


  reply	other threads:[~2013-12-06 16:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05  6:34 [PATCH] Use "get_current_arch" instead of "get_objfile_arch" on SystemTap SDT code (and fix ARM bug) Sergio Durigan Junior
2013-12-05 13:04 ` Pedro Alves
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 [this message]
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=52A1F482.5010405@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    --cc=tromey@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