Skip to content

Commit 7644258

Browse files
Fix reverse debugging commands (#365)
* Pin mypy to 0.782 * Fix reverse debugging commands * Bump version to 0.14.0.2
1 parent b0e4c3f commit 7644258

File tree

8 files changed

+48
-41
lines changed

8 files changed

+48
-41
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# gdbgui release history
22

3+
## 0.14.0.2
4+
5+
- Pinned mypy version to unbreak linting
6+
- Fixed reverse debugging commands that were broken when `--gdb` flag was removed
7+
38
## 0.14.0.1
49

510
- Fix import paths

gdbgui/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.14.0.1
1+
0.14.0.2

gdbgui/src/js/ControlButtons.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ControlButtons extends React.Component<{}, State> {
1111
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1-2 arguments, but got 0.
1212
super();
1313
// @ts-expect-error ts-migrate(2339) FIXME: Property 'connectComponentState' does not exist on... Remove this comment to see the full error message
14-
store.connectComponentState(this, ["gdb_pid"]);
14+
store.connectComponentState(this, ["gdb_pid", "reverse_supported"]);
1515
}
1616
render() {
1717
let btn_class = "btn btn-default btn-sm";
@@ -34,8 +34,7 @@ class ControlButtons extends React.Component<{}, State> {
3434
type="button"
3535
title={
3636
"Continue until breakpoint is hit or inferior program exits keyboard shortcut: c" +
37-
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'initial_data'.
38-
(initial_data.rr ? ". shift + c for reverse." : "")
37+
(this.state.reverse_supported ? ". shift + c for reverse." : "")
3938
}
4039
className={btn_class}
4140
>
@@ -57,8 +56,7 @@ class ControlButtons extends React.Component<{}, State> {
5756
type="button"
5857
title={
5958
"Step over next function call keyboard shortcut: n or right arrow" +
60-
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'initial_data'.
61-
(initial_data.rr ? ". shift + n for reverse." : "")
59+
(this.state.reverse_supported ? ". shift + n for reverse." : "")
6260
}
6361
className={btn_class}
6462
>
@@ -71,8 +69,7 @@ class ControlButtons extends React.Component<{}, State> {
7169
type="button"
7270
title={
7371
"Step into next function call keyboard shortcut: s or down arrow" +
74-
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'initial_data'.
75-
(initial_data.rr ? ". shift + s for reverse." : "")
72+
(this.state.reverse_supported ? ". shift + s for reverse." : "")
7673
}
7774
className={btn_class}
7875
>
@@ -95,8 +92,7 @@ class ControlButtons extends React.Component<{}, State> {
9592
type="button"
9693
title={
9794
"Next Instruction: Execute one machine instruction, stepping over function calls keyboard shortcut: m" +
98-
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'initial_data'.
99-
(initial_data.rr ? ". shift + m for reverse." : "")
95+
(this.state.reverse_supported ? ". shift + m for reverse." : "")
10096
}
10197
className="btn btn-default"
10298
>
@@ -108,8 +104,7 @@ class ControlButtons extends React.Component<{}, State> {
108104
type="button"
109105
title={
110106
"Step Instruction: Execute one machine instruction, stepping into function calls keyboard shortcut: ','" +
111-
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'initial_data'.
112-
(initial_data.rr ? ". shift + , for reverse." : "")
107+
(this.state.reverse_supported ? ". shift + , for reverse." : "")
113108
}
114109
className="btn btn-default"
115110
>

gdbgui/src/js/GlobalEvents.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import constants from "./constants";
66
import GdbApi from "./GdbApi";
7+
import { store } from "statorgfc";
78

89
const GlobalEvents = {
910
init: function() {
@@ -45,9 +46,10 @@ const GlobalEvents = {
4546
GdbApi.click_next_instruction_button(e.shiftKey);
4647
} else if (e.keyCode === constants.COMMA_BUTTON_NUM) {
4748
GdbApi.click_step_instruction_button(e.shiftKey);
48-
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'initial_data'.
49-
} else if (initial_data.rr && e.keyCode === constants.LEFT_BUTTON_NUM) {
50-
// reverse
49+
} else if (
50+
e.keyCode === constants.LEFT_BUTTON_NUM &&
51+
store.get("reverse_supported")
52+
) {
5153
GdbApi.click_next_button(true);
5254
}
5355
}

gdbgui/src/js/InitialStoreData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const initial_store_data = {
2323
show_settings: false,
2424

2525
debug_in_reverse: false,
26+
reverse_supported: false,
2627
show_modal: false,
2728
modal_header: null,
2829
modal_body: null,

gdbgui/src/js/TopBar.tsx

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class TopBar extends React.Component<{}, State> {
175175
this,
176176
[
177177
"debug_in_reverse",
178+
"reverse_supported",
178179
"source_code_state",
179180
"waiting_for_response",
180181
"show_filesystem",
@@ -303,30 +304,27 @@ class TopBar extends React.Component<{}, State> {
303304
);
304305
}
305306

306-
let reverse_checkbox = null;
307-
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'initial_data'.
308-
if (initial_data.rr) {
309-
reverse_checkbox = (
310-
<label
311-
title={
312-
"when clicking buttons to the right, pass the `--reverse` " +
313-
"flag to gdb in an attempt to debug in reverse. This is not always supported. " +
314-
"rr is known to support reverse debugging. Keyboard shortcuts go in " +
315-
"reverse when pressed with the shift key."
316-
}
317-
style={{ fontWeight: "normal", fontSize: "0.9em", margin: "5px" }}
318-
>
319-
<input
320-
type="checkbox"
321-
checked={store.get("debug_in_reverse")}
322-
onChange={e => {
323-
store.set("debug_in_reverse", e.target.checked);
324-
}}
325-
/>
326-
reverse
327-
</label>
328-
);
329-
}
307+
let reverse_checkbox = (
308+
<label
309+
title={
310+
"when clicking buttons to the right, pass the `--reverse` " +
311+
"flag to gdb in an attempt to debug in reverse. This is not always supported. " +
312+
"rr is known to support reverse debugging. Keyboard shortcuts go in " +
313+
"reverse when pressed with the shift key."
314+
}
315+
style={{ fontWeight: "normal", fontSize: "0.9em", margin: "5px" }}
316+
>
317+
<input
318+
type="checkbox"
319+
disabled={!this.state.reverse_supported}
320+
checked={store.get("debug_in_reverse")}
321+
onChange={e => {
322+
store.set("debug_in_reverse", e.target.checked);
323+
}}
324+
/>
325+
reverse
326+
</label>
327+
);
330328

331329
return (
332330
<div

gdbgui/src/js/processFeatures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ type Feature =
1919

2020
export function processFeatures(features: Array<Feature>) {
2121
if (features.indexOf("reverse") !== -1) {
22-
store.set("debug_in_reverse", true);
22+
store.set("reverse_supported", true);
2323
}
2424
}

noxfile.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
]
2020

2121
doc_dependencies = [".", "mkdocs", "mkdocs-material"]
22-
lint_dependencies = ["black==20.8b1", "vulture", "flake8", "mypy", "check-manifest"]
22+
lint_dependencies = [
23+
"black==20.8b1",
24+
"vulture",
25+
"flake8",
26+
"mypy==0.782",
27+
"check-manifest",
28+
]
2329
vulture_whitelist = ".vulture_whitelist.py"
2430
files_to_lint = ["gdbgui", "tests"] + [str(p) for p in Path(".").glob("*.py")]
2531
files_to_lint.remove(vulture_whitelist)

0 commit comments

Comments
 (0)