Simon Marchi [Tue, 12 Sep 2017 11:55:32 +0000 (13:55 +0200)]
Make collect_probes return an std::vector
Change collect_probes so it returns an std::vector<bound_probe> instead
of a VEC(bound_probe_s). This allows removing some cleanups. It also
seems like enable_probes_command and disable_probes_command were not
freeing that vector.
The comparison function compare_probes needs to be updated to return a
bool indicating whether the first parameter is "less than" the second
parameter.
I defined two constructors to bound_probe. The default constructor is
needed, for example, so the instance in struct bp_location can be
constructed without parameters. The constructor with parameters is
useful so we can use emplace_back and pass the values directly.
The s390 builder on the buildbot shows a weird failure that I can't
explain:
../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*):
../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror]
for (struct probe *probe : *probes)
^~~~~~
I guess it's a bug with that specific version< of the compiler, since no
other gcc gives me that error. It is using:
g++ (GCC) 6.3.1
20161221 (Red Hat 6.3.1-1)
Any idea about this problem?
gdb/ChangeLog:
* probe.h (struct bound_probe): Define constructors.
* probe.c (bound_probe_s): Remove typedef.
(DEF_VEC_O (bound_probe_s)): Remove VEC.
(collect_probes): Change return type to std::vector, remove
cleanup.
(compare_probes): Return bool, change parameter type. Change
semantic to "less than".
(gen_ui_out_table_header_info): Change parameter to std::vector
and update.
(exists_probe_with_pops): Likewise.
(info_probes_for_ops): Update to std::vector change.
(enable_probes_command): Likewise.
(disable_probes_command): Likewise.
Simon Marchi [Tue, 12 Sep 2017 11:37:00 +0000 (13:37 +0200)]
Make probe_ops::get_probes fill an std::vector
This patch changes one usage of VEC to std::vector. It is a relatively
straightforward 1:1 change. The implementations of
sym_probe_fns::sym_get_probes return a borrowed reference to their probe
vectors, meaning that the caller should not free it. In the new code, I
made them return a const reference to the vector.
This patch and the following one were tested by the buildbot. I didn't
see any failures that looked related to this one.
gdb/ChangeLog:
* probe.h (struct probe_ops) <get_probes>: Change parameter from
vec to std::vector.
* probe.c (parse_probes_in_pspace): Update.
(find_probes_in_objfile): Update.
(find_probe_by_pc): Update.
(collect_probes): Update.
(probe_any_get_probes): Update.
* symfile.h (struct sym_probe_fns) <sym_get_probes> Change
return type to reference to std::vector.
* dtrace-probe.c (dtrace_process_dof_probe): Change parameter to
std::vector and update.
(dtrace_process_dof): Likewise.
(dtrace_get_probes): Likewise.
* elfread.c (elf_get_probes): Change return type to std::vector,
store an std::vector in bfd_data.
(probe_key_free): Update to std::vector.
* stap-probe.c (handle_stap_probe): Change parameter to
std::vector and update.
(stap_get_probes): Likewise.
* symfile-debug.c (debug_sym_get_probes): Change return type to
std::vector and update.
GDB Administrator [Tue, 12 Sep 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 9 Sep 2017 16:47:10 +0000 (10:47 -0600)]
Remove make_show_memory_breakpoints_cleanup
This removes make_show_memory_breakpoints_cleanup, replacing it with
make_scoped_restore_show_memory_breakpoints and updating all callers.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* breakpoint.c (program_breakpoint_here_p): Update.
* target.c (make_scoped_restore_show_memory_breakpoints): Rename
from make_show_memory_breakpoints_cleanup. Return a
scoped_restore_tmpl<int>.
(restore_show_memory_breakpoints): Remove.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Update.
* mem-break.c (memory_validate_breakpoint): Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Update.
(ia64_memory_remove_breakpoint): Update.
(ia64_breakpoint_from_pc): Update.
* target.h (make_scoped_restore_show_memory_breakpoints): Rename
from make_show_memory_breakpoints_cleanup.
Tom Tromey [Sat, 9 Sep 2017 16:46:36 +0000 (10:46 -0600)]
Use std::string in d-namespace.c
This removes some cleanups from d-namespace.c by replacing manual
string management with std::string.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* d-namespace.c (d_lookup_symbol): Use std::string.
(find_symbol_in_baseclass): Likewise.
Tom Tromey [Sat, 9 Sep 2017 16:17:11 +0000 (10:17 -0600)]
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.
Tom Tromey [Sat, 9 Sep 2017 16:14:52 +0000 (10:14 -0600)]
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.
Tom Tromey [Sat, 9 Sep 2017 15:56:27 +0000 (09:56 -0600)]
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.
Tom Tromey [Sun, 13 Aug 2017 20:44:08 +0000 (14:44 -0600)]
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.
Tom Tromey [Sun, 13 Aug 2017 20:40:46 +0000 (14:40 -0600)]
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.
Tom Tromey [Sun, 13 Aug 2017 16:55:28 +0000 (10:55 -0600)]
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.
Tom Tromey [Sun, 10 Sep 2017 20:48:30 +0000 (14:48 -0600)]
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.
Tom Tromey [Sun, 10 Sep 2017 20:29:22 +0000 (14:29 -0600)]
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.
Tom Tromey [Sun, 10 Sep 2017 20:19:19 +0000 (14:19 -0600)]
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.
Tom Tromey [Fri, 8 Sep 2017 21:38:12 +0000 (15:38 -0600)]
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.
Tom Tromey [Fri, 8 Sep 2017 20:26:43 +0000 (14:26 -0600)]
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.
Tom Tromey [Tue, 5 Sep 2017 18:07:00 +0000 (12:07 -0600)]
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.
Kuan-Lin Chen [Mon, 11 Sep 2017 05:46:27 +0000 (13:46 +0800)]
nds32: Rename __BIT() to N32_BIT().
GDB Administrator [Mon, 11 Sep 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Sun, 10 Sep 2017 21:50:29 +0000 (17:50 -0400)]
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".
Sergio Durigan Junior [Sun, 10 Sep 2017 16:16:54 +0000 (12:16 -0400)]
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
f7000548a2b79d7e5cb924468117ca4245e6b820
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.
Andrew Burgess [Sun, 6 Aug 2017 20:45:08 +0000 (21:45 +0100)]
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:
¤t_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.
GDB Administrator [Sun, 10 Sep 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 9 Sep 2017 20:51:58 +0000 (22:51 +0200)]
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.
Tom Tromey [Wed, 6 Sep 2017 23:18:23 +0000 (17:18 -0600)]
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.
Tom Tromey [Wed, 6 Sep 2017 22:16:38 +0000 (16:16 -0600)]
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.
Tom Tromey [Mon, 14 Aug 2017 06:15:33 +0000 (00:15 -0600)]
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.
Tom Tromey [Wed, 6 Sep 2017 22:03:28 +0000 (16:03 -0600)]
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.
Tom Tromey [Thu, 7 Sep 2017 03:41:40 +0000 (21:41 -0600)]
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.
Tom Tromey [Sun, 13 Aug 2017 16:47:32 +0000 (10:47 -0600)]
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.
Tom Tromey [Fri, 11 Aug 2017 21:17:59 +0000 (15:17 -0600)]
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.
Tom Tromey [Fri, 11 Aug 2017 21:17:26 +0000 (15:17 -0600)]
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.
Tom Tromey [Fri, 11 Aug 2017 21:02:04 +0000 (15:02 -0600)]
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.
Tom Tromey [Sat, 9 Sep 2017 15:16:49 +0000 (09:16 -0600)]
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.
Tom Tromey [Sat, 9 Sep 2017 15:15:23 +0000 (09:15 -0600)]
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.
John Baldwin [Sat, 9 Sep 2017 18:02:37 +0000 (11:02 -0700)]
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.
Alan Modra [Sat, 9 Sep 2017 12:25:22 +0000 (21:55 +0930)]
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.
H.J. Lu [Sat, 9 Sep 2017 14:29:15 +0000 (07:29 -0700)]
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.
H.J. Lu [Sat, 9 Sep 2017 14:19:36 +0000 (07:19 -0700)]
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.
H.J. Lu [Sat, 9 Sep 2017 12:31:30 +0000 (05:31 -0700)]
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.
H.J. Lu [Sat, 9 Sep 2017 12:05:16 +0000 (05:05 -0700)]
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.
GDB Administrator [Sat, 9 Sep 2017 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Keith Seitz [Fri, 8 Sep 2017 23:44:30 +0000 (16:44 -0700)]
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.
H.J. Lu [Fri, 8 Sep 2017 16:15:25 +0000 (09:15 -0700)]
x86: Update comments in elfxx-x86.h
* elfxx-x86.h: Update comments.
Christoph Weinmann [Fri, 8 Sep 2017 13:11:47 +0000 (15:11 +0200)]
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.
Bernhard Heckel [Fri, 8 Sep 2017 13:11:47 +0000 (15:11 +0200)]
fortran: Testsuite, fix typos in vla-value.
Bernhard Heckel [Fri, 8 Sep 2017 13:11:47 +0000 (15:11 +0200)]
Fortran: Testsuite, fix differences in type naming.
Frank Penczek [Fri, 8 Sep 2017 13:11:47 +0000 (15:11 +0200)]
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
H.J. Lu [Fri, 8 Sep 2017 11:10:34 +0000 (04:10 -0700)]
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.
H.J. Lu [Fri, 8 Sep 2017 00:19:10 +0000 (17:19 -0700)]
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.
GDB Administrator [Fri, 8 Sep 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Palmer Dabbelt [Fri, 16 Jun 2017 21:33:16 +0000 (14:33 -0700)]
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.
Palmer Dabbelt [Fri, 16 Jun 2017 21:19:55 +0000 (14:19 -0700)]
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.
Palmer Dabbelt [Wed, 16 Aug 2017 17:41:56 +0000 (10:41 -0700)]
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.
Joel Brobecker [Thu, 7 Sep 2017 14:40:10 +0000 (07:40 -0700)]
Document the GDB 8.0.1 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 8.0.1 released.
Joel Brobecker [Thu, 7 Sep 2017 14:24:33 +0000 (07:24 -0700)]
remove QStartupWithShell entry from NEWS::Changes in GDB 7.11
This entry was added twice within the same commit, back in Dec 2017
by the following change:
commit
aefd8b33d97bded58e51d75271f99e1eaec9fb28
Date: Thu Dec 22 22:14:02 2016 -0500
Subject: Implement proper "startup-with-shell" support on gdbserver
I think the second entry is just a rebase/merge oversight, and it wasn't
meant to be added there, particularly since the 7.11 branch was no longer
active at that time anymore.
This patch just removes the entry.
gdb/ChangeLog:
* NEWS (Changes in GDB 7.11): Remove entry for QStartupWithShell.
H.J. Lu [Thu, 7 Sep 2017 11:03:15 +0000 (04:03 -0700)]
x86: Remove _bfd_{i386,x86_64}_elf_convert_load
Instead of converting GOT relocations when sizing dynamic sections, we
convert GOT relocations during relocation check. Add a field, local_ref,
to elf_x86_link_hash_entry to indicate if symbol references are always
local with a new function to check if symbol references are always local,
which works in check_relocs.
* elf32-i386.c (elf_i386_convert_load_reloc): Add an argument,
r_type_p. Remove the converted argument. Replace
SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return
the new relocation type via r_type_p.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(need_convert_load): Removed.
(check_relocs_failed): Updated.
(elf_i386_check_relocs): Call elf_i386_convert_load_reloc,
instead of setting need_convert_load.
(_bfd_i386_elf_convert_load): Removed.
* elf64-x86-64.c (need_convert_load): Removed.
(check_relocs_failed): Updated.
(elf_x86_64_convert_load_reloc): Add an argument, r_type_p.
Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P.
Return the new relocation type via r_type_p.
(elf_x86_64_check_relocs): Call elf_x86_64_convert_load_reloc,
instead of setting need_convert_load.
(elf_x86_64_check_relocs): Don't check PIC if relocation has
been converted.
(_bfd_x86_64_elf_convert_load): Removed.
(elf_x86_64_relocate_section): Replace SYMBOL_REFERENCES_LOCAL
with SYMBOL_REFERENCES_LOCAL_P.
(elf_x86_64_finish_dynamic_symbol): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Don't
set convert_load.
(_bfd_x86_elf_size_dynamic_sections): Don't call convert_load.
(_bfd_x86_elf_link_symbol_references_local): New function.
* elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): New.
(UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace elf.forced_local with
SYMBOL_REFERENCES_LOCAL_P.
(elf_x86_link_hash_entry): Add local_ref.
(elf_x86_link_hash_table): Remove convert_load.
(_bfd_i386_elf_convert_load): Removed.
(_bfd_x86_64_elf_convert_load): Likewise.
(_bfd_x86_elf_link_symbol_references_local): New.
GDB Administrator [Thu, 7 Sep 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 4 Sep 2017 03:50:47 +0000 (21:50 -0600)]
Change funcall_chain to be a std::vector
This simplifies the handling of funcall_chain, by changing it to be a
std::vector<int> and then fixing the users. This allows the removal
of a cleanup.
It would be even cleaner to replace this with better logic in the
parsers; but a baby step seemed ok.
gdb/ChangeLog
2017-09-05 Tom Tromey <tom@tromey.com>
* parse.c (funcall_chain): Now a std::vector.
(start_arglist, end_arglist): Simplify.
(free_funcalls): Remove.
(parse_exp_in_context_1): Remove cleanup.
Tom Tromey [Sun, 13 Aug 2017 16:40:35 +0000 (10:40 -0600)]
Remove last cleanups from go-exp.y
This removes the last remaining cleanups from go-exp.y.
2017-09-05 Tom Tromey <tom@tromey.com>
* go-exp.y (go_parse): Don't create a cleanup.
Tom Tromey [Sun, 13 Aug 2017 16:38:53 +0000 (10:38 -0600)]
Remove last cleanups from d-exp.y
This removes the last remaining cleanups from d-exp.y.
2017-09-05 Tom Tromey <tom@tromey.com>
* d-exp.y (PrimaryExpression): Use std::string.
(d_parse): Don't create a cleanup.
Tom Tromey [Sun, 13 Aug 2017 16:37:13 +0000 (10:37 -0600)]
Remove make_cleanup_clear_parser_state
This removes make_cleanup_clear_parser_state in favor of
scoped_restore.
2017-09-05 Tom Tromey <tom@tromey.com>
* utils.c (do_clear_parser_state): Remove.
(make_cleanup_clear_parser_state): Remove.
* p-exp.y (pascal_parse): Use scoped_restore.
* m2-exp.y (m2_parse): Use scoped_restore.
* f-exp.y (f_parse): Use scoped_restore.
* d-exp.y (d_parse): Use scoped_restore.
* c-exp.y (c_parse): Use scoped_restore.
* ada-exp.y (ada_parse): Use scoped_restore.
* utils.h (make_cleanup_clear_parser_state): Remove.
Keith Seitz [Wed, 6 Sep 2017 19:50:52 +0000 (12:50 -0700)]
Introduce dw2_linkage_name and dw2_linkage_name_attr.
The DWARF reader is littered with the following idiom to read a linkage name
from the debug info:
mangled = dwarf2_string_attr (die, DW_AT_linkage_name, cu);
if (mangled == NULL)
mangled = dwarf2_string_attr (die, DW_AT_MIPS_linkage_name, cu);
This patch introduces functions to simplify this to:
mangled = dw2_linkage_name (die, cu);
or
attr = dw2_linkage_name_attr (die, cu);
gdb/ChangeLog:
* dwarf2read.c (dw2_linkage_name_attr): New function.
(dw2_linkage_name): New function.
(dwarf2_compute_name, dwarf2_physname, read_call_site_scope)
(guess_full_die_structure_name, dwarf2_name): Use dw2_linkage_name.
(anonymous_struct_prefix, dwarf2_name): Use dw2_linkage_name_attr.
John Baldwin [Wed, 6 Sep 2017 17:16:12 +0000 (10:16 -0700)]
Honor an existing CC_FOR_BUILD in the environment for sim.
This matches the equivalent bits in bfd/acinclude.m4
sim/ChangeLog:
* configure.ac: Honor existing CC_FOR_BUILD in environment.
* configure: Regenerate.
sim/aarch64/ChangeLog:
* configure: Regenerate.
sim/arm/ChangeLog:
* configure: Regenerate.
sim/avr/ChangeLog:
* configure: Regenerate.
sim/bfin/ChangeLog:
* configure: Regenerate.
sim/common/ChangeLog:
* acinclude.m4 (SIM_AC_COMMON) Honor existing CC_FOR_BUILD in
environment.
sim/cr16/ChangeLog:
* configure: Regenerate.
sim/cris/ChangeLog:
* configure: Regenerate.
sim/d10v/ChangeLog:
* configure: Regenerate.
sim/erc32/ChangeLog:
* configure: Regenerate.
sim/frv/ChangeLog:
* configure: Regenerate.
sim/ft32/ChangeLog:
* configure: Regenerate.
sim/h8300/ChangeLog:
* configure: Regenerate.
sim/iq2000/ChangeLog:
* configure: Regenerate.
sim/lm32/ChangeLog:
* configure: Regenerate.
sim/m32c/ChangeLog:
* configure: Regenerate.
sim/m32r/ChangeLog:
* configure: Regenerate.
sim/m68hc11/ChangeLog:
* configure: Regenerate.
sim/mcore/ChangeLog:
* configure: Regenerate.
sim/microblaze/ChangeLog:
* configure: Regenerate.
sim/mips/ChangeLog:
* configure: Regenerate.
sim/mn10300/ChangeLog:
* configure: Regenerate.
sim/moxie/ChangeLog:
* configure: Regenerate.
sim/msp430/ChangeLog:
* configure: Regenerate.
sim/rl78/ChangeLog:
* configure: Regenerate.
sim/rx/ChangeLog:
* configure: Regenerate.
sim/sh/ChangeLog:
* configure: Regenerate.
sim/sh64/ChangeLog:
* configure: Regenerate.
sim/v850/ChangeLog:
* configure: Regenerate.
Tom Tromey [Wed, 30 Aug 2017 22:12:56 +0000 (16:12 -0600)]
Cast char constant to int in sizeof.exp
PR gdb/22010 concerns a regression I introduced with the scalar
printing changes. The bug is that this code in sizeof.exp:
set signof_byte [get_integer_valueof "'\\377'" -1]
can incorrectly compute sizeof_byte. One underlying problem here is
that gdb's C parser doesn't treat a char constant as an int (this is
PR 19973).
However, it seems good to have an immediate fix for the regression.
The simplest is to cast to an int here.
testsuite/ChangeLog
2017-09-05 Tom Tromey <tom@tromey.com>
PR gdb/22010:
* gdb.base/sizeof.exp (check_valueof): Cast char constant to int.
Kamil Rytarowski [Wed, 6 Sep 2017 16:48:49 +0000 (18:48 +0200)]
Correct shell compatibility issue detected with pkgsrc.
String comparison of in a POSIX bourne shell must be done
with '=', not '=='. For example the NetBSD sh(1) does not
support it.
gdb/ChangeLog
2017-09-06 Kamil Rytarowski <n54@gmx.com>
* config/djgpp/djconfig.sh: Correct shell portability issue.
Thomas Preud'homme [Wed, 6 Sep 2017 16:54:26 +0000 (17:54 +0100)]
Fix calls in gdb.arch/thumb2-it.exp
Tests in gdb.arch/thumb2-it.exp call functions defined in assembly
without type debugging information. Since
7022349d5c86bae74b49225515f42d2e221bd368 ("Stop assuming no-debug-info
functions return int") this triggers an error which leads to many tests
to FAIL. This patch cast the call to indicate the return type of the
functions when calling them.
2017-09-06 Thomas Preud'homme <thomas.preudhomme@arm.com>
gdb/testsuite/
* gdb.arch/thumb2-it.exp: Cast call to assembly defined function.
Kamil Rytarowski [Wed, 6 Sep 2017 16:33:46 +0000 (18:33 +0200)]
Define HAVE_NATIVE_GCORE_HOST on NetBSD
NetBSD ships with gcore(1) againg since the version 2.0.
This tool is functional and actively maintained.
gdb/ChangeLog
2017-09-06 Kamil Rytarowski <n54@gmx.com>
* configure.nat: Define HAVE_NATIVE_GCORE_HOST on NetBSD.
John Baldwin [Thu, 10 Aug 2017 18:00:42 +0000 (11:00 -0700)]
Add native target for FreeBSD/aarch64.
gdb/ChangeLog:
* Makefile.in (ALLDEPFILES): Add mips-fbsd-nat.c.
* NEWS: Mention new FreeBSD/mips native configuration.
* configure.host: Add aarch64*-*-freebsd*.
* configure.nat: Likewise.
* aarch64-fbsd-nat.c: New file.
John Baldwin [Wed, 9 Aug 2017 06:25:42 +0000 (23:25 -0700)]
Add FreeBSD/aarch64 architecture.
Support for collecting and supplying general purpose and floating point
register sets is provided along with signal frame unwinding.
gdb/ChangeLog:
* Makefile.in (ALL_64_TARGET_OBS): Add aarch64-fbsd-tdep.o.
(ALLDEPFILES): Add aarch64-fbsd-tdep.c.
* NEWS: Mention new FreeBSD/aarch64 target.
* configure.tgt: Add aarch64*-*-freebsd*.
* aarch64-fbsd-tdep.c: New file.
* aarch64-fbsd-tdep.h: New file.
Kamil Rytarowski [Wed, 6 Sep 2017 15:57:39 +0000 (17:57 +0200)]
Add myself as a write-after-approval GDB maintainer.
gdb/ChangeLog:
2017-09-06 Kamil Rytarowski <n54@gmx.com>
* MAINTAINERS (Write After Approval): Add Kamil Rytarowski.
H.J. Lu [Wed, 6 Sep 2017 12:06:35 +0000 (05:06 -0700)]
x86-64: Add R_X86_64_converted_reloc_bit
Add R_X86_64_converted_reloc_bit to relocation type to indicate if a
relocation is converted from a GOTPCREL relocation. Linker now generates
failed to convert GOTPCREL relocation; relink with --no-relax
for all cases, including relocations against local symbols.
bfd/
* elf64-x86-64.c (R_X86_64_converted_reloc_bit): New.
(elf_x86_64_info_to_howto): Get the real relocation type by
masking out R_X86_64_converted_reloc_bit.
(elf_x86_64_check_tls_transition): Get the real relocation type
by masking out R_X86_64_converted_reloc_bit.
(elf_x86_64_convert_load_reloc): Set R_X86_64_converted_reloc_bit
instead of setting converted_reloc.
(elf_x86_64_relocate_section): Check R_X86_64_converted_reloc_bit
instead of converted_reloc. Get the real relocation type by
masking out R_X86_64_converted_reloc_bit.
(elf_x86_64_link_setup_gnu_properties): Verify that the value of
R_X86_64_converted_reloc_bit is valid.
* elfxx-x86.h (converted_reloc): Removed.
ld/
* testsuite/ld-x86-64/pr19609-2a.d: Updated.
* testsuite/ld-x86-64/pr19609-2b.d: Likewise.
* testsuite/ld-x86-64/pr19609-4a.d: Likewise.
* testsuite/ld-x86-64/pr19609-4c.d: Likewise.
H.J. Lu [Wed, 6 Sep 2017 11:49:47 +0000 (04:49 -0700)]
x86: Don't change r_type when performing TLS transitions
Don't change r_type when performing TLS transitions to avoid getting
the relocation type with ELF32_R_TYPE again.
* elf32-i386.c (elf_i386_relocate_section): Don't change r_type
when calling elf_i386_tls_transition. Don't use ELF32_R_TYPE
to get the relocation type again.
* elf64-x86-64.c (elf_x86_64_relocate_section): Don't change
r_type when calling elf_x86_64_tls_transition. Don't use
ELF32_R_TYPE to get the relocation type again.
Jan Kratochvil [Wed, 6 Sep 2017 11:32:46 +0000 (12:32 +0100)]
Fix accessing TLS variables with no debug info
Since
2273f0ac95a7 ("change minsyms not to be relocated at
read-time"), printing TLS symbols of objfiles with a non-zero base
address, without debug info, fails.
E.g., with:
$ mv /usr/lib/debug /usr/lib/debug-x
to get debug info out of the way, we get:
$ echo 'int main(){}' | gcc -pthread -x c -
$ ./gdb -q -ex start -ex 'p (int) errno' ./a.out
Cannot access memory at address 0xffffef7c0698
instead of the expected:
$1 = 0
The regression is not visible with glibc debuginfo installed.
The problem is that we compute the address of TLS minsyms incorrectly.
To trigger the problem, it is important that the variable is in an
objfile with a non-zero base address. While glibc is a shared library
for 'errno', it's easier for the testcase to use PIE instead of a
shlib. For TLS variables in PT_EXEC the regression obviously does not
happen.
gdb/ChangeLog
2017-09-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* parse.c (find_minsym_type_and_address): Don't relocate addresses
of TLS symbols.
gdb/testsuite/ChangeLog
2017-09-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/tls-nodebug-pie.c: New file.
* gdb.threads/tls-nodebug-pie.exp: New file.
GDB Administrator [Wed, 6 Sep 2017 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 5 Sep 2017 20:41:18 +0000 (13:41 -0700)]
x86-64: Properly set converted_reloc
Linker now generates
failed to convert GOTPCREL relocation; relink with --no-relax
for more cases.
bfd/
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Properly set
converted_reloc.
ld/
* testsuite/ld-x86-64/pr19609-5d.d: Updated.
* testsuite/ld-x86-64/pr19609-7a.d: Likewise.
* testsuite/ld-x86-64/pr19609-7c.d: Likewise.
Philippe Waroquiers [Tue, 5 Sep 2017 18:51:23 +0000 (20:51 +0200)]
Fix leak of auto_obstack objfile_per_bfd_storage->storage_obstack;
commit
23732b1e32dd58f7c731d9aee56ff0b22a645d53
Author: Pedro Alves <palves@redhat.com>
Date: Tue Jun 27 16:22:08 2017 +0100
changed objfile_per_bfd_storage->storage_obstack
from 'struct obstack storage_obstack;'
to 'auto_obstack storage_obstack;'
So the obstack is auto allocated when the objfile_per_bfd_storage ctor is
manually called by get_objfile_bfd_data).
However, the ctor call was still followed by a manual call to
obstack_init (&storage->storage_obstack);
This results in a bunch of leaks detected by valgrind, such as:
==24665== 4,064 bytes in 1 blocks are definitely lost in loss record 11,469 of 11,590
==24665== at 0x4C27BF5: malloc (vg_replace_malloc.c:299)
==24665== by 0x5437B7: xmalloc (common-utils.c:44)
==24665== by 0x77CAA7: _obstack_begin_worker (obstack.c:141)
==24665== by 0x60168F: auto_obstack (gdb_obstack.h:70)
==24665== by 0x60168F: get_objfile_bfd_data(objfile*, bfd*) (objfiles.h:188)
==24665== by 0x601DB6: allocate_objfile(bfd*, char const*, enum_flags<objfile_flag>) (objfiles.c:423)
==24665== by 0x647753: symbol_file_add_with_addrs(bfd*, char const*, enum_flags<symfile_add_flag>, section_addr_info*, enum_flags<objfile_flag>, objfile*) (symfile.c:1158)
==24665== by 0x647C7B: symbol_file_add_separate(bfd*, char const*, enum_flags<symfile_add_flag>, objfile*) (symfile.c:1252)
==24665== by 0x4C7D79: elf_symfile_read(objfile*, enum_flags<symfile_add_flag>) (elfread.c:1270)
==24665== by 0x647CB4: read_symbols(objfile*, enum_flags<symfile_add_flag>) (symfile.c:861)
==24665== by 0x647809: syms_from_objfile_1 (symfile.c:1062)
-> remove the manual call to obstack_init.
Reg-tested on Debian 8/amd64, tests results are the same before/after the patch.
valgrind still show some leaks, but less.
gdb/ChangeLog
2017-09-05 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* objfiles.c (get_objfile_bfd_data): Remove useless obstack_init
call.
H.J. Lu [Tue, 5 Sep 2017 18:24:01 +0000 (11:24 -0700)]
x86-64: Improve GOTPCREL relocation conversion
When GOTPCREL relocation conversion leads to relocation overflow, we
may get a mysterious linker message, like
relocation truncated to fit: R_X86_64_32S against symbol `foo'
This patch changes the linker message to
failed to convert GOTPCREL relocation; relink with --no-relax
bfd/
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Remove the sec
argument. Don't check relocation overflow. Avoid relocation
overflow if --no-relax is used. Set converted_reloc on symbol
if a GOTPCREL relocation is converted.
(elf_x86_64_relocate_section): Issue a fatal error and suggest
--no-relax if GOTPCREL relocation conversion leads to relocation
overflow.
* elfxx-x86.h (elf_x86_link_hash_entry): Add converted_reloc.
ld/
* testsuite/ld-x86-64/pr19609-4e.d: Updated.
* testsuite/ld-x86-64/pr19609-6a.d: Likewise.
Tom Tromey [Mon, 4 Sep 2017 05:15:03 +0000 (23:15 -0600)]
Don't use -fdiagnostics-color=never for rustc
I noticed that the gdb.rust tests fail because the test suite passes
-fdiagnostics-color=never to rustc. This is not a recognized rustc
option, and the test suite already handles passing the appropriate
option to the Rust compiler.
This patch fixes the problem.
testsuite/ChangeLog
2017-09-05 Tom Tromey <tom@tromey.com>
* lib/gdb.exp (gdb_compile): Don't use universal_compile_options
for rust.
Simon Marchi [Tue, 5 Sep 2017 15:40:44 +0000 (17:40 +0200)]
Test different follow-exec-mode settings in gdb.multi/multi-arch-exec.exp
Using follow-exec-mode "new" takes a different code path than "same", so
it's interesting to test this path in combination with a change in
architecture of the inferior. This test fails if you remove the
previous patch.
gdb/testsuite/ChangeLog:
* gdb.multi/multi-arch-exec.exp: Test with different
"follow-exec-mode" settings.
(do_test): New procedure.
Simon Marchi [Tue, 5 Sep 2017 15:30:27 +0000 (17:30 +0200)]
Add thread after updating gdbarch when exec'ing
As mentioned in the previous patch, we should avoid doing register reads
after a process does an exec and before we've updated that inferior's
gdbarch. Otherwise, we may interpret the registers using the wrong
architecture. When a process does an exec with "follow-exec-mode new",
a new inferior is added by follow_exec. The gdbarch of that new
inferior is at first set to some default value, probably specific to the
gdb build (I get "i386" here), which may not be the right one. It is
updated later by the call to target_find_description. Before that
point, if we try to read the inferior's registers, we may not interpret
them correctly. This has been exposed by a failure in
gdb.base/foll-exec-mode.exp after the previous patch, with:
Remote 'g' packet reply is too long (expected 312 bytes, got 816 bytes)
The call to "add_thread" done just after adding the inferior is
problematic, because it ends up reading the registers (because the ptid
is re-used, we end up doing a switch_to_thread to it, which tries to
update stop_pc). The registers returned by gdbserver are the x86-64
ones, while we try to interpret them using the "i386" gdbarch.
Postponing the call to add_thread to until the target
description/gdbarch has been updated seems to fix the issue.
As to why this issue was uncovered by the previous patch: what I think
happened before that patch is that since we were updating stop_pc before
switching to the new inferior, we were filling the regcache associated
to the ptid (this worked fine as long as the architectures of the
previous and new process images were the same). The call to
switch_to_thread then worked, because the register read hit the
regcache. Now, it triggers a register read, while the gdbarch is not
set correctly, leading to the "reply is too long" error. If this is
right, it sounds wrong that we delete and re-add a thread with the same
ptid, and are able to access the registers from the deleted thread.
When we delete a thread, should we clear the regcache associated to that
ptid, so that the new thread starts with a fresh/empty regcache?
gdb/ChangeLog:
* infrun.c (follow_exec): Call add_thread after
target_find_description.
Simon Marchi [Tue, 5 Sep 2017 14:45:10 +0000 (16:45 +0200)]
Read stop_pc after updating the gdbarch when exec'ing
When an inferior execs and changes architecture (e.g. 64 bits to 32
bits), the gdbarch associated to the inferior is updated by the
follow_exec call in handle_inferior_event_1. We should avoid doing any
register read before that point, because the registers sent by the
remote side will be those of the new architecture, but we would
interpret them using the old architecture. We do just that by setting
stop_pc during this window, which obviously requires reading the
registers. This results in gdb.multi/multi-arch-exec.exp failing, GDB
outputting the following error:
Truncated register 50 in remote 'g' packet
This patch fixes that by postponing the setting of stop_pc to after
we've updated the inferior gdbarch.
This bug was hiding another problem, and as such introduces some
failures in gdb.base/foll-exec-mode.exp. The following patch takes care
of that.
gdb/ChangeLog:
* infrun.c (handle_inferior_event_1): When exec'ing, read
stop_pc after follow_exec.
Simon Marchi [Tue, 5 Sep 2017 14:43:07 +0000 (16:43 +0200)]
Improve "'g' reply is is to long" error message
... by adding the expected size, and the received size. I found this
useful when debugging gdbarch/remote issues, since it gives a hint of
what gdb expects and what the remote sent.
gdb/ChangeLog:
* remote.c (process_g_packet): Update error message.
Yao Qi [Tue, 5 Sep 2017 13:46:47 +0000 (14:46 +0100)]
Add i386.o to gdb_target_obs for x86_64-* targets
This patch fixes the build failure caused by
22916b0
(Convert the rest x86 target descriptions).
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* configure.tgt (gdb_target_obs): Add i386.o for x86_64-*
targets.
Pedro Alves [Tue, 5 Sep 2017 11:13:57 +0000 (12:13 +0100)]
eval.c:evaluate_subexp_standard: Factor out function call handling
While working on the no-debug-info debugging improvements, I found
evaluate_subexp_standard's function call code unnecessarily long and
hard to navigate and debug. The use of goto doesn't help either.
This commit tries to improve things by factoring out the
function-call-related code to separate helper functions.
gdb/ChangeLog:
2017-09-05 Pedro Alves <palves@redhat.com>
* eval.c (eval_call, evaluate_funcall): New functions, factored
out from ...
(evaluate_subexp_standard): ... this.
Nick Clifton [Tue, 5 Sep 2017 11:09:14 +0000 (12:09 +0100)]
Fix a buffer overrun when parsing a corrupt MIPS ELF binary.
PR 21995
* readelf.c (process_mips_specific): Add checks for a NULL data
pointer.
Yao Qi [Tue, 5 Sep 2017 08:54:54 +0000 (09:54 +0100)]
Convert the rest x86 target descriptions
This patch changes the rest of x86 target descriptions in GDB and
GDBserver.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* amd64-tdep.c (amd64_target_description): Create target
descriptions.
(_initialize_amd64_tdep): Don't call functions
initialize_tdesc_amd64_*. Add self tests.
* arch/amd64.c (amd64_create_target_description): Add parameter
is_linux. Call set_tdesc_osabi if is_linux is true.
* arch/amd64.h (amd64_create_target_description): Update the
declaration.
* arch/i386.c (i386_create_target_description): Add parameter
is_linux. Call set_tdesc_osabi if is_linux is true.
* arch/i386.h (i386_create_target_description): Update
declaration.
* configure.tgt: Add i386.o to gdb_target_obs.
* features/Makefile (XMLTOC): Remove i386/*.xml.
* features/i386/amd64-avx-avx512.c: Remove.
* features/i386/amd64-avx-mpx-avx512-pku.c: Remove.
* features/i386/amd64-avx-mpx.c: Remove.
* features/i386/amd64-avx.c: Remove.
* features/i386/amd64-mpx.c: Remove.
* features/i386/amd64.c: Remove.
* features/i386/i386-avx-avx512.c: Remove.
* features/i386/i386-avx-mpx-avx512-pku.c: Remove.
* features/i386/i386-avx-mpx.c: Remove.
* features/i386/i386-avx.c: Remove.
* features/i386/i386-mmx.c: Remove.
* features/i386/i386-mpx.c: Remove.
* features/i386/i386.c: Remove.
* i386-tdep.c: Don't include features/i386/i386*.c., include
target-descriptions.h and arch/i386.h.
(i386_target_description): Create target descriptions.
(i386_gdbarch_init): Don't call initialize_tdesc_i386_*
functions. Do self tests.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* configure.srv (srv_i386_regobj): Remove.
(srv_amd64_regobj): Remove.
(srv_regobj): Set it to "" for x86 non-linux targets.
* linux-x86-tdesc.c (i386_linux_read_description):
* lynx-i386-low.c: Include x86-xstate.h and arch/i386.h.
(init_registers_i386): Remove the declaration.
(tdesc_i386): Remove the declaration.
(lynx_i386_arch_setup): Call i386_create_target_description.
* nto-x86-low.c: Likewise.
* win32-i386-low.c [__x86_64__]: include arch/amd64.h.
[!__x86_64__]: include arch/i386.h.
(i386_arch_setup) [__x86_64__]: Call amd64_create_target_description.
Yao Qi [Tue, 5 Sep 2017 08:54:54 +0000 (09:54 +0100)]
Remove features/i386/amd64-*linux.c and features/i386/x32-*linux.c
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* features/Makefile (XMLTOC): Remove i386/amd64XXX-linux.xml.
* features/i386/amd64-avx-avx512-linux.c: Removed.
* features/i386/amd64-avx-linux.c: Removed.
* features/i386/amd64-avx-mpx-avx512-pku-linux.c: Removed.
* features/i386/amd64-avx-mpx-linux.c: Removed.
* features/i386/amd64-linux.c: Removed.
* features/i386/amd64-mpx-linux.c: Removed.
* features/i386/x32-avx-avx512-linux.c: Removed.
* features/i386/x32-avx-linux.c: Removed.
* features/i386/x32-linux.c: Removed.
Yao Qi [Tue, 5 Sep 2017 08:54:54 +0000 (09:54 +0100)]
[GDBserver] Shorten srv_amd64_linux_xmlfiles
GDBserver now is able to generate target descriptions from features, so
don't need to remember these target description files.
Note that it should be i386/amd64-avx-avx512-linux.xml instead of
i386/amd64-avx-avx512.xml in $srv_amd64_linux_xmlfiles. This patch
removes it anyway.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* configure.srv (srv_amd64_linux_xmlfiles): Remove
i386/amd64-XXX-linux from it.
Yao Qi [Tue, 5 Sep 2017 08:54:54 +0000 (09:54 +0100)]
[GDBserver] Use pre-generated amd64-linux tdesc as test
Now, all these amd64-linux pre-generated tdesc can be used as test, so
don't need to build them if $development is false.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* configure.srv: Empty srv_amd64_linux_regobj if $development is
false.
(ipa_amd64_linux_regobj): Remove.
(ipa_x32_linux_regobj): Remove.
Yao Qi [Tue, 5 Sep 2017 08:54:54 +0000 (09:54 +0100)]
Convert amd64-linux target descriptions
This patch changes amd64-linux target descriptions so that they can be
dynamically generated in both GDB and GDBserver.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* Makefile.in (arch-amd64.o): New rule.
* configure.srv: Append arch-amd64.o.
* linux-amd64-ipa.c: Include common/x86-xstate.h.
(get_ipa_tdesc): Call amd64_linux_read_description.
(initialize_low_tracepoint): Don't call init_registers_x32_XXX
and init_registers_amd64_XXX.
* linux-x86-low.c (x86_linux_read_description): Call
amd64_linux_read_description.
(x86_get_ipa_tdesc_idx): Call amd64_get_ipa_tdesc_idx.
(initialize_low_arch): Don't call init_registers_x32_XXX and
init_registers_amd64_XXX.
* linux-x86-tdesc-selftest.c: Declare init_registers_amd64_XXX
and tdesc_amd64_XXX.
[__x86_64__] (amd64_tdesc_test): New function.
(initialize_low_tdesc) [__x86_64__]: Call init_registers_x32_XXX
and init_registers_amd64_XXX.
* linux-x86-tdesc.c: Include arch/amd64.h.
(xcr0_to_tdesc_idx): New function.
(i386_linux_read_description): New function.
(amd64_get_ipa_tdesc_idx): New function.
* linux-x86-tdesc.h (amd64_get_ipa_tdesc_idx): Declare.
(amd64_get_ipa_tdesc): Declare.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* amd64-linux-tdep.c: Include arch/amd64.h. Don't include
features/i386/*.c.
(amd64_linux_read_description): Call
amd64_create_target_description.
* arch/amd64.c: New file.
* arch/amd64.h: New file.
* configure.tgt (x86_64-*-linux*): Append amd64.o.
* Makefile.in (ALL_64_TARGET_OBS): Append amd64.o.
Yao Qi [Tue, 5 Sep 2017 08:54:54 +0000 (09:54 +0100)]
Lazily and dynamically create amd64-linux target descriptions
This patch starts to use the generate c feature files to dynamically
create amd64-linux target descriptions.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* amd64-linux-tdep.c: Don't include amd64-XXX-linux and
x32-XXX-linux.c. Include 64bit-XX.c and x32-XX.c.
(amd64_linux_read_description): Create target descriptions.
(_initialize_amd64_linux_tdep): Don't call initialize_tdesc_XXX
functions. Add unit tests.
* features/Makefile (FEATURE_XMLFILES): Append 64bit-XXX.xml and
x32-core.xml.
* features/i386/64bit-avx.c: Generated.
* features/i386/64bit-avx512.c: Generated.
* features/i386/64bit-core.c: Generated.
* features/i386/64bit-linux.c: Generated.
* features/i386/64bit-mpx.c: Generated.
* features/i386/64bit-pkeys.c: Generated.
* features/i386/64bit-segments.c: Generated.
* features/i386/64bit-sse.c: Generated.
* features/i386/x32-core.c: Generated.
* target-descriptions.c (maint_print_c_tdesc_cmd): Print feature
c files for amd64-linux and x32-linux.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
Centralize amd64-linux target descriptions
This patch adds a new function amd64_linux_read_description, which
creates amd64-linux target descriptions according to its two
arguments, xcr0 and is_x32.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* amd64-linux-tdep.c (amd64_linux_read_description): New
function.
(amd64_linux_core_read_description): Call
amd64_linux_read_description.
(amd64_linux_init_abi): Likewise.
(amd64_x32_linux_init_abi): Likewise.
* amd64-linux-tdep.h (amd64_linux_read_description): Declare.
* x86-linux-nat.c (x86_linux_read_description): Call
amd64_linux_read_description.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
Update comments in amd64_linux_core_read_description
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* amd64-linux-tdep.c (amd64_linux_core_read_description): Update
comments.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
[GDBserver] Shorten srv_i386_linux_xmlfiles
GDBserver now is able to generate target descriptions from features, so
don't need to remember these target description files.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* configure.srv (srv_i386_linux_xmlfiles): Remove
i386/i386-XXX-linux.xml from it.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
[GDBserver] Use pre-generated tdesc as test
Now, these *-generate.c files are only used in GDBserver for unit test.
If $development is false (in release), these *-generate.c files won't be
used at all.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* configure.srv: Set srv_i386_linux_regobj empty if $development
is false.
* linux-i386-ipa.c (initialize_low_tracepoint): Don't call
initialize_low_tdesc.
* linux-x86-low.c (initialize_low_arch): Wrap initialize_low_tdesc
with #if initialize_low_tdesc.
* linux-x86-tdesc-selftest.c: New file.
* linux-x86-tdesc.c: Move code to linux-x86-tdesc-selftest.c.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
Remove features/i386/i386-*linux.c
Now, features/i386/i386-XXX-linux.c are not used, remove them.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* features/Makefile (XMLTOC): Remove i386/i386-XX-linux.xml.
* features/i386/i386-avx-avx512-linux.c: Remove.
* features/i386/i386-avx-linux.c: Remove.
* features/i386/i386-avx-mpx-avx512-pku-linux.c: Remove.
* features/i386/i386-avx-mpx-linux.c: Remove.
* features/i386/i386-linux.c: Remove.
* features/i386/i386-mmx-linux.c: Remove.
* features/i386/i386-mpx-linux.c: Remove.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
Share i386-linux target description between GDB and GDBserver
The code on creating i386-linux target descriptions are quite similar
between GDB and GDBserver, so this patch moves them into a shared file
arch/i386.c. I didn't name it as i386-linux.c, because I want to reuse it
to create other i386 non-linux target descriptions later.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_TARGET_OBS): Add i386.o.
(SFILES): Add arch/i386.c.
(HFILES_NO_SRCDIR): Add arch/i386.h.
* arch/i386.c: New file.
* arch/i386.h: New file.
* arch/tdesc.h (allocate_target_description): Declare.
(set_tdesc_architecture): Declare.
(set_tdesc_osabi): Declare.
* configure.tgt (i[34567]86-*-linux*): Add i386.o.
* i386-linux-tdep.c: Don't include ../features/i386/32bit-XXX.c.
include arch/i386.h.
(i386_linux_read_description): Remove code and call
i386_create_target_description.
(set_tdesc_architecture): New function.
(set_tdesc_osabi): New function.
* target-descriptions.h (allocate_target_description): Remove.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* Makefile.in (arch-i386.o): New rule.
* configure.srv (i[34567]86-*-linux*): Add arch-i386.o.
(x86_64-*-linux*): Likewise.
* linux-x86-tdesc.c: Don't include ../features/i386/32bit-XXX.c,
include arch/i386.h.
(i386_linux_read_description): Remove code and call
i386_create_target_description.
* tdesc.c (allocate_target_description): New function.
* tdesc.h (set_tdesc_architecture): Remove declaration.
(set_tdesc_osabi): Likewise.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
Dynamically composite xml in reply to GDB
GDBserver still uses pre-generated target descriptions in order to
reply to GDB's query on target description (see xml-builtin-generated.c
in GDBserver build directory). This patch teaches GDBserver to
create XML contents according to the target descriptions rather than
using pre-generated ones.
First, change target feature c files to pass the feature xml file
name to tdesc_create_feature, so that target description in GDBserver
can record them, and create XML contents from these features in
buffer, like
...
<xi:include href="$FEATURE1_XML_NAME"/>
<xi:include href="$FEATURE2_XML_NAME"/>
...
and send this buffer back to GDB.
Note that this patch reuses target_desc.xmltarget a little bit, which is
to hold the XML contents dynamically generated in tdesc_get_features_xml.
However, it is not xfree'ed in ~target_desc, because we can't tell it is
from xstrdup or a literal string. Since we don't delete target_desc,
there is no memory leak yet. After we change all target descriptions to
the new style, target_desc.xmltarget is from xstrdup, then, we can safely
xfree it in ~target_desc.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* arch/tdesc.h (tdesc_create_feature): Add an argument xml.
* target-descriptions.c (tdesc_create_feature): Likewise, and
adjust code.
* features/i386/32bit-avx.c: Re-generated.
* features/i386/32bit-avx512.c: Re-generated.
* features/i386/32bit-core.c: Re-generated.
* features/i386/32bit-linux.c: Re-generated.
* features/i386/32bit-mpx.c: Re-generated.
* features/i386/32bit-pkeys.c: Re-generated.
* features/i386/32bit-sse.c: Re-generated.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* linux-x86-tdesc.c: Don't include <inttypes.h>.
(i386_linux_read_description) [!IN_PROCESS_AGENT]: Call
set_tdesc_architecture and set_tdesc_osabi. Remove code setting
.xmltarget.
* server.c (get_features_xml): Call tdesc_get_features_xml.
* tdesc.c (set_tdesc_architecture): New function.
(set_tdesc_osabi): New function.
(tdesc_get_features_xml): New function.
(tdesc_create_feature): Add an argument.
* tdesc.h (struct target_desc) <features>: New field.
<arch, osabi>: New field.
(~target_desc): xfree features, arch, and osabi.
(target_desc::oerator==): Don't compare .xmltarget.
[!IN_PROCESS_AGENT] (set_tdesc_architecture): Declare.
(set_tdesc_osabi): Likewise.
(tdesc_get_features_xml): Likewise.
Yao Qi [Tue, 5 Sep 2017 08:54:53 +0000 (09:54 +0100)]
[GDBserver] unit test to i386_tdesc
This patch adds a unit test in GDBserver to test dynamically created
target descriptions equal these pre-generated ones.
gdb/gdbserver:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* linux-x86-tdesc.c: Include selftest.h.
(i386_tdesc_test): New function.
(initialize_low_tdesc): Call selftests::register_test.
* tdesc.h: Include regdef.h.
(target_desc): Override operator == and !=.
gdb:
2017-09-05 Yao Qi <yao.qi@linaro.org>
* regformats/regdef.h (struct reg): Override operator == and !=.