From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Remove two initialization functions
Date: Sat, 6 Aug 2022 12:52:01 -0600 [thread overview]
Message-ID: <20220806185201.1522864-1-tom@tromey.com> (raw)
I noticed a couple of initialization functions that aren't really
needed, and that currently require explicit calls in gdb_init. This
patch removes these functions, simplifying gdb a little.
Regression tested on x86-64 Fedora 34.
---
gdb/cli/cli-cmds.c | 8 +-------
gdb/cli/cli-cmds.h | 2 --
gdb/top.c | 23 +++++++----------------
3 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 18fb6e6d869..d5707192be0 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -76,7 +76,7 @@ static void filter_sals (std::vector<symtab_and_line> &);
\f
/* See cli-cmds.h. */
-unsigned int max_user_call_depth;
+unsigned int max_user_call_depth = 1024;
/* Define all cmd_list_elements. */
@@ -2105,12 +2105,6 @@ filter_sals (std::vector<symtab_and_line> &sals)
sals.erase (from, sals.end ());
}
-void
-init_cmd_lists (void)
-{
- max_user_call_depth = 1024;
-}
-
static void
show_info_verbose (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 770abecab8a..89ad0d199d2 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -151,8 +151,6 @@ extern unsigned int max_user_call_depth;
/* Exported to gdb/top.c */
-void init_cmd_lists (void);
-
int is_complete_command (struct cmd_list_element *cmd);
/* Exported to gdb/main.c */
diff --git a/gdb/top.c b/gdb/top.c
index 453fa236db1..07e491440e4 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2231,17 +2231,6 @@ show_startup_quiet (struct ui_file *file, int from_tty,
value);
}
-static void
-init_gdb_version_vars (void)
-{
- struct internalvar *major_version_var = create_internalvar ("_gdb_major");
- struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
- int vmajor = 0, vminor = 0, vrevision = 0;
- sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision);
- set_internalvar_integer (major_version_var, vmajor);
- set_internalvar_integer (minor_version_var, vminor + (vrevision > 0));
-}
-
static void
init_main (void)
{
@@ -2405,6 +2394,13 @@ Usage: new-ui INTERPRETER TTY\n\
The first argument is the name of the interpreter to run.\n\
The second argument is the terminal the UI runs on."), &cmdlist);
set_cmd_completer (c, interpreter_completer);
+
+ struct internalvar *major_version_var = create_internalvar ("_gdb_major");
+ struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
+ int vmajor = 0, vminor = 0, vrevision = 0;
+ sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision);
+ set_internalvar_integer (major_version_var, vmajor);
+ set_internalvar_integer (minor_version_var, vminor + (vrevision > 0));
}
/* See top.h. */
@@ -2423,8 +2419,6 @@ gdb_init ()
make_final_cleanup (do_chdir_cleanup, xstrdup (current_directory));
#endif
- init_cmd_lists (); /* This needs to be done first. */
-
init_page_info ();
/* Here is where we call all the _initialize_foo routines. */
@@ -2454,9 +2448,6 @@ gdb_init ()
during startup. */
set_language (language_c);
expected_language = current_language; /* Don't warn about the change. */
-
- /* Create $_gdb_major and $_gdb_minor convenience variables. */
- init_gdb_version_vars ();
}
void _initialize_top ();
--
2.34.1
next reply other threads:[~2022-08-06 18:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-06 18:52 Tom Tromey [this message]
2022-08-19 14:20 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220806185201.1522864-1-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).