From: krakjoe Date: Fri, 20 Dec 2013 12:51:24 +0000 (+0000) Subject: tidy up repository for merging X-Git-Tag: php-5.6.0alpha1~110^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=329e16a250aa5a42dcc314b4f8ab3a0396111b68;p=php tidy up repository for merging --- diff --git a/test.php b/test.php deleted file mode 100644 index faea3c2fab..0000000000 --- a/test.php +++ /dev/null @@ -1,54 +0,0 @@ -isGreat("PHP Rocks!!")); - -foreach (test(1,2) as $gen) - continue; - -echo "it works!\n"; - -if (isset($dump)) - var_dump($_SERVER); - -function phpdbg_test_ob() -{ - echo 'Start'; - ob_start(); - echo 'Hello'; - $b = ob_get_clean(); - echo 'End'; - echo $b; -} - - -?> diff --git a/tutorials/break-at.png b/tutorials/break-at.png deleted file mode 100644 index 7767f22647..0000000000 Binary files a/tutorials/break-at.png and /dev/null differ diff --git a/tutorials/help-break.png b/tutorials/help-break.png deleted file mode 100644 index bc1400f231..0000000000 Binary files a/tutorials/help-break.png and /dev/null differ diff --git a/tutorials/help.png b/tutorials/help.png deleted file mode 100644 index 2e8904ff30..0000000000 Binary files a/tutorials/help.png and /dev/null differ diff --git a/tutorials/initializing.md b/tutorials/initializing.md deleted file mode 100644 index de01bb23fa..0000000000 --- a/tutorials/initializing.md +++ /dev/null @@ -1,82 +0,0 @@ -phpdbginit -========== -*Setting up your debugging session automatically* - -By default, phpdbg looks for *.phpdbginit* in the current working directory, this location can be overrideen on the command line: - -``` -phpdbg -imy.phpdbginit -``` - -An init file should contain one command per line, any phpdbg command is supported during init. - -In addition, *.phpdbginit* can contain embedded code, allowing, for example - - - the setup of auto completion - - the registration of functions - - the acquisition and pre-compilation of code - - bootstrapping a web application - -It is common for C projects (PHP included) to include an init file for the GDB debugger; this would be a clever practice to adopt -for those distributing PHP library code. - -The default .phpdbginit -======================= - -We distribute the following init file by default, it should be copied to any directory you commonly execute in: - -``` -########################################################## -# .phpdbginit -# -# Lines starting with # are ignored -# Code must start and end with <: and :> respectively -########################################################## -# Place initialization commands one per line -########################################################## -# exec sapi/phpdbg/test.php - -########################################################## -# Embedding code in .phpdbginit -########################################################## -<: -/* - If readline is loaded, you might want to setup completion: -*/ -if (function_exists('readline_completion_function')) { - readline_completion_function(function(){ - return array_merge( - get_defined_functions()['user'], - array_keys(get_defined_constants()) - ); - }); -} -:> -########################################################## -# Now carry on initializing phpdbg ... -########################################################## -# R my_debugging_function - -########################################################## -# PHP has many functions that might be useful -# ... you choose ... -########################################################## -# R touch -# R unlink -# R scandir -# R glob - -########################################################## -# Remember: *you have access to the shell* -########################################################## -# The output of registered function calls is not, -# by default, very pretty (unless you implement -# and register a new implementation for phpdbg) -# The output of shell commands will usually be more -# readable on the console -########################################################## -# TLDR; if you have a good shell, use it ... -########################################################## -``` - - diff --git a/tutorials/intro.md b/tutorials/intro.md deleted file mode 100644 index 34ec1b20ba..0000000000 --- a/tutorials/intro.md +++ /dev/null @@ -1,117 +0,0 @@ -Getting started with phpdbg -=========================== -*An introduction to debugging PHP code with phpdbg* - -phpdbg provides an interactive environment to debug PHP; it is implemented and distributed as a SAPI module - just as the CLI interface. - -``` -cd /usr/src/php-src/sapi/phpdbg -./phpdbg -e test.php -``` - -![Welcome to phpdbg](https://raw.github.com/krakjoe/phpdbg/master/tutorials/welcome.png) - -phpdbg integrates with, and initializes, the Zend environment; from the moment the console is open you can start to manipulate the environment in order to prepare your debugging session. If you have used other debuggers, phpdbg should hopefully feel familiar, but you can always ask for `help`: - -![phpdbg help menu](https://raw.github.com/krakjoe/phpdbg/master/tutorials/phpdbg.png) - -phpdbg provides help for all of the supported commands. - -Breaking execution -================== -*Telling phpdbg when to stop ...* - -In order to debug your code, execution must be interrupted at very specific points during execution, and allow access to, and inspection of, the execution environment. phpdbg can step through the execution of your script, showing you information about every opcode the VM executes, including the address (in case you need to break at that specific point on the next execution). - -phpdbg provides many options for specifying breakpoints: - -![phpdbg help menu](https://raw.github.com/krakjoe/phpdbg/master/tutorials/help-break.png) - -phpdbg also includes a userland API to enable working with breakpoints from within your PHP code: - -```php -/** -* If no parameters are recieved sets a breakpoint at the next opcode address -* @param type a constant PHPDBG_ type -* @param expression the expression for the break command -* @return void -*/ -proto void phpdbg_break([integer type, string expression]); -``` - -The following type constants are registered by phpdbg: - - - PHPDBG_FILE - - PHPDBG_METHOD - - PHPDBG_LINENO - - PHPDBG_FUNC - -```php -/** -* Clear breakpoints before continuing execution -* @return void -*/ -proto void phpdbg_clear(void); -``` - -Inspecting the environment -========================== -*Finding out what went wrong* - -When a breakpoint is reached, control is passed back to the phpdbg console, execution will not continue until the *next* command is issued, a breakpoint being reached looks something like: - -![phpdbg broken](https://raw.github.com/krakjoe/phpdbg/master/tutorials/show-broken.png) - -Now is the time to get down to some serious `evil()`, er, I mean `eval()`. - -Direct access to `eval()` allows you to change _anything_ at _any_ time during execution. Helpful printing and listing commands help you to make sense of addresses and remind you of the names of the variables you want to `var_dump()`! - -Library code for this section: - -```php -isGreat("PHP Rocks!!")); -?> -``` - -Being precise -============= -*Don't be sloppy, ever ... true story* - -The ability to break at function entry, or even on a single statement, is not always exact enough. A single statement may have many opcodes and it could be any of those instructions that are ruining your day. phpdbg allows you to specify an exact opcode address and provides the ability to view the instructions of any method or function before execution occurs. - -Looking up addresses is made easy by the `print` command - -![phpdbg verbose](https://raw.github.com/krakjoe/phpdbg/master/tutorials/show-printing.png) - -For simple scripts, like the library code in the last section, and times when you want as much detail as possible, the `quiet` flag can be changed to `0` (default is `1`): - -![phpdbg verbose](https://raw.github.com/krakjoe/phpdbg/master/tutorials/show-verbose.png) - -Mocking a server -================ -*Mocking is easy!* - -Mocking a specific environment is child's play; simply include a bootstrap file before you run, or have your code include it. - -An example of such a file can be found in the repository: - -https://github.com/krakjoe/phpdbg/blob/master/web-bootstrap.php - -Advice you can keep -=================== -*The reason for all the images...* - -The best thing about this tutorial is you take all of the help with you when you install phpdbg. Don't be afraid to ask for `help`! :) - -Happy PHPing. :) diff --git a/tutorials/java-example.png b/tutorials/java-example.png deleted file mode 100644 index 6a159721d9..0000000000 Binary files a/tutorials/java-example.png and /dev/null differ diff --git a/tutorials/java/build.xml b/tutorials/java/build.xml deleted file mode 100644 index b8895fa38e..0000000000 --- a/tutorials/java/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project phpdbg-ui. - - - diff --git a/tutorials/java/dist/README.TXT b/tutorials/java/dist/README.TXT deleted file mode 100644 index 74e385cc4f..0000000000 --- a/tutorials/java/dist/README.TXT +++ /dev/null @@ -1,32 +0,0 @@ -======================== -BUILD OUTPUT DESCRIPTION -======================== - -When you build an Java application project that has a main class, the IDE -automatically copies all of the JAR -files on the projects classpath to your projects dist/lib folder. The IDE -also adds each of the JAR files to the Class-Path element in the application -JAR files manifest file (MANIFEST.MF). - -To run the project from the command line, go to the dist folder and -type the following: - -java -jar "phpdbg-ui.jar" - -To distribute this project, zip up the dist folder (including the lib folder) -and distribute the ZIP file. - -Notes: - -* If two JAR files on the project classpath have the same name, only the first -JAR file is copied to the lib folder. -* Only JAR files are copied to the lib folder. -If the classpath contains other types of files or folders, these files (folders) -are not copied. -* If a library on the projects classpath also has a Class-Path element -specified in the manifest,the content of the Class-Path element has to be on -the projects runtime path. -* To set a main class in a standard Java project, right-click the project node -in the Projects window and choose Properties. Then click Run and enter the -class name in the Main Class field. Alternatively, you can manually type the -class name in the manifest Main-Class element. diff --git a/tutorials/java/dist/phpdbg-ui.jar b/tutorials/java/dist/phpdbg-ui.jar deleted file mode 100644 index 0de3d09b7d..0000000000 Binary files a/tutorials/java/dist/phpdbg-ui.jar and /dev/null differ diff --git a/tutorials/java/manifest.mf b/tutorials/java/manifest.mf deleted file mode 100644 index 328e8e5bc3..0000000000 --- a/tutorials/java/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/tutorials/java/nbproject/build-impl.xml b/tutorials/java/nbproject/build-impl.xml deleted file mode 100644 index f937ce8944..0000000000 --- a/tutorials/java/nbproject/build-impl.xml +++ /dev/null @@ -1,1407 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tutorials/java/nbproject/genfiles.properties b/tutorials/java/nbproject/genfiles.properties deleted file mode 100644 index 0b6d3d0efb..0000000000 --- a/tutorials/java/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=ed67686a -build.xml.script.CRC32=8c03bdb5 -build.xml.stylesheet.CRC32=8064a381@1.68.1.46 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=ed67686a -nbproject/build-impl.xml.script.CRC32=ea01fe36 -nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 diff --git a/tutorials/java/nbproject/private/config.properties b/tutorials/java/nbproject/private/config.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tutorials/java/nbproject/private/private.properties b/tutorials/java/nbproject/private/private.properties deleted file mode 100644 index 9595bd60a1..0000000000 --- a/tutorials/java/nbproject/private/private.properties +++ /dev/null @@ -1,6 +0,0 @@ -compile.on.save=true -do.depend=false -do.jar=true -javac.debug=true -javadoc.preview=true -user.properties.file=/home/joe/.netbeans/7.4/build.properties diff --git a/tutorials/java/nbproject/project.properties b/tutorials/java/nbproject/project.properties deleted file mode 100644 index df42d35d16..0000000000 --- a/tutorials/java/nbproject/project.properties +++ /dev/null @@ -1,76 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=phpdbg-ui -application.vendor=joe -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/phpdbg-ui.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -includes=** -jar.compress=false -javac.classpath=\ - ${libs.eclipselink.classpath} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=phpdbg.ui.JConsole -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -test.src.dir=test diff --git a/tutorials/java/nbproject/project.xml b/tutorials/java/nbproject/project.xml deleted file mode 100644 index 0c410ae796..0000000000 --- a/tutorials/java/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - phpdbg-ui - - - - - - - - - diff --git a/tutorials/java/src/phpdbg/ui/CommandHistory.java b/tutorials/java/src/phpdbg/ui/CommandHistory.java deleted file mode 100644 index b8a3b0ff0a..0000000000 --- a/tutorials/java/src/phpdbg/ui/CommandHistory.java +++ /dev/null @@ -1,49 +0,0 @@ -package phpdbg.ui; - - -import java.util.ArrayList; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * Implement a simple history list for command input - * @author krakjoe - */ -public class CommandHistory extends ArrayList { - private Integer position = new Integer(0); - - public CommandHistory() { - super(); - } - - @Override public boolean add(String text) { - String last = last(); - if (text != null) { - if (last == null || !last.equals(text)) { - if (super.add(text)) { - position = size(); - return true; - } - } - } - return false; - } - - public String last() { - if (position >= 1) { - position--; - return get(position); - } else return new String(); - } - - public String next() { - if (position+1 < size()) { - position++; - return get(position); - } else return new String(); - } -} \ No newline at end of file diff --git a/tutorials/java/src/phpdbg/ui/DebugSocket.java b/tutorials/java/src/phpdbg/ui/DebugSocket.java deleted file mode 100644 index 8e811e9be9..0000000000 --- a/tutorials/java/src/phpdbg/ui/DebugSocket.java +++ /dev/null @@ -1,157 +0,0 @@ -package phpdbg.ui; - - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.channels.SelectionKey; -import static java.nio.channels.SelectionKey.OP_READ; -import java.nio.channels.Selector; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.nio.channels.spi.SelectorProvider; -import java.util.Iterator; -import java.util.Set; -import phpdbg.ui.JConsole.MessageType; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * Manage input and output data - * @author krakjoe - */ -public class DebugSocket implements Runnable { - private final String host; - private final Integer port; - private final Boolean reader; - private final JConsole main; - private final Thread thread; - - private volatile Boolean quit; - private volatile Boolean started; - - public DebugSocket(final String host, final Integer port, final JConsole main, Boolean reader) throws IOException { - this.host = host; - this.port = port; - this.main = main; - this.reader = reader; - this.quit = false; - this.started = false; - this.thread = new Thread(this); - } - - public void start() { - synchronized(this) { - if (!started) { - quit = false; - started = true; - thread.start(); - } - } - } - - public void quit() { - synchronized(this) { - quit = true; - started = false; - notifyAll(); - } - } - - @Override public void run() { - try { - synchronized(main) { - if (!main.isConnected()) { - main.setConnected(true); - } - } - - if (reader) { - /* The reader thread will wait() until there is input */ - Socket socket = new Socket(this.host, this.port); - String command; - OutputStream output = socket.getOutputStream(); - - do { - synchronized(this) { - wait(); - - if (!quit) { - command = main.getInputField().getText(); - /* send command to stdin socket */ - if (command != null) { - if (main.isEchoing()) { - main.getOutputField() - .appendANSI( - String.format("remote> %s\n", command)); - } - output.write( - command.getBytes()); - output.write("\n".getBytes()); - output.flush(); - } - main.getInputField().setText(null); - } - } - } while (!quit); - - socket.close(); - } else { - /* - * The writer thread will use non-blocking i/o consuming - * resources only when there is data to read - */ - Selector selector = Selector.open(); - SocketChannel channel = SocketChannel.open(); - - channel.connect( - new InetSocketAddress(this.host, this.port)); - channel.configureBlocking(false); - channel.register(selector, OP_READ); - - while (!quit) { - selector.select(); - - Iterator iter = selector.selectedKeys().iterator(); - - while (iter.hasNext()) { - if (!quit) { - SocketChannel ready = (SocketChannel) (iter.next().channel()); - ByteBuffer bytes = ByteBuffer.allocate(128); - - if (ready != null) { - if (ready.read(bytes) != -1) { - bytes.flip(); - - main.getOutputField() - .appendANSI(new String(bytes.array())); - - } - } - - iter.remove(); - } - } - } - channel.close(); - } - } catch (IOException | InterruptedException ex) { - if (!quit) { - main.messageBox(ex.getMessage(), MessageType.ERROR); - } - } finally { - synchronized(main) { - if (main.isConnected()) { - main.setConnected(false); - } - } - } - } -} diff --git a/tutorials/java/src/phpdbg/ui/JConsole.form b/tutorials/java/src/phpdbg/ui/JConsole.form deleted file mode 100644 index d2808942db..0000000000 --- a/tutorials/java/src/phpdbg/ui/JConsole.form +++ /dev/null @@ -1,225 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tutorials/java/src/phpdbg/ui/JConsole.java b/tutorials/java/src/phpdbg/ui/JConsole.java deleted file mode 100644 index 6c8cfb364b..0000000000 --- a/tutorials/java/src/phpdbg/ui/JConsole.java +++ /dev/null @@ -1,471 +0,0 @@ -package phpdbg.ui; - - -import java.awt.AWTException; -import java.awt.Frame; -import java.awt.Image; -import java.awt.SystemTray; -import java.awt.TrayIcon; -import static java.awt.event.KeyEvent.VK_DOWN; -import static java.awt.event.KeyEvent.VK_ENTER; -import static java.awt.event.KeyEvent.VK_UP; -import java.awt.event.WindowEvent; -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.imageio.ImageIO; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author krakjoe - */ -public class JConsole extends javax.swing.JDialog { - /** - * Creates user interface - * @param parent - * @param modal - */ - public JConsole(java.awt.Frame parent, boolean modal) { - super(parent, modal); - initComponents(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - stdoutPopupMenu = new javax.swing.JPopupMenu(); - resetStdout = new javax.swing.JMenuItem(); - systrayMenu = new java.awt.PopupMenu(); - systrayExitMenuItem = new java.awt.MenuItem(); - host = new javax.swing.JTextField(); - stdoutPort = new javax.swing.JTextField(); - stdinCheckBox = new javax.swing.JCheckBox(); - stdoutCheckBox = new javax.swing.JCheckBox(); - openButton = new javax.swing.JButton(); - stdinPort = new javax.swing.JTextField(); - hostnameLabel = new javax.swing.JLabel(); - input = new javax.swing.JTextField(); - outputScrollPane = new javax.swing.JScrollPane(); - output = new phpdbg.ui.JTerminalPane(); - echoCheckBox = new javax.swing.JCheckBox(); - commandLabel = new javax.swing.JLabel(); - - resetStdout.setText("Clear"); - resetStdout.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - resetStdoutActionPerformed(evt); - } - }); - stdoutPopupMenu.add(resetStdout); - - systrayMenu.setLabel("phpdbg"); - systrayMenu.setName(""); - systrayMenu.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - systrayMenuActionPerformed(evt); - } - }); - - systrayExitMenuItem.setLabel("Exit"); - systrayExitMenuItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - systrayExitMenuItemActionPerformed(evt); - } - }); - systrayMenu.add(systrayExitMenuItem); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("phpdbg jui"); - - host.setText("127.0.0.1"); - host.setToolTipText("Set the hostname, or IPv4 address of the machine running the phpdbg remote console server"); - - stdoutPort.setText("8000"); - stdoutPort.setToolTipText("By default, stdin * 2"); - - stdinCheckBox.setSelected(true); - stdinCheckBox.setText("stdin:"); - stdinCheckBox.setToolTipText("Set the port for stdin, or uncheck to disable stdin"); - - stdoutCheckBox.setSelected(true); - stdoutCheckBox.setText("stdout:"); - stdoutCheckBox.setToolTipText("Set the port for stdout, or unset to disable stdout"); - - openButton.setText("Connect"); - openButton.setActionCommand("open"); - openButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - openButtonActionPerformed(evt); - } - }); - - stdinPort.setText("4000"); - stdinPort.setToolTipText("The listen port passed to phpdbg (-l option)"); - - hostnameLabel.setText("Hostname:"); - - input.setToolTipText("Enter phpdbg commands here!"); - input.setEnabled(false); - input.addKeyListener(new java.awt.event.KeyAdapter() { - public void keyReleased(java.awt.event.KeyEvent evt) { - inputKeyReleased(evt); - } - }); - - output.setFont(new java.awt.Font("DialogInput", 0, 12)); // NOI18N - output.setComponentPopupMenu(stdoutPopupMenu); - outputScrollPane.setViewportView(output); - - echoCheckBox.setSelected(true); - echoCheckBox.setToolTipText("Check to echo sent commands in output"); - echoCheckBox.setEnabled(false); - echoCheckBox.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); - echoCheckBox.setLabel("echo"); - - commandLabel.setText("Command:"); - commandLabel.setEnabled(false); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(outputScrollPane) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(hostnameLabel) - .addComponent(commandLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(input) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(echoCheckBox)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(host, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(stdinCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(stdinPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(stdoutCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(stdoutPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(openButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(outputScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(input, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(echoCheckBox) - .addComponent(commandLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(stdoutPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(stdinCheckBox) - .addComponent(stdoutCheckBox) - .addComponent(stdinPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(hostnameLabel) - .addComponent(host, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(openButton)) - .addContainerGap()) - ); - - pack(); - }// //GEN-END:initComponents - - private void inputKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inputKeyReleased - switch (evt.getKeyCode()) { - case VK_ENTER: { - if (in != null) { - history.add(input.getText()); - synchronized(in) { - in.notifyAll(); - } - } - } break; - - case VK_UP: { - String last = history.last(); - if (last.length() > 0) { - input.setText(last); - } - } break; - - case VK_DOWN: { - String next = history.next(); - if (next.length() > 0) { - input.setText(next); - } - } break; - } - }//GEN-LAST:event_inputKeyReleased - - private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openButtonActionPerformed - try { - if (!connected) { - connect(); - } else { - disconnect(); - } - } catch (IOException ex) { - messageBox(ex.getMessage(), MessageType.ERROR); - } - }//GEN-LAST:event_openButtonActionPerformed - - private void resetStdoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetStdoutActionPerformed - // TODO add your handling code here: - output.setText(null); - }//GEN-LAST:event_resetStdoutActionPerformed - - private void systrayExitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systrayExitMenuItemActionPerformed - // TODO add your handling code here: - dialog.disconnect(); - System.exit(0); - }//GEN-LAST:event_systrayExitMenuItemActionPerformed - - private void systrayMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_systrayMenuActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_systrayMenuActionPerformed - - private void disconnect() { - if (in != null) { - in.quit(); - } - if (out != null) { - out.quit(); - } - } - - private void connect() throws IOException { - Integer ports[] = new Integer[2]; - String address = getHost(); - - if (address != null) { - ports[0] = stdinCheckBox.isSelected() ? getStdinPort() : -1; - ports[1] = stdoutCheckBox.isSelected() ? getStdoutPort() : -1; - - if (ports[0] != 0 && ports[1] != 0) { - if (stdinCheckBox.isSelected()) { - if (ports[0] > 0) { - in = new DebugSocket( - address, ports[0], this, true); - in.start(); - } - } - - if (stdoutCheckBox.isSelected()) { - if (ports[1] > 0) { - out = new DebugSocket( - address, ports[1], this, false); - out.start(); - } - } - } - } - } - - public Boolean isConnected() { - return connected; - } - - public Boolean isEchoing() { - return echoCheckBox.isSelected(); - } - - public void setConnected(Boolean isConnected) { - synchronized(this) { - if (isConnected) { - connected = true; - openButton.setText("Disconnect"); - host.setEnabled(false); - stdinPort.setEnabled(false); - stdinCheckBox.setEnabled(false); - if (stdinCheckBox.isSelected()) { - input.setEnabled(true); - commandLabel.setEnabled(true); - echoCheckBox.setEnabled(true); - } else { - input.setEnabled(false); - commandLabel.setEnabled(false); - echoCheckBox.setEnabled(false); - } - stdoutPort.setEnabled(false); - stdoutCheckBox.setEnabled(false); - hostnameLabel.setEnabled(false); - commandLabel.setEnabled(true); - } else { - connected = false; - openButton.setText("Connect"); - host.setEnabled(true); - stdinPort.setEnabled(true); - input.setEnabled(false); - commandLabel.setEnabled(false); - echoCheckBox.setEnabled(false); - stdinCheckBox.setEnabled(true); - stdoutPort.setEnabled(true); - stdoutCheckBox.setEnabled(true); - hostnameLabel.setEnabled(true); - } - } - } - - public JTextField getInputField() { return input; } - public JTerminalPane getOutputField() { return output; } - - public String getHost() { - String address = host.getText(); - if (address != null && address.length() > 0) { - return address; - } else { - messageBox("Invalid hostname provided!", MessageType.WARN); - } - - return null; - } - - public Integer getStdinPort() { - try { - return Integer.parseInt(stdinPort.getText()); - } catch (NumberFormatException ex) { - messageBox("Invalid stdin port provided!", MessageType.WARN); - } - return 0; - } - - public Integer getStdoutPort() { - try { - return Integer.parseInt(stdoutPort.getText()); - } catch (NumberFormatException ex) { - messageBox("Invalid stdout port provided!", MessageType.WARN); - } - return 0; - } - - public JScrollPane getOutputScrollPane() { - return outputScrollPane; - } - - public synchronized void messageBox(String message) { - messageBox(message, MessageType.INFO); - } - - public synchronized void messageBox(String message, MessageType type) { - JOptionPane.showMessageDialog(this, message, "phpdbg jui", type.getType()); - } - /** - * @param args the command line arguments - */ - public static void main(final String args[]) { - - for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { - if (info.getName().equals("Nimbus")) { - try { - UIManager.setLookAndFeel( - info.getClassName()); - break; - } catch (ClassNotFoundException | - InstantiationException | - IllegalAccessException | - UnsupportedLookAndFeelException ex) { - Logger.getLogger(JConsole.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - - /* Create and display the dialog */ - java.awt.EventQueue.invokeLater(new Runnable() { - @Override public void run() { - dialog = new JConsole(new javax.swing.JFrame(), true); - dialog.addWindowListener(new java.awt.event.WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent e) { - dialog.disconnect(); - System.exit(0); - } - }); - try { - if (tray == null) { - Image trayIconImage = ImageIO.read( - JConsole.class.getResource("logo-dbg.png")); - dialog.setIconImage(trayIconImage); - - tray = new TrayIcon(trayIconImage); - tray.setPopupMenu(systrayMenu); - tray.setToolTip("phpdbg - The Interactive PHP Debugger"); - - SystemTray.getSystemTray().add(tray); - } - } catch ( AWTException | IOException ex) { - dialog.messageBox(ex.getMessage(), MessageType.ERROR); - } - dialog.setVisible(true); - } - }); - } - - private static DebugSocket in; - private static DebugSocket out; - private static JConsole dialog; - private static Boolean connected = false; - private static CommandHistory history = new CommandHistory(); - private static TrayIcon tray; - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel commandLabel; - private javax.swing.JCheckBox echoCheckBox; - private javax.swing.JTextField host; - private javax.swing.JLabel hostnameLabel; - private javax.swing.JTextField input; - private javax.swing.JButton openButton; - private phpdbg.ui.JTerminalPane output; - private javax.swing.JScrollPane outputScrollPane; - private javax.swing.JMenuItem resetStdout; - private javax.swing.JCheckBox stdinCheckBox; - private javax.swing.JTextField stdinPort; - private javax.swing.JCheckBox stdoutCheckBox; - private javax.swing.JPopupMenu stdoutPopupMenu; - private javax.swing.JTextField stdoutPort; - private java.awt.MenuItem systrayExitMenuItem; - private static java.awt.PopupMenu systrayMenu; - // End of variables declaration//GEN-END:variables - public enum MessageType { - INFO (JOptionPane.INFORMATION_MESSAGE), - WARN (JOptionPane.WARNING_MESSAGE), - ERROR (JOptionPane.ERROR_MESSAGE); - - private final Integer type; - private MessageType(Integer type) { - this.type = type; - } - public Integer getType() { return this.type; } - public Boolean equals(Integer other) { return this.type.equals(other); } - public Boolean equals(MessageType other) { return this.type.equals(other.getType()); } - } -} diff --git a/tutorials/java/src/phpdbg/ui/JTerminalPane.java b/tutorials/java/src/phpdbg/ui/JTerminalPane.java deleted file mode 100644 index a08be440d3..0000000000 --- a/tutorials/java/src/phpdbg/ui/JTerminalPane.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package phpdbg.ui; - -/** - * - * @author krakjoe - */ -import javax.swing.*; -import javax.swing.text.*; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Image; -import java.io.IOException; -import java.util.HashMap; -import javax.imageio.ImageIO; - -public class JTerminalPane extends JTextPane { - private static class JTerminalColor { - private final Color color; - private final Boolean bold; - private final Boolean underline; - - public JTerminalColor(Float h, Float s, Float b, Boolean bold, Boolean underline) { - this.color = Color.getHSBColor(h, s, b); - this.bold = bold; - this.underline = underline; - } - - public JTerminalColor(Float h, Float s, Float b, Boolean bold) { - this(h, s, b, bold, false); - } - - public JTerminalColor(Float h, Float s, Float b) { - this(h, s, b, false, false); - } - - public Boolean isUnderlined() { return this.underline; } - public Boolean isBold() { return this.bold; } - public Color getColor() { return this.color; } - } - - private static class JTerminalColors extends HashMap { - public JTerminalColors() { - put("\u001B[0;30m", new JTerminalColor(0.000f, 0.000f, 0.502f)); - put("\u001B[0;31m", new JTerminalColor(0.000f, 1.000f, 1.000f)); - put("\u001B[0;32m", new JTerminalColor(0.333f, 1.000f, 1.000f)); - put("\u001B[0;33m", new JTerminalColor(0.167f, 1.000f, 1.000f)); - put("\u001B[0;34m", new JTerminalColor(0.667f, 1.000f, 1.000f)); - put("\u001B[0;35m", new JTerminalColor(0.833f, 1.000f, 1.000f)); - put("\u001B[0;36m", new JTerminalColor(0.500f, 1.000f, 1.000f)); - put("\u001B[0;37m", new JTerminalColor(0.000f, 0.000f, 1.000f)); - put("\u001B[0;64m", new JTerminalColor(0.000f, 0.000f, 1.000f)); - put("\u001B[1;30m", new JTerminalColor(0.000f, 0.000f, 0.502f, true)); - put("\u001B[1;31m", new JTerminalColor(0.000f, 1.000f, 1.000f, true)); - put("\u001B[1;32m", new JTerminalColor(0.333f, 1.000f, 1.000f, true)); - put("\u001B[1;33m", new JTerminalColor(0.167f, 1.000f, 1.000f, true)); - put("\u001B[1;34m", new JTerminalColor(0.667f, 1.000f, 1.000f, true)); - put("\u001B[1;35m", new JTerminalColor(0.833f, 1.000f, 1.000f, true)); - put("\u001B[1;36m", new JTerminalColor(0.500f, 1.000f, 1.000f, true)); - put("\u001B[1;37m", new JTerminalColor(0.000f, 0.000f, 1.000f, true)); - put("\u001B[1;64m", new JTerminalColor(0.000f, 0.000f, 1.000f, true)); - put("\u001B[4;30m", new JTerminalColor(0.000f, 0.000f, 0.502f, false, true)); - put("\u001B[4;31m", new JTerminalColor(0.000f, 1.000f, 1.000f, false, true)); - put("\u001B[4;32m", new JTerminalColor(0.333f, 1.000f, 1.000f, false, true)); - put("\u001B[4;33m", new JTerminalColor(0.167f, 1.000f, 1.000f, false, true)); - put("\u001B[4;34m", new JTerminalColor(0.667f, 1.000f, 1.000f, false, true)); - put("\u001B[4;35m", new JTerminalColor(0.833f, 1.000f, 1.000f, false, true)); - put("\u001B[4;36m", new JTerminalColor(0.500f, 1.000f, 1.000f, false, true)); - put("\u001B[4;37m", new JTerminalColor(0.000f, 0.000f, 1.000f, false, true)); - put("\u001B[4;64m", new JTerminalColor(0.000f, 0.000f, 1.000f, false, true)); - - put("reset", new JTerminalColor(0.000f, 0.000f, 1.000f)); - } - - public JTerminalColor find(String ANSIColor) { - if (containsKey(ANSIColor)) { - return get(ANSIColor); - } else return get("reset"); - } - } - - public JTerminalPane() { - super(); - setOpaque(false); - setBackground(new Color(0, 0, 0, 0)); - colorCurrent = colors.find("reset"); - } - - @Override public void paintComponent(Graphics g) { - g.setColor(Color.BLACK); - g.fillRect(0, 0, getWidth(), getHeight()); - - try { - Image image = ImageIO.read( - JTerminalPane.class.getResource("logo-small.png")); - - g.drawImage( - image, - getWidth() - image.getWidth(this) - 10, - getHeight() - image.getHeight(this) - 10, - image.getWidth(this), image.getHeight(this), this); - - } catch (IOException | NullPointerException | IllegalArgumentException ex) {} - - super.paintComponent(g); - } - - private void append(JTerminalColor c, String s) { - StyleContext sc = StyleContext.getDefaultStyleContext(); - AttributeSet aset = sc.addAttribute( - SimpleAttributeSet.EMPTY, StyleConstants.Foreground, c.getColor()); - - aset = sc.addAttribute(aset, StyleConstants.Underline, c.isUnderlined()); - aset = sc.addAttribute(aset, StyleConstants.Bold, c.isBold()); - - setCharacterAttributes(aset, false); - replaceSelection(s); - setCaretPosition(getDocument().getLength()); - } - - public synchronized void appendANSI(String s) { - int aPos = 0; - int aIndex; - int mIndex; - String tmpString; - boolean stillSearching; - - String addString = remaining + s; - - remaining = ""; - - if (addString.length() > 0) { - aIndex = addString.indexOf("\u001B"); - if (aIndex == -1) { - append(colorCurrent,addString); - return; - } - - if (aIndex > 0) { - tmpString = addString.substring(0,aIndex); - append(colorCurrent, tmpString); - aPos = aIndex; - } - - stillSearching = true; - while (stillSearching) { - mIndex = addString.indexOf("m",aPos); - if (mIndex < 0) { - remaining = addString.substring(aPos,addString.length()); - stillSearching = false; - continue; - } - else { - tmpString = addString.substring(aPos,mIndex+1); - colorCurrent = colors.find(tmpString); - } - aPos = mIndex + 1; - - aIndex = addString.indexOf("\u001B", aPos); - - if (aIndex == -1) { - tmpString = addString.substring(aPos,addString.length()); - append(colorCurrent, tmpString); - stillSearching = false; - continue; - } - tmpString = addString.substring(aPos,aIndex); - aPos = aIndex; - append(colorCurrent, tmpString); - } - } - } - - private static JTerminalColors colors = new JTerminalColors(); - private JTerminalColor colorCurrent; - private String remaining = ""; -} diff --git a/tutorials/java/src/phpdbg/ui/logo-dbg.png b/tutorials/java/src/phpdbg/ui/logo-dbg.png deleted file mode 100644 index 621f29b53e..0000000000 Binary files a/tutorials/java/src/phpdbg/ui/logo-dbg.png and /dev/null differ diff --git a/tutorials/java/src/phpdbg/ui/logo-small.png b/tutorials/java/src/phpdbg/ui/logo-small.png deleted file mode 100644 index 1792379f77..0000000000 Binary files a/tutorials/java/src/phpdbg/ui/logo-small.png and /dev/null differ diff --git a/tutorials/phpdbg.png b/tutorials/phpdbg.png deleted file mode 100644 index 8e8df1ee43..0000000000 Binary files a/tutorials/phpdbg.png and /dev/null differ diff --git a/tutorials/remote.md b/tutorials/remote.md deleted file mode 100644 index 72bac6efb1..0000000000 --- a/tutorials/remote.md +++ /dev/null @@ -1,66 +0,0 @@ -Remote Debugging -================ -*Using phpdbg across the network* - -It is sometimes useful to execute some code in the environment that exhibits some bugs; while there is a pretty good chance of being able to mock the environment that exhibited the bug on another machine, it is sometimes impossible or impractical. - -Remote debugging allows you to start an instance of phpdbg on any machine, and connect to it from any machine, bundled is a remote client implemented in Java: - -![phpdbg jui](https://raw.github.com/krakjoe/phpdbg/master/tutorials/java-example.png) - - -Starting phpdbg in Remote Console Mode -====================================== -*Starting the server ...* - -Simply open a terminal on the target machine and issue the command - -``` -./phpdbg -l4000 -``` - -This will initialize phpdbg in Remote Console Mode, using port 4000 for stdin and port 8000 for stdout. - -To stop the service, send *SIGINT* to the phpdbg process, this will force it to bailout, as gracefully as it ever does. - -Specific Ports --------------- - -To listen on specific ports, the -l flag will accept a pair of ports in the following way: - -``` -./phpdbg -l4000/8000 -``` - -Specific Interfaces -------------------- - -To bind to a specific interface, or all interfaces use the -a flag: - -``` -./phpdbg -l4000 -a192.168.0.3 -``` - -Will bind the Remote Console to the interface with the specified address, while: - -``` -./phpdbg -l4000 -a -``` - -Will bind the Remote Console to all available addresses. - -Starting phpdbg-jui Anywhere -============================ -*Java is everywhere, so is phpdbg ...* - -A JRE is needed for the bundled remote client, given any operating system with a working installation of Java: - -``` -java -jar /path/to/phpdbg-ui.jar -``` - -Will initialize the bundled client, simply configure the settings accordingly and press *Connect* - -If disconnection is normal, the environment persists - another team member can pick up the session where it is left off. - -Debugging remotely is no different to debugging locally, all of the same functionality is provided remotely. diff --git a/tutorials/session.png b/tutorials/session.png deleted file mode 100644 index 9146230bd8..0000000000 Binary files a/tutorials/session.png and /dev/null differ diff --git a/tutorials/show-broken.png b/tutorials/show-broken.png deleted file mode 100644 index 92e5b588ac..0000000000 Binary files a/tutorials/show-broken.png and /dev/null differ diff --git a/tutorials/show-conditionals.png b/tutorials/show-conditionals.png deleted file mode 100644 index 1decbcc421..0000000000 Binary files a/tutorials/show-conditionals.png and /dev/null differ diff --git a/tutorials/show-printing.png b/tutorials/show-printing.png deleted file mode 100644 index 1783fe09ac..0000000000 Binary files a/tutorials/show-printing.png and /dev/null differ diff --git a/tutorials/show-verbose.png b/tutorials/show-verbose.png deleted file mode 100644 index 858be5b739..0000000000 Binary files a/tutorials/show-verbose.png and /dev/null differ diff --git a/tutorials/simples.md b/tutorials/simples.md deleted file mode 100644 index 18d0a01bb7..0000000000 --- a/tutorials/simples.md +++ /dev/null @@ -1,132 +0,0 @@ -Simples -======= -*Everything is simple ...* - -It is easy to imagine that debugging a whole web application might be difficult, in a console program, in fact this is not the case: - -A web application is just an instance of the PHP interpreter with some very specific super globals set. - -With everything in the correct place, your web application has no clue that it being served not to a client, but to you, probably in your underwear. - -With the facts established, you can use phpdbg to debug anything that is PHP, with a bit of cleverness in the right places. - -Very Simple -=========== -*A good starting place ...* - -``` -phpdbg -e/path/to/my/script.php -``` - -The command above will result in a phpdbg console that has executed *.phpdbginit* (if it exists) and is ready to compile, inspect, step through -and execute the code contained in */path/to/my/script.php* - -The first thing to do upon being presented with the console, is decide what to break for ... - -Many options exist for choosing (and setting) breakpoints: - -``` -phpdbg> b phpdbg::isGreat -phpdbg> b phpdbg_is_great -``` - -The commands above will be the most common for most developers; that is, specifying the entry point of a function or method on which to break execution. - -Introspection of code is supported on the console, for anything that is compiled, if help is required remembering the name of a particular method then issue: - -``` -phpdbg> compile -phpdbg> print class myClassName -``` - -Introspection doesn't only provide you with names, but the addresses of every opcode in every statement, which you may use to specify with as much precision as -is possible where to break execution. - -**There is a print command for particular methods, useful if a class is very large and your screen is not!** - -At this point, break points are set; the next thing to do is issue the run command: - -``` -phpdbg> run -``` - -This will cause execution of the context, if a breakpoint is reached, the interactive console returns such that more commands can be issued. - -When a breakpoint is reached, several options for continuation exist: - - - step through every instruction - - run past the end of the stack - - run to the end of the stack - -*Q: WTF is a stack?* - -*A: Generally the current codepath, more precisely: current function, method or file* - -Just quickly; an explanation of what "to" and "past" the end of a "stack" means: - -Assuming there is a break set for *my_function_somewhere* in the following code: - -``` -function my_function_somewhere($input = array()) /* break here on entry to the function */ -{ - /* ... the stack ... */ - - if (count($input)) - { - /* to -> */ return $input[1]; - } - else - { - /* to -> */ return rand(1, 100); - } -} - -/* past -> */ $result = my_function_somewhere(); -if ($result) -{ - /* and so on */ - var_dump($result); -} -``` - -The commands *finish* and *leave*, run *past* and *to* the end of the stack respecitively. - -**Note: the finish command does not automatically break; to break past the end of the stack enable stepping before issuing finish, the leave command breaks implicitly** - -On with execution ... -===================== -*Stepping, slowly, is sometimes the way forward ...* - -Should you want to inspect what happens during the execution of the stack, enable stepping: - -``` -phpdbg> step 1 -``` - -In case it wasn't obvious, the next thing to do is nearly always *next*: - -``` -phpdbg> next -``` - -Which will cause the vm to assume control and continue execution until the next break point, or completion. - -Stepping through every single instruction is not usually beneficial, issue: - -``` -phpdbg> step 0 -``` - -To disable stepping again, and only interrupt execution for breakpoints. - -As hard as it gets ... -====================== -*Web Applications* - -As mentioned, a web application is only a script executing with some specific super globals set; - -**The mocking of any web request just requires that you set the super globals of the script accordingly** - -We refer to this as "bootstrapping", mostly because I have always wanted a genuine reason to use that word. - -See the example, for help with bootstrapping ... diff --git a/tutorials/welcome.png b/tutorials/welcome.png deleted file mode 100644 index 9df72c604f..0000000000 Binary files a/tutorials/welcome.png and /dev/null differ diff --git a/tutorials/windows-preview.png b/tutorials/windows-preview.png deleted file mode 100644 index 037d89f4d5..0000000000 Binary files a/tutorials/windows-preview.png and /dev/null differ