Implement a new command to show GDB build-time configuration parameters.

* top.c (print_gdb_configuration): New function, displays the
	details about GDB configure-time parameters.
	(print_gdb_version): Mention "show configuration".

	* cli/cli-cmds.c (show_configuration): New function.
	(_initialize_cli_cmds): Add the "show configuration" command.

	* main.c (captured_main) <print_configuration>: New static var.
	<long_options>: Use it.
	If --configuration was given, call print_gdb_configuration.

	* doc/gdb.texinfo (Mode Options): Document '-configuration'.
	(Help): Document "show configuration".
	(Bug Reporting): Add requirements to include the configuration
	details in bug reports.
This commit is contained in:
Eli Zaretskii
2013-04-12 08:57:07 +00:00
parent 3bcd3d1135
commit 6eaaf48b1c
7 changed files with 154 additions and 5 deletions

View File

@@ -1,3 +1,16 @@
2013-04-12 Eli Zaretskii <eliz@gnu.org>
* top.c (print_gdb_configuration): New function, displays the
details about GDB configure-time parameters.
(print_gdb_version): Mention "show configuration".
* cli/cli-cmds.c (show_configuration): New function.
(_initialize_cli_cmds): Add the "show configuration" command.
* main.c (captured_main) <print_configuration>: New static var.
<long_options>: Use it.
If --configuration was given, call print_gdb_configuration.
2013-04-11 Jan Kratochvil <jan.kratochvil@redhat.com> 2013-04-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com> Pedro Alves <palves@redhat.com>

View File

@@ -314,6 +314,12 @@ show_version (char *args, int from_tty)
printf_filtered ("\n"); printf_filtered ("\n");
} }
static void
show_configuration (char *args, int from_tty)
{
print_gdb_configuration (gdb_stdout);
}
/* Handle the quit command. */ /* Handle the quit command. */
void void
@@ -1756,6 +1762,9 @@ the previous command number shown."),
add_cmd ("version", no_set_class, show_version, add_cmd ("version", no_set_class, show_version,
_("Show what version of GDB this is."), &showlist); _("Show what version of GDB this is."), &showlist);
add_cmd ("configuration", no_set_class, show_configuration,
_("Show how GDB was configured at build time."), &showlist);
/* If target is open when baud changes, it doesn't take effect until /* If target is open when baud changes, it doesn't take effect until
the next open (I think, not sure). */ the next open (I think, not sure). */
add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\ add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\

View File

@@ -1,3 +1,10 @@
2013-04-12 Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Mode Options): Document '-configuration'.
(Help): Document "show configuration".
(Bug Reporting): Add requirements to include the configuration
details in bug reports.
2013-04-11 Jan Kratochvil <jan.kratochvil@redhat.com> 2013-04-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (MAN1S): Add gcore.1. * Makefile.in (MAN1S): Add gcore.1.

View File

@@ -1268,6 +1268,12 @@ memory usage after it completes each command and returns to the prompt.
This option causes @value{GDBN} to print its version number and This option causes @value{GDBN} to print its version number and
no-warranty blurb, and exit. no-warranty blurb, and exit.
@item -configuration
@cindex @code{--configuration}
This option causes @value{GDBN} to print details about its build-time
configuration parameters, and then exit. These details can be
important when reporting @value{GDBN} bugs (@pxref{GDB Bugs}).
@end table @end table
@node Startup @node Startup
@@ -1841,7 +1847,7 @@ values, you can use @code{show} with no arguments; you may also use
@end table @end table
@c @end group @c @end group
Here are three miscellaneous @code{show} subcommands, all of which are Here are several miscellaneous @code{show} subcommands, all of which are
exceptional in lacking corresponding @code{set} commands: exceptional in lacking corresponding @code{set} commands:
@table @code @table @code
@@ -1872,6 +1878,15 @@ Display information about permission for copying @value{GDBN}.
Display the @sc{gnu} ``NO WARRANTY'' statement, or a warranty, Display the @sc{gnu} ``NO WARRANTY'' statement, or a warranty,
if your version of @value{GDBN} comes with one. if your version of @value{GDBN} comes with one.
@kindex show configuration
@item show configuration
Display detailed information about the way @value{GDBN} was configured
when it was built. This displays the optional arguments passed to the
@file{configure} script and also configuration parameters detected
automatically by @command{configure}. When reporting a @value{GDBN}
bug (@pxref{GDB Bugs}), it is important to include this information in
your report.
@end table @end table
@node Running @node Running
@@ -34616,6 +34631,12 @@ the bug in the current version of @value{GDBN}.
The type of machine you are using, and the operating system name and The type of machine you are using, and the operating system name and
version number. version number.
@item
The details of the @value{GDBN} build-time configuration.
@value{GDBN} shows these details if you invoke it with the
@option{--configuration} command-line option, or if you type
@code{show configuration} at @value{GDBN}'s prompt.
@item @item
What compiler (and its version) was used to compile @value{GDBN}---e.g.@: What compiler (and its version) was used to compile @value{GDBN}---e.g.@:
``@value{GCC}--2.8.1''. ``@value{GCC}--2.8.1''.

