Skip to content

Commit

Permalink
do not clear program state when resuming (intended to better maintain…
Browse files Browse the repository at this point in the history
… scroll position in right pane)
  • Loading branch information
cs01 committed Jul 23, 2018
1 parent e150154 commit 2b7254b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# gdbgui release history

## master
* Do not clear program state when resuming inferior so that scroll position is better maintained

## 0.13.0.0
* 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)
* Add shift keyboard shortcut to go in reverse when using rr (#201)
Expand Down
5 changes: 4 additions & 1 deletion gdbgui/src/js/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ const Actions = {
Memory.clear_cache();
Locals.clear();
},
inferior_program_running: function() {
inferior_program_starting: function() {
store.set("inferior_program", constants.inferior_states.running);
Actions.clear_program_state();
},
inferior_program_resuming: function() {
store.set("inferior_program", constants.inferior_states.running);
},
inferior_program_paused: function(frame = {}) {
store.set("inferior_program", constants.inferior_states.paused);
store.set(
Expand Down
19 changes: 10 additions & 9 deletions gdbgui/src/js/GdbApi.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const GdbApi = {
},
_waiting_for_response_timeout: null,
click_run_button: function() {
Actions.inferior_program_running();
Actions.inferior_program_starting();
GdbApi.run_gdb_command("-exec-run");
},
run_initial_commands: function() {
Expand All @@ -129,51 +129,51 @@ const GdbApi = {
);
},
click_continue_button: function(reverse = false) {
Actions.inferior_program_running();
Actions.inferior_program_resuming();
GdbApi.run_gdb_command(
"-exec-continue" + (store.get("debug_in_reverse") || reverse ? " --reverse" : "")
);
},
click_next_button: function(reverse = false) {
Actions.inferior_program_running();
Actions.inferior_program_resuming();
GdbApi.run_gdb_command(
"-exec-next" + (store.get("debug_in_reverse") || reverse ? " --reverse" : "")
);
},
click_step_button: function(reverse = false) {
Actions.inferior_program_running();
Actions.inferior_program_resuming();
GdbApi.run_gdb_command(
"-exec-step" + (store.get("debug_in_reverse") || reverse ? " --reverse" : "")
);
},
click_return_button: function() {
// From gdb mi docs (https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html#GDB_002fMI-Program-Execution):
// `-exec-return` Makes current function return immediately. Doesn't execute the inferior.
// That means we do NOT dispatch the event `event_inferior_program_running`, because it's not, in fact, running.
// That means we do NOT dispatch the event `event_inferior_program_resuming`, because it's not, in fact, running.
// The return also doesn't even indicate that it's paused, so we need to manually trigger the event here.
GdbApi.run_gdb_command("-exec-return");
Actions.inferior_program_paused();
},
click_next_instruction_button: function(reverse = false) {
Actions.inferior_program_running();
Actions.inferior_program_resuming();
GdbApi.run_gdb_command(
"-exec-next-instruction" +
(store.get("debug_in_reverse") || reverse ? " --reverse" : "")
);
},
click_step_instruction_button: function(reverse = false) {
Actions.inferior_program_running();
Actions.inferior_program_resuming();
GdbApi.run_gdb_command(
"-exec-step-instruction" +
(store.get("debug_in_reverse") || reverse ? " --reverse" : "")
);
},
click_send_interrupt_button: function() {
Actions.inferior_program_running();
Actions.inferior_program_resuming();
GdbApi.run_gdb_command("-exec-interrupt");
},
send_autocomplete_command: function(command) {
Actions.inferior_program_running();
Actions.inferior_program_resuming();
GdbApi.run_gdb_command("complete " + command);
},
click_gdb_cmd_button: function(e) {
Expand Down Expand Up @@ -220,6 +220,7 @@ const GdbApi = {
const WAIT_TIME_SEC = 10;
clearTimeout(GdbApi._waiting_for_response_timeout);
GdbApi._waiting_for_response_timeout = setTimeout(() => {
Actions.clear_program_state();
store.set("waiting_for_response", false);

Actions.add_console_entries(
Expand Down
2 changes: 1 addition & 1 deletion gdbgui/static/js/build.js

Large diffs are not rendered by default.

0 comments on commit 2b7254b

Please sign in to comment.