Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gdbgui/src/js/BinaryLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ class BinaryLoader extends React.Component {
}
/>
<datalist id="past_binaries">
{this.state.past_binaries.map((b, i) => <option key={i}>{b}</option>)}
{this.state.past_binaries.map((b, i) => (
<option key={i}>{b}</option>
))}
</datalist>
</form>
);
Expand Down
15 changes: 8 additions & 7 deletions gdbgui/src/js/Breakpoints.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ class Breakpoint extends React.Component {
</div>
);
}
get_num_times_hit(bkpt){
if ((bkpt.times === undefined) // E.g. 'bkpt' is a child breakpoint
||
(bkpt.times == 0)) {
return ""
get_num_times_hit(bkpt) {
if (
bkpt.times === undefined || // E.g. 'bkpt' is a child breakpoint
bkpt.times == 0
) {
return "";
} else if (bkpt.times == 1) {
return "1 hit"
return "1 hit";
} else {
return `${bkpt.times} hits`;
}
Expand Down Expand Up @@ -131,7 +132,7 @@ class Breakpoint extends React.Component {
<span style={{ color: "#bbbbbb", fontStyle: "italic" }}>
thread groups: {b["thread-groups"]}
</span>
<span style={{ color: "#bbbbbb", fontStyle: "italic", paddingLeft: "5px"}}>
<span style={{ color: "#bbbbbb", fontStyle: "italic", paddingLeft: "5px" }}>
{times_hit}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion gdbgui/src/js/CopyToClipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ToolTip from "./ToolTip.jsx";
import { store } from "statorgfc";

type Props = {
content: string | null
content: string | null;
};

class CopyToClipboard extends React.Component<Props> {
Expand Down
3 changes: 2 additions & 1 deletion gdbgui/src/js/FileOps.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ const FileOps = {
<p>
{`Binary: ${store.get("inferior_binary_path")}, modified ${moment(
store.get("inferior_binary_path_last_modified_unix_sec") * 1000
).format(constants.DATE_FORMAT)}`})
).format(constants.DATE_FORMAT)}`}
)
</p>
</div>
);
Expand Down
11 changes: 4 additions & 7 deletions gdbgui/src/js/GdbApi.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ const GdbApi = {
const TIMEOUT_MIN = 5;
/* global io */
/* global initial_data */
GdbApi.socket = io.connect(
`/gdb_listener`,
{
timeout: TIMEOUT_MIN * 60 * 1000,
query: `csrf_token=${initial_data.csrf_token}&gdbpid=${initial_data.gdbpid}`
}
);
GdbApi.socket = io.connect(`/gdb_listener`, {
timeout: TIMEOUT_MIN * 60 * 1000,
query: `csrf_token=${initial_data.csrf_token}&gdbpid=${initial_data.gdbpid}`
});

GdbApi.socket.on("connect", function() {
debug_print("connected");
Expand Down
3 changes: 1 addition & 2 deletions gdbgui/src/js/GdbVariable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ class GdbVariable extends React.Component {
<span className="var_type">{_.trim(mi_obj.type) || ""}</span>

<div className="right_help_icon_show_on_hover">
<CopyToClipboard content={GdbVariable._get_full_path(mi_obj)} />:
{tree}
<CopyToClipboard content={GdbVariable._get_full_path(mi_obj)} />:{tree}
{plot_button}
{delete_button}
</div>
Expand Down
16 changes: 8 additions & 8 deletions gdbgui/src/js/Links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import CopyToClipboard from "./CopyToClipboard";
import MemoryLink from "./MemoryLink";

type Props = {
file?: string
fullname?: string
line: string
num_lines?: number
file?: string;
fullname?: string;
line: string;
num_lines?: number;
};

export class FileLink extends React.Component<Props> {
Expand Down Expand Up @@ -52,10 +52,10 @@ export class FileLink extends React.Component<Props> {
}

type FrameLinkProps = {
addr: string
file?: string
fullname?: string
line: string
addr: string;
file?: string;
fullname?: string;
line: string;
};

export class FrameLink extends React.Component<FrameLinkProps> {
Expand Down
4 changes: 2 additions & 2 deletions gdbgui/src/js/MemoryLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as React from "react";
import Memory from "./Memory.jsx";

type Props = {
addr: string
style?: React.CSSProperties
addr: string;
style?: React.CSSProperties;
};

class MemoryLink extends React.Component<Props> {
Expand Down
4 changes: 3 additions & 1 deletion gdbgui/src/js/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class Settings extends React.Component {
localStorage.setItem("theme", e.currentTarget.value);
}}
>
{store.get("themes").map(t => <option key={t}>{t}</option>)}
{store.get("themes").map(t => (
<option key={t}>{t}</option>
))}
</select>
</td>
</tr>
Expand Down
4 changes: 1 addition & 3 deletions gdbgui/src/js/TopBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ let About = {
show_about: function() {
Actions.show_modal(
"About gdbgui",
<React.Fragment>
Copyright © Chad Smith, grassfedcode.com
</React.Fragment>
<React.Fragment>Copyright © Chad Smith, grassfedcode.com</React.Fragment>
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion gdbgui/src/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let constants = {
BACKTRACE_LINK: "BACKTRACE_LINK",
GDBGUI_OUTPUT: "GDBGUI_OUTPUT",
GDBGUI_OUTPUT_RAW: "GDBGUI_OUTPUT_RAW",
AUTOCOMPLETE_OPTION: "AUTOCOMPLETE_OPTION",
AUTOCOMPLETE_OPTION: "AUTOCOMPLETE_OPTION"
},

source_code_selection_states: {
Expand Down
46 changes: 23 additions & 23 deletions gdbgui/src/js/tests/Util.jest.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import Util from '../Util.js';
import Util from "../Util.js";

/* eslint-env jest */

test('parses spaces', ()=>{
const fn = Util.string_to_array_safe_quotes
expect(fn('hi')).toEqual(['hi'])
expect(fn('"hi bye"')).toEqual(['"hi bye"'])
expect(fn('hi bye')).toEqual(['hi', 'bye'])
expect(fn('hi bye "1 2, 3" asdf\n\t' )).toEqual(['hi', 'bye', '"1 2, 3"', 'asdf\n\t'])
expect(fn('"hi bye" "1 2, 3" asdf\n\t' )).toEqual(['"hi bye"', '"1 2, 3"', 'asdf\n\t'])
})
test("parses spaces", () => {
const fn = Util.string_to_array_safe_quotes;
expect(fn("hi")).toEqual(["hi"]);
expect(fn('"hi bye"')).toEqual(['"hi bye"']);
expect(fn("hi bye")).toEqual(["hi", "bye"]);
expect(fn('hi bye "1 2, 3" asdf\n\t')).toEqual(["hi", "bye", '"1 2, 3"', "asdf\n\t"]);
expect(fn('"hi bye" "1 2, 3" asdf\n\t')).toEqual(['"hi bye"', '"1 2, 3"', "asdf\n\t"]);
});

test('dot version comparison', ()=>{
expect(Util.is_newer('1.0.0', '1.0.0')).toEqual(false)
expect(Util.is_newer('1.0.0', '0.9.9')).toEqual(true)
expect(Util.is_newer('0.1.0', '0.0.9')).toEqual(true)
expect(Util.is_newer('0.0.8', '0.0.9')).toEqual(false)
expect(Util.is_newer('0.11.3.1', '0.11.3.0')).toEqual(true)
expect(Util.is_newer('0.11.4.0', '0.11.3.0')).toEqual(true)
expect(Util.is_newer('0.11.4.0\n', '0.11.3.0')).toEqual(true)
expect(Util.is_newer('0.11.3.0', '0.11.3.0\n')).toEqual(false)
expect(Util.is_newer('0.11.3.0', '0.11.4.0\n')).toEqual(false)
expect(Util.is_newer('0.12.0.0', '0.11.4.0\n')).toEqual(true)
expect(Util.is_newer('1.0.0', '0.11.4.0\n')).toEqual(true)
expect(Util.is_newer('1.0.1', '1.0.0')).toEqual(true)
})
test("dot version comparison", () => {
expect(Util.is_newer("1.0.0", "1.0.0")).toEqual(false);
expect(Util.is_newer("1.0.0", "0.9.9")).toEqual(true);
expect(Util.is_newer("0.1.0", "0.0.9")).toEqual(true);
expect(Util.is_newer("0.0.8", "0.0.9")).toEqual(false);
expect(Util.is_newer("0.11.3.1", "0.11.3.0")).toEqual(true);
expect(Util.is_newer("0.11.4.0", "0.11.3.0")).toEqual(true);
expect(Util.is_newer("0.11.4.0\n", "0.11.3.0")).toEqual(true);
expect(Util.is_newer("0.11.3.0", "0.11.3.0\n")).toEqual(false);
expect(Util.is_newer("0.11.3.0", "0.11.4.0\n")).toEqual(false);
expect(Util.is_newer("0.12.0.0", "0.11.4.0\n")).toEqual(true);
expect(Util.is_newer("1.0.0", "0.11.4.0\n")).toEqual(true);
expect(Util.is_newer("1.0.1", "1.0.0")).toEqual(true);
});
8 changes: 4 additions & 4 deletions gdbgui/src/js/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module 'statorgfc' {
declare module "statorgfc" {
export let store: {
get(key: string): any
}
}
get(key: string): any;
};
}
9 changes: 9 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ def tests(session):

@nox.session(python="3.7")
def lint(session):
session.run(
"npx",
"prettier",
"--check",
"--config",
".prettierrc.js",
"gdbgui/src/js/**/*",
external=True,
)
session.install(*lint_dependencies)
files = ["gdbgui", "tests"] + [str(p) for p in Path(".").glob("*.py")]
session.run("black", "--check", *files)
Expand Down