Commit Graph

91984 Commits

Author SHA1 Message Date
Alan Modra bfec0f11ea PR22232, NULL pointer dereference in load_specific_debug_section
PR 22232
	PR 22230
	* objdump.c (load_specific_debug_section): Introduce a temp to
	stop bfd_get_full_section_contents NULLing out section->start.
2017-10-01 21:41:16 +10:30
Alan Modra 8cb1232a8c PR21970, assertion failed when more than one overlay has subalign specified
PR 21970
	* ldlang.c (lang_leave_overlay): Reset overlay_subalign.
2017-10-01 19:35:07 +10:30
Alan Modra 20230942fe PR21957, addr2line incorrectly handles non-increasing sequences in line table
PR 21957
	* dwarf2.c (new_line_sorts_after): Remove end_sequence comparison.
	(add_line_info): Always put end_sequence last.
2017-10-01 19:35:07 +10:30
Alexander Fedotov d2e6c9a368 Add new mnemonics for VLE multiple load instructions
opcodes/
	* ppc-opc.c (vle_opcodes): Add e_lmvsprw, e_lmvgprw,
	e_lmvsrrw, e_lmvcsrrw and e_lmvcsrrw as official mnemonics for
	VLE multimple load/store instructions. Old e_ldm* variants are
	kept as aliases.
	Add missing e_lmvmcsrrw and e_stmvmcsrrw.
gas/
	* testsuite/gas/ppc/vle-mult-ld-st-insns.s: New file: Tests the
	support for the VLE multiple load/store instructions.
	* testsuite/gas/ppc/vle-mult-ld-st-insns.d: New file: Test
	driver.
	* testsuite/gas/ppc/ppc.exp: Run it.
2017-10-01 19:35:06 +10:30
Alan Modra 4b04bba2eb PR22047, Heap out of bounds read in parse_comp_unit
Like the PR22230 fix, we can allocate a buffer with an extra byte
rather than letting bfd_simple_get_relocated_section_contents malloc
and return a buffer.  Much better than allocating another buffer
afterwards.

	PR 22047
	* dwarf2.c (read_section): Allocate buffer with extra byte for
	bfd_simple_get_relocated_section_contents rather than copying
	afterwards.
2017-10-01 12:07:59 +10:30
Alan Modra 4f1881b944 PR22230, buffer overflow in display_debug_macro
PR 22230
	* objdump.c (load_specific_debug_section): Allocate an extra byte
	for a terminating NUL.
2017-10-01 12:07:07 +10:30
GDB Administrator 3678b25d0c Automatic date update in version.in 2017-10-01 00:00:25 +00:00
H.J. Lu 2715765b0f Add a test for PR binutils/21978
PR binutils/21978
	* testsuite/ld-elf/pr21978.od: New file.
	* testsuite/ld-elf/pr21978a.c: Likewise.
	* testsuite/ld-elf/pr21978b.c: Likewise.
	* testsuite/ld-elf/shared.exp: Run PR binutils/21978 test.
2017-09-30 03:04:52 -07:00
Tom Tromey 386c8614d5 Remove free_memory_read_result_vector
This changes read_memory_robust to return a std::vector, allowing the
removal of free_memory_read_result_vector and associated cleanups.
This patch also changes the functions it touches to be a bit more
robust with regards to deallocation; it's perhaps possible that
read_memory_robust could have leaked in some situations.

This patch is based on my earlier series to remove some MI cleanups.
Regression tested by the buildbot.

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

	* target.c (read_whatever_is_readable): Change type of "result".
	Update.
	(free_memory_read_result_vector): Remove.
	(read_memory_robust): Change return type.  Update.
	* mi/mi-main.c (mi_cmd_data_read_memory_bytes): Update.  Use
	bin2hex, std::string.
	* target.h (memory_read_result_s): Remove typedef.
	(free_memory_read_result_vector): Remove.
	(read_memory_robust): Return std::vector.
2017-09-29 21:12:19 -06:00
Tom Tromey 789c4b5ea1 Change captured_mi_execute_command to use scoped_restore
Change captured_mi_execute_command to use a scoped_restore, removing a
cleanup.  The old code copied the current token, but I don't believe
that is necessary.

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

	* mi/mi-main.c (captured_mi_execute_command): Use scope_restore.
