diff options
author | Tom Tromey <tromey@redhat.com> | 2014-05-14 14:35:45 -0600 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2014-12-12 22:28:44 +0100 |
commit | bb2ec1b34e7cc8d8602512235016e74b800dac3b (patch) | |
tree | 6fb368ff4d35c37a24d434d5d7348d8dd8850ca7 /gdb/Makefile.in | |
parent | a2658febe2016f875ffb70287904b01013bcca75 (diff) | |
download | gdb-bb2ec1b34e7cc8d8602512235016e74b800dac3b.zip gdb-bb2ec1b34e7cc8d8602512235016e74b800dac3b.tar.gz gdb-bb2ec1b34e7cc8d8602512235016e74b800dac3b.tar.bz2 |
the "compile" command
This final patch adds the new "compile" command and subcommands, and
all the machinery needed to make it work.
A shared library supplied by gcc is used for all communications with
gcc. Types and most aspects of symbols are provided directly by gdb
to the compiler using this library.
gdb provides some information about the user's code using plain text.
Macros are emitted this way, and DWARF location expressions (and
bounds for VLA) are compiled to C code.
This hybrid approach was taken because, on the one hand, it is better
to provide global declarations and such on demand; but on the other
hand, for local variables, translating DWARF location expressions to C
was much simpler than exporting a full compiler API to gdb -- the same
result, only easier to implement, understand, and debug.
In the ordinary mode, the user's expression is wrapped in a dummy
function. After compilation, gdb inserts the resulting object code
into the inferior, then calls this function.
Access to local variables is provided by noting which registers are
used by location expressions, and passing a structure of register
values into the function. Writes to registers are supported by
copying out these values after the function returns.
This approach was taken so that we could eventually implement other
more interesting features based on this same infrastructure; for
example, we're planning to investigate inferior-side breakpoint
conditions.
gdb/ChangeLog
2014-12-12 Phil Muldoon <pmuldoon@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>
* NEWS: Update.
* symtab.h (struct symbol_computed_ops) <generate_c_location>: New
field.
* p-lang.c (pascal_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* language.h (struct language_defn) <la_get_compile_instance,
la_compute_program>: New fields.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Update.
* jv-lang.c (java_language_defn): Update.
* go-lang.c (go_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* dwarf2loc.h (dwarf2_compile_property_to_c): Declare.
* dwarf2loc.c (dwarf2_compile_property_to_c)
(locexpr_generate_c_location, loclist_generate_c_location): New
functions.
(dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Update.
* defs.h (enum compile_i_scope_types): New.
(enum command_control_type) <compile_control>: New constant.
(struct command_line) <control_u>: New field.
* d-lang.c (d_language_defn): Update.
* compile/compile.c: New file.
* compile/compile-c-support.c: New file.
* compile/compile-c-symbols.c: New file.
* compile/compile-c-types.c: New file.
* compile/compile.h: New file.
* compile/compile-internal.h: New file.
* compile/compile-loc2c.c: New file.
* compile/compile-object-load.c: New file.
* compile/compile-object-load.h: New file.
* compile/compile-object-run.c: New file.
* compile/compile-object-run.h: New file.
* cli/cli-script.c (multi_line_command_p, print_command_lines)
(execute_control_command, process_next_line)
(recurse_read_control_structure): Handle compile_control.
* c-lang.h (c_get_compile_context, c_compute_program): Declare.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* ada-lang.c (ada_language_defn): Update.
* Makefile.in (SUBDIR_GCC_COMPILE_OBS, SUBDIR_GCC_COMPILE_SRCS):
New variables.
(SFILES): Add SUBDIR_GCC_COMPILE_SRCS.
(HFILES_NO_SRCDIR): Add compile.h.
(COMMON_OBS): Add SUBDIR_GCC_COMPILE_OBS.
(INIT_FILES): Add SUBDIR_GCC_COMPILE_SRCS.
(compile.o, compile-c-types.o, compile-c-symbols.o)
(compile-object-load.o, compile-object-run.o, compile-loc2c.o)
(compile-c-support.o): New targets.
gdb/doc/ChangeLog
2014-12-12 Phil Muldoon <pmuldoon@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Altering): Update.
(Compiling and Injecting Code): New node.
gdb/testsuite/ChangeLog
2014-12-12 Phil Muldoon <pmuldoon@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>
* configure.ac: Add gdb.compile/.
* configure: Regenerate.
* gdb.compile/Makefile.in: New file.
* gdb.compile/compile-ops.exp: New file.
* gdb.compile/compile-ops.c: New file.
* gdb.compile/compile-tls.c: New file.
* gdb.compile/compile-tls.exp: New file.
* gdb.compile/compile-constvar.S: New file.
* gdb.compile/compile-constvar.c: New file.
* gdb.compile/compile-mod.c: New file.
* gdb.compile/compile-nodebug.c: New file.
* gdb.compile/compile-setjmp-mod.c: New file.
* gdb.compile/compile-setjmp.c: New file.
* gdb.compile/compile-setjmp.exp: New file.
* gdb.compile/compile-shlib.c: New file.
* gdb.compile/compile.c: New file.
* gdb.compile/compile.exp: New file.
* lib/gdb.exp (skip_compile_feature_tests): New proc.
Diffstat (limited to 'gdb/Makefile.in')
-rw-r--r-- | gdb/Makefile.in | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 81c8c94..2f69eb2 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -280,6 +280,24 @@ SUBDIR_TUI_LDFLAGS= SUBDIR_TUI_CFLAGS= \ -DTUI=1 +# +# GCC Compile support sub-directory definitions +# +SUBDIR_GCC_COMPILE_OBS = \ + compile.o compile-c-symbols.o compile-c-types.o \ + compile-object-load.o compile-object-run.o \ + compile-loc2c.o compile-c-support.o +SUBDIR_GCC_COMPILE_SRCS = \ + compile/compile.c \ + compile/compile-c-symbols.c \ + compile/compile-c-types.c \ + compile/compile-object-load.c \ + compile/compile-object-load.h \ + compile/compile-object-run.c \ + compile/compile-object-run.h \ + compile/compile-loc2c.c \ + compile/compile-c-support.c + # Guile sub directory definitons for guile support. SUBDIR_GUILE_OBS = \ @@ -854,7 +872,8 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ common/ptid.c common/buffer.c gdb-dlfcn.c common/agent.c \ common/format.c common/filestuff.c btrace.c record-btrace.c ctf.c \ target/waitstatus.c common/print-utils.c common/rsp-low.c \ - common/errors.c common/common-debug.c common/common-exceptions.c + common/errors.c common/common-debug.c common/common-exceptions.c \ + $(SUBDIR_GCC_COMPILE_SRCS) LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c @@ -876,7 +895,7 @@ nto-tdep.h serial.h \ c-lang.h d-lang.h go-lang.h frame.h event-loop.h block.h cli/cli-setshow.h \ cli/cli-decode.h cli/cli-cmds.h cli/cli-utils.h \ cli/cli-script.h macrotab.h symtab.h common/version.h \ -gnulib/import/string.in.h gnulib/import/str-two-way.h \ +compile/compile.h gnulib/import/string.in.h gnulib/import/str-two-way.h \ gnulib/import/stdint.in.h remote.h remote-notif.h gdb.h sparc-nat.h \ gdbthread.h dwarf2-frame.h dwarf2-frame-tailcall.h nbsd-nat.h dcache.h \ amd64-nat.h s390-linux-tdep.h arm-linux-tdep.h exceptions.h macroscope.h \ @@ -1041,7 +1060,8 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o \ format.o registry.o btrace.o record-btrace.o waitstatus.o \ print-utils.o rsp-low.o errors.o common-debug.o debug.o \ - common-exceptions.o + common-exceptions.o \ + $(SUBDIR_GCC_COMPILE_OBS) TSOBS = inflow.o @@ -1284,7 +1304,7 @@ test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY) # duplicates. Files in the gdb/ directory can end up appearing in # COMMON_OBS (as a .o file) and CONFIG_SRCS (as a .c file). -INIT_FILES = $(COMMON_OBS) $(TSOBS) $(CONFIG_SRCS) +INIT_FILES = $(COMMON_OBS) $(TSOBS) $(CONFIG_SRCS) $(SUBDIR_GCC_COMPILE_SRCS) init.c: $(INIT_FILES) @echo Making init.c @rm -f init.c-tmp init.l-tmp @@ -1916,6 +1936,39 @@ cli-utils.o: $(srcdir)/cli/cli-utils.c $(COMPILE) $(srcdir)/cli/cli-utils.c $(POSTCOMPILE) +# GCC Compile support dependencies +# +# Need to explicitly specify the compile rule as make will do nothing +# or try to compile the object file into the sub-directory. + +compile.o: $(srcdir)/compile/compile.c + $(COMPILE) $(srcdir)/compile/compile.c + $(POSTCOMPILE) + +compile-c-types.o: $(srcdir)/compile/compile-c-types.c + $(COMPILE) $(srcdir)/compile/compile-c-types.c + $(POSTCOMPILE) + +compile-c-symbols.o: $(srcdir)/compile/compile-c-symbols.c + $(COMPILE) $(srcdir)/compile/compile-c-symbols.c + $(POSTCOMPILE) + +compile-object-load.o: $(srcdir)/compile/compile-object-load.c + $(COMPILE) $(srcdir)/compile/compile-object-load.c + $(POSTCOMPILE) + +compile-object-run.o: $(srcdir)/compile/compile-object-run.c + $(COMPILE) $(srcdir)/compile/compile-object-run.c + $(POSTCOMPILE) + +compile-loc2c.o: $(srcdir)/compile/compile-loc2c.c + $(COMPILE) $(srcdir)/compile/compile-loc2c.c + $(POSTCOMPILE) + +compile-c-support.o: $(srcdir)/compile/compile-c-support.c + $(COMPILE) $(srcdir)/compile/compile-c-support.c + $(POSTCOMPILE) + # # GDBTK sub-directory |