Debug Command 18 and 19 - Map Read-Only or Read-Write Memory Alias Command
Parameters
Pid
Returns
Buffer
An alias to the debuggee's memory region of the requested length is mapped into the debugger's memory space. This region is reserved for use as an alias region until it is unmapped.
The access rights for the alias area are determined by the command number. The DBG_C_MapROAlias command maps a read-only alias region, while the DBG_C_MapRWAlias command maps a read-write alias region.
For read-write aliases, if the region is shared and read-only in the debuggee's context, a private copy of the aliased pages will be created in the debuggee's context, and dynamic RAS tracepoints will be removed from that region. This prevents debugging from affecting other areas of the system, while allowing access to shared memory areas, and proper disassembly of regions where dynamic RAS tracepoints are in use.
Because the read-write aliases may convert objects to private, using up system resources, it is recommended that read-only aliases be used when simply perusing memory. See the following Restrictions regarding read-only aliases on the 80386 processor.
Because the entire aliased region may map both valid and invalid regions of memory, debuggers should issue DosQueryMem just before accessing the alias region to determine if the region is valid. Debuggers should not access this region while the debuggee is executing, as portions of this region may become invalid without notifying the debugger. It is possible that no valid pages will exist in the alias region.
When the debuggee frees an aliased object, or shrinks the underlying object such that the alias would span a region outside the resultant object, an alias-free notification is returned to the debugger. This notification will be returned before the alias is invalidated. See DosDebug Notifications for details.
These commands may be performed while the debuggee is executing code via a DBG_C_Go command.
Restrictions
Because debuggers can execute code at ring 2, and the read-only bit in the page tables entries is effective only at ring 3, the read-only aliases cannot be supported. When the read-only bit becomes effective at all rings, as is expected on later processors, the read-only aliases will again be supported.
Most memory management calls may not be used on these aliases. DosQueryMem is permitted, but for interrogation only.
The passed starting addresses must be aligned on a page boundary, and the length of the aliased region must be a multiple of the page size. This restriction is due to the underlying hardware.
Aliased regions must be completely contained within a single debuggee memory object.
No interface is available for moving an alias to point to another section of debuggee memory. To move an alias, the debugger must free an existing alias, and then map a new alias to the desired region.
Aliases will only be permitted to the user space memory region of the debuggee. No aliases will be provided to system space.
The alias region will only be provided at the linear level. No debugger Local Descriptor Table ( LTD) selector will be available to access the alias region.