2017-09-29 21:12:18 -06:00
Tom Tromey ab816a2745 Use a std::vector for ada_exceptions_list
Change ada_exceptions_list to return a std::vector and fix up the
users.  This allows removing a cleanup in MI.

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

	* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Update.
	* ada-lang.h (struct ada_exc_info): Remove typedef.  Declare
	operator< and operator==.
	(ada_exceptions_list): Return a std::vector.
	* ada-lang.c (ada_exc_info::operator<): Rename from
	compare_ada_exception_info.
	(ada_exc_info::operator==): New.
	(sort_remove_dups_ada_exceptions_list): Change type of
	"exceptions".
	(ada_add_standard_exceptions, ada_add_exceptions_from_frame)
	(ada_add_global_exceptions): Likewise.
	(ada_exceptions_list_1): Return a std::vector.
	(ada_exceptions_list): Likewise.
2017-09-29 21:12:17 -06:00
Tom Tromey 52f9abe4c7 Use std::set in mi-main.c
Change a couple of spots in mi-main.c to use std::set.  This
simplifies the code and removes some cleanups.

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

	* mi/mi-main.c (struct print_one_inferior_data) <inferiors>: Now a
	'std::set *'.
	(print_one_inferior): Update.
	(free_vector_of_ints): Remove.
	(list_available_thread_groups): Change "ids" to std::set.
	(mi_cmd_list_thread_groups): Update.
	(struct collect_cores_data) <core>: Now a std::set.
	(collect_cores): Update.
	(unique): Remove.
	(print_one_inferior): Update.
2017-09-29 21:12:16 -06:00
Tom Tromey dcd5ddccd7 Use std::string in mi-main.c
Change a couple of spots in mi-main.c to use std::string, and change
one place to use field_fmt.  This removes some cleanups.

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

	* mi/mi-main.c (mi_execute_cli_command): Use std::string.
	(mi_execute_async_cli_command): Likewise.
	(mi_cmd_trace_frame_collected): Use field_fmt.
2017-09-29 21:12:16 -06:00
Tom Tromey 45d288cc64 Use gdb::byte_vector in mi_cmd_data_write_memory_bytes
This changes mi_cmd_data_write_memory_bytes to use gdb::byte_vector,
removing some cleanups.

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

	* mi/mi-main.c (mi_cmd_data_write_memory_bytes): Use
	gdb::byte_vector.
2017-09-29 21:12:15 -06:00
Tom Tromey 6afe2f4a39 Remove unused declaration
There was a leftover cleanup declaration in mi_parse.  Remove it.

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

	* mi/mi-parse.c (mi_parse): Remove unused declaration.
2017-09-29 21:12:13 -06:00
Tom Tromey 9813429a72 Don't copy a string in mi_cmd_disassemble
This string copy in mi_cmd_disassemble seems not to be needed, so
don't do it.

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

	* mi/mi-cmd-disas.c (mi_cmd_disassemble): Don't copy "oarg".
2017-09-29 21:12:13 -06:00
Tom Tromey 2d6960b456 Remove cleanups from mi-cmd-var.c
This removes some cleanups from mi-cmd-var.c.  varobj_gen_name now
returns a string, simplifying mi_cmd_var_create.  In
mi_cmd_var_delete, a string copy is apparently unnecessary, so it's
simply removed.

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

	* varobj.h (varobj_gen_name): Return std::string.
	* varobj.c (varobj_gen_name): Return std::string.
	* mi/mi-cmd-var.c (mi_cmd_var_create): Use std::string.
	(mi_cmd_var_delete): Don't copy "name".
2017-09-29 21:12:12 -06:00
Tom Tromey 784c453a4f Remove cleanups from mi_cmd_break_insert_1
This changes mi_argv_to_format to return a string, allowing the
removal of some cleanups.

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

	* mi/mi-cmd-break.c (mi_argv_to_format): Return std::string.
	(mi_cmd_break_insert_1): Update.
