Commit Graph

91565 Commits

Author SHA1 Message Date
Tom Tromey 50feb4bd43 Use std::string in ctf_start
This changes ctf_start to use std::string, allowing for some cleanup
removal.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* ctf.c (ctf_start): Use std::string.
2017-09-11 16:15:12 -06:00
Tom Tromey c6dc63a162 Remove cleanups from find_frame_funname
This changes find_frame_funname to return a unique_xmalloc_ptr and
then fixes up the callers.  This removes several cleanups.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (is_known_support_routine): Update.
	(ada_unhandled_exception_name_addr_from_raise): Update.
	* guile/scm-frame.c (gdbscm_frame_name): Update.
	* python/py-frame.c (frapy_name): Update.
	(frapy_function): Update.
	* stack.h (find_frame_funname): Update.
	* stack.c (find_frame_funname): Return unique_xmalloc_ptr.
	(print_frame): Update.
2017-09-11 16:15:11 -06:00
Tom Tromey d6b9b80f94 Remove cleanups from findcmd.c
This removes cleanups from findcmd.c, replacing manual buffer
management with a gdb::byte_vector.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* findcmd.c (put_bits): Take a gdb::byte_vector.
	(parse_find_args): Return gdb::byte_vector.  "args" now const.
	Remove "pattern_bufp" and "pattern_lenp" parameters.  Remove
	cleanups.
	(find_command): Update.
2017-09-11 16:15:10 -06:00
Tom Tromey a9921622de Replace clear_hook_in_cleanup with scoped_restore_hook_in
This removes clear_hook_in_cleanup in favor of a scoped_restore-like
class.  scoped_restore itself can't be used because hook_in is a
bitfield.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* cli/cli-script.c (class scoped_restore_hook_in): New.
	(clear_hook_in_cleanup): Remove.
	(execute_cmd_pre_hook, execute_cmd_post_hook): Use
	scoped_restore_hook_in.
2017-09-11 16:15:09 -06:00
Tom Tromey be0d7abb5e Replace interp_set_temp with scoped_restore_interp
This removes interp_set_temp and an associated cleanup, in favor of a
new RAII class, scoped_restore_interp.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* cli/cli-script.c (restore_interp): Remove.
	(read_command_lines): Use scoped_restore_interp.
	* interps.c (scoped_restore_interp::set_temp): Rename from
	interp_set_temp.
	* interps.h (class scoped_restore_interp): New.
	(interp_set_temp): Remove.
2017-09-11 16:15:08 -06:00
Tom Tromey 00f675ff65 Change setup_breakpoint_reporting to return a scoped_restore
This changes setup_breakpoint_reporting to return a scoped_restore,
allowing for some cleanup removal.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* mi/mi-cmd-catch.c (mi_cmd_catch_assert)
	(mi_cmd_catch_exception, mi_catch_load_unload): Update.
	* mi/mi-cmd-break.c (setup_breakpoint_reporting): Return a
	scoped_restore.
	(mi_cmd_break_insert_1): Update.
	* mi/mi-cmd-break.h (setup_breakpoint_reporting): Return a
	scoped_restore.
2017-09-11 16:15:07 -06:00
Tom Tromey cb791d5948 Make extract_arg return a std::string
Change extract_arg to return a std::string and fix up all the users.
I think string is mildly better than unique_xmalloc_ptr<char>, when
possible, because it provides a more robust API.

I changed the error messages emitted from find_location_by_number to
avoid either writing to a string or an extra allocation; this can be
changed but I thought that the new message was not any less clear.
You can see an example in the testsuite patch.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* demangle.c (demangle_command): Update.
	* breakpoint.c (disable_command): Update.
	(enable_command): Update.
	(find_location_by_number): Make "number" const.  Use
	get_number_trailer.
	* cli/cli-utils.c (extract_arg): Return std::string.
	* probe.c (parse_probe_linespec): Update.  Change types.
	(collect_probes): Take string arguments.
	(parse_probe_linespec): Likewise.
	(info_probes_for_ops): Update.
	(enable_probes_command): Update.
	(disable_probes_command): Update.
	* break-catch-sig.c (catch_signal_split_args): Update.
	* mi/mi-parse.c (mi_parse): Update.

testsuite/ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* gdb.base/ena-dis-br.exp (test_ena_dis_br): Update test.
2017-09-11 15:46:14 -06:00
Tom Tromey 2039bd9f0c Constify language_enum
Change language_enum to take a const argument.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* language.h (language_enum): Make argument const.
	* language.c (language_enum): Make argument const.
2017-09-11 15:46:13 -06:00
Tom Tromey f1735a53a6 Rename _const functions to use overloading instead
This renames a few functions -- skip_spaces_const,
skip_to_space_const, get_number_const, extract_arg_const -- to drop
the "_const" suffix and instead rely on overloading.

This makes future const fixes simpler by reducing the number of lines
that must be changed.  I think it is also not any less clear, as all
these functions have the same interface as their non-const versions by
design.  Furthermore there's an example of using an overload in-tree
already, namely check_for_argument.

This patch was largely created using some perl one-liners; then a few
fixes were applied by hand.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* common/common-utils.h (skip_to_space): Remove macro, redeclare
	as function.
	(skip_to_space): Rename from skip_to_space_const.
	* common/common-utils.c (skip_to_space): New function.
	(skip_to_space): Rename from skip_to_space_const.
	* cli/cli-utils.h (get_number): Rename from get_number_const.
	(extract_arg): Rename from extract_arg_const.
	* cli/cli-utils.c (get_number): Rename from get_number_const.
	(extract_arg): Rename from extract_arg_const.
	(number_or_range_parser::get_number): Use ::get_number.
	* aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c,
	break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c,
	cli/cli-script.c, cli/cli-setshow.c, compile/compile.c,
	completer.c, demangle.c, disasm.c, findcmd.c, linespec.c,
	linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c,
	minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c,
	python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c,
	stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-11 15:46:12 -06:00
Tom Tromey 7d221d749c Make it simpler to add events to Python
The first patch in this series went through several iterations as I'd
forgotten how many places had to be touched to add a new event and a
new event type.

This patch simplifies the process using two new ".def" files.  Now, a
new event type can be added by adding a line to "py-event-types.def",
and a new event registry can be added by adding a line to
"py-all-events.def".

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* python/python.c (do_start_initialization): Use
	py-event-types.def to initialize types.
	Define all object type structures.
	* python/python-internal.h: Don't declare event initialization
	functions.
	* python/py-threadevent.c (thread_event_object_type): Don't
	define.
	* python/py-stopevent.c (stop_event_object_type): Don't define.
	* python/py-signalevent.c (signal_event_object_type): Don't
	declare or define.
	* python/py-newobjfileevent.c (new_objfile_event_object_type)
	(clear_objfiles_event_object_type): Don't declare or define.
	* python/py-infevents.c (inferior_call_pre_event_object_type)
	(inferior_call_post_event_object_type)
	(register_changed_event_object_type)
	(memory_changed_event_object_type): Don't declare or define.
	* python/py-inferior.c (new_thread_event_object_type)
	(new_inferior_event_object_type)
	(inferior_deleted_event_object_type): Don't declare or define.
	* python/py-exitedevent.c (exited_event_object_type): Don't
	declare or define.
	* python/py-evts.c (gdbpy_initialize_py_events): Use
	py-all-events.def.
	* python/py-events.h (thread_event_object_type): Don't declare.
	(events_object): Use py-all-events.def.
	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove.  Use
	py-event-types.def.
	* python/py-event-types.def: New file.
	* python/py-continueevent.c (create_continue_event_object): Don't
	declare or define.
	* python/py-bpevent.c (breakpoint_event_object_type): Don't
	declare or define.
	* python/py-all-events.def: New file.
