Next: , Previous: Library List Format for SVR4 Targets, Up: Remote Protocol


E.16 Memory Map Format

To be able to write into flash memory, gdb needs to obtain a memory map from the target. This section describes the format of the memory map.

The memory map is obtained using the ‘qXfer:memory-map:read’ (see qXfer memory map read) packet and is an XML document that lists memory regions.

gdb must be linked with the Expat library to support XML memory maps. See Expat.

The top-level structure of the document is shown below:

     <?xml version="1.0"?>
     <!DOCTYPE memory-map
               PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
                      "http://sourceware.org/gdb/gdb-memory-map.dtd">
     <memory-map>
         region...
     </memory-map>

Each region can be either:

Regions must not overlap. gdb assumes that areas of memory not covered by the memory map are RAM, and uses the ordinary ‘M’ and ‘X’ packets to write to addresses in such ranges.

The formal DTD for memory map format is given below:

     <!-- ................................................... -->
     <!-- Memory Map XML DTD ................................ -->
     <!-- File: memory-map.dtd .............................. -->
     <!-- .................................... .............. -->
     <!-- memory-map.dtd -->
     <!-- memory-map: Root element with versioning -->
     <!ELEMENT memory-map (memory | property)>
     <!ATTLIST memory-map    version CDATA   #FIXED  "1.0.0">
     <!ELEMENT memory (property)>
     <!-- memory: Specifies a memory region,
                  and its type, or device. -->
     <!ATTLIST memory        type    CDATA   #REQUIRED
                             start   CDATA   #REQUIRED
                             length  CDATA   #REQUIRED
                             device  CDATA   #IMPLIED>
     <!-- property: Generic attribute tag -->
     <!ELEMENT property (#PCDATA | property)*>
     <!ATTLIST property      name    CDATA   #REQUIRED>