From fd79eceebf094938376c671ea3538a31d4f63eac Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 21 Sep 2006 13:54:03 +0000 Subject: gdb/ 2006-09-21 Vladimir Prus Daniel Jacobowitz Nathan Sidwell * 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 Daniel Jacobowitz * gdb.texinfo (Memory Region Attributes): Mention target-supplied memory regions and "mem auto". --- gdb/target.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'gdb/target.h') diff --git a/gdb/target.h b/gdb/target.h index aa884c6983a..67692163a41 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -55,6 +55,7 @@ struct bp_target_info; #include "symtab.h" #include "dcache.h" #include "memattr.h" +#include "vec.h" enum strata { @@ -198,7 +199,9 @@ enum target_object /* Transfer auxilliary vector. */ TARGET_OBJECT_AUXV, /* StackGhost cookie. See "sparc-tdep.c". */ - TARGET_OBJECT_WCOOKIE + TARGET_OBJECT_WCOOKIE, + /* Target memory map in XML format. */ + TARGET_OBJECT_MEMORY_MAP, /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */ }; @@ -453,6 +456,21 @@ struct target_ops gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len); + /* Returns the memory map for the target. A return value of NULL + means that no memory map is available. If a memory address + does not fall within any returned regions, it's assumed to be + RAM. The returned memory regions should not overlap. + + The order of regions does not matter; target_memory_map will + sort regions by starting address. For that reason, this + function should not be called directly except via + target_memory_map. + + This method should not cache data; if the memory map could + change unexpectedly, it should be invalidated, and higher + layers will re-fetch it. */ + VEC(mem_region_s) *(*to_memory_map) (struct target_ops *); + int to_magic; /* Need sub-structure for target machine related rather than comm related? */ @@ -576,6 +594,11 @@ extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int, extern int child_xfer_memory (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *); +/* Fetches the target's memory map. If one is found it is sorted + and returned, after some consistency checking. Otherwise, NULL + is returned. */ +VEC(mem_region_s) *target_memory_map (void); + extern char *child_pid_to_exec_file (int); extern char *child_core_file_to_sym_file (char *); @@ -1127,6 +1150,8 @@ extern int push_target (struct target_ops *); extern int unpush_target (struct target_ops *); +extern void target_pre_inferior (int); + extern void target_preopen (int); extern void pop_target (void); -- cgit v1.2.1