39 ms·
Anybody know any good resources on scripting the debugger? It seems like you should be able to use some kind of concolic execution approach + fuzzing to do some
by pizza 4y ago
Anybody know any good resources on scripting the debugger? It seems like you should be able to use some kind of concolic execution approach + fuzzing to do something like a binary search between forward and backward breakpoints to automatically find likely bug-containing regions. Or maybe union-find to partition the code into some (minimal) quite-buggy/(maximal) less-buggy sets of code regions.
Eg if you could get it to figure out the random values will probably always lie within some interval, you might be able to make it figure out “there is a path from <randint> to <if statement> to <raise segfault>”
Additionally it seems really powerful to be able to introspect a program from outside. I run into situations sometimes where I would like to be able to make a realtime statistical gui of the internal state of some 3rd party code without necessarily butchering its codebase, seems like I could just write a little python to sample the local variables from within gdb then have that serve from an http server.
Or if I want to extract some library internal scratch calculations that are private or get cleaned up at the end of some long computation, I’d much rather write 10 lines of Python to copy and paste the data I want than attempt to refactor a copy of the codebase. Learning enough about it to predict the side-effects of my modification could get quite tedious.
Not sure of the feasibility of this, or how well such an approach will work with 1000x the lines of code in the real world, however :D
- mark_undoio 4y agoGDB has some pretty good Python scripting: https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html#Python-API https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html#Py... That should get you somewhere useful for time travel systems based on GDB. You can also use Guile if you'd prefer a Lisp - https://sourceware.org/gdb/onlinedocs/gdb/Guile-API.html https://sourceware.org/gdb/onlinedocs/gdb/Guile-API.html Depending on your debugger of choice there are other options - e.g. WinDbg (which has time travel debug) can, I think, be scripted with JS.