Skip to content

Commit

Permalink
update prettier rules
Browse files Browse the repository at this point in the history
  • Loading branch information
cs01 committed Jun 25, 2018
1 parent f760efa commit 0ed9455
Show file tree
Hide file tree
Showing 45 changed files with 1,773 additions and 1,691 deletions.
5 changes: 0 additions & 5 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
module.exports = {
bracketSpacing: false,
singleQuote: true,
jsxBracketSameLine: true,
trailingComma: 'es5',
printWidth: 90,
semi: true,
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# gdbgui release history

## master
* Add "name" to Threads (new gdb 8.1 feature) (@P4Cu)
* Fix typo in tour (@nkirkby)

## 0.12.0.0
* Add pause button
* Update command line parsing for cmd and --args, change arguments from underscore to hyphen, add option to specify browser (@fritzr)
* Add tour
Expand Down
140 changes: 70 additions & 70 deletions gdbgui/src/js/Actions.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
import {store} from 'statorgfc';
import GdbApi from './GdbApi.jsx';
import SourceCode from './SourceCode.jsx';
import Locals from './Locals.jsx';
import Memory from './Memory.jsx';
import constants from './constants.js';
import React from 'react';
import { store } from "statorgfc";
import GdbApi from "./GdbApi.jsx";
import SourceCode from "./SourceCode.jsx";
import Locals from "./Locals.jsx";
import Memory from "./Memory.jsx";
import constants from "./constants.js";
import React from "react";
void React; // using jsx implicity uses React

const Actions = {
clear_program_state: function() {
store.set('line_of_source_to_flash', undefined);
store.set('paused_on_frame', undefined);
store.set('selected_frame_num', 0);
store.set('current_thread_id', undefined);
store.set('stack', []);
store.set('threads', []);
store.set("line_of_source_to_flash", undefined);
store.set("paused_on_frame", undefined);
store.set("selected_frame_num", 0);
store.set("current_thread_id", undefined);
store.set("stack", []);
store.set("threads", []);
Memory.clear_cache();
Locals.clear();
},
inferior_program_running: function() {
store.set('inferior_program', constants.inferior_states.running);
store.set("inferior_program", constants.inferior_states.running);
Actions.clear_program_state();
},
inferior_program_paused: function(frame = {}) {
store.set('inferior_program', constants.inferior_states.paused);
store.set("inferior_program", constants.inferior_states.paused);
store.set(
'source_code_selection_state',
"source_code_selection_state",
constants.source_code_selection_states.PAUSED_FRAME
);
store.set('paused_on_frame', frame);
store.set('fullname_to_render', frame.fullname);
store.set('line_of_source_to_flash', parseInt(frame.line));
store.set('current_assembly_address', frame.addr);
store.set('source_code_infinite_scrolling', false);
store.set("paused_on_frame", frame);
store.set("fullname_to_render", frame.fullname);
store.set("line_of_source_to_flash", parseInt(frame.line));
store.set("current_assembly_address", frame.addr);
store.set("source_code_infinite_scrolling", false);
SourceCode.make_current_line_visible();
Actions.refresh_state_for_gdb_pause();
},
inferior_program_exited: function() {
store.set('inferior_program', constants.inferior_states.exited);
store.set('disassembly_for_missing_file', []);
store.set('root_gdb_tree_var', null);
store.set('previous_register_values', {});
store.set('current_register_values', {});
store.set('inferior_pid', null);
store.set("inferior_program", constants.inferior_states.exited);
store.set("disassembly_for_missing_file", []);
store.set("root_gdb_tree_var", null);
store.set("previous_register_values", {});
store.set("current_register_values", {});
store.set("inferior_pid", null);
Actions.clear_program_state();
},
/**
Expand All @@ -52,32 +52,32 @@ const Actions = {
GdbApi.run_gdb_command(GdbApi._get_refresh_state_for_pause_cmds());
},
execute_console_command: function(command) {
if (store.get('refresh_state_after_sending_console_command')) {
if (store.get("refresh_state_after_sending_console_command")) {
GdbApi.run_command_and_refresh_state(command);
} else {
GdbApi.run_gdb_command(command);
}
},
clear_console: function() {
store.set('gdb_console_entries', []);
store.set("gdb_console_entries", []);
},
add_console_entries: function(entries, type) {
if (!_.isArray(entries)) {
entries = [entries];
}

const typed_entries = entries.map(entry => {
return {type: type, value: entry};
return { type: type, value: entry };
});

const previous_entries = store.get('gdb_console_entries');
const previous_entries = store.get("gdb_console_entries");
const MAX_NUM_ENTRIES = 1000;
const new_entries = previous_entries.concat(typed_entries);
if (new_entries.length > MAX_NUM_ENTRIES) {
new_entries.splice(0, new_entries.length - MAX_NUM_ENTRIES);
}

store.set('gdb_console_entries', new_entries);
store.set("gdb_console_entries", new_entries);
},
add_gdb_response_to_console(mi_obj) {
if (!mi_obj) {
Expand All @@ -87,22 +87,22 @@ const Actions = {
let entries = [],
error = false;
if (mi_obj.message) {
if (mi_obj.message === 'error') {
if (mi_obj.message === "error") {
error = true;
} else {
entries.push(mi_obj.message);
}
}
if (mi_obj.payload) {
const interesting_keys = ['msg', 'reason', 'signal-name', 'signal-meaning'];
const interesting_keys = ["msg", "reason", "signal-name", "signal-meaning"];
for (let k of interesting_keys) {
if (mi_obj.payload[k]) {
entries.push(mi_obj.payload[k]);
}
}

if (mi_obj.payload.frame) {
for (let i of ['file', 'func', 'line', 'addr']) {
for (let i of ["file", "func", "line", "addr"]) {
if (i in mi_obj.payload.frame) {
entries.push(`${i}: ${mi_obj.payload.frame[i]}`);
}
Expand All @@ -115,41 +115,41 @@ const Actions = {
Actions.add_console_entries(entries, type);
},
toggle_modal_visibility() {
store.set('show_modal', !store.get('show_modal'));
store.set("show_modal", !store.get("show_modal"));
},
show_modal(header, body) {
store.set('modal_header', header);
store.set('modal_body', body);
store.set('show_modal', true);
store.set("modal_header", header);
store.set("modal_body", body);
store.set("show_modal", true);
},
set_gdb_binary_and_arguments(binary, args) {
// remove list of source files associated with the loaded binary since we're loading a new one
store.set('source_file_paths', []);
store.set('language', 'c_family');
store.set('inferior_binary_path', null);
store.set("source_file_paths", []);
store.set("language", "c_family");
store.set("inferior_binary_path", null);
Actions.inferior_program_exited();
let cmds = GdbApi.get_load_binary_and_arguments_cmds(binary, args);
GdbApi.run_gdb_command(cmds);
GdbApi.get_inferior_binary_last_modified_unix_sec(binary);
},
connect_to_gdbserver(user_input) {
// https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation
store.set('source_file_paths', []);
store.set('language', 'c_family');
store.set('inferior_binary_path', null);
store.set("source_file_paths", []);
store.set("language", "c_family");
store.set("inferior_binary_path", null);
Actions.inferior_program_exited();
GdbApi.run_gdb_command([`-target-select remote ${user_input}`]);
},
remote_connected() {
Actions.inferior_program_paused();
let cmds = [];
if (store.get('auto_add_breakpoint_to_main')) {
if (store.get("auto_add_breakpoint_to_main")) {
Actions.add_console_entries(
'Connected to remote target! Adding breakpoint to main, then continuing target execution.',
"Connected to remote target! Adding breakpoint to main, then continuing target execution.",
constants.console_entry_type.GDBGUI_OUTPUT
);
cmds.push('-break-insert main');
cmds.push('-exec-continue');
cmds.push("-break-insert main");
cmds.push("-exec-continue");
cmds.push(GdbApi.get_break_list_cmd());
} else {
Actions.add_console_entries(
Expand All @@ -164,62 +164,62 @@ const Actions = {
GdbApi.run_gdb_command(`-target-attach ${user_input}`);
},
fetch_source_files() {
store.set('source_file_paths', []);
GdbApi.run_gdb_command('-file-list-exec-source-files');
store.set("source_file_paths", []);
GdbApi.run_gdb_command("-file-list-exec-source-files");
},
view_file(fullname, line) {
store.set('fullname_to_render', fullname);
store.set('source_code_infinite_scrolling', false);
store.set("fullname_to_render", fullname);
store.set("source_code_infinite_scrolling", false);
Actions.set_line_state(line);
},
set_line_state(line) {
store.set('source_code_infinite_scrolling', false);
store.set("source_code_infinite_scrolling", false);
store.set(
'source_code_selection_state',
"source_code_selection_state",
constants.source_code_selection_states.USER_SELECTION
);
store.set('line_of_source_to_flash', parseInt(line));
store.set('make_current_line_visible', true);
store.set("line_of_source_to_flash", parseInt(line));
store.set("make_current_line_visible", true);
},
clear_cached_assembly() {
store.set('disassembly_for_missing_file', []);
let cached_source_files = store.get('cached_source_files');
store.set("disassembly_for_missing_file", []);
let cached_source_files = store.get("cached_source_files");
for (let file of cached_source_files) {
file.assembly = {};
}
store.set('cached_source_files', cached_source_files);
store.set("cached_source_files", cached_source_files);
},
update_max_lines_of_code_to_fetch(new_value) {
if (new_value <= 0) {
new_value = constants.default_max_lines_of_code_to_fetch;
}
store.set('max_lines_of_code_to_fetch', new_value);
localStorage.setItem('max_lines_of_code_to_fetch', JSON.stringify(new_value));
store.set("max_lines_of_code_to_fetch", new_value);
localStorage.setItem("max_lines_of_code_to_fetch", JSON.stringify(new_value));
},
show_upgrade_modal() {
const body = (
<div>
<span>This feature is only available in gdbgui pro.</span>
<p />
<a onClick={() => window.open('http://gdbgui.com')} className="btn btn-primary">
<a onClick={() => window.open("http://gdbgui.com")} className="btn btn-primary">
Upgrade now
</a>
</div>
);
Actions.show_modal('upgrade to pro for this feature', body);
Actions.show_modal("upgrade to pro for this feature", body);
},
send_signal(signal_name, pid) {
$.ajax({
beforeSend: function(xhr) {
xhr.setRequestHeader(
'x-csrftoken',
"x-csrftoken",
initial_data.csrf_token
); /* global initial_data */
},
url: '/send_signal_to_pid',
url: "/send_signal_to_pid",
cache: false,
type: 'POST',
data: {signal_name: signal_name, pid: pid},
type: "POST",
data: { signal_name: signal_name, pid: pid },
success: function(response) {
Actions.add_console_entries(
response.message,
Expand All @@ -240,9 +240,9 @@ const Actions = {
}
console.error(response);
},
complete: function() {},
complete: function() {}
});
},
}
};

export default Actions;
Loading

0 comments on commit 0ed9455

Please sign in to comment.