diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-09-21 13:54:03 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-09-21 13:54:03 +0000 |
commit | fd79eceebf094938376c671ea3538a31d4f63eac (patch) | |
tree | 40bfd6dc3f8a1035a4eedb63f57460ebf033284a /gdb/remote.c | |
parent | 253c8abb67a72cdfcdb2be4b92e2dba8689e6554 (diff) | |
download | gdb-fd79eceebf094938376c671ea3538a31d4f63eac.zip gdb-fd79eceebf094938376c671ea3538a31d4f63eac.tar.gz gdb-fd79eceebf094938376c671ea3538a31d4f63eac.tar.bz2 |
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".
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 2e2871d..e2716b5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -60,6 +60,8 @@ #include "remote-fileio.h" +#include "memory-map.h" + /* The size to align memory write packets, when practical. The protocol does not guarantee any alignment, and gdb will generate short writes and unaligned writes, but even as a best-effort attempt this @@ -826,6 +828,7 @@ enum { PACKET_Z3, PACKET_Z4, PACKET_qXfer_auxv, + PACKET_qXfer_memory_map, PACKET_qGetTLSAddr, PACKET_qSupported, PACKET_MAX @@ -2172,7 +2175,9 @@ remote_packet_size (const struct protocol_feature *feature, static struct protocol_feature remote_protocol_features[] = { { "PacketSize", PACKET_DISABLE, remote_packet_size, -1 }, { "qXfer:auxv:read", PACKET_DISABLE, remote_supported_packet, - PACKET_qXfer_auxv } + PACKET_qXfer_auxv }, + { "qXfer:memory-map:read", PACKET_DISABLE, remote_supported_packet, + PACKET_qXfer_memory_map } }; static void @@ -5312,6 +5317,11 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object, return remote_read_qxfer (ops, "auxv", annex, readbuf, offset, len, &remote_protocol_packets[PACKET_qXfer_auxv]); + case TARGET_OBJECT_MEMORY_MAP: + gdb_assert (annex == NULL); + return remote_read_qxfer (ops, "memory-map", annex, readbuf, offset, len, + &remote_protocol_packets[PACKET_qXfer_memory_map]); + default: return -1; } @@ -5422,6 +5432,23 @@ remote_rcmd (char *command, } } +static VEC(mem_region_s) * +remote_memory_map (struct target_ops *ops) +{ + VEC(mem_region_s) *result = NULL; + char *text = target_read_stralloc (¤t_target, + TARGET_OBJECT_MEMORY_MAP, NULL); + + if (text) + { + struct cleanup *back_to = make_cleanup (xfree, text); + result = parse_memory_map (text); + do_cleanups (back_to); + } + + return result; +} + static void packet_command (char *args, int from_tty) { @@ -5694,6 +5721,7 @@ Specify the serial device it is connected to\n\ remote_ops.to_has_execution = 1; remote_ops.to_has_thread_control = tc_schedlock; /* can lock scheduler */ remote_ops.to_magic = OPS_MAGIC; + remote_ops.to_memory_map = remote_memory_map; } /* Set up the extended remote vector by making a copy of the standard @@ -5823,6 +5851,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; remote_async_ops.to_async = remote_async; remote_async_ops.to_async_mask_value = 1; remote_async_ops.to_magic = OPS_MAGIC; + remote_async_ops.to_memory_map = remote_memory_map; } /* Set up the async extended remote vector by making a copy of the standard @@ -6063,6 +6092,9 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL, add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_auxv], "qXfer:auxv:read", "read-aux-vector", 0); + add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_memory_map], + "qXfer:memory-map:read", "memory-map", 0); + add_packet_config_cmd (&remote_protocol_packets[PACKET_qGetTLSAddr], "qGetTLSAddr", "get-thread-local-storage-address", 0); |