未加星标

Dontbug - a reverse debugger for PHP implemented in golang and C

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二04 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏
Dontbug Debugger

Dontbug is a reverse debugger (aka time travel debugger ) forphp. It allows you to record the execution of PHP scripts (in command line mode or in the browser) and replay the same execution back in a PHP IDE debugger. During replay you may debug normally (forward mode debugging) or in reverse, which allows you to step over/out backwards, step backwards, run backwards, run to cursor backwards, set breakpoints in the past and so forth.

Debugging with the ability to run in reverse allows you to hunt down bugs much more easily. It also allows you to understand the runtime behavior of large PHP codebases more efficiently.

Demo Videos Short Demo Video (1m35s) https://www.youtube.com/watch?v=DA76z77KtY0 Demo Video (9m04s) https://www.youtube.com/watch?v=ggo9s3ug-k4 Debugger features Debug PHP sources in forward or reverse Ability to set line breakpoints, inspect PHP variables and the call stack, step over/out/into backwards or forward, hit breakpoints when running in reverse or forward mode, run to cursor backwards etc. Full compatibility with existing PHP IDEs like Netbeans , Eclipse PDT , PhpStorm or any other PHP IDE/Editor that supports Xdebug . No special IDE plugins or modifications required for your IDE/Editor Minimal learning curve: Apart from getting familiar with debugging in reverse, you continue using the same debugger as before. When Dontbug is put into reverse mode, the buttons on your IDE simply acquire opposite meanings. So step over is now step over backwards . This can be confusing, sohereis a cheat sheet. Ability to record PHP script execution completely even if there are network calls, database calls or any non-deterministic input/output in the PHP code. During replay, the PHP scripts will see the same input/output results from databases, network calls, calls to rand()/time() etc. as during record. (However, PHP will not write/read to the network or database a second time during replay) Highly performant forward/reverse mode execution so you can concentrate on finding the bug and not have the debugger "get in your way" Ability to record multiple web-server requests/responses in one go: Traditional PHP (website) debugging is done on a per URL basis. With dontbug you can record many webserver requests/responses at a time and then debug the consolidated execution trace. This can help you hit breakpoints in code which are rarely triggered or triggered in poorly understood situations. What this means in practice is that pressing run/continue (in forward or reverse mode) can often lead you to the next/previous request in the debugger and not the end of the program. (Feature caveat: be aware that recording too many page requests/responses at a time may degrade performance when debugging) Limitations and Caveats

Since Dontbug replays a saved PHP script execution trace, you cannot persistently modify a variable value in the debugger. All variables (and "state") in the PHP script is read-only. This limitation is fundamental in the current record/replay architecture. In practice, this is not such a big limitation as changing variable values while debugging is rarely needed.

Dontbug is of alpha level quality. It works but may be a bit rough around the edges. Please report any problems you encounter. Dontbug also does not have advanced debugging features like breaking on named exceptions, breaking on call to/return from a specifically named function, conditional breakpoints[*], watches etc. at the moment. Some of these are planned for future releases. [*] You can always emulate conditional breakpoints by adding an if statement for the breakpoint condition and a line breakpoint inside the if statement. Usage in Brief Record an execution by using dontbug record Ask your PHP IDE to listen for a debugging connection In your favorite shell, execute: dontbug replay Dontbug now tries to connect to the PHP IDE that is listening for debugger connections Once connected, dontbug will replay the last execution recorded (via dontbug record ) to the IDE Once connected, use the debugger in the IDE as you would, normally If you want run in reverse mode, press "r" for reverse mode and "f" for forward mode in the dontbug prompt

See below for more details.

Installation and OS Platforms

See Installation Instructions on installing Dontbug on your machine.

How the Dontbug Debugger Works

If you're interested in how the Dontbug debugger works internally please readthis document.

Credits

Standing on the shoulders of giants

Most open source projects are built with the help of other open source projects and Dontbug is no exception.

The Mozilla/RR , Xdebug and GDB projects are the most important open source projects that Dontbug depends on. The existence of these fantastic open source projects has allowed Dontbug to be built. The roles and contributions of these three projects to the overall functionality of Dontbug is outlined in the "How the Dontbug Debugger works" document.

The Dontbug executable has been programmed in the golang programming language. Dontbug directly depends on a number of open source golang libraries:

Thecyrus-and/gdb golang library to communicate with GDB using the GDB/MI protocol Thechzyer/readline golang library for a GNU Readline kind implementation Thekr/pty golang library to interface with Unix psuedo-terminals Thespf13/cobra and the relatedspf13/viper golang libraries for command line interfaces and persistent configuration TheMasterminds/semver golang library for version string comparisons Thefatih/color golang library for using colors in Unix terminals

This may not be an exhaustive/upto date list. Please refer to the source code.

License and Copyright

Dontbug is Copyright 2016 Sidharth Kshatriya. Dontbug is licensed under the terms of the Apache License (Version 2.0).

Using the Dontbug Debugger

Once you have installed dontbug you have two commands available:

dontbug record dontbug replay Se

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

主题: PHP
分页:12
转载请注明
本文标题:Dontbug - a reverse debugger for PHP implemented in golang and C
本站链接:http://www.codesec.net/view/483308.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(29)