[489740f] | 1 | .. comment SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
| 2 | |
---|
[fabe6d0] | 3 | .. COMMENT: COPYRIGHT (c) 1988-2008. |
---|
| 4 | .. COMMENT: On-Line Applications Research Corporation (OAR). |
---|
| 5 | .. COMMENT: All rights reserved. |
---|
| 6 | |
---|
[8ca13ed] | 7 | Memory Commands |
---|
[f15d607] | 8 | *************** |
---|
[8ca13ed] | 9 | |
---|
| 10 | Introduction |
---|
| 11 | ============ |
---|
| 12 | |
---|
| 13 | The RTEMS shell has the following memory commands: |
---|
| 14 | |
---|
[fabe6d0] | 15 | - mdump_ - Display contents of memory |
---|
[8ca13ed] | 16 | |
---|
[fabe6d0] | 17 | - wdump_ - Display contents of memory (word) |
---|
[8ca13ed] | 18 | |
---|
[fabe6d0] | 19 | - ldump_ - Display contents of memory (longword) |
---|
[8ca13ed] | 20 | |
---|
[fabe6d0] | 21 | - medit_ - Modify contents of memory |
---|
[8ca13ed] | 22 | |
---|
[fabe6d0] | 23 | - mfill_ - File memory with pattern |
---|
[8ca13ed] | 24 | |
---|
[fabe6d0] | 25 | - mmove_ - Move contents of memory |
---|
[8ca13ed] | 26 | |
---|
[fabe6d0] | 27 | - malloc_ - Obtain information on C Program Heap |
---|
[8ca13ed] | 28 | |
---|
| 29 | Commands |
---|
| 30 | ======== |
---|
| 31 | |
---|
| 32 | This section details the Memory Commands available. A |
---|
| 33 | subsection is dedicated to each of the commands and |
---|
| 34 | describes the behavior and configuration of that |
---|
| 35 | command as well as providing an example usage. |
---|
| 36 | |
---|
[bf61a8b] | 37 | .. raw:: latex |
---|
| 38 | |
---|
| 39 | \clearpage |
---|
| 40 | |
---|
[fabe6d0] | 41 | .. _mdump: |
---|
| 42 | |
---|
[8ca13ed] | 43 | mdump - display contents of memory |
---|
| 44 | ---------------------------------- |
---|
| 45 | .. index:: mdump |
---|
| 46 | |
---|
[bf61a8b] | 47 | SYNOPSYS: |
---|
| 48 | .. code-block:: shell |
---|
[8ca13ed] | 49 | |
---|
[bf61a8b] | 50 | mdump [address [length [size]]] |
---|
[8ca13ed] | 51 | |
---|
[bf61a8b] | 52 | DESCRIPTION: |
---|
| 53 | This command displays the contents of memory at the ``address`` and |
---|
| 54 | ``length`` in ``size`` byte units specified on the command line. |
---|
[8ca13ed] | 55 | |
---|
[bf61a8b] | 56 | When ``size`` is not provided, it defaults to ``1`` byte units. Values of |
---|
| 57 | ``1``, ``2``, and ``4`` are valid; all others will cause an error to be |
---|
| 58 | reported. |
---|
[8ca13ed] | 59 | |
---|
[bf61a8b] | 60 | When ``length`` is not provided, it defaults to ``320`` which is twenty |
---|
| 61 | lines of output with sixteen bytes of output per line. |
---|
[8ca13ed] | 62 | |
---|
[bf61a8b] | 63 | When ``address`` is not provided, it defaults to ``0x00000000``. |
---|
[8ca13ed] | 64 | |
---|
[bf61a8b] | 65 | EXIT STATUS: |
---|
| 66 | This command always returns 0 to indicate success. |
---|
[8ca13ed] | 67 | |
---|
[bf61a8b] | 68 | NOTES: |
---|
| 69 | Dumping memory from a non-existent address may result in an unrecoverable |
---|
| 70 | program fault. |
---|
[8ca13ed] | 71 | |
---|
[bf61a8b] | 72 | EXAMPLES: |
---|
| 73 | The following is an example of how to use ``mdump``: |
---|
[fabe6d0] | 74 | |
---|
[bf61a8b] | 75 | .. code-block:: shell |
---|
[8ca13ed] | 76 | |
---|
[bf61a8b] | 77 | SHLL [/] $ mdump 0x10000 32 |
---|
| 78 | 0x0001000000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ |
---|
| 79 | 0x0001001000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ |
---|
| 80 | SHLL [/] $ mdump 0x02000000 32 |
---|
| 81 | 0x02000000A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!. |
---|
| 82 | 0x02000010A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!. |
---|
| 83 | SHLL [/] $ mdump 0x02001000 32 |
---|
| 84 | 0x0200100003 00 80 00 82 10 60 00-81 98 40 00 83 48 00 00 ......`.....H.. |
---|
| 85 | 0x0200101084 00 60 01 84 08 A0 07-86 10 20 01 87 28 C0 02 ..`....... ..(.. |
---|
[8ca13ed] | 86 | |
---|
| 87 | .. index:: CONFIGURE_SHELL_NO_COMMAND_MDUMP |
---|
| 88 | .. index:: CONFIGURE_SHELL_COMMAND_MDUMP |
---|
| 89 | |
---|
[bf61a8b] | 90 | CONFIGURATION: |
---|
| 91 | This command is included in the default shell command set. When building a |
---|
| 92 | custom command set, define ``CONFIGURE_SHELL_COMMAND_MDUMP`` to have this |
---|
| 93 | command included. |
---|
[8ca13ed] | 94 | |
---|
[bf61a8b] | 95 | This command can be excluded from the shell command set by defining |
---|
| 96 | ``CONFIGURE_SHELL_NO_COMMAND_MDUMP`` when all shell commands have been |
---|
| 97 | configured. |
---|
[8ca13ed] | 98 | |
---|
| 99 | .. index:: rtems_shell_rtems_main_mdump |
---|
| 100 | |
---|
[bf61a8b] | 101 | PROGRAMMING INFORMATION: |
---|
| 102 | The ``mdump`` is implemented by a C language function which has the |
---|
| 103 | following prototype: |
---|
| 104 | |
---|
| 105 | .. code-block:: c |
---|
[fabe6d0] | 106 | |
---|
[bf61a8b] | 107 | int rtems_shell_rtems_main_mdump( |
---|
| 108 | int argc, |
---|
| 109 | char **argv |
---|
| 110 | ); |
---|
[8ca13ed] | 111 | |
---|
[bf61a8b] | 112 | The configuration structure for the ``mdump`` has the following prototype: |
---|
[8ca13ed] | 113 | |
---|
[bf61a8b] | 114 | .. code-block:: c |
---|
[fabe6d0] | 115 | |
---|
[bf61a8b] | 116 | extern rtems_shell_cmd_t rtems_shell_MDUMP_Command; |
---|
[8ca13ed] | 117 | |
---|
[bf61a8b] | 118 | .. raw:: latex |
---|
| 119 | |
---|
| 120 | \clearpage |
---|
[8ca13ed] | 121 | |
---|
[fabe6d0] | 122 | .. _wdump: |
---|
| 123 | |
---|
[8ca13ed] | 124 | wdump - display contents of memory (word) |
---|
| 125 | ----------------------------------------- |
---|
| 126 | .. index:: wdump |
---|
| 127 | |
---|
[bf61a8b] | 128 | SYNOPSYS: |
---|
| 129 | .. code-block:: shell |
---|
[8ca13ed] | 130 | |
---|
[bf61a8b] | 131 | wdump [address [length]] |
---|
[8ca13ed] | 132 | |
---|
[bf61a8b] | 133 | DESCRIPTION: |
---|
| 134 | This command displays the contents of memory at the ``address`` and |
---|
| 135 | ``length`` in bytes specified on the command line. |
---|
[8ca13ed] | 136 | |
---|
[bf61a8b] | 137 | This command is equivalent to ``mdump address length 2``. |
---|
[8ca13ed] | 138 | |
---|
[bf61a8b] | 139 | When ``length`` is not provided, it defaults to ``320`` which is twenty |
---|
| 140 | lines of output with eight words of output per line. |
---|
[8ca13ed] | 141 | |
---|
[bf61a8b] | 142 | When ``address`` is not provided, it defaults to ``0x00000000``. |
---|
[8ca13ed] | 143 | |
---|
[bf61a8b] | 144 | EXIT STATUS: |
---|
| 145 | This command always returns 0 to indicate success. |
---|
[8ca13ed] | 146 | |
---|
[bf61a8b] | 147 | NOTES: |
---|
| 148 | Dumping memory from a non-existent address may result in an unrecoverable |
---|
| 149 | program fault. |
---|
[8ca13ed] | 150 | |
---|
[bf61a8b] | 151 | EXAMPLES: |
---|
| 152 | The following is an example of how to use ``wdump``: |
---|
[8ca13ed] | 153 | |
---|
[bf61a8b] | 154 | .. code-block:: shell |
---|
[fabe6d0] | 155 | |
---|
[bf61a8b] | 156 | SHLL [/] $ wdump 0x02010000 32 |
---|
| 157 | 0x02010000 0201 08D8 0201 08C0-0201 08AC 0201 0874 ...............t |
---|
| 158 | 0x02010010 0201 0894 0201 0718-0201 0640 0201 0798 ............... |
---|
[8ca13ed] | 159 | |
---|
| 160 | .. index:: CONFIGURE_SHELL_NO_COMMAND_WDUMP |
---|
| 161 | .. index:: CONFIGURE_SHELL_COMMAND_WDUMP |
---|
| 162 | |
---|
[bf61a8b] | 163 | CONFIGURATION: |
---|
| 164 | This command is included in the default shell command set. When building a |
---|
| 165 | custom command set, define ``CONFIGURE_SHELL_COMMAND_WDUMP`` to have this |
---|
| 166 | command included. |
---|
[8ca13ed] | 167 | |
---|
[bf61a8b] | 168 | This command can be excluded from the shell command set by defining |
---|
| 169 | ``CONFIGURE_SHELL_NO_COMMAND_WDUMP`` when all shell commands have been |
---|
| 170 | configured. |
---|
[8ca13ed] | 171 | |
---|
| 172 | .. index:: rtems_shell_rtems_main_wdump |
---|
| 173 | |
---|
[bf61a8b] | 174 | PROGRAMMING INFORMATION: |
---|
| 175 | The ``wdump`` is implemented by a C language function which has the |
---|
| 176 | following prototype: |
---|
| 177 | |
---|
| 178 | .. code-block:: c |
---|
| 179 | |
---|
| 180 | int rtems_shell_rtems_main_wdump( |
---|
| 181 | int argc, |
---|
| 182 | char **argv |
---|
| 183 | ); |
---|
[fabe6d0] | 184 | |
---|
[bf61a8b] | 185 | The configuration structure for the ``wdump`` has the following prototype: |
---|
[8ca13ed] | 186 | |
---|
[bf61a8b] | 187 | .. code-block:: c |
---|
[8ca13ed] | 188 | |
---|
[bf61a8b] | 189 | extern rtems_shell_cmd_t rtems_shell_WDUMP_Command; |
---|
[fabe6d0] | 190 | |
---|
[bf61a8b] | 191 | .. raw:: latex |
---|
[8ca13ed] | 192 | |
---|
[bf61a8b] | 193 | \clearpage |
---|
[8ca13ed] | 194 | |
---|
[fabe6d0] | 195 | .. _ldump: |
---|
| 196 | |
---|
[8ca13ed] | 197 | ldump - display contents of memory (longword) |
---|
| 198 | --------------------------------------------- |
---|
| 199 | .. index:: ldump |
---|
| 200 | |
---|
[bf61a8b] | 201 | SYNOPSYS: |
---|
| 202 | .. code-block:: shell |
---|
[8ca13ed] | 203 | |
---|
[bf61a8b] | 204 | ldump [address [length]] |
---|
[8ca13ed] | 205 | |
---|
[bf61a8b] | 206 | DESCRIPTION: |
---|
| 207 | This command displays the contents of memory at the ``address`` and |
---|
| 208 | ``length`` in bytes specified on the command line. |
---|
[8ca13ed] | 209 | |
---|
[bf61a8b] | 210 | This command is equivalent to ``mdump address length 4``. |
---|
[8ca13ed] | 211 | |
---|
[bf61a8b] | 212 | When ``length`` is not provided, it defaults to ``320`` which is twenty |
---|
| 213 | lines of output with four longwords of output per line. |
---|
[8ca13ed] | 214 | |
---|
[bf61a8b] | 215 | When ``address`` is not provided, it defaults to ``0x00000000``. |
---|
[8ca13ed] | 216 | |
---|
[bf61a8b] | 217 | EXIT STATUS: |
---|
| 218 | This command always returns 0 to indicate success. |
---|
[8ca13ed] | 219 | |
---|
[bf61a8b] | 220 | NOTES: |
---|
| 221 | Dumping memory from a non-existent address may result in an unrecoverable |
---|
| 222 | program fault. |
---|
[8ca13ed] | 223 | |
---|
[bf61a8b] | 224 | EXAMPLES: |
---|
| 225 | The following is an example of how to use ``ldump``: |
---|
[8ca13ed] | 226 | |
---|
[bf61a8b] | 227 | .. code-block:: shell |
---|
[8ca13ed] | 228 | |
---|
[bf61a8b] | 229 | SHLL [/] $ ldump 0x02010000 32 |
---|
| 230 | 0x02010000 020108D8 020108C0-020108AC 02010874 ...............t |
---|
| 231 | 0x02010010 020 0894 02010718-02010640 02010798 ............... |
---|
[8ca13ed] | 232 | |
---|
| 233 | .. index:: CONFIGURE_SHELL_NO_COMMAND_LDUMP |
---|
| 234 | .. index:: CONFIGURE_SHELL_COMMAND_LDUMP |
---|
| 235 | |
---|
[bf61a8b] | 236 | CONFIGURATION: |
---|
| 237 | This command is included in the default shell command set. When building a |
---|
| 238 | custom command set, define ``CONFIGURE_SHELL_COMMAND_LDUMP`` to have this |
---|
| 239 | command included. |
---|
[8ca13ed] | 240 | |
---|
[bf61a8b] | 241 | This command can be excluded from the shell command set by defining |
---|
| 242 | ``CONFIGURE_SHELL_NO_COMMAND_LDUMP`` when all shell commands have been |
---|
| 243 | configured. |
---|
[8ca13ed] | 244 | |
---|
| 245 | .. index:: rtems_shell_rtems_main_ldump |
---|
| 246 | |
---|
[bf61a8b] | 247 | PROGRAMMING INFORMATION: |
---|
| 248 | The ``ldump`` is implemented by a C language function which has the following |
---|
| 249 | prototype: |
---|
| 250 | |
---|
| 251 | .. code-block:: c |
---|
[fabe6d0] | 252 | |
---|
[bf61a8b] | 253 | int rtems_shell_rtems_main_ldump( |
---|
| 254 | int argc, |
---|
| 255 | char **argv |
---|
| 256 | ); |
---|
[8ca13ed] | 257 | |
---|
[bf61a8b] | 258 | The configuration structure for the ``ldump`` has the following prototype: |
---|
[8ca13ed] | 259 | |
---|
[bf61a8b] | 260 | .. code-block:: c |
---|
[fabe6d0] | 261 | |
---|
[bf61a8b] | 262 | extern rtems_shell_cmd_t rtems_shell_LDUMP_Command; |
---|
[8ca13ed] | 263 | |
---|
[bf61a8b] | 264 | .. raw:: latex |
---|
| 265 | |
---|
| 266 | \clearpage |
---|
[8ca13ed] | 267 | |
---|
[fabe6d0] | 268 | .. _medit: |
---|
| 269 | |
---|
[8ca13ed] | 270 | medit - modify contents of memory |
---|
| 271 | --------------------------------- |
---|
| 272 | .. index:: medit |
---|
| 273 | |
---|
[bf61a8b] | 274 | SYNOPSYS: |
---|
| 275 | .. code-block:: shell |
---|
[8ca13ed] | 276 | |
---|
[bf61a8b] | 277 | medit address value1 [value2 ... valueN] |
---|
[8ca13ed] | 278 | |
---|
[bf61a8b] | 279 | DESCRIPTION: |
---|
| 280 | This command is used to modify the contents of the memory starting at |
---|
| 281 | ``address`` using the octets specified by the parameters``value1`` through |
---|
| 282 | ``valueN``. |
---|
[8ca13ed] | 283 | |
---|
[bf61a8b] | 284 | EXIT STATUS: |
---|
| 285 | This command returns 0 on success and non-zero if an error is encountered. |
---|
[8ca13ed] | 286 | |
---|
[bf61a8b] | 287 | NOTES: |
---|
| 288 | Dumping memory from a non-existent address may result in an unrecoverable |
---|
| 289 | program fault. |
---|
[8ca13ed] | 290 | |
---|
[bf61a8b] | 291 | EXAMPLES: |
---|
| 292 | The following is an example of how to use ``medit``: |
---|
[8ca13ed] | 293 | |
---|
[bf61a8b] | 294 | .. code-block:: shell |
---|
[8ca13ed] | 295 | |
---|
[bf61a8b] | 296 | SHLL [/] $ mdump 0x02000000 32 |
---|
| 297 | 0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!. |
---|
| 298 | 0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!. |
---|
| 299 | SHLL [/] $ medit 0x02000000 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 |
---|
| 300 | SHLL [/] $ mdump 0x02000000 32 |
---|
| 301 | 0x02000000 01 02 03 04 05 06 07 08-09 00 22 BC A6 10 21 00 .........."...!. |
---|
| 302 | 0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!. |
---|
[8ca13ed] | 303 | |
---|
| 304 | .. index:: CONFIGURE_SHELL_NO_COMMAND_MEDIT |
---|
| 305 | .. index:: CONFIGURE_SHELL_COMMAND_MEDIT |
---|
| 306 | |
---|
[bf61a8b] | 307 | CONFIGURATION: |
---|
| 308 | This command is included in the default shell command set. When building a |
---|
| 309 | custom command set, define ``CONFIGURE_SHELL_COMMAND_MEDIT`` to have this |
---|
| 310 | command included. |
---|
[8ca13ed] | 311 | |
---|
[bf61a8b] | 312 | This command can be excluded from the shell command set by defining |
---|
| 313 | ``CONFIGURE_SHELL_NO_COMMAND_MEDIT`` when all shell commands have been |
---|
| 314 | configured. |
---|
[8ca13ed] | 315 | |
---|
| 316 | .. index:: rtems_shell_rtems_main_medit |
---|
| 317 | |
---|
[bf61a8b] | 318 | PROGRAMMING INFORMATION: |
---|
| 319 | The ``medit`` is implemented by a C language function which has the |
---|
| 320 | following prototype: |
---|
[fabe6d0] | 321 | |
---|
[bf61a8b] | 322 | .. code-block:: c |
---|
[8ca13ed] | 323 | |
---|
[bf61a8b] | 324 | int rtems_shell_rtems_main_medit( |
---|
| 325 | int argc, |
---|
| 326 | char **argv |
---|
| 327 | ); |
---|
[8ca13ed] | 328 | |
---|
[bf61a8b] | 329 | The configuration structure for the ``medit`` has the following prototype: |
---|
[fabe6d0] | 330 | |
---|
[bf61a8b] | 331 | .. code-block:: c |
---|
[8ca13ed] | 332 | |
---|
[bf61a8b] | 333 | extern rtems_shell_cmd_t rtems_shell_MEDIT_Command; |
---|
| 334 | |
---|
| 335 | .. raw:: latex |
---|
| 336 | |
---|
| 337 | \clearpage |
---|
[8ca13ed] | 338 | |
---|
[fabe6d0] | 339 | .. _mfill: |
---|
| 340 | |
---|
[8ca13ed] | 341 | mfill - file memory with pattern |
---|
| 342 | -------------------------------- |
---|
| 343 | .. index:: mfill |
---|
| 344 | |
---|
[bf61a8b] | 345 | SYNOPSYS: |
---|
| 346 | .. code-block:: shell |
---|
[8ca13ed] | 347 | |
---|
[bf61a8b] | 348 | mfill address length value |
---|
[8ca13ed] | 349 | |
---|
[bf61a8b] | 350 | DESCRIPTION: |
---|
| 351 | This command is used to fill the memory starting at ``address`` for the |
---|
| 352 | specified ``length`` in octets when the specified at``value``. |
---|
[8ca13ed] | 353 | |
---|
[bf61a8b] | 354 | EXIT STATUS: |
---|
| 355 | This command returns 0 on success and non-zero if an error is encountered. |
---|
[8ca13ed] | 356 | |
---|
[bf61a8b] | 357 | NOTES: |
---|
| 358 | Filling a non-existent address range may result in an unrecoverable program |
---|
| 359 | fault. Similarly overwriting interrupt vector tables, code space or |
---|
| 360 | critical data areas can be fatal as shown in the example. |
---|
[8ca13ed] | 361 | |
---|
[bf61a8b] | 362 | EXAMPLES: |
---|
| 363 | In this example, the address used (``0x23d89a0``) as the base address of |
---|
| 364 | the filled area is the end of the stack for the Idle thread. This address |
---|
| 365 | was determined manually using gdb and is very specific to this application |
---|
| 366 | and BSP. The first command in this example is an ``mdump`` to display the |
---|
| 367 | initial contents of this memory. We see that the first 8 bytes are 0xA5 |
---|
| 368 | which is the pattern used as a guard by the Stack Checker. On the first |
---|
| 369 | context switch after the pattern is overwritten by the ``mfill`` command, |
---|
| 370 | the Stack Checker detect the pattern has been corrupted and generates a |
---|
| 371 | fatal error. |
---|
[8ca13ed] | 372 | |
---|
[bf61a8b] | 373 | .. code-block:: shell |
---|
[8ca13ed] | 374 | |
---|
[bf61a8b] | 375 | SHLL [/] $ mdump 0x23d89a0 16 |
---|
| 376 | 0x023D89A0 A5 A5 A5 A5 A5 A5 A5 A5-FE ED F0 0D 0B AD 0D 06 ................ |
---|
| 377 | SHLL [/] $ mfill 0x23d89a0 13 0x5a |
---|
| 378 | SHLL [/] $ BLOWN STACK!!! Offending task(0x23D4418): id=0x09010001; name=0x0203D908 |
---|
| 379 | stack covers range 0x23D89A0 - 0x23D99AF (4112 bytes) |
---|
| 380 | Damaged pattern begins at 0x023D89A8 and is 16 bytes long |
---|
[8ca13ed] | 381 | |
---|
| 382 | .. index:: CONFIGURE_SHELL_NO_COMMAND_MFILL |
---|
| 383 | .. index:: CONFIGURE_SHELL_COMMAND_MFILL |
---|
| 384 | |
---|
[bf61a8b] | 385 | CONFIGURATION: |
---|
| 386 | This command is included in the default shell command set. When building a |
---|
| 387 | custom command set, define ``CONFIGURE_SHELL_COMMAND_MFILL`` to have this |
---|
| 388 | command included. |
---|
[8ca13ed] | 389 | |
---|
[bf61a8b] | 390 | This command can be excluded from the shell command set by defining |
---|
| 391 | ``CONFIGURE_SHELL_NO_COMMAND_MFILL`` when all shell commands have been |
---|
| 392 | configured. |
---|
[8ca13ed] | 393 | |
---|
| 394 | .. index:: rtems_shell_rtems_main_mfill |
---|
| 395 | |
---|
[bf61a8b] | 396 | PROGRAMMING INFORMATION: |
---|
| 397 | The ``mfill`` is implemented by a C language function which has the |
---|
| 398 | following prototype: |
---|
| 399 | |
---|
| 400 | .. code-block:: c |
---|
[fabe6d0] | 401 | |
---|
[bf61a8b] | 402 | int rtems_shell_rtems_main_mfill( |
---|
| 403 | int argc, |
---|
| 404 | char **argv |
---|
| 405 | ); |
---|
[8ca13ed] | 406 | |
---|
[bf61a8b] | 407 | The configuration structure for the ``mfill`` has the |
---|
| 408 | following prototype: |
---|
[8ca13ed] | 409 | |
---|
[bf61a8b] | 410 | .. code-block:: c |
---|
[fabe6d0] | 411 | |
---|
[bf61a8b] | 412 | extern rtems_shell_cmd_t rtems_shell_MFILL_Command; |
---|
[8ca13ed] | 413 | |
---|
[bf61a8b] | 414 | .. raw:: latex |
---|
| 415 | |
---|
| 416 | \clearpage |
---|
[8ca13ed] | 417 | |
---|
[fabe6d0] | 418 | .. _mmove: |
---|
| 419 | |
---|
[8ca13ed] | 420 | mmove - move contents of memory |
---|
| 421 | ------------------------------- |
---|
| 422 | .. index:: mmove |
---|
| 423 | |
---|
[bf61a8b] | 424 | SYNOPSYS: |
---|
| 425 | .. code-block:: shell |
---|
[8ca13ed] | 426 | |
---|
[bf61a8b] | 427 | mmove dst src length |
---|
[8ca13ed] | 428 | |
---|
[bf61a8b] | 429 | DESCRIPTION: |
---|
| 430 | This command is used to copy the contents of the memory starting at ``src`` |
---|
| 431 | to the memory located at ``dst`` for the specified ``length`` in octets. |
---|
[8ca13ed] | 432 | |
---|
[bf61a8b] | 433 | EXIT STATUS: |
---|
| 434 | This command returns 0 on success and non-zero if an error is encountered. |
---|
[8ca13ed] | 435 | |
---|
[bf61a8b] | 436 | NOTES: |
---|
| 437 | NONE |
---|
[8ca13ed] | 438 | |
---|
[bf61a8b] | 439 | EXAMPLES: |
---|
| 440 | The following is an example of how to use ``mmove``: |
---|
[8ca13ed] | 441 | |
---|
[bf61a8b] | 442 | .. code-block:: shell |
---|
[8ca13ed] | 443 | |
---|
[bf61a8b] | 444 | SHLL [/] $ mdump 0x023d99a0 16 |
---|
| 445 | 0x023D99A0 A5 A5 A5 A5 A5 A5 A5 A5-A5 A5 A5 A5 A5 A5 A5 A5 ................ |
---|
| 446 | SHLL [/] $ mdump 0x02000000 16 |
---|
| 447 | 0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!. |
---|
| 448 | SHLL [/] $ mmove 0x023d99a0 0x02000000 13 |
---|
| 449 | SHLL [/] $ mdump 0x023d99a0 16 |
---|
| 450 | 0x023D99A0 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 A5 A5 A5 .H..)..3.."..... |
---|
[8ca13ed] | 451 | |
---|
| 452 | .. index:: CONFIGURE_SHELL_NO_COMMAND_MMOVE |
---|
| 453 | .. index:: CONFIGURE_SHELL_COMMAND_MMOVE |
---|
| 454 | |
---|
[bf61a8b] | 455 | CONFIGURATION: |
---|
| 456 | This command is included in the default shell command set. When building a |
---|
| 457 | custom command set, define ``CONFIGURE_SHELL_COMMAND_MMOVE`` to have this |
---|
| 458 | command included. |
---|
[8ca13ed] | 459 | |
---|
[bf61a8b] | 460 | This command can be excluded from the shell command set by defining |
---|
| 461 | ``CONFIGURE_SHELL_NO_COMMAND_MMOVE`` when all shell commands have been |
---|
| 462 | configured. |
---|
[8ca13ed] | 463 | |
---|
| 464 | .. index:: rtems_shell_rtems_main_mmove |
---|
| 465 | |
---|
[bf61a8b] | 466 | PROGRAMMING INFORMATION: |
---|
| 467 | The ``mmove`` is implemented by a C language function which has the |
---|
| 468 | following prototype: |
---|
| 469 | |
---|
| 470 | .. code-block:: c |
---|
| 471 | |
---|
| 472 | int rtems_shell_rtems_main_mmove( |
---|
| 473 | int argc, |
---|
| 474 | char **argv |
---|
| 475 | ); |
---|
[fabe6d0] | 476 | |
---|
[bf61a8b] | 477 | The configuration structure for the ``mmove`` has the following prototype: |
---|
[8ca13ed] | 478 | |
---|
[bf61a8b] | 479 | .. code-block:: c |
---|
[8ca13ed] | 480 | |
---|
[bf61a8b] | 481 | extern rtems_shell_cmd_t rtems_shell_MMOVE_Command; |
---|
[fabe6d0] | 482 | |
---|
[bf61a8b] | 483 | .. raw:: latex |
---|
[8ca13ed] | 484 | |
---|
[bf61a8b] | 485 | \clearpage |
---|
[8ca13ed] | 486 | |
---|
[fabe6d0] | 487 | .. _malloc: |
---|
| 488 | |
---|
[8ca13ed] | 489 | malloc - obtain information on C program heap |
---|
| 490 | --------------------------------------------- |
---|
| 491 | .. index:: malloc |
---|
| 492 | |
---|
[bf61a8b] | 493 | SYNOPSYS: |
---|
| 494 | .. code-block:: shell |
---|
[8ca13ed] | 495 | |
---|
[bf61a8b] | 496 | malloc [walk] |
---|
[8ca13ed] | 497 | |
---|
[bf61a8b] | 498 | DESCRIPTION: |
---|
| 499 | This command prints information about the current state of the C Program |
---|
| 500 | Heap used by the ``malloc()`` family of calls if no or invalid options are |
---|
| 501 | passed to the command. This includes the following information: |
---|
[8ca13ed] | 502 | |
---|
[bf61a8b] | 503 | - Number of free blocks |
---|
[8ca13ed] | 504 | |
---|
[bf61a8b] | 505 | - Largest free block |
---|
[8ca13ed] | 506 | |
---|
[bf61a8b] | 507 | - Total bytes free |
---|
[8ca13ed] | 508 | |
---|
[bf61a8b] | 509 | - Number of used blocks |
---|
[8ca13ed] | 510 | |
---|
[bf61a8b] | 511 | - Largest used block |
---|
[8ca13ed] | 512 | |
---|
[bf61a8b] | 513 | - Total bytes used |
---|
[8ca13ed] | 514 | |
---|
[bf61a8b] | 515 | - Size of the allocatable area in bytes |
---|
[8ca13ed] | 516 | |
---|
[bf61a8b] | 517 | - Minimum free size ever in bytes |
---|
[8ca13ed] | 518 | |
---|
[bf61a8b] | 519 | - Maximum number of free blocks ever |
---|
[8ca13ed] | 520 | |
---|
[bf61a8b] | 521 | - Maximum number of blocks searched ever |
---|
[8ca13ed] | 522 | |
---|
[bf61a8b] | 523 | - Lifetime number of bytes allocated |
---|
[8ca13ed] | 524 | |
---|
[bf61a8b] | 525 | - Lifetime number of bytes freed |
---|
[8ca13ed] | 526 | |
---|
[bf61a8b] | 527 | - Total number of searches |
---|
[8ca13ed] | 528 | |
---|
[bf61a8b] | 529 | - Total number of successful allocations |
---|
[8ca13ed] | 530 | |
---|
[bf61a8b] | 531 | - Total number of failed allocations |
---|
[8ca13ed] | 532 | |
---|
[bf61a8b] | 533 | - Total number of successful frees |
---|
[8ca13ed] | 534 | |
---|
[bf61a8b] | 535 | - Total number of successful resizes |
---|
[8ca13ed] | 536 | |
---|
[bf61a8b] | 537 | When the subcommand ``walk`` is specified, then a heap walk will be |
---|
| 538 | performed and information about each block is printed out. |
---|
[8ca13ed] | 539 | |
---|
[bf61a8b] | 540 | EXIT STATUS: |
---|
| 541 | This command returns 0 on success and non-zero if an error is encountered. |
---|
[8ca13ed] | 542 | |
---|
[bf61a8b] | 543 | NOTES: |
---|
| 544 | NONE |
---|
[8ca13ed] | 545 | |
---|
[bf61a8b] | 546 | EXAMPLES: |
---|
| 547 | The following is an example of how to use the ``malloc`` command. |
---|
[8ca13ed] | 548 | |
---|
[bf61a8b] | 549 | .. code-block:: shell |
---|
[8ca13ed] | 550 | |
---|
[bf61a8b] | 551 | SHLL [/] $ malloc |
---|
| 552 | C Program Heap and RTEMS Workspace are the same. |
---|
| 553 | Number of free blocks: 2 |
---|
| 554 | Largest free block: 266207504 |
---|
| 555 | Total bytes free: 266208392 |
---|
| 556 | Number of used blocks: 167 |
---|
| 557 | Largest used block: 16392 |
---|
| 558 | Total bytes used: 83536 |
---|
| 559 | Size of the allocatable area in bytes: 266291928 |
---|
| 560 | Minimum free size ever in bytes: 266207360 |
---|
| 561 | Maximum number of free blocks ever: 6 |
---|
| 562 | Maximum number of blocks searched ever: 5 |
---|
| 563 | Lifetime number of bytes allocated: 91760 |
---|
| 564 | Lifetime number of bytes freed: 8224 |
---|
| 565 | Total number of searches: 234 |
---|
| 566 | Total number of successful allocations: 186 |
---|
| 567 | Total number of failed allocations: 0 |
---|
| 568 | Total number of successful frees: 19 |
---|
| 569 | Total number of successful resizes: 0 |
---|
| 570 | SHLL [/] $ malloc walk |
---|
| 571 | malloc walk |
---|
| 572 | PASS[0]: page size 8, min block size 48 |
---|
| 573 | area begin 0x00210210, area end 0x0FFFC000 |
---|
| 574 | first block 0x00210214, last block 0x0FFFBFDC |
---|
| 575 | first free 0x00228084, last free 0x00228354 |
---|
| 576 | PASS[0]: block 0x00210214: size 88 |
---|
| 577 | ... |
---|
| 578 | PASS[0]: block 0x00220154: size 144 |
---|
| 579 | PASS[0]: block 0x002201E4: size 168, prev 0x002205BC, next 0x00228354 (= last free) |
---|
| 580 | PASS[0]: block 0x0022028C: size 168, prev_size 168 |
---|
| 581 | ... |
---|
| 582 | PASS[0]: block 0x00226E7C: size 4136 |
---|
| 583 | PASS[0]: block 0x00227EA4: size 408, prev 0x00228084 (= first free), next 0x00226CE4 |
---|
| 584 | PASS[0]: block 0x0022803C: size 72, prev_size 408 |
---|
| 585 | PASS[0]: block 0x00228084: size 648, prev 0x0020F75C (= head), next 0x00227EA4 |
---|
| 586 | PASS[0]: block 0x0022830C: size 72, prev_size 648 |
---|
| 587 | PASS[0]: block 0x00228354: size 266157192, prev 0x002201E4, next 0x0020F75C (= tail) |
---|
| 588 | PASS[0]: block 0x0FFFBFDC: size 4028711480, prev_size 266157192 |
---|
[8ca13ed] | 589 | |
---|
| 590 | .. index:: CONFIGURE_SHELL_NO_COMMAND_MALLOC |
---|
| 591 | .. index:: CONFIGURE_SHELL_COMMAND_MALLOC |
---|
| 592 | |
---|
[bf61a8b] | 593 | CONFIGURATION: |
---|
| 594 | This command is included in the default shell command set. When building a |
---|
| 595 | custom command set, define ``CONFIGURE_SHELL_COMMAND_MALLOC`` to have this |
---|
| 596 | command included. |
---|
[8ca13ed] | 597 | |
---|
[bf61a8b] | 598 | This command can be excluded from the shell command set by defining |
---|
| 599 | ``CONFIGURE_SHELL_NO_COMMAND_MALLOC`` when all shell commands have been |
---|
| 600 | configured. |
---|
[8ca13ed] | 601 | |
---|
| 602 | .. index:: rtems_shell_rtems_main_malloc |
---|
| 603 | |
---|
[bf61a8b] | 604 | PROGRAMMING INFORMATION: |
---|
| 605 | The ``malloc`` is implemented by a C language function which has the |
---|
| 606 | following prototype: |
---|
[fabe6d0] | 607 | |
---|
[bf61a8b] | 608 | .. code-block:: c |
---|
[8ca13ed] | 609 | |
---|
[bf61a8b] | 610 | int rtems_shell_rtems_main_malloc( |
---|
| 611 | int argc, |
---|
| 612 | char **argv |
---|
| 613 | ); |
---|
[8ca13ed] | 614 | |
---|
[bf61a8b] | 615 | The configuration structure for the ``malloc`` has the following prototype: |
---|
[fabe6d0] | 616 | |
---|
[bf61a8b] | 617 | .. code-block:: c |
---|
[8ca13ed] | 618 | |
---|
[bf61a8b] | 619 | extern rtems_shell_cmd_t rtems_shell_MALLOC_Command; |
---|