2017-09-11 14:15:22 -06:00
Tom Tromey 35c61a1dd5 Small event ownership clean up in Python layer
It seems cleaner to me for functions like create_thread_event_object,
which pass object ownership to their callers, to directly return a
gdb_ref<>.  This way the ownership transfer is part of the API.  This
patch makes this change.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* python/py-threadevent.c (create_thread_event_object): Return
	gdbpy_ref.
	* python/py-stopevent.h (create_stop_event_object)
	(create_breakpoint_event_object, create_signal_event_object):
	Update.
	* python/py-stopevent.c (create_stop_event_object): Return
	gdbpy_ref.
	(emit_stop_event): Update.
	* python/py-signalevent.c (create_signal_event_object): Return
	gdbpy_ref.
	* python/py-infevents.c (create_inferior_call_event_object):
	Update.
	* python/py-event.h (create_event_object)
	(create_thread_event_object): Update.
	* python/py-event.c (create_event_object): Return gdbpy_ref.
	* python/py-continueevent.c: Return gdbpy_ref.
	* python/py-bpevent.c (create_breakpoint_event_object): Return
	gdbpy_ref.
2017-09-11 14:15:21 -06:00
Tom Tromey 7c96f8c1da Add new_inferior, inferior_deleted, and new_thread events
This adds a few new events to gdb's Python layer: new_inferior,
inferior_deleted, and new_thread.  I wanted to be able to add a
combined inferior/thread display window to my GUI, and I needed a few
events to make this work.  This is PR python/15622.

ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	PR python/15622:
	* NEWS: Add entry.
	* python/python.c (do_start_initialization): Initialize new event
	types.
	* python/python-internal.h (gdbpy_initialize_new_inferior_event)
	(gdbpy_initialize_inferior_deleted_event)
	(gdbpy_initialize_new_thread_event): Declare.
	* python/py-threadevent.c (create_thread_event_object): Add option
	"thread" parameter.
	* python/py-inferior.c (new_thread_event_object_type)
	(new_inferior_event_object_type)
	(inferior_deleted_event_object_type): Declare.
	(python_new_inferior, python_inferior_deleted): New functions.
	(add_thread_object): Emit new_thread event.
	(gdbpy_initialize_inferior): Attach new functions to corresponding
	observers.
	(new_thread, new_inferior, inferior_deleted): Define new event
	types.
	* python/py-evts.c (gdbpy_initialize_py_events): Add new
	registries.
	* python/py-events.h (events_object) <new_inferior,
	inferior_deleted, new_thread>: New fields.
	* python/py-event.h (create_thread_event_breakpoint): Add optional
	"thread" parameter.

doc/ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* python.texi (Events In Python): Document new events.

testsuite/ChangeLog
2017-09-11  Tom Tromey  <tom@tromey.com>

	* gdb.python/py-infthread.exp: Add tests for new_thread event.
	* gdb.python/py-inferior.exp: Add tests for new inferior events.
2017-09-11 14:15:20 -06:00
Kuan-Lin Chen 4ec521f238 nds32: Rename __BIT() to N32_BIT(). 2017-09-11 13:46:27 +08:00
GDB Administrator 555cb16881 Automatic date update in version.in 2017-09-11 00:00:31 +00:00
Sergio Durigan Junior a059f00c85 Fix build breakage on GNU/Linux AArch64, take 2
The last commit unfortunately was not enough to fix the build breakage
on AArch64.  I made a mistake and did not test it alone on BuildBot,
but along with another patch that was responsible for fixing the
breakage.

The failure is:

  In file included from /usr/include/string.h:640:0,
		   from build-gnulib-gdbserver/import/string.h:41,
		   from ../../../binutils-gdb/gdb/gdbserver/../common/common-defs.h:56,
		   from ../../../binutils-gdb/gdb/gdbserver/server.h:22,
		   from ../../../binutils-gdb/gdb/gdbserver/regcache.c:19:
  In function ‘void* memset(void*, int, size_t)’,
      inlined from ‘regcache* init_register_cache(regcache*, const target_desc*, unsigned char*)’ at ../../../binutils-gdb/gdb/gdbserver/regcache.c:150:50:
  /usr/include/aarch64-linux-gnu/bits/string3.h:81:32: error: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror]
	 __warn_memset_zero_len ();
				  ^
  In function ‘void* memset(void*, int, size_t)’,
      inlined from ‘regcache* get_thread_regcache(thread_info*, int)’ at ../../../binutils-gdb/gdb/gdbserver/regcache.c:57:60:
  /usr/include/aarch64-linux-gnu/bits/string3.h:81:32: error: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror]
	 __warn_memset_zero_len ();

This is likely due to a GCC bug, because for some reason the compiler
assumes that the third argument to the memset:

  memset (regcache->register_status, REG_UNAVAILABLE,
	  VEC_length (tdesc_reg_p, regcache->tdesc->reg_defs));

is always zero, which is not always true.

Anyway, the simple fix for this is to guard the memset calls with:

  if (!VEC_empty (tdesc_reg_p, regcache->tdesc->reg_defs))

This time, I made sure to regtest only this patch on BuildBot, and it
finally solved the breakage.

gdb/gdbserver/ChangeLog:
2017-09-10  Sergio Durigan Junior  <sergiodj@redhat.com>

	* regcache.c (get_thread_regcache): Guard calls to "memset"
          with "!VEC_empty".
2017-09-10 18:12:14 -04:00
Sergio Durigan Junior cc397f3a23 Fix build breakage on GNU/Linux AArch64
This patch fixes the build breakage that has been happening on AArch64
since September 5th.  The breakage was introduced by the following
commit:

  author        Yao Qi <yao.qi@linaro.org>
          Tue, 5 Sep 2017 04:54:52 -0400 (09:54 +0100)
  committer     Yao Qi <yao.qi@linaro.org>
          Tue, 5 Sep 2017 04:54:52 -0400 (09:54 +0100)
  commit        f7000548a2

  Use VEC for target_desc.reg_defs

The build log for this commit can be seen here:

  <https://gdb-build.sergiodj.net/builders/Ubuntu-AArch64-native-gdbserver-m64/builds/2696/steps/compile%20gdb/logs/stdio>

And the underlying problem is that the code is not calling the new
function "allocate_target_description" to allocate the "struct
target_desc" using "new" instead of XNEW, which end up not properly
initializing the fields of the structure.

Regtested on BuildBot.

gdb/gdbserver/ChangeLog:
2017-09-10  Sergio Durigan Junior  <sergiodj@redhat.com>

	* linux-low.c (handle_extended_wait): Use
	"allocate_target_description" instead of "XNEW".
	* linux-x86-low.c (initialize_low_arch): Likewise.
2017-09-10 12:33:28 -04:00
Andrew Burgess 72542b8ee6 gdb: Remove check for gdb_stderr == NULL
Recent changes made gdb_stderr a macro:

  #define gdb_stderr (*current_ui_gdb_stderr_ptr ())

and current_ui_gdb_stderr_ptr return this:

   &current_ui->m_gdb_stderr

The problem is that this is undefined if current_ui is NULL, which can
happen early on during gdb start up.

If we run into an error during early gdb start up then we write the
error message to gdb_stderr.  However, if we are too early during the
start up then current_ui is NULL, and using the gdb_stderr macro
triggers undefined behaviour.

We try to avoid this using a check 'gdb_stderr == NULL' which was fine
before the recent changes, but now, still triggers undefined behaviour.

A better check is instead 'current_ui == NULL' which is what I use in
this patch.

Triggering this failure is pretty hard, most of the really early errors
are only triggered if pretty basic things are not as expected, for
example, if the default signal handlers are not as expected.  Seeing one
of these errors trigger usually means that someone working on gdb has
made an incorrect change.  Still, the errors are present in gdb, and
should we ever trigger one it would be nice if gdb didn't crash.

