Skip to content

Commit 717cba8

Browse files
committed
add shift keyboard shortcut when using rr cs01#201
1 parent f733460 commit 717cba8

9 files changed

+110
-60
lines changed

.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"jquery": true
66
},
77
"globals":{
8+
"initial_data": true,
89
"module": true,
910
"_": true,
1011
"moment": true

CHANGELOG.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# gdbgui release history
22

33
## 0.13.0.0
4-
* Add ability to map source file paths. Added flags `--remap-sources` and `-m` to replace compile-time source paths to local source paths. i.e. `gdbgui --remap-sources='{"/buildmachine":"/home/chad"}'` (#158)
4+
* Add ability to re-map source file paths. Added flags `--remap-sources` and `-m` to replace compile-time source paths to local source paths. i.e. `gdbgui --remap-sources='{"/buildmachine": "/home/chad"}'` (#158)
5+
* Add shift keyboard shortcut to go in reverse when using rr (#201)
56
* Pass arbitrary gdb arguments directly to gdb: added `--gdb-args` flag
67
* Removed `-x` CLI option, which caused major version to change. New way to pass is `gdbgui --gdb-args='-x=FILE'` (#205)
7-
* Fix typo in tour (@nkirkby)
88
* Add "name" to Threads (new gdb 8.1 feature) (@P4Cu)
99
* Fix crash/black screen from "Python Exception <class NameError> name long is not defined" #212
1010
* Fix bug when debugging filenames with spaces (Fix Cannot create breakpoint: -break-insert: Garbage following <location> #211")
1111
* Fix empty frame causes the ui to crash/black screen #216
12-
* Update tour text
13-
* update npm packages; update react to 16.4
14-
* update prettier rules
12+
* Update npm packages; update react to 16.4
13+
* Update prettier rules
14+
* Update tour text + fix typo in tour (@nkirkby)
1515

1616
## 0.12.0.0
1717
* Add pause button

gdbgui/backend.py

+1
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ def gdbgui():
542542
else "",
543543
"project_home": app.config["project_home"],
544544
"remap_sources": app.config["remap_sources"],
545+
"rr": app.config["rr"],
545546
"show_gdbgui_upgrades": app.config["show_gdbgui_upgrades"],
546547
"themes": THEMES,
547548
"signals": SIGNAL_NAME_TO_OBJ,

gdbgui/src/js/ControlButtons.jsx

+29-14
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,22 @@ class ControlButtons extends React.Component {
1616
<React.Fragment>
1717
<button
1818
id="run_button"
19-
onClick={GdbApi.click_run_button}
19+
onClick={()=>GdbApi.click_run_button()}
2020
type="button"
21-
title="Start inferior program from the beginning (keyboard shortcut: r)"
21+
title="Start inferior program from the beginning keyboard shortcut: r"
2222
className={btn_class}
2323
>
2424
<span className="glyphicon glyphicon-repeat" />
2525
</button>
2626

2727
<button
2828
id="continue_button"
29-
onClick={GdbApi.click_continue_button}
29+
onClick={()=>GdbApi.click_continue_button()}
3030
type="button"
31-
title="Continue until breakpoint is hit or inferior program exits (keyboard shortcut: c)"
31+
title={
32+
"Continue until breakpoint is hit or inferior program exits keyboard shortcut: c" +
33+
(initial_data.rr ? ". shift + c for reverse." : "")
34+
}
3235
className={btn_class}
3336
>
3437
<span className="glyphicon glyphicon-play" />
@@ -45,48 +48,60 @@ class ControlButtons extends React.Component {
4548

4649
<button
4750
id="next_button"
48-
onClick={GdbApi.click_next_button}
51+
onClick={()=>GdbApi.click_next_button()}
4952
type="button"
50-
title="Step over next function call (keyboard shortcut: n or right arrow)"
53+
title={
54+
"Step over next function call keyboard shortcut: n or right arrow" +
55+
(initial_data.rr ? ". shift + n for reverse." : "")
56+
}
5157
className={btn_class}
5258
>
5359
<span className="glyphicon glyphicon-step-forward" />
5460
</button>
5561

5662
<button
5763
id="step_button"
58-
onClick={GdbApi.click_step_button}
64+
onClick={()=>GdbApi.click_step_button()}
5965
type="button"
60-
title="Step into next function call (keyboard shortcut: s or down arrow)"
66+
title={
67+
"Step into next function call keyboard shortcut: s or down arrow" +
68+
(initial_data.rr ? ". shift + s for reverse." : "")
69+
}
6170
className={btn_class}
6271
>
6372
<span className="glyphicon glyphicon-arrow-down" />
6473
</button>
6574

6675
<button
6776
id="return_button"
68-
onClick={GdbApi.click_return_button}
77+
onClick={()=>GdbApi.click_return_button()}
6978
type="button"
70-
title="Step out of current function (keyboard shortcut: u or up arrow)"
79+
title="Step out of current function keyboard shortcut: u or up arrow"
7180
className={btn_class}
7281
>
7382
<span className="glyphicon glyphicon-arrow-up" />
7483
</button>
7584
<div role="group" className="btn-group btn-group-xs">
7685
<button
7786
id="next_instruction_button"
78-
onClick={GdbApi.click_next_instruction_button}
87+
onClick={()=>GdbApi.click_next_instruction_button()}
7988
type="button"
80-
title="Next Instruction: Execute one machine instruction, stepping over function calls (keyboard shortcut: m)"
89+
title={
90+
"Next Instruction: Execute one machine instruction, stepping over function calls keyboard shortcut: m" +
91+
(initial_data.rr ? ". shift + m for reverse." : "")
92+
}
8193
className="btn btn-default"
8294
>
8395
NI
8496
</button>
8597
<button
8698
id="step_instruction_button"
87-
onClick={GdbApi.click_step_instruction_button}
99+
onClick={()=>GdbApi.click_step_instruction_button()}
88100
type="button"
89-
title="Step Instruction: Execute one machine instruction, stepping into function calls (keyboard shortcut: ,)"
101+
title={
102+
"Step Instruction: Execute one machine instruction, stepping into function calls keyboard shortcut: ','" +
103+
(initial_data.rr ? ". shift + , for reverse." : "")
104+
}
90105
className="btn btn-default"
91106
>
92107
SI

gdbgui/src/js/GdbApi.jsx

+16-14
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ const GdbApi = {
114114
GdbApi.run_gdb_command("-exec-run");
115115
},
116116
run_initial_commands: function() {
117-
const cmds = ["set breakpoint pending on"]
118-
for(const src in initial_data.remap_sources){
119-
const dst = initial_data.remap_sources[src]
120-
cmds.push(`set substitute-path "${src}" "${dst}"`)
117+
const cmds = ["set breakpoint pending on"];
118+
for (const src in initial_data.remap_sources) {
119+
const dst = initial_data.remap_sources[src];
120+
cmds.push(`set substitute-path "${src}" "${dst}"`);
121121
}
122122
GdbApi.run_gdb_command(cmds);
123123
},
@@ -128,22 +128,22 @@ const GdbApi = {
128128
) !== -1
129129
);
130130
},
131-
click_continue_button: function() {
131+
click_continue_button: function(reverse = false) {
132132
Actions.inferior_program_running();
133133
GdbApi.run_gdb_command(
134-
"-exec-continue" + (store.get("debug_in_reverse") ? " --reverse" : "")
134+
"-exec-continue" + (store.get("debug_in_reverse") || reverse ? " --reverse" : "")
135135
);
136136
},
137-
click_next_button: function() {
137+
click_next_button: function(reverse = false) {
138138
Actions.inferior_program_running();
139139
GdbApi.run_gdb_command(
140-
"-exec-next" + (store.get("debug_in_reverse") ? " --reverse" : "")
140+
"-exec-next" + (store.get("debug_in_reverse") || reverse ? " --reverse" : "")
141141
);
142142
},
143-
click_step_button: function() {
143+
click_step_button: function(reverse = false) {
144144
Actions.inferior_program_running();
145145
GdbApi.run_gdb_command(
146-
"-exec-step" + (store.get("debug_in_reverse") ? " --reverse" : "")
146+
"-exec-step" + (store.get("debug_in_reverse") || reverse ? " --reverse" : "")
147147
);
148148
},
149149
click_return_button: function() {
@@ -154,16 +154,18 @@ const GdbApi = {
154154
GdbApi.run_gdb_command("-exec-return");
155155
Actions.inferior_program_paused();
156156
},
157-
click_next_instruction_button: function() {
157+
click_next_instruction_button: function(reverse = false) {
158158
Actions.inferior_program_running();
159159
GdbApi.run_gdb_command(
160-
"-exec-next-instruction" + (store.get("debug_in_reverse") ? " --reverse" : "")
160+
"-exec-next-instruction" +
161+
(store.get("debug_in_reverse") || reverse ? " --reverse" : "")
161162
);
162163
},
163-
click_step_instruction_button: function() {
164+
click_step_instruction_button: function(reverse = false) {
164165
Actions.inferior_program_running();
165166
GdbApi.run_gdb_command(
166-
"-exec-step-instruction" + (store.get("debug_in_reverse") ? " --reverse" : "")
167+
"-exec-step-instruction" +
168+
(store.get("debug_in_reverse") || reverse ? " --reverse" : "")
167169
);
168170
},
169171
click_send_interrupt_button: function() {

gdbgui/src/js/GlobalEvents.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,29 @@ const GlobalEvents = {
2424
* enabled only when key is depressed on a target that is NOT an input.
2525
*/
2626
body_keydown: function(e) {
27-
let modifier = e.altKey || e.ctrlKey || e.shiftKey || e.metaKey;
27+
let modifier = e.altKey || e.ctrlKey || e.metaKey;
2828

2929
if (e.target.nodeName !== "INPUT" && !modifier) {
3030
let char = String.fromCharCode(e.keyCode).toLowerCase();
3131
if (e.keyCode === constants.DOWN_BUTTON_NUM || char === "s") {
3232
GdbApi.click_step_button();
33-
} else if (e.keyCode === constants.RIGHT_BUTTON_NUM || char === "n") {
33+
} else if (e.keyCode === constants.RIGHT_BUTTON_NUM) {
3434
GdbApi.click_next_button();
35+
} else if (char === "n") {
36+
GdbApi.click_next_button(e.shiftKey);
3537
} else if (char === "c") {
36-
GdbApi.click_continue_button();
38+
GdbApi.click_continue_button(e.shiftKey);
3739
} else if (e.keyCode === constants.UP_BUTTON_NUM || char === "u") {
3840
GdbApi.click_return_button();
3941
} else if (char === "r") {
4042
GdbApi.click_run_button();
4143
} else if (char === "m") {
42-
GdbApi.click_next_instruction_button();
44+
GdbApi.click_next_instruction_button(e.shiftKey);
4345
} else if (e.keyCode === constants.COMMA_BUTTON_NUM) {
44-
GdbApi.click_step_instruction_button();
46+
GdbApi.click_step_instruction_button(e.shiftKey);
47+
} else if (initial_data.rr && e.keyCode === constants.LEFT_BUTTON_NUM) {
48+
// reverse
49+
GdbApi.click_next_button(true);
4550
}
4651
}
4752
}

gdbgui/src/js/TopBar.jsx

+25-13
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,30 @@ class TopBar extends React.Component {
344344
);
345345
}
346346

347+
let reverse_checkbox = null;
348+
if (initial_data.rr) {
349+
reverse_checkbox = (
350+
<label
351+
title={
352+
"when clicking buttons to the right, pass the `--reverse` " +
353+
"flag to gdb in an attempt to debug in reverse. This is not always supported. " +
354+
"rr is known to support reverse debugging. Keyboard shortcuts go in " +
355+
"reverse when pressed with the shift key."
356+
}
357+
style={{ fontWeight: "normal", fontSize: "0.9em", margin: "5px" }}
358+
>
359+
<input
360+
type="checkbox"
361+
checked={store.get("debug_in_reverse")}
362+
onChange={e => {
363+
store.set("debug_in_reverse", e.target.checked);
364+
}}
365+
/>
366+
reverse
367+
</label>
368+
);
369+
}
370+
347371
return (
348372
<div
349373
id="top"
@@ -352,19 +376,7 @@ class TopBar extends React.Component {
352376
<div className="flexrow">
353377
<BinaryLoader initial_user_input={this.props.initial_user_input} />
354378
{spinner}
355-
<label
356-
title="when clicking buttons to the right, pass the `--reverse` flag to gdb in an attempt to debug in reverse. This is not always supported. rr is known to support reverse debugging."
357-
style={{ fontWeight: "normal", fontSize: "0.9em", margin: "5px" }}
358-
>
359-
<input
360-
type="checkbox"
361-
checked={store.get("debug_in_reverse")}
362-
onChange={e => {
363-
store.set("debug_in_reverse", e.target.checked);
364-
}}
365-
/>
366-
reverse
367-
</label>
379+
{reverse_checkbox}
368380

369381
{this.get_controls()}
370382

gdbgui/static/js/build.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

yarn.lock

+20-6
Original file line numberDiff line numberDiff line change
@@ -2203,8 +2203,8 @@ eslint-loader@^2.0.0:
22032203
rimraf "^2.6.1"
22042204

22052205
eslint-plugin-prettier@^2.6.0:
2206-
version "2.6.1"
2207-
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.1.tgz#de902b4a66b7bca24296429a59a1cc04020ccbbd"
2206+
version "2.6.2"
2207+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad"
22082208
dependencies:
22092209
fast-diff "^1.1.1"
22102210
jest-docblock "^21.0.0"
@@ -3160,8 +3160,8 @@ is-builtin-module@^1.0.0:
31603160
builtin-modules "^1.0.0"
31613161

31623162
is-callable@^1.1.1, is-callable@^1.1.3:
3163-
version "1.1.3"
3164-
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
3163+
version "1.1.4"
3164+
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
31653165

31663166
is-ci@^1.0.10:
31673167
version "1.1.0"
@@ -3724,6 +3724,10 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
37243724
version "3.0.2"
37253725
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
37263726

3727+
"js-tokens@^3.0.0 || ^4.0.0":
3728+
version "4.0.0"
3729+
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
3730+
37273731
js-yaml@^3.7.0, js-yaml@^3.9.1:
37283732
version "3.12.0"
37293733
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
@@ -4055,12 +4059,18 @@ longest@^1.0.1:
40554059
version "1.0.1"
40564060
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
40574061

4058-
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
4062+
loose-envify@^1.0.0, loose-envify@^1.1.0:
40594063
version "1.3.1"
40604064
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
40614065
dependencies:
40624066
js-tokens "^3.0.0"
40634067

4068+
loose-envify@^1.3.1:
4069+
version "1.4.0"
4070+
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
4071+
dependencies:
4072+
js-tokens "^3.0.0 || ^4.0.0"
4073+
40644074
40654075
version "1.0.0"
40664076
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306"
@@ -4850,7 +4860,11 @@ preserve@^0.2.0:
48504860
version "0.2.0"
48514861
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
48524862

4853-
prettier@^1.12.0, prettier@^1.12.1:
4863+
prettier@^1.12.0:
4864+
version "1.13.7"
4865+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281"
4866+
4867+
prettier@^1.12.1:
48544868
version "1.13.6"
48554869
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44"
48564870

0 commit comments

Comments
 (0)