View File

@@ -321,6 +321,7 @@ captured_main (void *data)
initializer. */ initializer. */
static int print_help; static int print_help;
static int print_version; static int print_version;
static int print_configuration;
/* Pointers to all arguments of --command option. */ /* Pointers to all arguments of --command option. */
VEC (cmdarg_s) *cmdarg_vec = NULL; VEC (cmdarg_s) *cmdarg_vec = NULL;
@@ -483,6 +484,7 @@ captured_main (void *data)
{"command", required_argument, 0, 'x'}, {"command", required_argument, 0, 'x'},
{"eval-command", required_argument, 0, 'X'}, {"eval-command", required_argument, 0, 'X'},
{"version", no_argument, &print_version, 1}, {"version", no_argument, &print_version, 1},
{"configuration", no_argument, &print_configuration, 1},
{"x", required_argument, 0, 'x'}, {"x", required_argument, 0, 'x'},
{"ex", required_argument, 0, 'X'}, {"ex", required_argument, 0, 'X'},
{"init-command", required_argument, 0, OPT_IX}, {"init-command", required_argument, 0, OPT_IX},
@@ -726,8 +728,9 @@ captured_main (void *data)
} }
} }
/* If --help or --version, disable window interface. */ /* If --help or --version or --configuration, disable window
if (print_help || print_version) interface. */
if (print_help || print_version || print_configuration)
{ {
use_windows = 0; use_windows = 0;
} }
@@ -818,6 +821,14 @@ captured_main (void *data)
exit (0); exit (0);
} }
if (print_configuration)
{
print_gdb_configuration (gdb_stdout);
wrap_here ("");
printf_filtered ("\n");
exit (0);
}
/* FIXME: cagney/2003-02-03: The big hack (part 1 of 2) that lets /* FIXME: cagney/2003-02-03: The big hack (part 1 of 2) that lets
GDB retain the old MI1 interpreter startup behavior. Output the GDB retain the old MI1 interpreter startup behavior. Output the
copyright message before the interpreter is installed. That way copyright message before the interpreter is installed. That way
@@ -1129,6 +1140,7 @@ Options:\n\n\
#endif #endif
fputs_unfiltered (_("\ fputs_unfiltered (_("\
--version Print version information and then exit.\n\ --version Print version information and then exit.\n\
--configuration Print details about GDB configuration and then exit.\n\
-w Use a window interface.\n\ -w Use a window interface.\n\
--write Set writing into executable and core files.\n\ --write Set writing into executable and core files.\n\
--xdb XDB compatibility mode.\n\ --xdb XDB compatibility mode.\n\

View File

@@ -1148,7 +1148,8 @@ and \"show warranty\" for details.\n");
{ {
fprintf_filtered (stream, "%s", host_name); fprintf_filtered (stream, "%s", host_name);
} }
fprintf_filtered (stream, "\"."); fprintf_filtered (stream, "\".\n\
Type \"show configuration\" for configuration details.");
if (REPORT_BUGS_TO[0]) if (REPORT_BUGS_TO[0])
{ {
@@ -1157,6 +1158,91 @@ and \"show warranty\" for details.\n");
fprintf_filtered (stream, "%s.", REPORT_BUGS_TO); fprintf_filtered (stream, "%s.", REPORT_BUGS_TO);
} }
} }
/* Print the details of GDB build-time configuration. */
void
print_gdb_configuration (struct ui_file *stream)
{
fprintf_filtered (stream, _("\
This GDB was configured as follows:\n\
configure --host=%s --target=%s\n\
"), host_name, target_name);
fprintf_filtered (stream, _("\
--with-auto-load-dir=%s\n\
--with-auto-load-safe-path=%s\n\
"), AUTO_LOAD_DIR, AUTO_LOAD_SAFE_PATH);
#if HAVE_LIBEXPAT
fprintf_filtered (stream, _("\
--with-expat\n\
"));
#else
fprintf_filtered (stream, _("\
--without-expat\n\
"));
#endif
if (GDB_DATADIR[0])
fprintf_filtered (stream, _("\
--with-gdb-datadir=%s%s\n\
"), GDB_DATADIR, GDB_DATADIR_RELOCATABLE ? " (relocatable)" : "");
#ifdef ICONV_BIN
fprintf_filtered (stream, _("\
--with-iconv-bin=%s%s\n\
"), ICONV_BIN, ICONV_BIN_RELOCATABLE ? " (relocatable)" : "");
#endif
if (JIT_READER_DIR[0])
fprintf_filtered (stream, _("\
--with-jit-reader-dir=%s%s\n\
"), JIT_READER_DIR, JIT_READER_DIR_RELOCATABLE ? " (relocatable)" : "");
#if HAVE_LIBUNWIND_IA64_H
fprintf_filtered (stream, _("\
--with-libunwind-ia64\n\
"));
#else
fprintf_filtered (stream, _("\
--without-libunwind-ia64\n\
"));
#endif
#if HAVE_LIBLZMA
fprintf_filtered (stream, _("\
--with-lzma\n\
"));
#else
fprintf_filtered (stream, _("\
--without-lzma\n\
"));
#endif
#ifdef WITH_PYTHON_PATH
fprintf_filtered (stream, _("\
--with-python=%s%s\n\
"), WITH_PYTHON_PATH, PYTHON_PATH_RELOCATABLE ? " (relocatable)" : "");
#endif
#ifdef RELOC_SRCDIR
fprintf_filtered (stream, _("\
--with-relocated-sources=%s\n\
"), RELOC_SRCDIR);
#endif
if (DEBUGDIR[0])
fprintf_filtered (stream, _("\
--with-separate-debug-dir=%s%s\n\
"), DEBUGDIR, DEBUGDIR_RELOCATABLE ? " (relocatable)" : "");
if (TARGET_SYSTEM_ROOT[0])
fprintf_filtered (stream, _("\
--with-sysroot=%s%s\n\
"), TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_RELOCATABLE ? " (relocatable)" : "");
if (SYSTEM_GDBINIT[0])
fprintf_filtered (stream, _("\
--with-system-gdbinit=%s%s\n\
"), SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE ? " (relocatable)" : "");
#if HAVE_ZLIB_H
fprintf_filtered (stream, _("\
--with-zlib\n\
"));
#else
fprintf_filtered (stream, _("\
--without-zlib\n\
"));
#endif
}
/* The current top level prompt, settable with "set prompt", and/or /* The current top level prompt, settable with "set prompt", and/or

View File

@@ -31,6 +31,7 @@ extern int inhibit_gdbinit;
extern char gdbinit[]; extern char gdbinit[];
extern void print_gdb_version (struct ui_file *); extern void print_gdb_version (struct ui_file *);
extern void print_gdb_configuration (struct ui_file *);
extern void read_command_file (FILE *); extern void read_command_file (FILE *);
extern void init_history (void); extern void init_history (void);