Created
January 3, 2023 15:15
-
-
Save sitano/9068dbaf4958e13702019163012e04ba to your computer and use it in GitHub Desktop.
define gdb symbol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/7272558/can-we-define-a-new-data-type-in-a-gdb-session | |
// sample.c | |
#include "sample.h" | |
struct sample foo; | |
gcc -g -c sample.c | |
(gdb) add-symbol-file sample.o 0 | |
add symbol table from file "sample.o" at | |
.text_addr = 0x0 | |
(gdb) p (struct sample *)0x7fffffffd6b0 | |
$1 = (struct sample *) 0x7fffffffd6b0 | |
(gdb) p *$1 | |
$2 = {i = 42, less = 0x7fffffffd6b0, more = 0x7fffffffd6b0} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment