From: Kevin Buettner <kevinb@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: [rfa:ppc64] Use target in convert_from_func_ptr_addr
Date: Thu, 23 Oct 2003 16:00:00 -0000 [thread overview]
Message-ID: <1031023160017.ZM13795@localhost.localdomain> (raw)
In-Reply-To: Andrew Cagney <ac131313@redhat.com> "[rfa:ppc64] Use target in convert_from_func_ptr_addr" (Oct 22, 9:37pm)
On Oct 22, 9:37pm, Andrew Cagney wrote:
> The attached rewrites the PPC64 GNU/Linux convert_from_func_ptr_addr
> method so that it makes use of the explicit "struct target_ops"
> parameter I recently added (previously it was indirectly using
> current_target).
[...]
> Index: ppc-linux-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
> retrieving revision 1.44
> diff -u -r1.44 ppc-linux-tdep.c
> --- ppc-linux-tdep.c 22 Oct 2003 23:54:11 -0000 1.44
> +++ ppc-linux-tdep.c 23 Oct 2003 01:32:51 -0000
> @@ -936,14 +936,14 @@
> CORE_ADDR addr,
> struct target_ops *targ)
> {
> - struct obj_section *s;
> -
> - s = find_pc_section (addr);
> -
> - /* Check if ADDR points to a function descriptor. */
> - if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
> - return read_memory_unsigned_integer (addr, 8);
> -
> + struct section_table *s = target_section_by_addr (targ, addr);
> + if (s != NULL && s->the_bfd_section != NULL
> + && strcmp (s->the_bfd_section->name, ".opd") == 0)
> + {
> + char desc[8];
> + target_read (targ, TARGET_OBJECT_MEMORY, NULL, desc, addr, 8);
> + return extract_unsigned_integer (desc, 8);
> + }
> return addr;
> }
IMO, this version of the code is harder to read than the old version.
Can you explain what using an explicit `struct target_ops'' parameter
buys us?
Kevin
next prev parent reply other threads:[~2003-10-23 16:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-23 1:37 Andrew Cagney
2003-10-23 16:00 ` Kevin Buettner [this message]
2003-10-23 16:26 ` Andrew Cagney
2003-10-23 17:12 ` Kevin Buettner
2003-10-23 21:02 ` Andrew Cagney
2003-10-23 21:23 ` Kevin Buettner
2003-10-23 22:31 ` Andrew Cagney
2003-10-24 20:27 ` [commit] Add get_target_memory ... + " Andrew Cagney
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=1031023160017.ZM13795@localhost.localdomain \
--to=kevinb@redhat.com \
--cc=ac131313@redhat.com \
--cc=gdb-patches@sources.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