gdbserver
|
gdbserver hostname:port --attach pid
gdbserver hostname:port program
|
gdb
|
(gdb) target remote hostname:port
(gdb) target remote <IP_remote>:<PORT>
|
gdbserver
|
remote(192.168.1.10)# gdbserver --attach
:2000 pid_for_prog
remote(192.168.1.10)# gdbserver
localhost:2000 prog
|
Process prg created; pid = 20624
|
gdb
|
host$ gdb prog
(gdb) target remote 192.168.1.10:2000
(gdb) b main #Breakpoint 1 at 0x400550
(gdb) continue
|
Remote debugging using 192.168.1.10:2000
|
gdbserver
|
remote# gdbserver --remote-debug --multi
localhost:2000
|
Multi-process Mode
|
gdb
|
$ gdb
(gdb) target extended-remote 192.168.1.10:2000
(gdb) set remote exec-file /prog #set program to debug
(gdb) attach pid_for_prog #Attach to a Running Process
(gdb) file /prog #load symbols from program in host
(gdb) b main
(gdb) run #Starting program: /prog
|
run gdbserver in multi process mode
|
gdb
|
(gdb) info threads #get current thread
(gdb) thread ID #set ID for current thread
(gdb) thread ID1 ID2 command
(gdb) thread apply [threadno | all ] command
|
GDB MultiThread Debug
|
(gdb) info forks #get all process info
(gdb) fork pid #switch to process pid
(gdb) set follow-fork-mode child|parent
(gdb) show follow-fork-mode
(gdb) set detach-on-flow on|off #flow two
(gdb) detach-fork pid #don’t
flow
(gdb) delete fork #kill and stop flowing
|
MultiProcess debug: After fork, child
process sleep 30s to let us get pid to attach;
|
No comments:
Post a Comment