* Makefile.in (memattr_h, memattr.o): Update.

* memattr.h: Include "vec.h".
	(struct mem_region): Remove linked list pointer.
	(mem_region_s): New typedef and corresponding vector.
	* memattr.c: Include "vec.h".
	(mem_region_chain): Delete.
	(mem_region_list): New vector pointer.
	(mem_region_lessthan): New function.
	(create_mem_region): Remove unused return value.  Use vector
	operations.  Remove linear search.
	(delete_mem_region): Delete.
	(lookup_mem_region): Use vector operations.  Add a FIXME.
	(mem_info_command): Update to work with vectors.
	(mem_enable, mem_enable_command, mem_disable, mem_disable_command)
	(mem_free, mem_delete): Likewise.
This commit is contained in:
Daniel Jacobowitz
2006-09-21 13:48:29 +00:00
parent 350da6eece
commit c96fc75e9e
4 changed files with 100 additions and 67 deletions

View File

@@ -1,5 +1,6 @@
/* Memory attributes support, for GDB.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2006 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +22,8 @@
#ifndef MEMATTR_H
#define MEMATTR_H
#include "vec.h"
enum mem_access_mode
{
MEM_RW, /* read/write */
@@ -67,12 +70,6 @@ struct mem_attrib
struct mem_region
{
/* FIXME: memory regions are stored in an unsorted singly-linked
list. This probably won't scale to handle hundreds of memory
regions --- that many could be needed to describe the allowed
access modes for memory mapped i/o device registers. */
struct mem_region *next;
CORE_ADDR lo;
CORE_ADDR hi;
@@ -86,6 +83,12 @@ struct mem_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);
#endif /* MEMATTR_H */