{"id":12166,"date":"2021-05-12T09:58:02","date_gmt":"2021-05-12T09:58:02","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=12166"},"modified":"2021-05-12T13:09:52","modified_gmt":"2021-05-12T13:09:52","slug":"vscode-gdb-display-memory","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=12166","title":{"rendered":"vscode GDB display memory"},"content":{"rendered":"<p>In computing, endianness is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest. A little-endian system, in contrast, stores the least-significant byte at the smallest address.<\/p>\n<ul>\n<li>big-endian: most significant byte in smallest memory address<\/li>\n<li>little-endian: least significant byte at the smallest address<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/Microsoft\/vscode-cpptools\/issues\/1503\">Question: How to display memory during a debug session #1503<\/a><br \/>\n<a href=\"https:\/\/www.humblec.com\/examine-display-memory-and-register-in-gdb\/\">Examine\/display memory and register in gdb<\/a><\/p>\n<div><a href=\"http:\/\/blog.bachi.net\/wp-content\/uploads\/2021\/05\/GDB_memory_inspect.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.bachi.net\/wp-content\/uploads\/2021\/05\/GDB_memory_inspect-1024x349.png\" alt=\"\" width=\"625\" height=\"213\" class=\"alignleft size-large wp-image-12167\" srcset=\"https:\/\/blog.bachi.net\/wp-content\/uploads\/2021\/05\/GDB_memory_inspect-1024x349.png 1024w, https:\/\/blog.bachi.net\/wp-content\/uploads\/2021\/05\/GDB_memory_inspect-300x102.png 300w, https:\/\/blog.bachi.net\/wp-content\/uploads\/2021\/05\/GDB_memory_inspect-768x262.png 768w, https:\/\/blog.bachi.net\/wp-content\/uploads\/2021\/05\/GDB_memory_inspect-624x212.png 624w, https:\/\/blog.bachi.net\/wp-content\/uploads\/2021\/05\/GDB_memory_inspect.png 1204w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/div>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nconst char  str&#x5B;] = &quot;hello world!&quot;;\r\nconst int   k = -15;  \r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n-exec x\/s str\r\n0x7ff608319998 &lt;str&gt;:    &quot;hello world!&quot;\r\n\r\n-exec x\/13xb str\r\n0x7ff608319998 &lt;str&gt;:    0x68    0x65    0x6c    0x6c    0x6f    0x20    0x77    0x6f\r\n0x7ff6083199a0 &lt;str+8&gt;:  0x72    0x6c    0x64    0x21    0x00\r\n\r\n-exec x &amp;k\r\n0x7ff6083199a8 &lt;k&gt;:      0xf1\r\n\r\n-exec x\/d &amp;k\r\n0x7ff6083199a8 &lt;k&gt;:      -15\r\n\r\n-exec x\/4b &amp;k\r\n0x7ff6083199a8 &lt;k&gt;:      -15    -1    -1    -1\r\n\r\n-exec x\/4xb &amp;k\r\n0x7ff6083199a8 &lt;k&gt;:      0xf1    0xff    0xff    0xff\r\n\r\n-exec p sine\r\n$2 = {0x7ff608319000 &lt;sine_300&gt; &quot;&quot;, 0x7ff608319260 &lt;sine_400&gt; &quot;&quot;, 0x7ff608319420 &lt;sine_500&gt; &quot;&quot;, 0x7ff608319580 &lt;sine_600&gt; &quot;&quot;, 0x7ff6083196a0 &lt;sine_700&gt; &quot;&quot;, 0x7ff6083197a0 &lt;sine_800&gt; &quot;&quot;, 0x7ff608319880 &lt;sine_900&gt; &quot;&quot;}\r\n\r\n-exec x\/7xg &amp;sine\r\n0x7ff608318020 &lt;sine&gt;:       0x00007ff608319000    0x00007ff608319260\r\n0x7ff608318030 &lt;sine+16&gt;:    0x00007ff608319420    0x00007ff608319580\r\n0x7ff608318040 &lt;sine+32&gt;:    0x00007ff6083196a0    0x00007ff6083197a0\r\n0x7ff608318050 &lt;sine+48&gt;:    0x00007ff608319880\r\n\r\n-exec x\/8xh sine&#x5B;0]\r\n0x7ff608319000 &lt;sine_300&gt;:\t0x0000\t0x0000\t0x0579\t0x0578\t0x0aeb\t0x0aee\t0x1062\t0x105d\r\n\r\n-exec x\/8xh sine&#x5B;1]\r\n0x7ff608319260 &lt;sine_400&gt;:\t0x0000\t0x0000\t0x074b\t0x074a\t0x0e8d\t0x0e90\t0x15ca\t0x15c6\r\n\r\n-exec x\/8xh &amp;m_wave\r\n0x7ff7c3f2d060 &lt;m_wave&gt;:\t0x0000\t0x0000\t0x02bc\t0x0578\t0x0aeb\t0x0aee\t0x1062\t0x105d\r\n\r\n-exec x\/8xh wave_16bit\r\n0x7ff7c3f2d060 &lt;m_wave&gt;:\t0x0000\t0x0000\t0x02bc\t0x0578\t0x0aeb\t0x0aee\t0x1062\t0x105d\r\n\r\n\r\n\r\n\r\n\r\n\r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n-exec tui enable\r\nCannot enable the TUI when the interpreter is 'mi'\r\n\r\n-exec show endian\r\nThe target endianness is set automatically (currently little endian).\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In computing, endianness is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest. A little-endian [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12166","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/12166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12166"}],"version-history":[{"count":3,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/12166\/revisions"}],"predecessor-version":[{"id":12170,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/12166\/revisions\/12170"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}