2017-09-29 21:12:11 -06:00
Tom Tromey a9bc57b978 Remove make_cleanup_defer_target_commit_resume
This removes make_cleanup_defer_target_commit_resume in favor of using
scoped_restore.

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

	* target.h (make_scoped_defer_target_commit_resume): Update.
	* target.c (make_scoped_defer_target_commit_resume): Rename from
	make_cleanup_defer_target_commit_resume.  Return a
	scoped_restore.
	* infrun.c (proceed): Use make_scoped_defer_target_commit_resume.
2017-09-29 21:12:10 -06:00
Tom Tromey 9754d8c4c4 Remove some unused declarations
This removes a couple of unused cleanup-related declarations.

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

	* main.c (captured_main_1): Remove unused declaration.
	* spu-multiarch.c (parse_spufs_run): Remove unused declaration.
2017-09-29 20:46:45 -06:00
Tom Tromey 99ef965c6e Remove a cleanup from symtab.c
This removes an unused outer cleanup from symtab.c, and an unused
cleanup declaration as well.

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

	* symtab.c (search_symbols): Remove unused outer cleanup.
	(make_source_files_completion_list): Remove unused declaration.
2017-09-29 20:46:45 -06:00
Tom Tromey 42518ba746 Remove cleanup from mt-tdep.c
Remove a cleanup from mt-tdep.c, using gdb::byte_vector.

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

	* mt-tdep.c (mt_push_dummy_call): Use gdb::byte_vector.
2017-09-29 20:46:44 -06:00
Tom Tromey 726b2169b4 Remove cleanup from xstormy16-tdep.c
This removes a cleanup from xstormy16-tdep.c, using gdb::byte_vector.

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

	* xstormy16-tdep.c (xstormy16_push_dummy_call): Use
	gdb::byte_vector.
2017-09-29 20:46:44 -06:00
Tom Tromey 55b064321e Remove cleanup from complaints.c
This removes a cleanup from complaints.c by using std::string.

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

	* complaints.c (vcomplaint): Use std::string.
2017-09-29 20:46:44 -06:00
Tom Tromey 8abcee9173 Remove some cleanups from tracepoint.c
This removes some cleanups from tracepoint.c by using std::string.  It
also removes some unused cleanup declarations.

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

	* tracepoint.c (trace_variable_command): Use std::string.
	(encode_actions_1): Remove unused declarations.
	(create_tsv_from_upload): Use std::string.
2017-09-29 20:46:44 -06:00
Tom Tromey 6ad94bc766 Remove cleanups from cp-support.c
This removes some cleanups from cp-support.c, using std::string.

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

	* cp-support.c (gdb_demangle): Use std::string.
2017-09-29 20:46:44 -06:00
Tom Tromey 2003f3d839 Remove some cleanups from stack.c
This removes some cleanups from stack.c by using std::string or
gdb::unique_xmalloc_ptr.  One cleanup remains in this file; I did not
remove it here because it is handled in another patch series that has
yet to be resolved.

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

	* stack.c (parse_frame_specification): Use std::string
	(info_frame_command): Use gdb::unique_xmalloc_ptr.
2017-09-29 20:46:43 -06:00
Tom Tromey 8f8accb580 Remove cleanup from tilegx-tdep.c
This removes a cleanup from tilegx-tdep.c, by using gdb::byte_vector.

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

	* tilegx-tdep.c (tilegx_push_dummy_call): Use gdb::byte_vector.
2017-09-29 20:46:43 -06:00
Tom Tromey 200aa7b154 Remove cleanups from utils.c
This removes a couple of cleanups from utils.c through the use of
std::string.

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

	* utils.c (vfprintf_maybe_filtered): Use std::string.
	(vfprintf_unfiltered): Likewise.
2017-09-29 20:46:43 -06:00
Tom Tromey 606aae8a73 Remove cleanup from display_gdb_prompt
This removes a cleanup from display_gdb_prompt by using std::string.

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

	* event-top.c (top_level_prompt): Return std::string.
	(display_gdb_prompt): Update.
