Added (some) documentation
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 23 Jan 2019 11:02:06 +0000
changeset 142 dae35d5b3d72
parent 141 385e05acdd8c
child 143 df7f89efd39d
Added (some) documentation ...albeit far from being complete, as always.
NEWS.md
README.md
doc/Building.md
doc/Invoking.md
doc/README.md
doc/References.md
doc/vdb-001.png
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NEWS.md	Wed Jan 23 11:02:06 2019 +0000
@@ -0,0 +1,12 @@
+### 2019-01-21:
+
+  * Support for arbitrary command to invoke GDB. This way one can use
+    VDB on a local workstation while the GDB itself runs on a remote
+    computer (server or development board, for example)
+
+  * Support for command completion on Windows.
+
+### 2018-10-05:
+
+  * Add support multiple debugger layouts. Currently supported layouts
+    are "Single", "Eclipse" and "IDAPro".
\ No newline at end of file
--- a/README.md	Mon Jan 21 15:44:53 2019 +0000
+++ b/README.md	Wed Jan 23 11:02:06 2019 +0000
@@ -1,29 +1,31 @@
 # Visual / VM Debugger
 
-*Visual / VM Debugger* (*VDB* for short) is a simple standalone graphical 
-front-end for [GDB][2] aimed to debug, not only, virtual machines. It provides
-easy-to-use, easy-to-extend user interface while keeping full power of GDB 
-command line and scripting facilities. 
+*Visual / VM Debugger* (*VDB* for short) is a simple standalone graphical front-end for [GDB][2]aimed to debug, not only, virtual machines. It provides easy-to-use, easy-to-extend user interface while keeping full power of GDB command line and scripting facilities. 
 
 ## Features
 
-  * integrated support for reverse-debugging
+  * integrated support for reverse-debugging,
   * source-and-assembly view with detailed instruction analysis (basic blocks, 
-    jump targets and so on)
-  * data structure inspector
-  * configurable memory view
-  * integrated *GDB* command line
+    jump targets and so on),
+  * data structure inspector,
+  * configurable memory view,
+  * integrated *GDB* command line with completion (even on Windows!),
+  * integrated support for reverse debugging using *GDB's* native reverse 
+    debugging or [rr][11],
+  * ability to run *GDB* remotely through SSH on a remote server or on a 
+    development board
+
+## Obligatory Screenshot
+
+![Visual/VM Debugger](doc/vdb-001.png)
 
 ## Prerequisites
 