For testing this change I've been applying this patch which adds an
unconditional error into a function called early during gdb start up.
Later in the same function is a real error call which, in some
circumstances could be triggered:

  ## START ##
  diff --git a/gdb/common/signals-state-save-restore.c b/gdb/common/signals-state-save-restore.c
  index d11a9ae006c..d75ba70f894 100644
  --- a/gdb/common/signals-state-save-restore.c
  +++ b/gdb/common/signals-state-save-restore.c
  @@ -37,6 +37,9 @@ static sigset_t original_signal_mask;
   void
   save_original_signals_state (void)
   {
  +
  +  internal_error (__FILE__, __LINE__, "example error");
  +
   #ifdef HAVE_SIGACTION
     int i;
     int res;
  ## END ##

gdb/ChangeLog:

	* utils.c (abort_with_message): Don't compare gdb_stderr to NULL,
	check current_ui instead.
	(internal_vproblem): Likewise.
2017-09-10 09:49:34 +01:00
GDB Administrator 502b834c1a Automatic date update in version.in 2017-09-10 00:00:33 +00:00
Simon Marchi 0d64823e51 Remove unnecessary calls to is_mi_like_p in print_thread_info_1
There are two calls to uiout->is_mi_like_p in the else branch of a
if (uiout->is_mi_like_p ()), we already know they will return false.

A bit lower, there are two if (!uiout->is_mi_like_p ()) that we can
merge.

gdb/ChangeLog:

	* thread.c (print_thread_info_1): Remove unnecessary calls to
	uiout->is_mi_like_p.
2017-09-09 22:51:58 +02:00
Tom Tromey eb1e02fd05 Use std::vector in add_using_directive
This changes add_using_directive to accept a std::vector and then
changes the callers.  This allows removing a cleanup.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* namespace.h (add_using_directive): Update.
	* namespace.c (add_using_directive): Change type of excludes to
	std::vector.
	* dwarf2read.c (read_import_statement): Use std::vector.
	(read_namespace): Update.
	* cp-namespace.c (cp_scan_for_anonymous_namespaces): Update.
2017-09-09 14:10:51 -06:00
Tom Tromey 0fc21fd8cf Use gdb::def_vector in create_sals_line_offset
This changes create_sals_line_offset to use gdb::def_vector, removing
some cleanups.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* linespec.c (create_sals_line_offset): Use gdb::def_vector.
2017-09-09 14:10:50 -06:00
Tom Tromey 49663d051c Use gdb::byte_vector in pascal_object_print_value
This changes pascal_object_print_value to use a gdb::byte_vector.
This removes a cleanup.  This change also points out how the previous
code had a possible use-after-free bug.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* p-valprint.c (pascal_object_print_value): Use gdb::byte_vector.
2017-09-09 14:10:49 -06:00
Tom Tromey 0b868b60c9 Use gdb::def_vector in func_command
This changes func_command to use gdb::def_vector, removing a cleanup.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* stack.c (func_command): Use gdb::def_vector.
2017-09-09 14:10:48 -06:00
Tom Tromey c0470d489b Use ui_out_emit_list and ui_out_emit_tuple with gdb::optional
This changes a few spots to use ui_out_emit_list and/or
ui_out_emit_tuple with gdb::optional, to preserve existing behavior.
This allows for the removal of a few more cleanups.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* mi/mi-cmd-var.c (mi_cmd_var_list_children): Use gdb::optional,
	ui_out_emit_list, ui_out_emit_tuple.
	(mi_cmd_var_update): Likewise.
2017-09-09 13:46:09 -06:00
Tom Tromey ca5909c7de Remove make_cleanup_ui_out_redirect_pop
This patch introduces ui_out_redirect_pop.  All uses of
make_cleanup_ui_out_redirect_pop are replaced with this new class.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* mi/mi-interp.c (mi_user_selected_context_changed): Use
	ui_out_redirect_pop.
	* guile/scm-ports.c (ioscm_with_output_to_port_worker): Use
	ui_out_redirect_pop.
	* utils.c (do_ui_out_redirect_pop)
	(make_cleanup_ui_out_redirect_pop): Remove.
	* top.c (execute_command_to_string): Use ui_out_redirect_pop.
	* utils.h (make_cleanup_ui_out_redirect_pop): Remove.
	* ui-out.h (ui_out_redirect_pop): New class.
2017-09-09 13:46:08 -06:00
Tom Tromey e6a2252ac3 Use ui_out_emit_list in more places
This changes various spots to use ui_out_emit_list, removing some
cleanups.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* mi/mi-main.c (output_cores): Use ui_out_emit_list.
	(list_available_thread_groups, mi_cmd_list_thread_groups)
	(mi_cmd_data_list_changed_registers, mi_cmd_data_read_memory)
	(mi_cmd_data_read_memory_bytes, mi_cmd_trace_frame_collected):
	Likewise.
2017-09-09 13:46:07 -06:00
Tom Tromey 393702cd59 Use ui_out_emit_tuple in disasm.c
This changes one spot in disasm.c to use ui_out_emit_tuple.  This
patch required a large reindentation, so I've separated it out.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Use
	ui_out_emit_tuple.
2017-09-09 13:46:06 -06:00
Tom Tromey 76f9c9cfd4 Use ui_out_emit_tuple in more places
This changes more places to use ui_out_emit_tuple, removing cleanups.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* target.c (flash_erase_command): Use ui_out_emit_tuple.
	* stack.c (print_frame): Use ui_out_emit_tuple.
	* spu-tdep.c (info_spu_event_command): Use ui_out_emit_tuple.
	(info_spu_mailbox_command, info_spu_dma_command)
	(info_spu_proxydma_command): Likewise.
	* mi/mi-main.c (mi_cmd_trace_frame_collected): Use
	ui_out_emit_tuple, gdb::byte_vector, bin2hex.
	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Use
	ui_out_emit_tuple.
	* breakpoint.c (print_it_watchpoint): Use ui_out_emit_tuple.
2017-09-09 13:46:05 -06:00
Tom Tromey dc9fe180a4 Remove make_cleanup_ui_out_table_begin_end
This changes the few remaining uses of
make_cleanup_ui_out_table_begin_end to use ui_out_emit_table instead,
and then removes the cleanup.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* ui-out.h (make_cleanup_ui_out_table_begin_end): Remove.
	(class ui_out_emit_table): Update comment.
	* ui-out.c (do_cleanup_table_end)
	(make_cleanup_ui_out_table_begin_end): Remove.
	* spu-tdep.c (info_spu_mailbox_list): Use ui_out_emit_table.
	(info_spu_dma_cmdlist): Likewise.
	* probe.c (info_probes_for_ops): Use ui_out_emit_table.
	* darwin-nat-info.c (darwin_debug_regions_recurse): Use
	ui_out_emit_table.
2017-09-09 13:46:04 -06:00
Tom Tromey f8cc3da6e4 Use ui_out_emit_table and ui_out_emit_list in print_thread_info_1
This changes print_thread_info_1 to use ui_out_emit_table and
ui_out_emit_list.  Which one is used depends on whether the ui-out is
mi-like; so the emitters are wrapped in gdb::optional.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* thread.c (print_thread_info_1): Use ui_out_emit_table,
	ui_out_emit_list, gdb::optional.
2017-09-09 13:46:04 -06:00
John Baldwin 481695ed5f Remove unnecessary function prototypes.
These prototypes were required when compiling GDB as C but are not
required for C++.

gdb/ChangeLog:

	* aarch64-linux-nat.c: Remove _initialize_aarch64_linux_nat
	prototype.
	* aarch64-linux-tdep.c: Remove _initialize_aarch64_linux_tdep
	prototype.
	* aarch64-newlib-tdep.c: Remove _initialize_aarch64_newlib_tdep
	prototype.
	* aarch64-tdep.c: Remove _initialize_aarch64_tdep prototype.
	* ada-exp.y: Remove _initialize_ada_exp prototype.
	* ada-lang.c: Remove _initialize_ada_language prototype.
	* ada-tasks.c: Remove _initialize_tasks prototype.
	* addrmap.c: Remove _initialize_addrmap prototype.
	* agent.c: Remove _initialize_agent prototype.
	* aix-thread.c: Remove _initialize_aix_thread prototype.
	* alpha-bsd-nat.c: Remove _initialize_alphabsd_nat prototype.
	* alpha-linux-nat.c: Remove _initialize_alpha_linux_nat prototype.
	* alpha-linux-tdep.c: Remove _initialize_alpha_linux_tdep
	prototype.
	* alpha-nbsd-tdep.c: Remove _initialize_alphanbsd_tdep prototype.
	* alpha-obsd-tdep.c: Remove _initialize_alphaobsd_tdep prototype.
	* alpha-tdep.c: Remove _initialize_alpha_tdep prototype.
	* amd64-darwin-tdep.c: Remove _initialize_amd64_darwin_tdep
	prototype.
	* amd64-dicos-tdep.c: Remove _initialize_amd64_dicos_tdep
	prototype.
	* amd64-fbsd-nat.c: Remove _initialize_amd64fbsd_nat prototype.
	* amd64-fbsd-tdep.c: Remove _initialize_amd64fbsd_tdep prototype.
	* amd64-linux-nat.c: Remove _initialize_amd64_linux_nat prototype.
	* amd64-linux-tdep.c: Remove _initialize_amd64_linux_tdep
	prototype.
	* amd64-nbsd-nat.c: Remove _initialize_amd64nbsd_nat prototype.
	* amd64-nbsd-tdep.c: Remove _initialize_amd64nbsd_tdep prototype.
	* amd64-obsd-nat.c: Remove _initialize_amd64obsd_nat prototype.
	* amd64-obsd-tdep.c: Remove _initialize_amd64obsd_tdep prototype.
	* amd64-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype.
	* amd64-tdep.c: Remove _initialize_amd64_tdep prototype.
	* amd64-windows-nat.c: Remove _initialize_amd64_windows_nat
	prototype.
	* amd64-windows-tdep.c: Remove _initialize_amd64_windows_tdep
	prototype.
	* annotate.c: Remove _initialize_annotate prototype.
	* arc-newlib-tdep.c: Remove _initialize_arc_newlib_tdep prototype.
	* arc-tdep.c: Remove _initialize_arc_tdep prototype.
	* arch-utils.c: Remove _initialize_gdbarch_utils prototype.
	* arm-linux-nat.c: Remove _initialize_arm_linux_nat prototype.
	* arm-linux-tdep.c: Remove _initialize_arm_linux_tdep prototype.
	* arm-nbsd-tdep.c: Remove _initialize_arm_netbsd_tdep prototype.
	* arm-obsd-tdep.c: Remove _initialize_armobsd_tdep prototype.
	* arm-symbian-tdep.c: Remove _initialize_arm_symbian_tdep
	prototype.
	* arm-tdep.c: Remove _initialize_arm_tdep prototype.
	* arm-wince-tdep.c: Remove _initialize_arm_wince_tdep prototype.
	* auto-load.c: Remove _initialize_auto_load prototype.
	* auxv.c: Remove _initialize_auxv prototype.
	* avr-tdep.c: Remove _initialize_avr_tdep prototype.
	* ax-gdb.c: Remove _initialize_ax_gdb prototype.
	* bfin-linux-tdep.c: Remove _initialize_bfin_linux_tdep prototype.
	* bfin-tdep.c: Remove _initialize_bfin_tdep prototype.
	* break-catch-sig.c: Remove _initialize_break_catch_sig prototype.
	* break-catch-syscall.c: Remove _initialize_break_catch_syscall
	prototype.
	* break-catch-throw.c: Remove _initialize_break_catch_throw
	prototype.
	* breakpoint.c: Remove _initialize_breakpoint prototype.
	* bsd-uthread.c: Remove _initialize_bsd_uthread prototype.
	* btrace.c: Remove _initialize_btrace prototype.
	* charset.c: Remove _initialize_charset prototype.
	* cli/cli-cmds.c: Remove _initialize_cli_cmds prototype.
	* cli/cli-dump.c: Remove _initialize_cli_dump prototype.
	* cli/cli-interp.c: Remove _initialize_cli_interp prototype.
	* cli/cli-logging.c: Remove _initialize_cli_logging prototype.
	* cli/cli-script.c: Remove _initialize_cli_script prototype.
	* coff-pe-read.c: Remove _initialize_coff_pe_read prototype.
	* coffread.c: Remove _initialize_coffread prototype.
	* compile/compile.c: Remove _initialize_compile prototype.
	* complaints.c: Remove _initialize_complaints prototype.
	* completer.c: Remove _initialize_completer prototype.
	* copying.awk: Remove _initialize_copying prototype.
	* copying.c: Regenerate.
	* core-regset.c: Remove _initialize_core_regset prototype.
	* corefile.c: Remove _initialize_core prototype.
	* corelow.c: Remove _initialize_corelow prototype.
	* cp-abi.c: Remove _initialize_cp_abi prototype.
	* cp-namespace.c: Remove _initialize_cp_namespace prototype.
	* cp-support.c: Remove _initialize_cp_support prototype.
	* cp-valprint.c: Remove _initialize_cp_valprint prototype.
	* cris-linux-tdep.c: Remove _initialize_cris_linux_tdep prototype.
	* cris-tdep.c: Remove _initialize_cris_tdep prototype.
	* ctf.c: Remove _initialize_ctf prototype.
	* d-lang.c: Remove _initialize_d_language prototype.
	* darwin-nat-info.c: Remove _initialize_darwin_info_commands
	prototype.
	* darwin-nat.c: Remove _initialize_darwin_inferior prototype.
	* dbxread.c: Remove _initialize_dbxread prototype.
	* dcache.c: Remove _initialize_dcache prototype.
	* demangle.c: Remove _initialize_demangler prototype.
	* disasm-selftests.c: Remove _initialize_disasm_selftests
	prototype.
	* disasm.c: Remove _initialize_disasm prototype.
	* dtrace-probe.c: Remove _initialize_dtrace_probe prototype.
	* dummy-frame.c: Remove _initialize_dummy_frame prototype.
	* dwarf2-frame-tailcall.c: Remove _initialize_tailcall_frame
	prototype.
	* dwarf2-frame.c: Remove _initialize_dwarf2_frame prototype.
	* dwarf2expr.c: Remove _initialize_dwarf2expr prototype.
	* dwarf2loc.c: Remove _initialize_dwarf2loc prototype.
	* dwarf2read.c: Remove _initialize_dwarf2_read prototype.
	* elfread.c: Remove _initialize_elfread prototype.
	* exec.c: Remove _initialize_exec prototype.
	* extension.c: Remove _initialize_extension prototype.
	* f-lang.c: Remove _initialize_f_language prototype.
	* f-valprint.c: Remove _initialize_f_valprint prototype.
	* fbsd-nat.c: Remove _initialize_fbsd_nat prototype.
	* fbsd-tdep.c: Remove _initialize_fbsd_tdep prototype.
	* filesystem.c: Remove _initialize_filesystem prototype.
	* findcmd.c: Remove _initialize_mem_search prototype.
	* fork-child.c: Remove _initialize_fork_child prototype.
	* frame-base.c: Remove _initialize_frame_base prototype.
	* frame-unwind.c: Remove _initialize_frame_unwind prototype.
	* frame.c: Remove _initialize_frame prototype.
	* frv-linux-tdep.c: Remove _initialize_frv_linux_tdep prototype.
	* frv-tdep.c: Remove _initialize_frv_tdep prototype.
	* ft32-tdep.c: Remove _initialize_ft32_tdep prototype.
	* gcore.c: Remove _initialize_gcore prototype.
	* gdb_bfd.c: Remove _initialize_gdb_bfd prototype.
	* gdbarch.c: Regenerate.
	* gdbarch.sh: Remove _initialize_gdbarch prototype.
	* gdbtypes.c: Remove _initialize_gdbtypes prototype.
	* gnu-nat.c: Remove _initialize_gnu_nat prototype.
	* gnu-v2-abi.c: Remove _initialize_gnu_v2_abi prototype.
	* gnu-v3-abi.c: Remove _initialize_gnu_v3_abi prototype.
	* go-lang.c: Remove _initialize_go_language prototype.
	* go32-nat.c: Remove _initialize_go32_nat prototype.
	* guile/guile.c: Remove _initialize_guile prototype.
	* h8300-tdep.c: Remove _initialize_h8300_tdep prototype.
	* hppa-linux-nat.c: Remove _initialize_hppa_linux_nat prototype.
	* hppa-linux-tdep.c: Remove _initialize_hppa_linux_tdep prototype.
	* hppa-nbsd-nat.c: Remove _initialize_hppanbsd_nat prototype.
	* hppa-nbsd-tdep.c: Remove _initialize_hppanbsd_tdep prototype.
	* hppa-obsd-nat.c: Remove _initialize_hppaobsd_nat prototype.
	* hppa-obsd-tdep.c: Remove _initialize_hppaobsd_tdep prototype.
	* hppa-tdep.c: Remove _initialize_hppa_tdep prototype.
	* i386-bsd-nat.c: Remove _initialize_i386bsd_nat prototype.
	* i386-cygwin-tdep.c: Remove _initialize_i386_cygwin_tdep
	prototype.
	* i386-darwin-tdep.c: Remove _initialize_i386_darwin_tdep
	prototype.
	* i386-dicos-tdep.c: Remove _initialize_i386_dicos_tdep prototype.
	* i386-fbsd-nat.c: Remove _initialize_i386fbsd_nat prototype.
	* i386-fbsd-tdep.c: Remove _initialize_i386fbsd_tdep prototype.
	* i386-gnu-nat.c: Remove _initialize_i386gnu_nat prototype.
	* i386-gnu-tdep.c: Remove _initialize_i386gnu_tdep prototype.
	* i386-linux-nat.c: Remove _initialize_i386_linux_nat prototype.
	* i386-linux-tdep.c: Remove _initialize_i386_linux_tdep prototype.
	* i386-nbsd-nat.c: Remove _initialize_i386nbsd_nat prototype.
	* i386-nbsd-tdep.c: Remove _initialize_i386nbsd_tdep prototype.
	* i386-nto-tdep.c: Remove _initialize_i386nto_tdep prototype.
	* i386-obsd-nat.c: Remove _initialize_i386obsd_nat prototype.
	* i386-obsd-tdep.c: Remove _initialize_i386obsd_tdep prototype.
	* i386-sol2-nat.c: Remove _initialize_amd64_sol2_nat prototype.
	* i386-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype.
	* i386-tdep.c: Remove _initialize_i386_tdep prototype.
	* i386-windows-nat.c: Remove _initialize_i386_windows_nat
	prototype.
	* ia64-libunwind-tdep.c: Remove _initialize_libunwind_frame
	prototype.
	* ia64-linux-nat.c: Remove _initialize_ia64_linux_nat prototype.
	* ia64-linux-tdep.c: Remove _initialize_ia64_linux_tdep prototype.
	* ia64-tdep.c: Remove _initialize_ia64_tdep prototype.
	* ia64-vms-tdep.c: Remove _initialize_ia64_vms_tdep prototype.
	* infcall.c: Remove _initialize_infcall prototype.
	* infcmd.c: Remove _initialize_infcmd prototype.
	* inferior.c: Remove _initialize_inferiors prototype.
	* inflow.c: Remove _initialize_inflow prototype.
	* infrun.c: Remove _initialize_infrun prototype.
	* interps.c: Remove _initialize_interpreter prototype.
	* iq2000-tdep.c: Remove _initialize_iq2000_tdep prototype.
	* jit.c: Remove _initialize_jit prototype.
	* language.c: Remove _initialize_language prototype.
	* linux-fork.c: Remove _initialize_linux_fork prototype.
	* linux-nat.c: Remove _initialize_linux_nat prototype.
	* linux-tdep.c: Remove _initialize_linux_tdep prototype.
	* linux-thread-db.c: Remove _initialize_thread_db prototype.
	* lm32-tdep.c: Remove _initialize_lm32_tdep prototype.
	* m2-lang.c: Remove _initialize_m2_language prototype.
	* m32c-tdep.c: Remove _initialize_m32c_tdep prototype.
	* m32r-linux-nat.c: Remove _initialize_m32r_linux_nat prototype.
	* m32r-linux-tdep.c: Remove _initialize_m32r_linux_tdep prototype.
	* m32r-tdep.c: Remove _initialize_m32r_tdep prototype.
	* m68hc11-tdep.c: Remove _initialize_m68hc11_tdep prototype.
	* m68k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype.
	* m68k-bsd-tdep.c: Remove _initialize_m68kbsd_tdep prototype.
	* m68k-linux-nat.c: Remove _initialize_m68k_linux_tdep prototype.
	* m68k-linux-tdep.c: Remove _initialize_m68k_linux_tdep prototype.
	* m68k-tdep.c: Remove _initialize_m68k_tdep prototype.
	* m88k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype.
	* m88k-tdep.c: Remove _initialize_m68kbsd_tdep prototype.
	* machoread.c: Remove _initialize_machoread prototype.
	* macrocmd.c: Remove _initialize_macrocmd prototype.
	* macroscope.c: Remove _initialize_macroscope prototype.
	* maint.c: Remove _initialize_maint_cmds prototype.
	* mdebugread.c: Remove _initialize_mdebugread prototype.
	* memattr.c: Remove _initialize_mem prototype.
	* mep-tdep.c: Remove _initialize_mep_tdep prototype.
	* mi/mi-cmd-env.c: Remove _initialize_mi_cmd_env prototype.
	* mi/mi-cmds.c: Remove _initialize_mi_cmds prototype.
	* mi/mi-interp.c: Remove _initialize_mi_interp prototype.
	* mi/mi-main.c: Remove _initialize_mi_main prototype.
	* microblaze-linux-tdep.c: Remove
	_initialize_microblaze_linux_tdep prototype.
	* microblaze-tdep.c: Remove _initialize_microblaze_tdep prototype.
	* mips-fbsd-nat.c: Remove _initialize_mips_fbsd_nat prototype.
	* mips-fbsd-tdep.c: Remove _initialize_mips_fbsd_tdep prototype.
	* mips-linux-nat.c: Remove _initialize_mips_linux_nat prototype.
	* mips-linux-tdep.c: Remove _initialize_mips_linux_tdep prototype.
	* mips-nbsd-nat.c: Remove _initialize_mipsnbsd_nat prototype.
	* mips-nbsd-tdep.c: Remove _initialize_mipsnbsd_tdep prototype.
	* mips-sde-tdep.c: Remove _initialize_mips_sde_tdep prototype.
	* mips-tdep.c: Remove _initialize_mips_tdep prototype.
	* mips64-obsd-nat.c: Remove _initialize_mips64obsd_nat prototype.
	* mips64-obsd-tdep.c: Remove _initialize_mips64obsd_tdep
	prototype.
	* mipsread.c: Remove _initialize_mipsread prototype.
	* mn10300-linux-tdep.c: Remove _initialize_mn10300_linux_tdep
	prototype.
	* mn10300-tdep.c: Remove _initialize_mn10300_tdep prototype.
	* moxie-tdep.c: Remove _initialize_moxie_tdep prototype.
	* msp430-tdep.c: Remove _initialize_msp430_tdep prototype.
	* mt-tdep.c: Remove _initialize_mt_tdep prototype.
	* nds32-tdep.c: Remove _initialize_nds32_tdep prototype.
	* nios2-linux-tdep.c: Remove _initialize_nios2_linux_tdep
	prototype.
	* nios2-tdep.c: Remove _initialize_nios2_tdep prototype.
	* nto-procfs.c: Remove _initialize_procfs prototype.
	* nto-tdep.c: Remove _initialize_nto_tdep prototype.
	* objc-lang.c: Remove _initialize_objc_language prototype.
	* objfiles.c: Remove _initialize_objfiles prototype.
	* observer.c: Remove observer_test_first_notification_function,
	observer_test_second_notification_function,
	observer_test_third_notification_function, and
	_initialize_observer prototypes.
	* opencl-lang.c: Remove _initialize_opencl_language prototypes.
	* osabi.c: Remove _initialize_gdb_osabi prototype.
	* osdata.c: Remove _initialize_osdata prototype.
	* p-valprint.c: Remove _initialize_pascal_valprint prototype.
	* parse.c: Remove _initialize_parse prototype.
	* ppc-fbsd-nat.c: Remove _initialize_ppcfbsd_nat prototype.
	* ppc-fbsd-tdep.c: Remove _initialize_ppcfbsd_tdep prototype.
	* ppc-linux-nat.c: Remove _initialize_ppc_linux_nat prototype.
	* ppc-linux-tdep.c: Remove _initialize_ppc_linux_tdep prototype.
	* ppc-nbsd-nat.c: Remove _initialize_ppcnbsd_nat prototype.
	* ppc-nbsd-tdep.c: Remove _initialize_ppcnbsd_tdep prototype.
	* ppc-obsd-nat.c: Remove _initialize_ppcobsd_nat prototype.
	* ppc-obsd-tdep.c: Remove _initialize_ppcobsd_tdep prototype.
	* printcmd.c: Remove _initialize_printcmd prototype.
	* probe.c: Remove _initialize_probe prototype.
	* proc-api.c: Remove _initialize_proc_api prototype.
	* proc-events.c: Remove _initialize_proc_events prototype.
	* proc-service.c: Remove _initialize_proc_service prototype.
	* procfs.c: Remove _initialize_procfs prototype.
	* psymtab.c: Remove _initialize_psymtab prototype.
	* python/python.c: Remove _initialize_python prototype.
	* ravenscar-thread.c: Remove _initialize_ravenscar prototype.
	* record-btrace.c: Remove _initialize_record_btrace prototype.
	* record-full.c: Remove _initialize_record_full prototype.
	* record.c: Remove _initialize_record prototype.
	* regcache.c: Remove _initialize_regcache prototype.
	* reggroups.c: Remove _initialize_reggroup prototype.
	* remote-notif.c: Remove _initialize_notif prototype.
	* remote-sim.c: Remove _initialize_remote_sim prototype.
	* remote.c: Remove _initialize_remote prototype.
	* reverse.c: Remove _initialize_reverse prototype.
	* rl78-tdep.c: Remove _initialize_rl78_tdep prototype.
	* rs6000-aix-tdep.c: Remove _initialize_rs6000_aix_tdep prototype.
	* rs6000-lynx178-tdep.c: Remove _initialize_rs6000_lynx178_tdep
	prototype.
	* rs6000-nat.c: Remove _initialize_rs6000_nat prototype.
	* rs6000-tdep.c: Remove _initialize_rs6000_tdep prototype.
	* rust-exp.y: Remove _initialize_rust_exp prototype.
	* rx-tdep.c: Remove _initialize_rx_tdep prototype.
	* s390-linux-nat.c: Remove _initialize_s390_nat prototype.
	* s390-linux-tdep.c: Remove _initialize_s390_tdep prototype.
	* score-tdep.c: Remove _initialize_score_tdep prototype.
	* selftest-arch.c: Remove _initialize_selftests_foreach_arch
	prototype.
	* ser-go32.c: Remove _initialize_ser_dos prototype.
	* ser-mingw.c: Remove _initialize_ser_windows prototype.
	* ser-pipe.c: Remove _initialize_ser_pipe prototype.
	* ser-tcp.c: Remove _initialize_ser_tcp prototype.
	* ser-unix.c: Remove _initialize_ser_hardwire prototype.
	* serial.c: Remove _initialize_serial prototype.
	* sh-linux-tdep.c: Remove _initialize_sh_linux_tdep prototype.
	* sh-nbsd-nat.c: Remove _initialize_shnbsd_nat prototype.
	* sh-nbsd-tdep.c: Remove _initialize_shnbsd_tdep prototype.
	* sh-tdep.c: Remove _initialize_sh_tdep prototype.
	* skip.c: Remove _initialize_step_skip prototype.
	* sol-thread.c: Remove _initialize_sol_thread prototype.
	* solib-aix.c: Remove _initialize_solib_aix prototype.
	* solib-darwin.c: Remove _initialize_darwin_solib prototype.
	* solib-dsbt.c: Remove _initialize_dsbt_solib prototype.
	* solib-frv.c: Remove _initialize_frv_solib prototype.
	* solib-spu.c: Remove _initialize_spu_solib prototype.
	* solib-svr4.c: Remove _initialize_svr4_solib prototype.
	* solib-target.c: Remove _initialize_solib_target prototype.
	* solib.c: Remove _initialize_solib prototype.
	* source.c: Remove _initialize_source prototype.
	* sparc-linux-nat.c: Remove _initialize_sparc_linux_nat prototype.
	* sparc-linux-tdep.c: Remove _initialize_sparc_linux_tdep
	prototype.
	* sparc-nat.c: Remove _initialize_sparc_nat prototype.
	* sparc-nbsd-nat.c: Remove _initialize_sparcnbsd_nat prototype.
	* sparc-nbsd-tdep.c: Remove _initialize_sparcnbsd_tdep prototype.
	* sparc-obsd-tdep.c: Remove _initialize_sparc32obsd_tdep
	prototype.
	* sparc-sol2-nat.c: Remove _initialize_sparc_sol2_nat prototype.
	* sparc-sol2-tdep.c: Remove _initialize_sparc_sol2_tdep prototype.
	* sparc-tdep.c: Remove _initialize_sparc_tdep prototype.
	* sparc64-fbsd-nat.c: Remove _initialize_sparc64fbsd_nat
	prototype.
	* sparc64-fbsd-tdep.c: Remove _initialize_sparc64fbsd_tdep
	prototype.
	* sparc64-linux-nat.c: Remove _initialize_sparc64_linux_nat
	prototype.
	* sparc64-linux-tdep.c: Remove _initialize_sparc64_linux_tdep
	prototype.
	* sparc64-nat.c: Remove _initialize_sparc64_nat prototype.
	* sparc64-nbsd-nat.c: Remove _initialize_sparc64nbsd_nat
	prototype.
	* sparc64-nbsd-tdep.c: Remove _initialize_sparc64nbsd_tdep
	prototype.
	* sparc64-obsd-nat.c: Remove _initialize_sparc64obsd_nat
	prototype.
	* sparc64-obsd-tdep.c: Remove _initialize_sparc64obsd_tdep
	prototype.
	* sparc64-sol2-tdep.c: Remove _initialize_sparc64_sol2_tdep
	prototype.
	* spu-linux-nat.c: Remove _initialize_spu_nat prototype.
	* spu-multiarch.c: Remove _initialize_spu_multiarch prototype.
	* spu-tdep.c: Remove _initialize_spu_tdep prototype.
	* stabsread.c: Remove _initialize_stabsread prototype.
	* stack.c: Remove _initialize_stack prototype.
	* stap-probe.c: Remove _initialize_stap_probe prototype.
	* std-regs.c: Remove _initialize_frame_reg prototype.
	* symfile-debug.c: Remove _initialize_symfile_debug prototype.
	* symfile-mem.c: Remove _initialize_symfile_mem prototype.
	* symfile.c: Remove _initialize_symfile prototype.
	* symmisc.c: Remove _initialize_symmisc prototype.
	* symtab.c: Remove _initialize_symtab prototype.
	* target-dcache.c: Remove _initialize_target_dcache prototype.
	* target-descriptions.c: Remove _initialize_target_descriptions
	prototype.
	* thread.c: Remove _initialize_thread prototype.
	* tic6x-linux-tdep.c: Remove _initialize_tic6x_linux_tdep
	prototype.
	* tic6x-tdep.c: Remove _initialize_tic6x_tdep prototype.
	* tilegx-linux-nat.c: Remove _initialize_tile_linux_nat prototype.
	* tilegx-linux-tdep.c: Remove _initialize_tilegx_linux_tdep
	prototype.
	* tilegx-tdep.c: Remove _initialize_tilegx_tdep prototype.
	* tracefile-tfile.c: Remove _initialize_tracefile_tfile prototype.
	* tracefile.c: Remove _initialize_tracefile prototype.
	* tracepoint.c: Remove _initialize_tracepoint prototype.
	* tui/tui-hooks.c: Remove _initialize_tui_hooks prototype.
	* tui/tui-interp.c: Remove _initialize_tui_interp prototype.
	* tui/tui-layout.c: Remove _initialize_tui_layout prototype.
	* tui/tui-regs.c: Remove _initialize_tui_regs prototype.
	* tui/tui-stack.c: Remove _initialize_tui_stack prototype.
	* tui/tui-win.c: Remove _initialize_tui_win prototype.
	* tui/tui.c: Remove _initialize_tui prototype.
	* typeprint.c: Remove _initialize_typeprint prototype.
	* user-regs.c: Remove _initialize_user_regs prototype.
	* utils.c: Remove _initialize_utils prototype.
	* v850-tdep.c: Remove _initialize_v850_tdep prototype.
	* valarith.c: Remove _initialize_valarith prototype.
	* valops.c: Remove _initialize_valops prototype.
	* valprint.c: Remove _initialize_valprint prototype.
	* value.c: Remove _initialize_values prototype.
	* varobj.c: Remove _initialize_varobj prototype.
	* vax-bsd-nat.c: Remove _initialize_vaxbsd_nat prototype.
	* vax-nbsd-tdep.c: Remove _initialize_vaxnbsd_tdep prototype.
	* vax-tdep.c: Remove _initialize_vax_tdep prototype.
	* windows-nat.c: Remove _initialize_windows_nat,
	_initialize_check_for_gdb_ini, and _initialize_loadable
	prototypes.
	* windows-tdep.c: Remove _initialize_windows_tdep prototype.
	* xcoffread.c: Remove _initialize_xcoffread prototype.
	* xml-support.c: Remove _initialize_xml_support prototype.
	* xstormy16-tdep.c: Remove _initialize_xstormy16_tdep prototype.
	* xtensa-linux-nat.c: Remove _initialize_xtensa_linux_nat
	prototype.
	* xtensa-linux-tdep.c: Remove _initialize_xtensa_linux_tdep
	prototype.
	* xtensa-tdep.c: Remove _initialize_xtensa_tdep prototype.
2017-09-09 11:02:37 -07:00
Alan Modra 2420fff633 PowerPC64 --plt-align
This changes the PowerPC64 --plt-align option to perform the usual
alignment of code as suggested by its name, as well as the previous
behaviour of padding so as to reduce boundary crossing.  The old
behaviour is had by using a negative parameter.

The default is also changed to align plt stub code by default to 32
byte boundaries, the point being to get better bctr branch prediction
on power8 and power9 hardware.

bfd/
	* elf64-ppp.c (plt_stub_pad): Handle positive and negative
	plt_stub_align.
ld/
	* ld.texinfo (--plt-align): Describe new behaviour of option.
	* emultempl/ppc64elf.em (params): Default plt_stub_align to 5.
	* testsuite/ld-powerpc/powerpc.exp: Pass --no-plt-align for
	selected tests.
	* testsuite/ld-powerpc/relbrlt.d: Pass --no-plt-align.
	* testsuite/ld-powerpc/elfv2so.d: Adjust expected output.
2017-09-10 01:55:16 +09:30
H.J. Lu c5bce5c697 x86: Update UNDEFINED_WEAK_RESOLVED_TO_ZERO
Since the only information which SYMBOL_REFERENCES_LOCAL_P doesn't check
is relocations, UNDEFINED_WEAK_RESOLVED_TO_ZERO only needs to check for
relocations with SYMBOL_REFERENCES_LOCAL_P.

	* elf32-i386.c (elf_i386_relocate_section): Update usage of
	UNDEFINED_WEAK_RESOLVED_TO_ZERO.
	(elf_i386_finish_dynamic_symbol): Likewise.
	* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
	(elf_x86_64_finish_dynamic_symbol): Likewise.
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
	(_bfd_x86_elf_fixup_symbol): Likewise.
2017-09-09 07:29:29 -07:00
H.J. Lu 8fbf0ba18c x86: Don't check has_non_got_reloc
_bfd_x86_elf_link_symbol_references_local should depend only on symbol
references, not relocations, to work in check_relocs.

	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
	check has_non_got_reloc.
2017-09-09 07:20:58 -07:00
H.J. Lu 4e9ac44a89 x86: Remove restriction on NOTRACK prefix position
Since the NOTRACK prefix is no longer required to be the last prefix
before the REX prefix, restriction on the NOTRACK prefix position is
removed from assembler as well as disassembler.  Assembler encodes the
NOTRACK prefix the same way as the DS segment register, which places
it before other prefixes.  Disassembler displays prefixes in the order
they appear.

gas/

	* config/tc-i386.c (NOTRACK_PREFIX): Removed.
	(REX_PREFIX): Updated.
	(MAX_PREFIXES): Likewise.
	(parse_insn): Remove restriction on NOTRACK prefix position.
	* testsuite/gas/i386/notrack.s: Add tests with NOTRACK prefix
	before other prefixes.
	* testsuite/gas/i386/x86-64-notrack.s: Likewise.
	* testsuite/gas/i386/notrackbad.s: Remove tests with NOTRACK
	prefix before other prefixes.
	* testsuite/gas/i386/x86-64-notrackbad.s: Likewise.
	* testsuite/gas/i386/notrack-intel.d: Updated.
	* testsuite/gas/i386/notrack.d: Likewise.
	* testsuite/gas/i386/notrackbad.l: Likewise.
	* testsuite/gas/i386/x86-64-notrack-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-notrack.d: Likewise.
	* testsuite/gas/i386/x86-64-notrackbad.l: Likewise.

opcodes/

	* i386-dis.c (last_active_prefix): Removed.
	(ckprefix): Don't set last_active_prefix.
	(NOTRACK_Fixup): Don't check last_active_prefix.
2017-09-09 05:32:11 -07:00
H.J. Lu 0a27fed72d x86: Properly handle __ehdr_start
After _bfd_i386_elf_convert_load and _bfd_x86_64_elf_convert_load are
removed, elf_i386_convert_load_reloc and elf_x86_64_convert_load_reloc
see __ehdr_start as an undefined symbol when they are called from
check_relocs to convert GOT relocations against local symbols.  But
__ehdr_start will be defined as a hidden symbol by linker at the later
stage if it is referenced.  This patch marks __ehdr_start as a defined
local symbol at the start of check_relocs if it is referenced and not
defined.

bfd/

	PR ld/22115
	* elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def.
	Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
	* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check
	linker_def.  Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
	* elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref
	and linker_def on __ehdr_start if it is referenced and not
	defined.
	(_bfd_x86_elf_link_symbol_references_local): Also set local_ref
	and return TRUE when building executable, if a symbol has
	non-GOT/non-PLT relocations in text section or there is no
	dynamic linker.
	* elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def.

ld/

	PR ld/22115
	* ld-i386/i386.exp: Run PR ld/22115 tests,
	* ld/testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr22115-1.s: New file.
	* testsuite/ld-i386/pr22115-1a.d: Likewise.
	* testsuite/ld-i386/pr22115-1b.d: Likewise.
	* testsuite/ld-i386/pr22115-1c.d: Likewise.
	* testsuite/ld-i386/pr22115-1d.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1.s: Likewise.
	* testsuite/ld-x86-64/pr22115-1a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1a.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1b-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1b.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1c.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1d-x32.d: Likewise.
	* testsuite/ld-x86-64/pr22115-1d.d: Likewise.
2017-09-09 05:05:29 -07:00
GDB Administrator 90d499086b Automatic date update in version.in 2017-09-09 00:00:19 +00:00
Keith Seitz a611b5cb00 Remove unused field field_info.fnfields
Since at least 7.3 the "fnfields" field in struct field_info has been
unused.  This patch simply removes it.

gdb/ChangeLog:

	* dwarf2read.c (struct field_info) <fnfields>: Remove unused
	field.
2017-09-08 16:47:13 -07:00
H.J. Lu c7df954fc4 x86: Update comments in elfxx-x86.h
* elfxx-x86.h: Update comments.
2017-09-08 09:15:37 -07:00
Christoph Weinmann 469412dd9c Remove C/C++ relevant code in Fortran specific file.
Remove code relevant for printing C/C++ Integer values in a
Fortran specific file to unify printing of Fortran values.
This does not change the output.
2017-09-08 15:11:47 +02:00
Bernhard Heckel e0f86435f8 fortran: Testsuite, fix typos in vla-value. 2017-09-08 15:11:47 +02:00
Bernhard Heckel 9e9af4be9f Fortran: Testsuite, fix differences in type naming. 2017-09-08 15:11:47 +02:00
Frank Penczek a5ad232b3e Fix indentation for printing Fortran types with pointers
Printing the prefix "PTR TO -> (" resp. "REF TO ->(" ignored the active
indentation level.  This caused inconsistent appearance of user-defined
Fortran types containing pointers.  Fix by using "fprintfi_filtered" with the
current indentation level for outputting the prefix string.  Add test case
ptr-indentation.

Example using 'ptype' on object of type:
  type TypeWithPointer
    integer i
    integer, pointer:: p
  end type TypeWithPointer

Before:
  type = Type typewithpointer
      integer(kind=4) :: i
  PTR TO -> ( integer(kind=4) :: p)
  End Type typewithpointer

After:
  type = Type typewithpointer
      integer(kind=4) :: i
      PTR TO -> ( integer(kind=4) :: p)
  End Type typewithpointer
2017-09-08 15:11:47 +02:00
H.J. Lu 1de031c80b x86: Replace elf_x86_plt_layout_table with elf_x86_init_table
* elf32-i386.c (elf_i386_link_setup_gnu_properties): Replace
	elf_x86_plt_layout_table with elf_x86_init_table.
	* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties):
	Likewise.
	* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties):
	Likewise.
	* elfxx-x86.h (elf_x86_plt_layout_table): Renamed to ...
	(elf_x86_init_table): This.
	(_bfd_x86_elf_link_setup_gnu_properties): Replace
	elf_x86_plt_layout_table with elf_x86_init_table.