2017-09-29 20:46:43 -06:00
Tom Tromey bd413795d3 Introduce string_vprintf
This adds string_vprintf, a va_list variant of string_printf.  This
will be used in later patches.

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

	* unittests/common-utils-selftests.c (format): New function.
	(string_vprintf_tests): New function.
	(_initialize_common_utils_selftests): Register new tests.
	* common/common-utils.c (string_vprintf): New function.
	* common/common-utils.h (string_vprintf): Declare.
2017-09-29 20:46:42 -06:00
Alan Modra 8b5b252959 PR21978, objdump does not display line numbers in certain cases
Same line but different file ought to display file and line.

	PR 21978
	* objdump.c: Formatting.
	(show_line): Reset prev_line when function name changes.
2017-09-30 12:01:43 +09:30
GDB Administrator 1755697b1d Automatic date update in version.in 2017-09-30 00:00:28 +00:00
Pedro Alves 256642e857 Constify unpack_varlen_hex & fix fallout
I ran into non-const unpack_varlen_hex while working on something
else, and decided to just fix it first.  Ends up constifying a good
deal of remote packet parsing.

gdb/ChangeLog:
2017-09-29  Pedro Alves  <palves@redhat.com>

	* common/rsp-low.c (unpack_varlen_hex): Constify.
	* common/rsp-low.h (unpack_varlen_hex): Constify.
	* linux-nat.c (linux_child_static_tracepoint_markers_by_strid):
	Constify.
	* remote.c (remote_set_permissions, read_ptid)
	(remote_current_thread, remote_get_threads_with_qthreadinfo)
	(remote_static_tracepoint_marker_at)
	(remote_static_tracepoint_markers_by_strid)
	(stop_reply_extract_thread, remote_parse_stop_reply): Constify.
	* tracepoint.c (parse_trace_status, parse_tracepoint_status)
	(parse_tracepoint_definition, parse_tsv_definition)
	(parse_static_tracepoint_marker_definition): Constify.
	* tracepoint.h (parse_static_tracepoint_marker_definition)
	(parse_trace_status, parse_tracepoint_status)
	(parse_tracepoint_definition, parse_tsv_definition): Constify.

gdb/gdbserver/ChangeLog:
2017-09-29  Pedro Alves  <palves@redhat.com>

	* ax.c (gdb_parse_agent_expr): Constify.
	* ax.h (gdb_parse_agent_expr): Constify.
	* mem-break.c (add_breakpoint_condition, add_breakpoint_commands):
	Constify.
	* mem-break.h (add_breakpoint_condition, add_breakpoint_commands): Constify.
	* remote-utils.c (hex_or_minus_one, read_ptid): Constify.
	* remote-utils.h (read_ptid): Constify.
	* server.c (handle_qxfer_exec_file, handle_query, handle_v_cont)
	(process_point_options, process_serial_event): Constify.
	* tracepoint.c (add_tracepoint_action, cmd_qtdp, cmd_qtdpsrc)
	(cmd_qtdv, cmd_qtenable_disable, cmd_qtro, cmd_qtframe, cmd_qtp)
	(cmd_qtbuffer): Constify.
2017-09-29 17:15:36 +01:00
Pedro Alves b6bb34680b gdb/remote.c: Eliminate target_buf/target_buf_size hack
This finally eliminates an old hack left in place when tracepoint RSP
support was migrated from tracepoint.c to remote.c, back in
35b1e5cca0 ("Make tracepoint operations go through target vector.")
over 7 years ago.

Tested on x86_64 GNU/Linux.

gdb/ChangeLog:
2017-09-29  Pedro Alves  <palves@redhat.com>

	* remote.c (target_buf, target_buf_size): Delete.
	(remote_get_noisy_reply): Remove buf_p and sizeof_buf parameters.
	Use the connection's packet buffer instead.
	All callers adjusted.
	(_initialize_remote): Remove references to target_buf and
	target_buf_size.
2017-09-29 17:09:05 +01:00
Pedro Alves 5b9ca4d43b gdbserver/libthread_db: Don't ignore memory reading failures
If we had this in place before, then the regression fixed by the
previous commit would have been been visible is all test runs.  E.g.:

  Running src/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp ...
  FAIL: gdb.threads/multi-create-ns-info-thr.exp: continue to breakpoint 6

Debugging manually we'd see this:
  gdbserver: Cannot get thread handle for LWP 1467: generic error

