Dontbug: A reversible debugger for PHP (similar in concept to RevDB for Python/PyPy)

Dear All, There have been some interesting blogs about RevDB a reversible debugger for Python on the PyPy blog. I'd like to tell you about Dontbug, a reversible debugger for PHP that I recently released. Like RevDB, it allows you to debug forwards and backwards -- but in PHP. See: https://github.com/sidkshatriya/dontbug For a short (1m35s) demo video: https://www.youtube.com/watch?v=DA76z77KtY0 Why am I talking about this in a PyPy mailing list :-) ? Firstly, because I think reverse debuggers for dynamic languages are relatively rare -- so its a good idea that we know about each other! Secondly, the fact that there are more and more reversible debuggers for various languages every year means that reverse debugging is definitely entering the mainstream. We could be at an inflexion point here! Hope you guys find Dontbug interesting! Thanks, Sidharth

Hi Sidharth I see dontbug is based on rr - I would like to know how well rr works for you. We've tried using rr for pypy and it didn't work as advertised. On the other hand it seems the project is moving fast, so maybe it works these days On Thu, Oct 20, 2016 at 9:50 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:

Hi Maciej, Yes, Dontbug is built on top of RR. Mozilla/RR can be finicky at times but overall I had a very good experience with it. I developed Dontbug on Ubuntu 16.04 and I found RR to be pretty robust on that distro at least. I did encounter a serious regression once (I was on a bleeding edge commit) but it was addressed quickly after I filed a ticket. RR runs Travis tests on Ubuntu 14.04 so we can be sure about that distro also. I also see references to Fedora in RR documentation so I'm guessing RR should be good on that distribution also. The reason I mention all these distros is that your experience with RR will often depend on the specific Linux kernel version and the gdb debugger version you're using (and to a slightly lesser extend the specific distro). RR tends to use a lot of hairy/advanced features like ptrace, seccomp-bpf, CPU performance counters etc. and the internal implementation of these in the kernel tends to subtly change over time (or suffer bugs). So you can often run into problems on very recent distros. For instance there is currently an outstanding ticket for test failures on Ubuntu 16.10. But as mentioned, the developers tend to address these quickly. As long as you're on a mainstream non-bleeding edge distro, I would think that RR should work fine for you. The Mozilla folks use RR to debug Firefox which is a hugely complex application (as you can imagine) and this gives me confidence about the overall correctness of RR. Coming to PyPy I would suggest you try RR out again. As a start, try it out on Ubuntu 16.04. If you run into problems do post a ticket on the RR project. I also noticed some references to UndoDB usage on the PyPy project. How has your team's experience been with UndoDB+PyPy in general? It would interesting to learn about your experiences there... Thanks, Sidharth On Fri, Oct 21, 2016 at 10:58 AM, Maciej Fijalkowski <fijall@gmail.com> wrote:

A small note related to Travis mentioned in my last email: It turns out, Travis was actually *not* running any rr tests. It seems Travis was only there to make sure rr built correctly. Tests could not be run because the VMs on which Travis was running don't support PMU virtualization. The situation has now changed. There is a buildbot on Digital ocean that is now running tests. Digital Ocean VMs support PMU virtualization. See: https://mail.mozilla.org/pipermail/rr-dev/2016-October/000424.html https://mail.mozilla.org/pipermail/rr-dev/2016-October/000420.html TL;DR: rr has proper CI now (but its not via Travis) Thanks, Sidharth On Fri, Oct 21, 2016 at 12:06 PM, Sidharth Kshatriya < sid.kshatriya@gmail.com> wrote:

Hi Sidharth, Sorry for answering you only now. Dontbug is interesting. It offers roughly the same set of basic features than RevDB or UndoDB or rr itself. It is interesting indeed that reverse debugging is slowly becoming more mainstream, and standardizing a bit the supported features. For example, when using RevDB I found watchpoints to be one of the most useful features. I see that Dontbug doesn't support them yet, but plans to. Great :-) Implementation-wise, Dontbug is a very different approach than RevDB. RevDB is much easier to port than rr: for example it works on OS/X too, and could be made to work on Windows with more efforts. It doesn't require particular OS support, apart from being based for now on fork(). In the typical PyPy way, it works by systematically transforming some constructs in the RPython source code of PyPy; this is something that you can't really do if you start with C code. On the other hand, with Dontbug I imagine you built a reverse debugger for PHP by starting with C source code of the PHP implementation, building on top of what rr provides. There is a chance that someone will also do with CPython some day, as well as other interpreters. Maybe we should try to push RevDB more, but right now it seems not to be used or known a lot. On 21 October 2016 at 08:36, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
Yes, we use UndoDB very occasionally to debug hard issues inside the generated C code of PyPy itself (which is unrelated to RevDB, whose goal is to be used by Python users). UndoDB is rather stable nowadays. I also tried rr for that once or twice. But needing that is rare enough that I'm at most an occasional user of both. A bientôt, Armin.