2017-09-08 04:10:34 -07:00
H.J. Lu 7a382c1c50 x86; Don't add elf64-x86-64.lo nor elf64.lo together with elfxx-x86.lo
Don't set r_info and r_sym fields in _bfd_x86_elf_link_hash_table_create.
Instead, set them in _bfd_x86_elf_link_setup_gnu_properties.  We can
avoid adding elf64-x86-64.lo and elf64.lo together with elfxx-x86.lo to
bfd_backends.

	* configure.ac (bfd_backends): Don't add elf64-x86-64.lo nor
	elf64.lo together with elfxx-x86.lo for 64-bit BFD.
	* configure: Regenerated.
	* elf32-i386.c (elf_i386_link_setup_gnu_properties): Set r_info
	and r_sym fields of plt_layout.
	* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties):
	Likewise.
	* elfxx-x86.c (elf_x86_64_is_reloc_section): Remove BFD64 check.
	(_bfd_x86_elf_link_hash_table_create): Likewise.  Don't set
	r_info nor r_sym fields.
	(_bfd_x86_elf_link_setup_gnu_properties): Set r_info and r_sym
	fields of htab.
	* elfxx-x86.h (elf_x86_plt_layout_table): Add r_info and r_sym.
2017-09-07 17:21:07 -07:00
GDB Administrator bd757a5bf2 Automatic date update in version.in 2017-09-08 00:00:20 +00:00
Palmer Dabbelt ed0816bd93 RISC-V: Avoid emitting invalid instructions in mixed RVC/no-RVC code
When linking the following code

    .global _prog_start
    _prog_start:
            mv x1, x1
            mv x2, x2
    .align 2
    rvc_boundry:
    .option norvc
    .align 3
            mv x3, x3

