introduce ui_file_write_for_put

This introduces a small helper function, ui_file_write_for_put.  It is
a wrapper for ui_write that is suitable for passing directly to
ui_file_put.

This patch also updates one existing spot to use this new function.

2014-05-14  Tom Tromey  <tromey@redhat.com>

	* ui-file.h (ui_file_write_for_put): Declare.
	* ui-file.c (ui_file_write_for_put): New function.
	* mi/mi-out.c (do_write): Remove.
	(mi_out_put): Use ui_file_write_for_put.
add gcc/gdb interface files

The gcc plugin is split into two parts.  One part is an ordinary gcc
plugin.  The other part is a shared library that is loaded by gdb.

This patch adds some files that define the interface exported by this
shared library to gdb.  These files also define the internal API by
which the gdb- and gcc-sides communicate.

These files will be kept in sync between gcc and gdb like much of
include/.

The exported API has been intentionally kept very simple.  In
particular only a single function is exported from the gdb-side
library; symbol visibility is used to hide everything else.  This
exported symbol is a function which is called to return a structure
holding function pointers that gdb then uses.  This structure is
versioned so that changes can be made without necessarily requiring a
simultaneous gdb upgrade.

Note that the C compiler API is broken out separately.  This lets us
extend it to other GCC front ends as desired.  We plan to investigate
C++ in the future.

2014-05-12  Phil Muldoon  <pmuldoon@redhat.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* gcc-c-fe.def: New file.
	* gcc-c-interface.h: New file.
	* gcc-interface.h: New file.
add some missing ops to DWARF assembler

This changes the DWARF assembler to allow comments in a location
expression, and also adds support for a few new opcodes I needed.

2014-05-14  Tom Tromey  <tromey@redhat.com>

	* lib/dwarf.exp (_location): Ignore blank lines.  Allow comments.
	Handle DW_OP_pick, DW_OP_skip, DW_OP_bra.
add make_unqualified_type

There's seemingly no function to get the unqualified variant of a
type, so this patch adds one.  This new function will be used in the
final patch.

2014-05-14  Tom Tromey  <tromey@redhat.com>

	* gdbtypes.h (make_unqualified_type): Declare.
	* gdbtypes.c (make_unqualified_type): New function.
change how the CLI handles comments

When using the multi-line feature, we don't want the gdb CLI to remove
comments from the command list, as this will remove things like
"#define".

This patch moves the comment feature into command_loop to avoid this
problem.

2014-05-14  Phil Muldoon  <pmuldoon@redhat.com>

	* top.c (command_loop): Handle comments here...
	(command_line_input): ... not here.
add dummy frame destructor

The compiler code needed a hook into dummy frame destruction, so that
some state could be kept while the inferior call is made and then
destroyed when the inferior call finishes.

This patch adds an optional destructor to dummy frames and a new API
to access it.

2014-05-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dummy-frame.c (struct dummy_frame) <dtor, dtor_data>: New
	fields.
	(pop_dummy_frame): Call the destructor if it exists.
	(register_dummy_frame_dtor, find_dummy_frame_dtor): New
	functions.
	* dummy-frame.h (dummy_frame_dtor_ftype): New typedef.
	(register_dummy_frame_dtor, find_dummy_frame_dtor): Declare.
add infcall_mmap and gcc_target_options gdbarch methods

2014-05-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* arch-utils.c (default_infcall_mmap)
	(default_gcc_target_options): New functions.
	* arch-utils.h (default_infcall_mmap, default_gcc_target_options):
	Declare.
	* gdbarch.h: Rebuild.
	* gdbarch.c: Rebuild.
	* gdbarch.sh (infcall_mmap, gcc_target_options): New methods.
introduce call_function_by_hand_dummy

Possibly merge with the dummy-frame patch?

2014-05-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* infcall.h (call_function_by_hand_dummy): Declare.
	* infcall.c (call_function_by_hand): Use
	call_function_by_hand_dummy.
	(call_function_by_hand_dummy): Rename from call_function_by_hand.
	Add arguments.  Register a destructor.
split dwarf2_fetch_cfa_info from dwarf2_compile_expr_to_ax

This removes dwarf2_compile_expr_to_ax, replacing it with a utility
function that fetches the CFA data and adding the code to actually
compile to an agent expression directly into
dwarf2_compile_expr_to_ax.  This refactoring lets a later patch reuse
the new dwarf2_fetch_cfa_info.

2014-05-14  Tom Tromey  <tromey@redhat.com>

	* dwarf2loc.c (dwarf2_compile_expr_to_ax) <DW_OP_call_frame_cfa>:
	Update.
	* dwarf2-frame.c (dwarf2_fetch_cfa_info): New function, based on
	dwarf2_compile_cfa_to_ax.
	(dwarf2_compile_cfa_to_ax): Remove.
	* dwarf2-frame.h (dwarf2_fetch_cfa_info): Declare.
	(dwarf2_compile_cfa_to_ax): Remove.
make dwarf_expr_frame_base_1 public

This exports dwarf_expr_frame_base_1 so that other code can use it.

2014-05-14  Tom Tromey  <tromey@redhat.com>

	* dwarf2loc.h (dwarf_expr_frame_base_1): Declare.
	* dwarf2loc.c (dwarf_expr_frame_base_1): Now public.
export dwarf2_reg_to_regnum_or_error

This exports a utility function, dwarf2_reg_to_regnum_or_error, that
was previously private to dwarf2loc.c.

2014-05-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dwarf2loc.h (dwarf2_reg_to_regnum_or_error): Declare.
	* dwarf2loc.c (dwarf2_reg_to_regnum_or_error): Rename from
	translate_register.  Now public.
	(dwarf2_compile_expr_to_ax): Update.
add linux_infcall_mmap

This implements the new gdbarch "infcall_mmap" method for Linux.

merge with the gdbarch patch?

2014-05-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* linux-tdep.c (linux_infcall_mmap): New function.
	(linux_init_abi): Add it to gdbarch.
add s390_gcc_target_options

This adds s390_gcc_target_options, an implementation of the new
"gcc_target_options" gdbarch method.

2014-05-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* s390-linux-tdep.c (s390_gcc_target_options): New function.
	(s390_gdbarch_init): Add it to gdbarch.
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.

2014-05-15  Phil Muldoon  <pmuldoon@redhat.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* 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.

2014-05-15  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Altering): Update.
	(Compiling and Injecting Code): New node.

2014-05-15  Phil Muldoon  <pmuldoon@redhat.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* gdb.dwarf2/compile-ops.exp: New file.
	* gdb.threads/compile-tls.c: New file.
	* gdb.threads/compile-tls.exp: New file.
	* gdb.base/compile-constvar.S: New file.
	* gdb.base/compile-constvar.c: New file.
	* gdb.base/compile-mod.c: New file.
	* gdb.base/compile-nodebug.c: New file.
	* gdb.base/compile-setjmp-mod.c: New file.
	* gdb.base/compile-setjmp.c: New file.
	* gdb.base/compile-setjmp.exp: New file.
	* gdb.base/compile-shlib.c: New file.
	* gdb.base/compile.c: New file.
	* gdb.base/compile.exp: New file.