From: Andrew Cagney <ac131313@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: Andrew Cagney <ac131313@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: [rfc] New files "memory.[hc]"
Date: Mon, 27 Oct 2003 15:39:00 -0000 [thread overview]
Message-ID: <3F9D3C16.2070205@redhat.com> (raw)
In-Reply-To: <1031024210419.ZM3102@localhost.localdomain>
> On Oct 24, 4:48pm, Andrew Cagney wrote:
>
>
>> What do people think of putting the new (with target parameter) methods,
>> that wrap target_{read,write} in a new file "memory.[hc]"? I think they
>> are going to end up cluttering up "target.[hc]".
>
>
> Sounds okay to me.
But is it a good idea, as in will it make the code easier to read, find,
and understand? The old target-memory routines are all "hidden" (well i
think they are :-) in gdbcore.h and corefile.c
> Do you have a naming scheme in mind for the new methods?
This is the comment I added to "target.h":
/* Wrappers to target read/write that perform memory transfers. They
throw an error if the memory transfer fails.
NOTE: cagney/2003-10-23: The naming schema is lifted from
"frame.h". The parameter order is lifted from get_frame_memory,
which in turn lifted it from read_memory. */
and this is the corresponding comment in "frame.h":
/* The following is the intended naming schema for frame functions.
It isn't 100% consistent, but it is aproaching that. Frame naming
schema:
Prefixes:
get_frame_WHAT...(): Get WHAT from the THIS frame (functionaly
equivalent to THIS->next->unwind->what)
frame_unwind_WHAT...(): Unwind THIS frame's WHAT from the NEXT
frame.
put_frame_WHAT...(): Put a value into this frame (unsafe, need to
invalidate the frame / regcache afterwards) (better name more
strongly hinting at its unsafeness)
safe_....(): Safer version of various functions, doesn't throw an
error (leave this for later?). Returns non-zero if the fetch
succeeds. Return a freshly allocated error message?
Suffixes:
void /frame/_WHAT(): Read WHAT's value into the buffer parameter.
ULONGEST /frame/_WHAT_unsigned(): Return an unsigned value (the
alternative is *frame_unsigned_WHAT).
LONGEST /frame/_WHAT_signed(): Return WHAT signed value.
What:
/frame/_memory* (frame, coreaddr, len [, buf]): Extract/return
*memory.
/frame/_register* (frame, regnum [, buf]): extract/return register.
CORE_ADDR /frame/_{pc,sp,...} (frame): Resume address, innner most
stack *address, ...
*/
which gave rise to:
extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
void *buf, LONGEST len);
extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
CORE_ADDR addr, int len);
Andrew
next prev parent reply other threads:[~2003-10-27 15:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-24 20:48 Andrew Cagney
2003-10-24 21:04 ` Kevin Buettner
2003-10-27 15:39 ` Andrew Cagney [this message]
2003-10-27 16:24 ` Kevin Buettner
2003-10-30 20:28 ` 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=3F9D3C16.2070205@redhat.com \
--to=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kevinb@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