Hi Sidharth I see dontbug is based on rr - I would like to know how well rr works for you. We've tried using rr for pypy and it didn't work as advertised. On the other hand it seems the project is moving fast, so maybe it works these days On Thu, Oct 20, 2016 at 9:50 PM, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:

Hi Maciej, Yes, Dontbug is built on top of RR. Mozilla/RR can be finicky at times but overall I had a very good experience with it. I developed Dontbug on Ubuntu 16.04 and I found RR to be pretty robust on that distro at least. I did encounter a serious regression once (I was on a bleeding edge commit) but it was addressed quickly after I filed a ticket. RR runs Travis tests on Ubuntu 14.04 so we can be sure about that distro also. I also see references to Fedora in RR documentation so I'm guessing RR should be good on that distribution also. The reason I mention all these distros is that your experience with RR will often depend on the specific Linux kernel version and the gdb debugger version you're using (and to a slightly lesser extend the specific distro). RR tends to use a lot of hairy/advanced features like ptrace, seccomp-bpf, CPU performance counters etc. and the internal implementation of these in the kernel tends to subtly change over time (or suffer bugs). So you can often run into problems on very recent distros. For instance there is currently an outstanding ticket for test failures on Ubuntu 16.10. But as mentioned, the developers tend to address these quickly. As long as you're on a mainstream non-bleeding edge distro, I would think that RR should work fine for you. The Mozilla folks use RR to debug Firefox which is a hugely complex application (as you can imagine) and this gives me confidence about the overall correctness of RR. Coming to PyPy I would suggest you try RR out again. As a start, try it out on Ubuntu 16.04. If you run into problems do post a ticket on the RR project. I also noticed some references to UndoDB usage on the PyPy project. How has your team's experience been with UndoDB+PyPy in general? It would interesting to learn about your experiences there... Thanks, Sidharth On Fri, Oct 21, 2016 at 10:58 AM, Maciej Fijalkowski <fijall@gmail.com> wrote:

A small note related to Travis mentioned in my last email: It turns out, Travis was actually *not* running any rr tests. It seems Travis was only there to make sure rr built correctly. Tests could not be run because the VMs on which Travis was running don't support PMU virtualization. The situation has now changed. There is a buildbot on Digital ocean that is now running tests. Digital Ocean VMs support PMU virtualization. See: https://mail.mozilla.org/pipermail/rr-dev/2016-October/000424.html https://mail.mozilla.org/pipermail/rr-dev/2016-October/000420.html TL;DR: rr has proper CI now (but its not via Travis) Thanks, Sidharth On Fri, Oct 21, 2016 at 12:06 PM, Sidharth Kshatriya < sid.kshatriya@gmail.com> wrote:

Hi Sidharth, Sorry for answering you only now. Dontbug is interesting. It offers roughly the same set of basic features than RevDB or UndoDB or rr itself. It is interesting indeed that reverse debugging is slowly becoming more mainstream, and standardizing a bit the supported features. For example, when using RevDB I found watchpoints to be one of the most useful features. I see that Dontbug doesn't support them yet, but plans to. Great :-) Implementation-wise, Dontbug is a very different approach than RevDB. RevDB is much easier to port than rr: for example it works on OS/X too, and could be made to work on Windows with more efforts. It doesn't require particular OS support, apart from being based for now on fork(). In the typical PyPy way, it works by systematically transforming some constructs in the RPython source code of PyPy; this is something that you can't really do if you start with C code. On the other hand, with Dontbug I imagine you built a reverse debugger for PHP by starting with C source code of the PHP implementation, building on top of what rr provides. There is a chance that someone will also do with CPython some day, as well as other interpreters. Maybe we should try to push RevDB more, but right now it seems not to be used or known a lot. On 21 October 2016 at 08:36, Sidharth Kshatriya <sid.kshatriya@gmail.com> wrote:
Yes, we use UndoDB very occasionally to debug hard issues inside the generated C code of PyPy itself (which is unrelated to RevDB, whose goal is to be used by Python users). UndoDB is rather stable nowadays. I also tried rr for that once or twice. But needing that is rare enough that I'm at most an occasional user of both. A bientôt, Armin.
participants (3)
-
Armin Rigo
-
Maciej Fijalkowski
-
Sidharth Kshatriya