aq@ececomp2 /web/groups/ece264/23sp/lecture/20230418/snippets $ gdb ./e GNU gdb (GDB) 9.1 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./e... (gdb) b main Breakpoint 1 at 0x4004f0: file e.c, line 11. (gdb) r Starting program: /web/groups/ece264/23sp/lecture/20230418/snippets/e Breakpoint 1, main (argc=1, argv=0x7fffffffd5b8) at e.c:11 11 uint8_t eight = 8; (gdb) n 12 int two_thousand = 2000; (gdb) 13 char bat[] = "bat"; // stack (gdb) 14 char* cow = "cow"; // data segment (gdb) 15 uint8_t five_six_seven[] = { 5, 6, 7 }; (gdb) 17 return EXIT_SUCCESS; (gdb) 18 } (gdb) p eight $1 = 8 '\b' (gdb) p two_thousand $2 = 2000 (gdb) p five_six_seven $3 = "\005\006\a" (gdb) p/d eight $4 = 8 (gdb) p/x eight $5 = 0x8 (gdb) p &eight $6 = (uint8_t *) 0x7fffffffd4cf "\b" (gdb) p/a &eight $7 = 0x7fffffffd4cf (gdb) p/d &eight $8 = 140737488344271 (gdb) p cow $9 = 0x4005f8 "cow" (gdb) p/a cow $10 = 0x4005f8 (gdb) x/s cow 0x4005f8: "cow" (gdb) x/c cow 0x4005f8: 99 'c' (gdb) x/4bc cow 0x4005f8: 99 'c' 111 'o' 119 'w' 0 '\000' (gdb) x/4bx cow 0x4005f8: 0x63 0x6f 0x77 0x00 (gdb) x/4bx &two_thousand 0x7fffffffd4c8: 0xd0 0x07 0x00 0x00 (gdb) quit A debugging session is active. Inferior 1 [process 31563] will be killed. Quit anyway? (y or n) EOF [assumed Y] aq@ececomp2 /web/groups/ece264/23sp/lecture/20230418/snippets $