Instead of:
  gdbserver: PID mismatch!  Expected 27472, got 27471

which is misleading - gdbserver didn't 27471, that was stale stack
data from previous function invocations.

gdb/gdbserver/ChangeLog:
2017-09-29  Pedro Alves  <palves@redhat.com>

	* proc-service.c (ps_pdread): Return PS_ERR if reading memory
	fails.
2017-09-29 13:10:39 +01:00
Pedro Alves 94c207e097 Fix gdbserver regression exposed by gdb.threads/multi-create-ns-info-thr.exp
Commit 8629910955 ("Add thread_db_notice_clone to gdbserver")
introduced calls into libthread_db without making sure that the
current thread is pointing to a know-stopped thread.  This resulted in
sometimes thread_db_notice_clone failing->find_one_thread failing like
this, as seen when running gdb.threads/multi-create-ns-info-thr.exp:

~~~
  Thread <6> executing
  Thread <7> executing
  gdbserver: PID mismatch!  Expected 27472, got 27471
  gdbserver: Cannot find thread after clone.

  Thread <1000> executing
  Thread <1001> executing
~~~

Things go south from here and sometimes that ends up resulting in
gdbserver crashing and the test failing.

gdb/gdbserver/ChangeLog:
2017-09-29  Pedro Alves  <palves@redhat.com>

	* linux-low.c (handle_extended_wait): Pass parent thread instead
	of process to thread_db_notice_clone.
	* linux-low.h (thread_db_notice_clone): Replace parent process
	parameter with parent thread parameter.
	* thread-db.c (find_one_thread): Add comment.
	(thread_db_notice_clone): Replace parent process parameter with
	parent thread parameter.  Temporarily switch to the parent thread.
2017-09-29 13:06:34 +01:00
Alan Modra f6ac8c52c9 Fail when string merge can't alloc memory
I was looking at Debian bug #874674 again today, and think I might
have spotted the problem.  It appears that merge.c tries to cope with
memory allocation failures in some circumstances, but doesn't quite
manage to get everything right.  This patch will make ld report memory
allocation failures instead of silently not merging strings.

	* merge.c (merge_strings): Return FALSE on malloc failure.
	(_bfd_merge_sections): Return failures from record_section and
	merge_strings.
2017-09-29 14:42:36 +09:30
GDB Administrator 1b8f6c7f82 Automatic date update in version.in 2017-09-29 00:00:24 +00:00
Pedro Alves b2f8eb7a30 Move utils-selftests.c -> gdb/unittests/
This file was only under gdb/ currently because it predates the
gdb/unittests/ directory.

gdb/ChangeLog:
2017-09-28  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
	unittests/common-utils-selftests.c.
	(SUBDIR_UNITTESTS_OBS): Add common-utils-selftests.o.
	(COMMON_OBS): Remove utils-selftests.o.
	* utils-selftests.c: Move to ...
	* unittests/common-utils-selftests.c: ... here and rename self
	test to "string_printf".
2017-09-28 22:31:42 +01:00
Doug Evans 08302ed2cb (open_and_init_dwp_file): Protect against some segvs
This is a "tiny patch", no assignment required.

2017-09-28  Alexander Shaposhnikov <alexander.v.shaposhnikov@gmail.com>

	* dwarf2read.c (open_and_init_dwp_file): Protect against dwp_file
	having NULL cus or tus.
2017-09-28 09:24:48 -07:00
Nick Clifton 231ca75323 Skip the PR 14918 linker test for ARM targets.
I am applying a patch that has been lying around in the Fedora
  binutils sources for a while.  It skips the PR14918 linker test for
  ARM based targets.  This test checks that libgcc is not included in a
  link of an empty executable.  This works for most targets, but on the
  ARM the crt1.o startup code calls __libc_csu_init which is in
  /usr/lib/libc_nonshared.a(elf-init.oS).  This in turn needs
  __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1,
  and so the test fails.
2017-09-28 11:33:20 +01:00
Alan Modra 1a3b5c34fe PR22220, BFD linker wrongly marks symbols as PREVAILING_DEF_IRONLY
non_ir_ref_dynamic wasn't being set in the case where we have a
versioned dynamic symbol definition with a non-versioned matching IR
symbol.

