$(patsubst %.c,%.o,$(COMMON_SFILES)) \
$(SUBDIR_CLI_OBS) \
$(SUBDIR_MI_OBS) \
- $(SUBDIR_TARGET_OBS) \
- $(SUBDIR_GCC_COMPILE_OBS)
+ $(SUBDIR_TARGET_OBS)
SUBDIRS = doc @subdirs@ data-directory
CLEANDIRS = $(SUBDIRS)
* Support for stabs debugging format and the a.out/dbx object format is
deprecated, and will be removed in GDB 18.
+* A new configure option was added, allowing support for the compile
+ subsystem to be disabled at configure time, in the form of
+ --disable-gdb-compile.
+
*** Changes in GDB 16
* Support for Nios II targets has been removed as this architecture
Requires a curses library (ncurses and cursesX are also
supported).
+`--disable-gdb-compile'
+ Build GDB without support for the 'compile' command.
+
`--with-curses'
Use the curses library instead of the termcap library, for
text-mode terminal operations.
}
case compile_control:
+#if defined(HAVE_COMPILE)
eval_compile_command (cmd, NULL, cmd->control_u.compile.scope,
cmd->control_u.compile.scope_data);
ret = simple_control;
+#else
+ error (_("compile support has not been compiled into gdb"));
+#endif
break;
case define_control:
#include "gdbsupport/scoped_ignore_signal.h"
#include "gdbsupport/buildargv.h"
+/* Hold "compile" commands. */
+
+static struct cmd_list_element *compile_command_list;
+
\f
+#ifdef HAVE_COMPILE
/* Initial filename for temporary files. */
#define TMP_PREFIX "/tmp/gdbobj-"
-/* Hold "compile" commands. */
-
-static struct cmd_list_element *compile_command_list;
-
/* Debug flag for "compile" commands. */
bool compile_debug;
#undef FORWARD
+#else /* HAVE_COMPILE */
+
+/* The "compile" prefix command, when support was disabled. */
+
+static void
+compile_command (const char *args, int from_tty)
+{
+ error (_("This command is not supported."));
+}
+
+#endif /* HAVE_COMPILE */
+
/* See compile.h. */
cmd_list_element *compile_cmd_element = nullptr;
void
_initialize_compile ()
{
- struct cmd_list_element *c = NULL;
-
compile_cmd_element = add_prefix_cmd ("compile", class_obscure,
- compile_command, _("\
+ compile_command,
+#ifdef HAVE_COMPILE
+ _("\
Command to compile source code and inject it into the inferior."),
+#else /* HAVE_COMPILE */
+ _("\
+Command to compile source code and inject it into the inferior.\n\
+\n\
+Code compilation and injection is not supported in this copy of GDB.\n\
+This command is only a placeholder."),
+#endif /* HAVE_COMPILE */
&compile_command_list, 1, &cmdlist);
add_com_alias ("expression", compile_cmd_element, class_obscure, 0);
+#ifdef HAVE_COMPILE
+
+ struct cmd_list_element *c = NULL;
+
const auto compile_opts = make_compile_options_def_group (nullptr);
static const std::string compile_code_help
If empty the default target triplet will be searched in $PATH."),
NULL, show_compile_gcc, &setlist,
&showlist);
+#endif /* HAVE_COMPILE */
}
the CoreFoundation framework. */
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
+/* Define if compiling support to gdb compile. */
+#undef HAVE_COMPILE
+
/* Define to 1 if you have the <cursesX.h> header file. */
#undef HAVE_CURSESX_H
with_python
with_python_libdir
with_guile
+enable_gdb_compile
enable_source_highlight
with_sysroot
with_system_gdbinit
--enable-gdbtk enable gdbtk graphical user interface (GUI)
--enable-profiling enable profiling of GDB
--enable-codesign=CERT sign gdb with 'codesign -s CERT'
+ --enable-gdb-compile enable support for the compile subsystem, default
+ 'yes'
--enable-source-highlight
enable source-highlight for source listings
--enable-werror treat compile warnings as errors
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11503 "configure"
+#line 11506 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11609 "configure"
+#line 11612 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
fi
+# ---------------------------- #
+# Check for compile support. #
+# ---------------------------- #
+
+# Check whether --enable-gdb-compile was given.
+if test "${enable_gdb_compile+set}" = set; then :
+ enableval=$enable_gdb_compile;
+ case $enableval in
+ yes | no)
+ ;;
+ *)
+ as_fn_error $? "bad value $enableval for --enable-gdb-compile" "$LINENO" 5
+ ;;
+ esac
+
+else
+ enable_gdb_compile=yes
+fi
+
+
+if test "${enable_gdb_compile}" == yes; then
+
+$as_echo "#define HAVE_COMPILE 1" >>confdefs.h
+
+ CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GCC_COMPILE_OBS)"
+else
+ # Even if compile support is not enabled, we need this file to define
+ # the "compile" command.
+ CONFIG_OBS="$CONFIG_OBS compile/compile.o"
+ CONFIG_SRCS="$CONFIG_SRCS compile/compile.c"
+fi
+
# ---------------------------- #
# Check for source highlight. #
# ---------------------------- #
AC_SUBST(GUILE_LIBS)
AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no)
+# ---------------------------- #
+# Check for compile support. #
+# ---------------------------- #
+
+AC_ARG_ENABLE([gdb-compile],
+ AS_HELP_STRING([--enable-gdb-compile],
+ [enable support for the compile subsystem, default 'yes']),
+ [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-gdb-compile])],
+ [enable_gdb_compile=yes])
+
+if test "${enable_gdb_compile}" == yes; then
+ AC_DEFINE(HAVE_COMPILE, 1, [Define if compiling support to gdb compile.])
+ CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GCC_COMPILE_OBS)"
+else
+ # Even if compile support is not enabled, we need this file to define
+ # the "compile" command.
+ CONFIG_OBS="$CONFIG_OBS compile/compile.o"
+ CONFIG_SRCS="$CONFIG_SRCS compile/compile.c"
+fi
+
# ---------------------------- #
# Check for source highlight. #
# ---------------------------- #
CORE_ADDR pc,
struct symbol *sym)
{
+#if defined (HAVE_COMPILE)
const dwarf2_property_baton *baton = prop->baton ();
const gdb_byte *data;
size_t size;
gdbarch, registers_used,
per_cu->addr_size (),
data, data + size, per_cu, per_objfile);
+#else
+ gdb_assert_not_reached ("Compile support was disabled");
+#endif
}
/* Compute the correct symbol_needs_kind value for the location
std::vector<bool> ®isters_used,
CORE_ADDR pc, const char *result_name)
{
+#if defined (HAVE_COMPILE)
struct dwarf2_locexpr_baton *dlbaton
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (sym);
unsigned int addr_size = dlbaton->per_cu->addr_size ();
sym, pc, gdbarch, registers_used, addr_size,
dlbaton->data, dlbaton->data + dlbaton->size,
dlbaton->per_cu, dlbaton->per_objfile);
+#else
+ gdb_assert_not_reached ("Compile support was disabled");
+#endif
}
/* The set of location functions used with the DWARF-2 expression
std::vector<bool> ®isters_used,
CORE_ADDR pc, const char *result_name)
{
+#if defined (HAVE_COMPILE)
struct dwarf2_loclist_baton *dlbaton
= (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (sym);
unsigned int addr_size = dlbaton->per_cu->addr_size ();
data, data + size,
dlbaton->per_cu,
dlbaton->per_objfile);
+#else
+ gdb_assert_not_reached ("Compile support was disabled");
+#endif
}
/* The set of location functions used with the DWARF-2 expression
proc run_quoting_and_escaping_tests { root } {
# Test all the commands which allow quoting of filenames, and
# which require whitespace to be escaped in unquoted filenames.
- foreach_with_prefix cmd { file exec-file symbol-file add-symbol-file \
- remove-symbol-file \
- "target core" "target exec" "target tfile" \
- "maint print c-tdesc" "compile file" \
- "save gdb-index" "save gdb-index -dwarf-5" } {
+ set all_cmds { file exec-file symbol-file add-symbol-file \
+ remove-symbol-file \
+ "target core" "target exec" "target tfile" \
+ "maint print c-tdesc" "save gdb-index"
+ "save gdb-index -dwarf-5" }
+ if { [allow_compile_tests] } {
+ lappend all_cmds "compile file"
+ }
+ foreach_with_prefix cmd $all_cmds {
# Try each test placing the filename as the first argument
# then again with a quoted string immediately after the
# command. This works because the filename completer will
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++ additional_flags=-std=c++11}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
set options {}
if [test_compiler_info gcc*] {
lappend options additional_flags=-g3
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[prepare_for_testing $testfile $testfile $srcfile \
{debug nowarnings c++}]} {
return -1
require is_c_compiler_gcc
+require allow_compile_tests
+
set options {}
if { [test_compiler_info gcc*] || [test_compiler_info clang*] } {
lappend options additional_flags=-g3
require allow_ifunc_tests
+require allow_compile_tests
+
standard_testfile
require is_c_compiler_gcc
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
+require allow_compile_tests
+
require is_c_compiler_gcc
standard_testfile .c -dbg.S
require is_c_compiler_gcc
+require allow_compile_tests
+
if { [prepare_for_testing "failed to prepare" "$testfile"] } {
return -1
}
require is_c_compiler_gcc
+require allow_compile_tests
+
if { [prepare_for_testing "failed to prepare" $testfile] } {
return -1
}
require is_c_compiler_gcc
+require allow_compile_tests
+
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable {debug}] != "" } {
return -1
load_lib compile-support.exp
+require allow_compile_tests
+
standard_testfile .c compile-shlib.c compile-constvar.S compile-nodebug.c
require is_c_compiler_gcc
# This appears to be a bug in the compiler plugin.
set result "apparent compiler plugin bug"
}
+ -re "This command is not supported." {
+ set result "compiler disabled at configure time"
+ }
-re "\r\n$gdb_prompt $" {
}
}
return [expr {[string first "--with-python" $output] != -1}]
}
+# Return a 1 if GDB was configured to support compile commands.
+gdb_caching_proc allow_compile_tests {} {
+ set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS -ex \"compile int x = 1\" -batch"]
+ return [expr {[string first "The program must be running" $output] != -1}]
+}
+
# Return a 1 for configurations that use system readline rather than the
# in-repo copy.