Skip to content

Commit 13f8fda

Browse files
author
Chad Smith
committed
add plotting for expressions; bugfix displaying characters in gdb console; documentation
1 parent 5d06f09 commit 13f8fda

File tree

18 files changed

+266
-524
lines changed

18 files changed

+266
-524
lines changed

README.rst

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A browser-based frontend/gui for GDB
88
.. image:: https://travis-ci.org/cs01/gdbgui.svg?branch=master
99
:target: https://travis-ci.org/cs01/gdbgui
1010

11-
.. image:: https://img.shields.io/badge/pyPI-v0.7.4.3-blue.svg
11+
.. image:: https://img.shields.io/badge/pyPI-v0.7.4.4-blue.svg
1212
:target: https://pypi.python.org/pypi/gdbgui/
1313

1414
.. image:: https://img.shields.io/badge/python-2.7, 3.4, 3.5, pypy-blue.svg
@@ -75,12 +75,12 @@ Examples
7575
--------
7676
See `https://github.com/cs01/gdbgui/tree/master/examples <https://github.com/cs01/gdbgui/tree/master/examples>`_
7777

78-
Options
78+
Arguments
7979
~~~~~~~
80-
optional positional arguments:
81-
``command``: (Optional) The binary and arguments to run in gdb. This is a way to script the intial loading of the inferior binary you wish to debug. For example ``gdbgui ./mybinary -myarg -flag1 -flag2``
80+
Positional arguments:
81+
``command``: (Optional) The binary and arguments to run in gdb. This is a way to script the intial loading of the inferior binary you wish to debug. For example ``gdbgui ./mybinary -myarg -flag1 -flag2``. Binaries and arguments can also be input through the browser interface after launching.
8282

83-
optional arguments:
83+
Flags (all are optional):
8484
-h, --help show this help message and exit
8585
-p PORT, --port PORT The port on which gdbgui will be hosted
8686
--host HOST The host ip address on which gdbgui serve.
@@ -89,15 +89,12 @@ optional arguments:
8989
--debug The debug flag of this Flask application. Pass this
9090
flag when debugging gdbgui itself to automatically
9191
reload the server when changes are detected
92-
--no_browser By default, the browser will open with gdb gui. Pass
92+
-n, --no_browser By default, the browser will open with gdb gui. Pass
9393
this flag so the browser does not open.
9494

9595
Compatibility
9696
-------------
9797

98-
``gdbgui`` has been tested to work in these environments. It may work in
99-
other environments as well.
100-
10198
Python versions: 2.7, 3.4, 3.5, pypy
10299

103100
Operating systems: Ubuntu 14.04, Ubuntu 16.04, OSX
@@ -106,31 +103,41 @@ Browsers: Chrome, Firefox, Ubuntu Web Browser
106103

107104
Gdb: 7.7.1 (tested), 7.12 (tested), likely works with intermediate versions
108105

109-
Development
110-
-----------
111-
Contributions and bug fixes are welcome. Before creating an issue, make sure you are using the latest version of gdbgui
112-
since it is under active development.
106+
Contributing
107+
------------
108+
Creating and voting on issues in github will help me prioritize what to work on.
113109

114-
To get started with development, set up a new virtual environment, then
110+
Documentation, spelling fixes, bug fixes, features, etc. are of course welcome too. To get started with development, set up a new virtual environment, then
115111
run
116112

117113
::
118114

119115
git clone https://github.com/cs01/gdbgui
120116
cd gdbgui
121117
pip install -r requirements.txt
122-
python -m gdbgui/backend.py --debug
118+
gdbgui/backend.py --debug
119+
120+
If you are modifying gdbgui.js, make sure you have the developer console open so the browser doesn't cache the file and miss your changes. When ``--debug`` is passed, there is a new component at the bottom of the right sidebar that displays the raw gdb mi output to help you debug.
121+
122+
123+
Testing
124+
~~~~~~~
125+
126+
``make test`` runs unit tests and verifies README.rst is properly formatted.
127+
``gdbgui/tests/test_app.py``. Add new tests there as necessary.
128+
123129

124130
License
125131
-------
126132
This software licensed under Creative Commons Attribution-NonCommercial 3.0 for personal use. `Click here <http://grassfedcode.com/gdbguicommercial>`_ for commercial license.
127133

