Skip to content

Debugging with GDB

Guille Polito edited this page Oct 6, 2022 · 1 revision

GDB user defined commands

In the root of the repository there is a .gdbinit file that can be copied at ~/.gdbinit to get common debugging functions and shortcuts for the Pharo VM. The list of all user-defined functions can be accessed in gdb with help user-defined and documentation for a specific function with help function_name.

Printing:

Command Arguments Description
ptt - Print trampoline table
pf frame address Print frame info
pcog cog method address Print cog method info
pcogs - Print all cogged methods
pct cog method type Print all cog methods of a given type
pcp primitive index Print all cog methods using a given primitive
pcm compiled method address Print all cog methods of a given method
pcs selector address Print all cog methods for a given selector

Locating and Disassembling

Command Arguments Description
whereis address Locates the enclosing cog method or trampoline
dt trampoline address Disassemble the given trampoline
dc cog method address (optional length) Disassemble the cog method (splits metadata/checks/method body) up to a given length if provided (all method otherwise)
dnc cog method address (optional length) Disassemble the cog method (starting at the method body) up to a given length if provided (all method otherwise)
Clone this wiki locally