Skip to content

Instantly share code, notes, and snippets.

@o11c
Created May 15, 2017 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save o11c/a84d36383711ea3a7a682681a34146d1 to your computer and use it in GitHub Desktop.
Save o11c/a84d36383711ea3a7a682681a34146d1 to your computer and use it in GitHub Desktop.
Draft at fixing the `tty` bug
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 2a5b128d56..618640cffe 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1710,6 +1710,11 @@ void
_initialize_cli_cmds (void)
{
struct cmd_list_element *c;
+ /* Called more than once due to ordering dependencies. */
+ static bool initialized = false;
+ if (initialized)
+ return;
+ initialized = true;
/* Define the classes of commands.
They will appear in the help list in alphabetical order. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index f42c6d132a..3b997bcd18 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -3199,6 +3199,9 @@ _initialize_infcmd (void)
struct cmd_list_element *c = NULL;
const char *cmd_name;
+ extern initialize_file_ftype _initialize_cli_cmds;
+ _initialize_cli_cmds();
+
/* Add the filename of the terminal connected to inferior I/O. */
add_setshow_optional_filename_cmd ("inferior-tty", class_run,
&inferior_io_terminal_scratch, _("\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment