1## Command functions ## 2 3The `functions` command will list all of 4the [convenience functions](https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Funs.html) 5provided by GEF. 6 7- `$_base([filepath])` -- Return the matching file's base address plus an 8 optional offset. Defaults to the current file. Note that quotes need to be 9 escaped. 10- `$_bss([offset])` -- Return the current bss base address plus the given 11 offset. 12- `$_got([offset])` -- Return the current bss base address plus the given 13 offset. 14- `$_heap([offset])` -- Return the current heap base address plus an 15 optional offset. 16- `$_stack([offset])` -- Return the current stack base address plus an 17 optional offset. 18 19These functions can be used as arguments to other commands to dynamically 20calculate values. 21 22``` 23gef➤ deref -l 4 $_heap() 240x0000000000602000│+0x00: 0x0000000000000000 ← $r8 250x0000000000602008│+0x08: 0x0000000000000021 ("!"?) 260x0000000000602010│+0x10: 0x0000000000000000 ← $rax, $rdx 270x0000000000602018│+0x18: 0x0000000000000000 28gef➤ deref -l 4 $_heap(0x20) 290x0000000000602020│+0x00: 0x0000000000000000 ← $rsi 300x0000000000602028│+0x08: 0x0000000000020fe1 310x0000000000602030│+0x10: 0x0000000000000000 320x0000000000602038│+0x18: 0x0000000000000000 33gef➤ deref -l 4 $_base(\"libc\") 340x00007ffff7da9000│+0x0000: 0x03010102464c457f 350x00007ffff7da9008│+0x0008: 0x0000000000000000 360x00007ffff7da9010│+0x0010: 0x00000001003e0003 370x00007ffff7da9018│+0x0018: 0x0000000000027c60 38``` 39