Target Control Debugging: gi Command (Compact 2013)
3/26/2014
This command gets information about processes or processes with threads, modules, critical sections that have threads waiting, and events.
Syntax
gi proc | thrd | mod | delta | all
Parameters
- proc
List of all processes in the system.
- thrd
List of all processes with their threads.
- mod
List of all modules loaded.
- delta
List of only those threads that have changes in CPU times.
- all
Default; list of all of the preceding parameters.
Remarks
You can enter the command in two ways:
- If the OS on your device supports the console window, you can bring up the Target Control window on your device by running shell -c. You can then enter the gi command at the shell command prompt on your device.
- If you use Platform Builder, you can enter the gi command from the Visual Studio Target Control window.
Example
When a process loads a DLL, virtual pages are allocated within the process address space to map to the DLL. If multiple processes map to the same DLL, each separate process has an individual allocation of virtual memory that can be mapped to the DLL. This occurs even though each process shares the same physical page.
Each process in the system exists in a 2-GB portion of virtual space. In this space, a DLL is always loaded in the upper 512 MB of memory. Thus, in the output of mi full, any virtual page that is allocated from 0x40000000 to 0x60000000 of the virtual space of a process can be attributed to a DLL that the process is using. For more information about the mi command, see Target Control Debugging: mi Command.
Using the gi mod command, you can obtain a list of DLLs loaded in the system and their base addresses within the system. Using this base address and the base address of a process, you can then determine which DLL is using which page within the virtual space of a process.
To determine the DLL address mapping in a process
In the Target Control window, run the mi full command.
In the Target Control window, run the gi mod command.
In the output of the mi full command, find the beginning address of a DLL mapped into a process.
In the output of the gi mod command, in the VMBase column, find the VMBase address that corresponds to the start of the DLL in the memory map.
The following example shows the output of the mi full command, including the memory map of a single process: Shell.exe. DLLs are mapped in to this process at 0x40010000, 0x40090000, 0x400d0000, 0x404c0000, 0x404e0000, and 0x404f0000.
Memory usage for Process 'shell.exe' pid 1bf000a
00000000: -----r----------
00010000: -CCCCCCCCCCCCCWW
00020000: -
00030000: --------------SS
00040000: WW-------------
00050000: RRRRRRRRRRRRRRRR
00060000: RRRRRRRRRRRRRRRR
00070000: RRRRRRRRRRRRRRRR
00080000: RRRRR
00090000: RRRRRRR
000a0000: R
000b0000: WW
40000000: ----------------
40010000: -CCCCCCCCCCCCCCC
40020000: CCCCCCCCCCCCCCCC
40030000: CCCCCCCCCCCCCCCC
40040000: CCCCCCCCCCCCCCCC
40050000: CCCCCCCCCCCCCCCC
40060000: CCCCCCCCCCCCCCCC
40070000: CCCCCCCCCCCCCCCC
40080000: CCCCWWCCC---
40090000: -CCCCCCCCCCCCCCC
400a0000: WCCCCCCCCCCCCCCC
400b0000: CC-
400d0000: -CCCCW-
404c0000: -CW-
404e0000: -CWC-
404f0000: -CCCCCCW-
Page summary: code=176(0) data r/o=62 r/w=13 stack=2 reserved=74
The following example shows a partial output from the gi mod command, including some of the DLLs that are mapped in to the Shell.exe process.
Windows CE>gi mod
MOD: Name pModule :dwInUSE :dwVMBase:CurZone
M00: afd.dll c041ae28 00000001 efbf0000 00000000
M01: alpcd.dll c0412000 00000001 efa00000 00000000
M02: autoras.dll c0423f60 00000005 efb70000 00000000
M03: bcrypt.dll c04362d0 00000004 41650000 00000000
…
M14: commctrl.dll c04454e0 00000001 40550000 00000000
M15: coredll.dll c040bc2c 00000008 40010000 00000000
M16: cplmain.cpl c04460b0 00000001 cdc50000 00000000
…
M52: kitl.dll c0400d50 00000001 80230000 00000000
M53: locale.dll c040c0c8 00000007 40090000 00000000
M54: lpcd.dll c044bb58 00000001 40760000 00000000