we currently emit an invalid two-byte 0 instruction.  The actual output
code looks like

    0000000080000000 <_prog_start>:
        80000000:   8086                    mv      ra,ra
        80000002:   810a                    mv      sp,sp

    0000000080000004 <rvc_boundry>:
        80000004:   0000                    unimp
        80000006:   0001                    nop
        80000008:   00018193                mv      gp,gp

This ends up manifesting due to the two-byte compressed NOP that's
pessimisticly emitted by the ".align 2", which results in "rvc_boundry"
being 2-byte aligned.  frag_align_code() then goes and outputs a 2-byte
NOP (which is invalid in no-RVC mode) to align the code back to a 4-byte
boundry, which can't be relaxed away by the linker as it's not part of
the R_RISCV_RELAX relocation.

The fix is to just always emit the worst case possible alignment into
the output as a single R_RISCV_RELAX, which the linker will then fix up.

With this patch I get the expected code generation

    0000000080000000 <_prog_start>:
        80000000:   8086                    mv      ra,ra
        80000002:   810a                    mv      sp,sp

    0000000080000004 <rvc_boundry>:
        80000004:   00000013                nop
        80000008:   00018193                mv      gp,gp

gas/ChangeLog

2017-09-07  Palmer Dabbelt  <palmer@dabbelt.com>

        * config/tc-riscv.c (riscv_frag_align_code): Emit the entire
        alignment sequence inside R_RISCV_ALIGN.