-It is recommended to use the latest GDB built from GDB [git master][4] as it
-contains changes required by *VDB*.
+It is recommended to use GDB built from [https://bitbucket.org/janvrany/binutils-gdb][4] as it contains changes required by *VDB*. For more information about building patched GDB see [https://bitbucket.org/janvrany/jv-libgdbs/src/tip/doc/GDB.md][9].
 
 ## Building from Source
 
-*Visual / VM Debugger* is a part of [Smalltalk/X jv-branch][3] since 
-version 8.0.0. To build VDB, just follow instructions how to [build 
-Smalltalk/X jv-branch][6] and then run either:
+*Visual / VM Debugger* is a part of [Smalltalk/X jv-branch][3] since version 8.0.0. To build VDB, just follow instructions how to [build Smalltalk/X jv-branch][6] and then run either:
 
 ```
 ./build/stx/projects/smalltalk/smalltalk --load jv:vdb --run VDBStartup
@@ -38,6 +40,9 @@
 VDBStartup main: #('--help')
 ```
 
+For more details, see [documentation][10], sections [Building from Source](Building.md)
+and [Invoking and Configuring](Invoking.md).
+
 ## Pre-built binaries
 
 Download and unpack latest [Smalltalk/X jv-branch toy archive][5]
@@ -56,6 +61,10 @@
 VDBStartup main: #('--help')
 ```
 
+## Documentation
+
+Some documentation can be found in [doc][10] directory, see [doc/README.md][10]
+
 ## Reporting issues
 
 Use [Smalltalk/X jv-branch issue tracker][6] to [report issues][7] (you may need
@@ -88,8 +97,11 @@
 [1]: http://creativecommons.org/licenses/by-nc/4.0/
 [2]: https://www.gnu.org/software/gdb/
 [3]: https://swing.fit.cvut.cz/projects/stx-jv
-[4]: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git
+[4]: https://bitbucket.org/janvrany/binutils-gdb
 [5]: https://swing.fit.cvut.cz/jenkins/job/stx_jv/lastSuccessfulBuild/
 [6]: https://swing.fit.cvut.cz/projects/stx-jv/wiki/Documentation/BuildingStXWithRakefiles
 [7]: https://swing.fit.cvut.cz/projects/stx-jv/newticket
 [8]: https://groups.google.com/forum/#!forum/stx-jv
+[9]: https://bitbucket.org/janvrany/jv-libgdbs/src/tip/doc/GDB.md
+[10]: doc/README.md
+[11]: https://rr-project.org/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/Building.md	Wed Jan 23 11:02:06 2019 +0000
@@ -0,0 +1,17 @@
+## Building VDB from Sources
+
+### Building GNU Debugger for use with VDB
+
+See [GDB building instructions][3] from [jv:libgdbs][4]
+
+### Building VDB
+
+*Visual / VM Debugger* is a part of [Smalltalk/X jv-branch][1] since version 
+8.0.0. To build VDB, just follow instructions how to [build Smalltalk/X jv-branch][2]
+
+
+
+[1]: https://swing.fit.cvut.cz/projects/stx-jv
+[2]: https://swing.fit.cvut.cz/projects/stx-jv/wiki/Documentation/BuildingStXWithRakefiles
+[3]: https://bitbucket.org/janvrany/jv-libgdbs/src/tip/doc/GDB.md
+[4]: https://bitbucket.org/janvrany/jv-libgdbs
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/Invoking.md	Wed Jan 23 11:02:06 2019 +0000
@@ -0,0 +1,120 @@
+# Invoking and Configuring
+
+TL;DR: For the impatient, jump to section [Examples](#markdown-header-examples) section below. 
+
+## Invoking VDB from Command Line
+
+```
+stx --load jv:vdb --run VDBStartup
+```
+You may append VDB command line options and parameters after `--run VDBStartup`,
+for example: `stx --load jv:vdb --run VDBStartup --help`.
+
+See below for documentation on command line options and examples
+
+## Invoking VDB from Smalltalk/X IDE
+
+The easiest (and recommended) way to invoke VDB from Smalltalk/X IDE is to use VDB's command line 
+launcher:
+
+```
+Smalltalk loadPackage: 'jv:vdb'.
+VDBStartup main: {}
+```
+The parameter to `#main:` is an array of command line arguments, for example:
+`VDBStartup main: { '--help' }`
+
+See below for documentation on command line options and examples
+
+## Command Line Options
+
+```
+usage: vdb [OPTIONS] [PROGRAM [ARGS]] 
+       vdb [OPTIONS] [PID]
+
+options:
+ --replay ..................... replay last rr record
+ --no-pty ..................... do not use PTY-based GDB console even if current
+                                platform supports it. 
+ -d | --gdb CMD ............... use CMD to launch GDB (instead of platform
+                                default).    
+ --preference FILE ............ read user settings from FILE
+ --no-preferences ............. do not read user settings at all
+ --help ....................... output this message
+```
+
+## Configuration 
+
+### GDB Configuration
+
+Since VDB de-facto requires a special GDB (until all required patches are 
+upstreamed which may take time), most users if not all need to configure 
+command to launch GDB. To do so, set `#gdbCommand:` user preference by
+evaluating following in workspace:  
+
+```
+"/ Set gdb command:
+UserPreferences current gdbCommand: `~/path/to/gdb'. 
+
+"/ Save user preferences to make the setting persistent across
+"/ sessions:
+UserPreferences current save.
+```
+
+If no gdb command is configured, VDB uses the default GDB found along the
+path (and - on Windows - at some standard places). 
+
+The `#gdbCommand:` settings value can be an arbitrary shell command (or - on
+Windows - `cmd.exe` command). This means you may pass additional command line
+arguments or even run GDB through remote shell (see the *Examples* section).
+This is particularly handy when a  manually compiled GDB is used right from
+the build tree (i.e, without installing it using `make install` or alike). In
+that case you may want to pass path to  GDB data directory:
+
+```
+UserPreferences current gdbCommand: `/home/user/src/binutils-gdb/gdb/gdb --data-directory /home/user/src/binutils-gdb/gdb/data-directory'.
+```
+
+### VDB Configuration
+
+Right after VDB initializes and launches GDB, it executes a startup script 
+`$HOME/.vdbinit.st` (`%UserProfile%\.vdbinit.st` on Windows). 
+
+Startup script is uses standard Smalltalk syntax and may contain any Smalltalk
+code and use any class and/or method or even load new classes. Reference to VDB
+(as an instance of `VDBDebuggerApplication` class) is accessible via pre-define 
+variable `vdb`  Reference to running GDB (as an instance of `GDBDebugger` is 
+accessible through VDB via `vdb debugger`. 
+
+An example of `.vdbinit.st` script:
+
+```
+"/ VDB init script
+"/ Current VDB instance can be accessed in via variable `vdb`
+"/
+"/ Set prompt
+vdb debugger setParameter: 'prompt' to: '(vdb) '
+
+"/ Set default font:
+VDBAbstractApplication defaultTextFont: (CodeView defaultFont asSize: 16).
+```
+
+## Examples
+
+1.  Run VDB on local (Linux) machine connecting to remote GDB running on 
+    *HiFive Unleashed* board debugging `compilertest`:
+
+    ```
+    VDBStartup main: { '--no-pty' . '--gdb' . 'ssh debian-sid-rv64 /home/jv/Projects/gdb/users_jv_vdb_riscv64-linux-gnu/gdb/gdb --data-directory /home/jv/Projects/gdb/users_jv_vdb_riscv64-linux-gnu/gdb/data-directory /home/jv/Projects/J9/omr-riscv/build/fvtest/compilertest' }
+    ```
+
+    Here we use:
+     
+      * `--gdb` option to configure custom command to launch GDB on remote machine 
+        using SSH. Note that this requires SSH key-based authentication since VDB
+        is completely unaware of any SSH in between and cannot ask interactively 
+        for password. 
+      * `--no-pty` *MUST* be used because GDB itself runs on remote machine and
+        therefore cannot access or allocate PTYs on that remote machine. Again,
+        we have to tell VDB this via `--no-pty` option because VDB is unaware of SSH
+        being used. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README.md	Wed Jan 23 11:02:06 2019 +0000
@@ -0,0 +1,9 @@
+# Debugging with Visual / VM Debugger
+
+*...always incomplete...*
+
+ 1. [What's New?](../NEWS.md)
+ 2. [Building from Source](Building.md)
+ 3. [Invoking and Configuring](Invoking.md)
+ 4. [Other References](References.md)
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/References.md	Wed Jan 23 11:02:06 2019 +0000
@@ -0,0 +1,11 @@
+# References
+
+1.  [Debugging with GDB][1]
+1.  Using rr and Visual/VM Debugger to debug Smalltalk/X crash
+
+      * [blog post][2]
+      * [talk at Smalltalks 2019][3]
+
+[1]: https://sourceware.org/gdb/onlinedocs/gdb/
+[2]: https://janvrany.github.io/2018/09/vdb-01.html
+[3]: https://youtu.be/Qbu4ED8wPYE
Binary file doc/vdb-001.png has changed