multithreading - Is there a better way to control gdb other than using command-line tools/libraries such as pexpect in python? -
i'm trying develop program uses gdb it's basic debugging purposes. executes gdb command line, attaches target process , gives specific commands, reads std output. seemed on paper @ first started out python , pexpect. recently, while thinking future implementations, i've encountered problem. since can execute 1 command @ time command-line(there can 1 gdb instance per process), threads request data refresh ui element lead chaos eventually. think it:
1-)gdb stops program execute commands
2-)blocks other threads while executing code
3-)gdb continues program after execution finishes
4-)one of waiting threads try use gdb immediately
5-)go 1 , repeat
the process we'll work on freeze every 0.5 sec, unbearable.
so, thing want achieve multi-threading while executing commands. how can it? thought using gdb libraries since use python , codes written in c, left question mark on head compatibility.
there 2 main ways script gdb.
one way use gdb mi ("machine interface") protocol. specialized input , output mode gdb has intended programmatic use. has warts "usable enough" - of gdb guis use.
the other way write python scripts run inside gdb, using gdb's python api. approach simpler program, on downside python api missing useful pieces, can't done, depending on you're trying accomplish.
Comments
Post a Comment