old-cross-binutils/gdb/memattr.h
Daniel Jacobowitz fd79eceebf gdb/
2006-09-21  Vladimir Prus  <vladimir@codesourcery.com>
	    Daniel Jacobowitz  <dan@codesourcery.com>
	    Nathan Sidwell  <nathan@codesourcery.com>

	* Makefile.in (SFILES): Add memory-map.c and xml-support.c.
	(memory_map_h, xml_support_h): New.
	(target_h): Add vec_h dependency.
	(COMMON_OBS): Add memory-map.o and xml-support.o.
	(memory-map.o, xml-support.o): New rules.
	(remote.o): Update.
	* exceptions.h (enum errors): Add XML_PARSE_ERROR.
	* infcmd.c (run_command_1, attach_command): Call target_pre_inferior.
	* memattr.c (default_mem_attrib): Initialize blocksize.
	(target_mem_region_list, mem_use_target)
	(target_mem_regions_valid, mem_region_cmp, mem_region_init)
	(require_user_regions, require_target_regions)
	(invalidate_target_mem_regions): New.
	(create_mem_region): Use mem_region_init.
	(mem_clear): Move higher.
	(lookup_mem_region): Use require_target_regions.
	(mem_command): Implement "mem auto".
	(mem_info_command): Handle target-supplied regions and flash
	attributes.
	(mem_enable_command, mem_disable_command, mem_delete_command): Use
	require_user_regions.
	(_initialize_mem): Mention "mem auto" in help.
	* memattr.h (enum mem_access_mode): Add MEM_FLASH.
	(struct mem_attrib): Add blocksize.
	(invalidate_target_mem_regions, mem_region_init, mem_region_cmp): New
	prototypes.
	* remote.c: Include "memory-map.h".
	(PACKET_qXfer_memory_map): New enum value.
	(remote_protocol_features): Add qXfer:memory-map:read.
	(remote_xfer_partial): Handle memory maps.
	(remote_memory_map): New.
	(init_remote_ops, init_remote_async_ops): Set to_memory_map.
	(_initialize_remote): Register qXfer:memory-map:read.
	* target.c (update_current_target): Mention to_memory_map.
	(target_memory_map, target_pre_inferior): New.
	(target_preopen): Call target_pre_inferior.
	* target.h: Include "vec.h".
	(enum target_object): Add TARGET_OBJECT_MEMORY_MAP.
	(struct target_ops): Add to_memory_map.
	(target_memory_map, target_pre_inferior): New prototypes.
	* memory-map.c, memory-map.h, xml-support.c, xml-support.h: New files.
gdb/doc/
2006-09-21  Vladimir Prus  <vladimir@codesourcery.com>
	    Daniel Jacobowitz  <dan@codesourcery.com>

	* gdb.texinfo (Memory Region Attributes): Mention target-supplied
	memory regions and "mem auto".
2006-09-21 13:54:03 +00:00

106 lines
2.9 KiB
C

/* Memory attributes support, for GDB.
Copyright (C) 2001, 2006 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#ifndef MEMATTR_H
#define MEMATTR_H
#include "vec.h"
enum mem_access_mode
{
MEM_RW, /* read/write */
MEM_RO, /* read only */
MEM_WO, /* write only */
/* Read/write, but special steps are required to write to it. */
MEM_FLASH
};
enum mem_access_width
{
MEM_WIDTH_UNSPECIFIED,
MEM_WIDTH_8, /* 8 bit accesses */
MEM_WIDTH_16, /* 16 " " */
MEM_WIDTH_32, /* 32 " " */
MEM_WIDTH_64 /* 64 " " */
};
/* The set of all attributes that can be set for a memory region.
This structure was created so that memory attributes can be passed
to target_ functions without exposing the details of memory region
list, which would be necessary if these fields were simply added to
the mem_region structure.
FIXME: It would be useful if there was a mechanism for targets to
add their own attributes. For example, the number of wait states. */
struct mem_attrib
{
/* read/write, read-only, or write-only */
enum mem_access_mode mode;
enum mem_access_width width;
/* enables hardware breakpoints */
int hwbreak;
/* enables host-side caching of memory region data */
int cache;
/* enables memory verification. after a write, memory is re-read
to verify that the write was successful. */
int verify;
/* Block size. Only valid if mode == MEM_FLASH. */
int blocksize;
};
struct mem_region
{
CORE_ADDR lo;
CORE_ADDR hi;
/* Item number of this memory region. */
int number;
/* Status of this memory region (enabled if non-zero, otherwise disabled) */
int enabled_p;
/* Attributes for this region */
struct mem_attrib attrib;
};
/* Declare a vector type for a group of mem_region structures. The
typedef is necessary because vec.h can not handle a struct tag.
Except during construction, these vectors are kept sorted. */
typedef struct mem_region mem_region_s;
DEF_VEC_O(mem_region_s);
extern struct mem_region *lookup_mem_region(CORE_ADDR);
void invalidate_target_mem_regions (void);
void mem_region_init (struct mem_region *);
int mem_region_cmp (const void *, const void *);
#endif /* MEMATTR_H */