This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [Patch] Another small memattr fix.
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Don Howard <dhoward at redhat dot com>
- Cc: <gdb-patches at sources dot redhat dot com>
- Date: Fri, 14 Jun 2002 13:00:09 -0700
- Subject: Re: [Patch] Another small memattr fix.
- References: <Pine.LNX.4.33.0206141132310.3839-100000@theotherone>
On Jun 14, 12:44pm, Don Howard wrote:
> The strings are arbitrary expressions and are converted to address via
> parse_and_eval_address(), which does not flag overflow:
>
> mem_command (char *args, int from_tty)
> {
> CORE_ADDR lo, hi;
> char *tok;
> struct mem_attrib attrib;
>
> if (!args)
> error_no_arg ("No mem");
>
> tok = strtok (args, " \t");
> if (!tok)
> error ("no lo address");
> lo = parse_and_eval_address (tok);
>
> tok = strtok (NULL, " \t");
> if (!tok)
> error ("no hi address");
> hi = parse_and_eval_address (tok);
>
> mabe parse_and_eval_address could detect overflow and throw an error().
Maybe I'm missing something, but it seems to me that you're still left
with the problem of how to represent the maximum address + 1. (Throwing
an error doesn't really help, does it?)
> Another possiblity is that the interface could be changed, making the
> upper bound inclusive also.
This sounds better.
So, on a 16 bit machine, you could say
mem 0xf000 0xffff ro
to indicate that the top 4096 bytes are read-only.
Kevin