bfd/
	PR 22220
	* elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in
	a case where plugin_notice isn't called.
ld/
	* testsuite/ld-plugin/pr22220.h,
	* testsuite/ld-plugin/pr22220lib.cc,
	* testsuite/ld-plugin/pr22220lib.ver,
	* testsuite/ld-plugin/pr22220main.cc: New test.
	* testsuite/ld-plugin/lto.exp: Run it.
2017-09-28 17:36:36 +09:30
GDB Administrator 50300765aa Automatic date update in version.in 2017-09-28 00:00:30 +00:00
Ulrich Weigand 96a5a1d378 Complete tdep move to convert_typed_floating
Many tdep files need to perform conversions between two floating-point
types, usually when accessing FP registers.  Most targets now use the
convert_typed_floating helper routine to do so.  However, a small number
still use the old method of converting via a DOUBLEST.  Since we want
to get rid of DOUBLEST, these targets need to be moved to the new
method as well.

The main obstacle is that for convert_typed_floating we need an actual
*type*, not just a floatformat.

In arm-tdep.c, this is very straightforward, since there is already a
type using the ARM extended floatformat.

For sh-tdep.c and sh64-tdep.c, no such type already exists, so I've
added one to the gdbarch_tdep struct as done on other targets.

gdb/ChangeLog
2017-09-27  Ulrich Weigand  <uweigand@de.ibm.com>

	* arm-tdep.c: (convert_from_extended): Remove.
	(convert_to_extended): Likewise.
	(arm_extract_return_value): Use convert_typed_floating.
	(arm_store_return_value): Likewise.

	* sh-tdep.h (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
	* sh-tdep.c: Do not include "floatformat.h".
	(sh_littlebyte_bigword_type): New function.
	(sh_register_convert_to_virtual): Use convert_typed_floating.
	(sh_register_convert_to_raw): Likewise.
	* sh64-tdep.c: (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
	(sh64_littlebyte_bigword_type): New function.
	(sh64_extract_return_value): Use convert_typed_floating.
	(sh64_register_convert_to_virtual): Likewise.
	(sh64_register_convert_to_raw): Likewise.
2017-09-27 19:05:21 +02:00
Ulrich Weigand 0db7851f9f Simplify floatformat_from_type
For historical reasons, the TYPE_FLOATFORMAT element is still set to hold
an array of two floatformat structs, one for big-endian and the other for
little-endian.  When accessing the element via floatformat_from_type,
the code would check the type's byte order and return the appropriate
floatformat.

However, these days this is quite unnecessary, since the type's byte order
is already known at the time the type is allocated and the floatformat is
installed into TYPE_FLOATFORMAT.  Therefore, we can just install the correct
version here.

Also, moves the (now trivially simple) floatformat_from_type accessor to
gdbtypes.{c,h}, since it doesn't really need to be in doublest.c now.

gdb/ChangeLog
2017-09-27  Ulrich Weigand  <uweigand@de.ibm.com>

	* doublest.h (floatformat_from_type): Move to gdbtypes.h.
	* doublest.c (floatformat_from_type): Move to gdbtypes.c.

	* gdbtypes.h (union type_specific): Make field floatformat hold
	just a single struct floatformat, not an array.
	(floatformat_from_type): Move here.
	* gdbtypes.c (floatformat_from_type): Move here.  Update to
	changed TYPE_FLOATFORMAT definition.
	(verify_floatformat): Update to changed TYPE_FLOATFORMAT.
	(recursive_dump_type): Likewise.
	(init_float_type): Install correct floatformat for byte order.
	(arch_float_type): Likewise.
2017-09-27 19:03:36 +02:00
Ulrich Weigand 77b7c781e9 Make init_type/arch_type take a size in bits
This changes the interfaces to init_type and arch_type to take the
type length in bits as input (instead of as bytes).  The routines
assert that the length is a multiple of TARGET_CHAR_BIT.

For consistency, arch_flags_type is changed likewise, so that now
all type creation interfaces always use length in bits.

All callers are updated in the straightforward manner.

The assert actually found a bug in read_range_type, where the
init_integer_type routine was called with a wrong argument (probably
a bug introduced with the conversion to use init_integer_type).

gdb/ChangeLog
2017-09-27  Ulrich Weigand  <uweigand@de.ibm.com>

	* gdbtypes.c (init_type): Change incoming argument from
	length-in-bytes to length-in-bits.  Assert length is a
	multiple of TARGET_CHAR_BITS.
	(arch_type, arch_flags_type): Likewise.
	(init_integer_type): Update call to init_type.
	(init_character_type): Likewise.
	(init_boolean_type): Likewise.
	(init_float_type): Likewise.
	(init_decfloat_type): Likewise.
	(init_complex_type): Likewise.
	(init_pointer_type): Likewise.
	(objfile_type): Likewise.
	(arch_integer_type): Update call to arch_type.
	(arch_character_type): Likewise.
	(arch_boolean_type): Likewise.
	(arch_float_type): Likewise.
	(arch_decfloat_type): Likewise.
	(arch_complex_type): Likewise.
	(arch_pointer_type): Likewise.
	(gdbtypes_post_init): Likewise.

	* dwarf2read.c (dwarf2_init_float_type): Update call to init_type.
	(read_base_type): Likewise.
	* mdebugread.c (basic_type): Likewise.
	* stabsread.c (dbx_init_float_type): Likewise.
	(rs6000_builtin_type): Likewise.
	(read_range_type): Likewise.  Also, fix call to init_integer_type
	with erroneous length argument.

	* ada-lang.c (ada_language_arch_info): Update call to arch_type.
	* d-lang.c (build_d_types): Likewise.
	* f-lang.c (build_fortran_types): Likewise.
	* go-lang.c (build_go_types): Likewise.
	* opencl-lang.c (build_opencl_types): Likewise.
	* jit.c (finalize_symtab): Likewise.
	* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
	(build_std_type_info_type): Likewise.
	* target-descriptions.c (tdesc_gdb_type): Likewise.  Also,
	update call to arch_flags_type.

	* linux-tdep.c (linux_get_siginfo_type_with_fields): Update call to
	arch_type.
	* fbsd-tdep.c (fbsd_get_siginfo_type): Likewise.
	* windows-tdep.c (windows_get_tlb_type): Likewise.

	* avr-tdep.c (avr_gdbarch_init): Update call to arch_type.
	* ft32-tdep.c (ft32_gdbarch_init): Likewise.
	* m32c-tdep.c (make_types): Likewise.
	* rl78-tdep.c (rl78_gdbarch_init): Likewise.
	(rl78_psw_type): Update call to arch_flags_type.
	* m68k-tdep.c (m68k_ps_type): Update call to arch_flags_type.
	* rx-tdep.c (rx_psw_type): Likewise.
	(rx_fpsw_type): Likewise.
	* sparc-tdep.c (sparc_psr_type): Likewise.
	(sparc_fsr_type): Likewise.
	* sparc64-tdep.c (sparc64_pstate_type): Likewise.
	(sparc64_ccr_type): Likewise.
	(sparc64_fsr_type): Likewise.
	(sparc64_fprs_type): Likewise.
2017-09-27 19:02:00 +02:00
Nick Clifton 8e43602e34 Add support for the new names of the RISC-V fmv.x.s and fmv.s.x instructions, vis: fmv.x.w and fmv.w.x.
PR 22179
opcodes	* riscv-opc.c (riscv_opcodes): Add fmv.x.w and fmv.w.x as the new
	names for the fmv.x.s and fmv.s.x instructions respectively.

gas	* testsuite/gas/riscv/fmv.x.s: New file: Tests the support for the
	renamed fmv.x.s and fmv.s.x instructions.
	* testsuite/gas/riscv/fmv.x.d: New file: Test driver.
2017-09-27 16:21:36 +01:00
Tom Tromey f21b4d5c59 Constify find_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* findcmd.c (find_command): Constify.
2017-09-27 08:45:11 -06:00
Tom Tromey 643c2ffafe Constify some commands in ada-tasks.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* ada-tasks.c (task_command_1, task_command): Constify.
2017-09-27 08:45:10 -06:00