Skip to content

Commit 3819717

Browse files
committed
blackify; README.rst -> README.md
1 parent 9b51db7 commit 3819717

11 files changed

+199
-172
lines changed

.github/ISSUE_TEMPLATE.md

-16
This file was deleted.

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# A browser-based frontend for GDB
2+
3+
[![](https://github.com/cs01/gdbgui/raw/master/screenshots/gdbgui_animation.gif)](https://github.com/cs01/gdbgui/raw/master/screenshots/gdbgui_animation.gif)
4+
5+
[![image](https://travis-ci.org/cs01/gdbgui.svg?branch=master)](https://travis-ci.org/cs01/gdbgui)
6+
[![image](https://img.shields.io/badge/pypi-0.11.3.1-blue.svg)](https://pypi.python.org/pypi/gdbgui/)
7+
![image](https://img.shields.io/badge/python-2.7,3.4,3.5,3.6,pypy-blue.svg)
8+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
9+
[![image](https://github.com/cs01/gdbgui/raw/master/images/gdbgui_banner.png)](https://gdbgui.com)
10+
11+
A modern, browser-based frontend to gdb (gnu debugger). Add breakpoints, view stack traces, and more in C, C++, Go, and Rust! Simply run `gdbgui` from the terminal and a new tab will open in your browser.
12+
13+
## Download
14+
15+
Visit [gdbgui.com](https://gdbgui.com) to download, view documentation, installation instructions, screenshots and more.
16+
17+
## License
18+
19+
GNU GPLv3
20+
21+
For alternate licensing schemes, contact <[email protected]> for more information.
22+
23+
[gdbgui.com](https://gdbgui.com), [https://github.com/cs01/gdbgui](https://github.com/cs01/gdbgui), and [PyPI](https://pypi.python.org/pypi/gdbgui/) are the only official sources of gdbgui.
24+
25+
## Support gdbgui
26+
27+
You can support the project by [donating](https://www.paypal.me/grassfedcode/20), spreading the word, and reporting issues.
28+
## Contributing
29+
30+
To add a feature or fix a bug, see [CONTRIBUTING](https://github.com/cs01/gdbgui/blob/master/CONTRIBUTING.md).
31+
32+
## Authors
33+
34+
`gdbgui` is primarily authored by Chad Smith, with [help from the community](https://github.com/cs01/gdbgui/graphs/contributors). Large contributions were made by @bobthekingofegyp, who added initial autocomplete functionality for the gdb terminal.
35+
36+
## Contact
37+
38+

README.rst

-51
This file was deleted.

gdbgui/SSLify.py

+24-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
class SSLify(object):
1313
"""Secures your Flask App."""
1414

15-
def __init__(self, app=None, age=YEAR_IN_SECS, subdomains=False, permanent=False, skips=None):
15+
def __init__(
16+
self, app=None, age=YEAR_IN_SECS, subdomains=False, permanent=False, skips=None
17+
):
1618
self.app = app
1719
self.hsts_age = age
1820

@@ -25,24 +27,26 @@ def __init__(self, app=None, age=YEAR_IN_SECS, subdomains=False, permanent=False
2527

2628
def init_app(self, app):
2729
"""Configures the specified Flask app to enforce SSL."""
28-
app.config.setdefault('SSLIFY_SUBDOMAINS', False)
29-
app.config.setdefault('SSLIFY_PERMANENT', False)
30-
app.config.setdefault('SSLIFY_SKIPS', None)
30+
app.config.setdefault("SSLIFY_SUBDOMAINS", False)
31+
app.config.setdefault("SSLIFY_PERMANENT", False)
32+
app.config.setdefault("SSLIFY_SKIPS", None)
3133

32-
self.hsts_include_subdomains = self.hsts_include_subdomains or app.config['SSLIFY_SUBDOMAINS']
33-
self.permanent = self.permanent or self.app.config['SSLIFY_PERMANENT']
34-
self.skip_list = self.skip_list or self.app.config['SSLIFY_SKIPS']
34+
self.hsts_include_subdomains = (
35+
self.hsts_include_subdomains or app.config["SSLIFY_SUBDOMAINS"]
36+
)
37+
self.permanent = self.permanent or self.app.config["SSLIFY_PERMANENT"]
38+
self.skip_list = self.skip_list or self.app.config["SSLIFY_SKIPS"]
3539

3640
app.before_request(self.redirect_to_ssl)
3741
app.after_request(self.set_hsts_header)
3842

3943
@property
4044
def hsts_header(self):
4145
"""Returns the proper HSTS policy."""
42-
hsts_policy = 'max-age={0}'.format(self.hsts_age)
46+
hsts_policy = "max-age={0}".format(self.hsts_age)
4347

4448
if self.hsts_include_subdomains:
45-
hsts_policy += '; includeSubDomains'
49+
hsts_policy += "; includeSubDomains"
4650

4751
return hsts_policy
4852

@@ -52,7 +56,7 @@ def skip(self):
5256
# Should we skip?
5357
if self.skip_list and isinstance(self.skip_list, list):
5458
for skip in self.skip_list:
55-
if request.path.startswith('/{0}'.format(skip)):
59+
if request.path.startswith("/{0}".format(skip)):
5660
return True
5761
return False
5862

@@ -63,12 +67,12 @@ def redirect_to_ssl(self):
6367
request.is_secure,
6468
self.app.debug,
6569
self.app.testing,
66-
request.headers.get('X-Forwarded-Proto', 'http') == 'https'
70+
request.headers.get("X-Forwarded-Proto", "http") == "https",
6771
]
6872

6973
if not any(criteria) and not self.skip:
70-
if request.url.startswith('http://'):
71-
url = request.url.replace('http://', 'https://', 1)
74+
if request.url.startswith("http://"):
75+
url = request.url.replace("http://", "https://", 1)
7276
code = 302
7377
if self.permanent:
7478
code = 301
@@ -79,7 +83,7 @@ def set_hsts_header(self, response):
7983
"""Adds HSTS header to each response."""
8084
# Should we add STS header?
8185
if request.is_secure and not self.skip:
82-
response.headers.setdefault('Strict-Transport-Security', self.hsts_header)
86+
response.headers.setdefault("Strict-Transport-Security", self.hsts_header)
8387
return response
8488

8589

@@ -88,7 +92,12 @@ def get_ssl_context(private_key, certificate):
8892
The return value is used when calling Flask.
8993
i.e. app.run(ssl_context=get_ssl_context(,,,))
9094
"""
91-
if certificate and os.path.isfile(certificate) and private_key and os.path.isfile(private_key):
95+
if (
96+
certificate
97+
and os.path.isfile(certificate)
98+
and private_key
99+
and os.path.isfile(private_key)
100+
):
92101
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
93102
context.load_cert_chain(certificate, private_key)
94103
return context

gdbgui/__init__.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
import os
33
import sys
44

5-
_base_dir = getattr(sys, '_MEIPASS', os.path.dirname(os.path.realpath(__file__)))
6-
_version = io.open(os.path.join(_base_dir, 'VERSION.txt'), 'r', encoding="utf-8").read().strip()
5+
_base_dir = getattr(sys, "_MEIPASS", os.path.dirname(os.path.realpath(__file__)))
6+
_version = (
7+
io.open(os.path.join(_base_dir, "VERSION.txt"), "r", encoding="utf-8")
8+
.read()
9+
.strip()
10+
)
711

8-
__title__ = 'gdbgui'
12+
__title__ = "gdbgui"
913
__version__ = _version
10-
__author__ = 'Chad Smith'
11-
__copyright__ = 'Copyright Chad Smith'
14+
__author__ = "Chad Smith"
15+
__copyright__ = "Copyright Chad Smith"

gdbgui/backend.py

+29-18
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
render_template,
1717
jsonify,
1818
redirect,
19-
abort
19+
abort,
2020
)
2121
from flask_socketio import SocketIO, emit
2222
from flask_compress import Compress
@@ -267,9 +267,10 @@ def verify_gdb_exists():
267267
else:
268268
print('try "sudo apt-get install gdb" for Linux or "brew install gdb"')
269269
sys.exit(1)
270-
elif "lldb" in app.config["gdb_path"].lower() and "lldb-mi" not in app.config[
271-
"gdb_path"
272-
].lower():
270+
elif (
271+
"lldb" in app.config["gdb_path"].lower()
272+
and "lldb-mi" not in app.config["gdb_path"].lower()
273+
):
273274
pygdbmi.printcolor.print_red(
274275
'gdbgui cannot use the standard lldb executable. You must use an executable with "lldb-mi" in its name.'
275276
)
@@ -499,8 +500,11 @@ def authenticate(f):
499500
def wrapper(*args, **kwargs):
500501
if app.config.get("gdbgui_auth_user_credentials") is not None:
501502
auth = request.authorization
502-
if not auth or not auth.username or not auth.password or not credentials_are_valid(
503-
auth.username, auth.password
503+
if (
504+
not auth
505+
or not auth.username
506+
or not auth.password
507+
or not credentials_are_valid(auth.username, auth.password)
504508
):
505509
return Response(
506510
"You must log in to continue.",
@@ -531,9 +535,9 @@ def gdbgui():
531535
"themes": THEMES,
532536
"signals": SIGNAL_NAME_TO_OBJ,
533537
"gdbpid": gdbpid,
534-
"p": pbkdf2_hex(str(app.config.get("l")), "Feo8CJol") if app.config.get(
535-
"l"
536-
) else "",
538+
"p": pbkdf2_hex(str(app.config.get("l")), "Feo8CJol")
539+
if app.config.get("l")
540+
else "",
537541
"project_home": app.config["project_home"],
538542
"csrf_token": session["csrf_token"],
539543
"using_windows": USING_WINDOWS,
@@ -561,12 +565,15 @@ def send_signal_to_pid():
561565
try:
562566
pid_int = int(pid_str)
563567
except ValueError:
564-
return jsonify(
565-
{
566-
"message": "The pid %s cannot be converted to an integer. Signal %s was not sent."
567-
% (pid_str, signal_name)
568-
}
569-
), 400
568+
return (
569+
jsonify(
570+
{
571+
"message": "The pid %s cannot be converted to an integer. Signal %s was not sent."
572+
% (pid_str, signal_name)
573+
}
574+
),
575+
400,
576+
)
570577

571578
os.kill(pid_int, signal_obj)
572579
return jsonify(
@@ -658,7 +665,9 @@ def read_file():
658665
raise e
659666

660667
else:
661-
highlight = True # highlight argument was invalid for some reason, default to true
668+
highlight = (
669+
True
670+
) # highlight argument was invalid for some reason, default to true
662671

663672
if path and os.path.isfile(path):
664673
try:
@@ -676,7 +685,7 @@ def read_file():
676685
if raw_source_code_list[i] == "":
677686
raw_source_code_list[i] = " "
678687
raw_source_code_lines_of_interest = raw_source_code_list[
679-
(start_line - 1):(end_line)
688+
(start_line - 1) : (end_line)
680689
]
681690
try:
682691
lexer = get_lexer_for_filename(path)
@@ -688,7 +697,9 @@ def read_file():
688697
# convert string into tokens
689698
tokens = lexer.get_tokens("\n".join(raw_source_code_lines_of_interest))
690699
# format tokens into nice, marked up list of html
691-
formatter = htmllistformatter.HtmlListFormatter() # Don't add newlines after each line
700+
formatter = (
701+
htmllistformatter.HtmlListFormatter()
702+
) # Don't add newlines after each line
692703
source_code = formatter.get_marked_up_list(tokens)
693704
else:
694705
highlighted = False

gdbgui/statemanager.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ def connect_client(self, client_id, desired_gdbpid):
5353
if self.get_controller_from_client_id(client_id) is None:
5454
logger.info("new sid", client_id)
5555

56-
gdb_args = deepcopy(
57-
self.config["initial_binary_and_args"]
58-
) + REQUIRED_GDB_FLAGS
56+
gdb_args = (
57+
deepcopy(self.config["initial_binary_and_args"]) + REQUIRED_GDB_FLAGS
58+
)
5959

6060
if startup_with_shell_off:
6161
# macOS Sierra (and later) may have issues with gdb. This should fix it, but there might be other issues
@@ -75,7 +75,8 @@ def connect_client(self, client_id, desired_gdbpid):
7575

7676
pid = self.get_pid_from_controller(controller)
7777
message += "gdbgui spawned subprocess with pid %s from executable %s." % (
78-
str(pid), self.config["gdb_path"]
78+
str(pid),
79+
self.config["gdb_path"],
7980
)
8081

8182
return {

0 commit comments

Comments
 (0)