From: Andrew Cagney <cagney@gnu.org>
To: Randolph Chung <randolph@tausq.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch/rfc/hppa] handle setting gp for calling shlib functions
Date: Thu, 29 Apr 2004 14:12:00 -0000 [thread overview]
Message-ID: <40910D4F.1020700@gnu.org> (raw)
In-Reply-To: <20040429062324.GX3965@tausq.org>
> +#define FIND_GLOBAL_POINTER \
> + (gdbarch_tdep (current_gdbarch)->find_global_pointer)
> +
Just not this (macro's are bad m'kay :-). The code should instead do
something like:
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
...
... = tdep->find_global_pointer (...);
You'll find most architecture functions have that near the start.
The function also needs to add gdbarch|tdep|frame parameters and then
use them instead of relying on globals such as current_gdbarch (I need
to deprecate that)(1).
> static CORE_ADDR
> +hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
> + CORE_ADDR addr,
> + struct target_ops *targ)
> +{
> + if (addr & 2)
> + {
> + ULONGEST gp;
> +
> + addr &= ~3;
> +
> + gp = read_memory_unsigned_integer (addr + 4, 4);
> + write_register (19, gp);
> + addr = read_memory_unsigned_integer (addr, 4);
> + }
> +
> + return addr;
> +}
> +
> +static CORE_ADDR
This should be using TARG methods read memory(2), and should not be
writing GP to register 19.
Andrew
PS: The direction is strongly away from global state. Already GDB has
instances where two targets and/or architectures exist simultaneously:
(1) When handling 32 on 64-bit debugging (e.g., i386 on amd64) both
architectures are active.
(2) Computing the entry point address, both the executable
(un-relocated) and process targets are active.
next prev parent reply other threads:[~2004-04-29 14:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-29 6:23 Randolph Chung
2004-04-29 14:12 ` Andrew Cagney [this message]
2004-04-29 15:07 ` Randolph Chung
2004-04-29 16:02 ` Andrew Cagney
2004-04-29 16:13 ` Randolph Chung
2004-04-29 16:48 ` Andrew Cagney
2004-04-30 4:04 ` Randolph Chung
2004-04-30 14:25 ` Andrew Cagney
2004-05-04 14:03 ` Andrew Cagney
2004-05-04 14:10 ` Randolph Chung
2004-05-04 14:34 ` 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=40910D4F.1020700@gnu.org \
--to=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=randolph@tausq.org \
/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