Add stuff
This commit is contained in:
parent
ca7b87b22b
commit
b4a0af09f9
47
gdb.md
47
gdb.md
|
@ -8,5 +8,52 @@
|
|||
- Go to end of function: `finish`
|
||||
- Create Breakpoint: `break <lineNr>`
|
||||
- Go on with `start`
|
||||
- Go no breakpoint: `c`
|
||||
- Inspect variable: `print <ariable>`
|
||||
|
||||
- Refresh window when "broken": `ctrl + L`
|
||||
|
||||
- Print: `p`
|
||||
|
||||
## Debug Assembly
|
||||
- Load file
|
||||
- Enable assembly: `layout asm`
|
||||
- Start at first instruction: `starti`
|
||||
- Step through using `stepi (si)` and `nexti (ni)`
|
||||
|
||||
- Show top $10$ elements of the stack: `x/10x $sp`
|
||||
|
||||
## TUI
|
||||
- Change window: `CTRL + x o`
|
||||
|
||||
- Previous/Next Command: `CTRL + P`/`CTRL + N`
|
||||
|
||||
- Change size: `winheight <window> <+/-> <size>`
|
||||
- When leaving out `<+/->` it is set to absolute size
|
||||
|
||||
|
||||
- Execute command `n` times: `python [gdb.execute('<YOUR_COMMAND>') for x in range(n)]`
|
||||
|
||||
##
|
||||
- Disassemble function: `disassemble <function>`
|
||||
|
||||
## Breakpoint
|
||||
- At function + offset: `b *FUNC+OFFSET`
|
||||
- At Address: `b *ADDR`
|
||||
|
||||
## Stripped Binaries
|
||||
|
||||
### Entry Point
|
||||
- Sometimes this works: `b __libc_start_main`
|
||||
- Only works when dynamic libraries (libc) were loaded (which is only after start of program)
|
||||
- When hitting this breakpoint, GDB tells us the location of main, which is the first argument to `__libc_start_main`
|
||||
- `(gdb) info file` tells the entry point address
|
||||
|
||||
x
|
||||
x/s
|
||||
x/10xw 32 bit
|
||||
x/10xX 64 bit
|
||||
|
||||
|
||||
vmmap gives overwie of virtual memory
|
||||
|
||||
|
|
Loading…
Reference in New Issue