2017-09-07 09:45:40 -07:00
Palmer Dabbelt 9eb7b0acb5 RISC-V: Print an error when unable to align a section
This used to just print "can't relax section: Success", which is a silly
error message.

bfd/ChangeLog

2017-09-07  Palmer Dabbelt  <palmer@dabbelt.com>

        * elfnn-riscv.c (_bfd_riscv_relax_align): Call bfd_set_error and
        print an error message when unable to relax a .align directive.
2017-09-07 09:45:35 -07:00
Palmer Dabbelt b1308d2c37 RISC-V: Support PCREL_* relocations agaist weak undefined symbols
I recently modified our Linux port's base address such the absolute
address 0 is no longer addressable as a 32-bit PC-relative offset.
Since Linux links a weak undefined symbol in an intermediate binary, it
needs to be able to reference absolute address 0.

This patch changes R_RISCV_PCREL_* relocations to absolute relocations
while resolving them in order to allow these symbols to be referenced in
PC-relative programs linked at high addresses.  Note that this doesn't
apply to PIC, which also uses PC-relative relocations, just to
position-dependent objects, which we use to allow programs to be linked
at high addresses.

In case some of our embedded users are using R_RISCV_PCREL_* as a hacked
up method of getting position-independent binaries (which can work if
you have very simple programs), we only convert the relocations when the
PC-relative version would overflow.

bfd/ChangeLog:

2017-09-07  Palmer Dabbelt  <palmer@dabbelt.com>

        * elfnn-riscv.c (riscv_zero_pcrel_hi_reloc): New function.
        (riscv_record_pcrel_hi_reloc): Add absolute argument.
        (riscv_elf_relocate_section): Call riscv_zero_pcrel_hi_reloc for
        R_RISCV_PCREL_HI20 relocs, and pass the result to
        riscv_record_pcrel_hi_reloc.
2017-09-07 09:42:15 -07:00
Joel Brobecker e50142270b Document the GDB 8.0.1 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 8.0.1 released.
2017-09-07 07:53:34 -07:00