134+
pyPI and this github page are the only official sources of gdbgui. Any other sites serving gdbgui in any way should be avoided not only due to licensing issues, but due to security concerns as well.
128135

129136
How Does it Work?
130137
-----------------
131138
It uses Python to manage gdb as a subprocess. Specifically, the `pygdbmi library <https://github.com/cs01/pygdbmi>`__, which returns key/value pairs (dictionaries) that can be used to create a frontend. To make a usable frontend, first a server must made to interface with gdb. In this case, the Flask server is used, which does three things: creates a managed gdb subprocess with pygdbmi, spawns a separate thread to constantly check for output from the gdb subprocess, and creates endpoints for the browser including http requests and websocket connections.
132139

133-
As output is parsed in the reader thread, it is immediately sent to the frontend through the websocket. As the browser receives these websocket messages, it maintains the state of gdb (whether it's running, paused, or exited, where breakpoints are, what the stack is, etc.) and updates the DOM as appropriate. Of course, the browser also sends commands to gdb through the Flask server, which it does as needed when various buttons are pressed, or when the user enters a command-line command. The server also has access to the filesystem, so the client can show source code of any file.
140+
As output is parsed in the reader thread, it is immediately sent to the frontend through the websocket. As the browser receives these websocket messages, it maintains the state of gdb (whether it's running, paused, or exited, where breakpoints are, what the stack is, etc.) and updates the DOM as appropriate. The browser also sends commands to gdb through a websocket to Flask server, which then passes the command to gdb. Gdb writes new output, which is picked up by the reader thread.
134141

135142
``gdbgui`` was designed to be easily hackable and extendable. There is
136143
no build system necessary to run or develop this app.
@@ -145,27 +152,11 @@ The main components of gdbgui are
145152

146153
2. ``gdbgui.pug``: HTML file that defines the frontend
147154

148-
3. ``gdbgui.js``: The majority of the application is contained in this file. If dynamically updates the page, and maintains gdb state. It sends AJAX requests and uses websockets to interact with gdb through the server, then gets the response and updates the DOM as necessary.
155+
3. ``gdbgui.js``: The majority of the application is contained in this file. It dynamically updates the page, and maintains gdb state. It sends AJAX requests and uses websockets to interact with gdb through the server, then gets the response and updates the DOM as necessary.
149156

150157
4. ``gdbgui.css``: css stylesheet
151158

152159

153-
Testing
154-
~~~~~~~
155-
156-
``python setup.py test`` runs unit tests located in
157-
``gdbgui/tests/test_app.py``. Add new tests there as necessary.
158-
159-
160-
Future Improvements
161-
-------------------
162-
163-
- Hover over a variable in source code to see its value
164-
- Embed plotting tools to plot a variable's value over time
165-
- Assign values to variables / memory addresses
166-
- Embed a binary/decimal/hex calculator
167-
168-
169160
Screenshots
170161
-----------
171162
Enter the binary and args just as you'd call them on the command line. Binary is restored when gdbgui is opened at a later time.
@@ -199,16 +190,24 @@ With assembly. Note the bold line is the current instruction that gdb is stopped
199190

200191

201192
Variables and Expressions
202-
------------------------------------------------
193+
-------------------------
194+
195+
All local variables are automatically displayed, and are clickable to explore their fields.
203196

204197
.. image:: https://github.com/cs01/gdbgui/raw/master/screenshots/locals.png
205198
:target: https://github.com/cs01/gdbgui/raw/master/screenshots/locals.png
206199

207-
All variables and their values are displayed each time gdb pauses. Arbitrary expressions can be evaluated as well.
200+
Arbitrary expressions can be evaluated as well.
208201

209202
.. image:: https://github.com/cs01/gdbgui/raw/master/screenshots/expressions.png
210203
:target: https://github.com/cs01/gdbgui/raw/master/screenshots/expressions.png
211204

205+
Expressions record their previous values, and can be displayed in an x/y plot.
206+
207+
.. image:: https://github.com/cs01/gdbgui/raw/master/screenshots/plots.png
208+
:target: https://github.com/cs01/gdbgui/raw/master/screenshots/plots.png
209+
210+
212211

213212
Memory Viewer
214213
-------------

dev_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
collective.checkdocs==0.2

docs/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/Makefile

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/conf.py

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)