GDB old - Opty-Forks/SSof GitHub Wiki
GDB Basics
Below is a simple list of basic GDB commands. They should get you going for most of our exercises
gdb ./file--- open GDB to debugfiledisas function--- disassemble functionfunctiondisas address--- disassemble function at thisaddressb address--- inserts a breakpoint at addressaddressr < file--- run the program with inputfiles--- execute next step of programc--- execute until the next breakpoint of the programp expr--- prints the valueexpr.exprcan be a var, the pointer to a var (its address), a register, etc. It can even beaddress1 - address2and in this case returns the difference between the addresses.info f--- returns the info of a frame. Particularly usefull whenever you need to know where the return address of the function is stored and/or the value contained there.stack n--- show thenregisters after the stack pointerx/nx $rsp--- show thenregisters after the register$rspx/nx address--- show thenregisters after the addressaddress