User Tools

Site Tools


gdb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gdb [2024/04/24 09:04] A User Not Logged ingdb [2024/11/14 06:58] (current) A User Not Logged in
Line 1: Line 1:
 ====== General ====== ====== General ======
  
 +attach to running process without break:
 +
 +  gdb attach -ex cont -iex "set pagination off" $(pidof process_name)
  
 <code> <code>
Line 10: Line 13:
 end end
 </code> </code>
 +
 +====== Print Command ======
 +
 +print string pointed by $rdi:
 +
 +  x/s $rdi
 +  
 +show bytes pointed by register with offset:
 +
 +  x/16bx $rsi+0x42
 +  
 +print array with size as bytes in registers:
 +
 +  p/x *(char *)$rcx@$dx
 +  p/x (char[size]) *$rcx
  
 ====== Breakpoint ====== ====== Breakpoint ======
 +
 +break on address:
 +
 +  b *0xdeadbeef
 +
 +break at offset to function name:
 +
 +<code>
 +b *(&func_name+0xbeef)
 +b *(funcname+0xbeef)
 +b *('class::method'+0xbeef)
 +</code>
  
 set conditional breakpoint: set conditional breakpoint:
  
-  break dlopen if strcmp(file, "libc.so") == 0+  break dlopen if strcmp(file, "libc.so") == 0   
 + 
 +set logpoint: 
 + 
 +<code> 
 +break func_name 
 +commands 
 +  silent 
 +  printf "msg: %d\n", *($rdi+0xbeef) 
 +  cont 
 +end 
 + 
 +</code>
      
      
-====== View Memory ====== 
- 
  
gdb.1713949485.txt.gz · Last modified: by A User Not Logged in

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki