Skip to content

Instantly share code, notes, and snippets.

@sitano
Created January 3, 2023 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sitano/9068dbaf4958e13702019163012e04ba to your computer and use it in GitHub Desktop.
Save sitano/9068dbaf4958e13702019163012e04ba to your computer and use it in GitHub Desktop.
define gdb symbol
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