Kevin Buettner [Wed, 4 May 2016 23:23:08 +0000 (16:23 -0700)]
Add `thread_from_thread_handle' method to (Python) gdb.Inferior
gdb/ChangeLog:
* python/py-inferior.c (gdbpy_thread_from_thread_handle): New
function.
(inferior_object_methods): Add gdbpy_thread_from_thread_handle.
* python/python-internal.h (thread_object_type): Declare.
Kevin Buettner [Wed, 4 May 2016 22:21:12 +0000 (15:21 -0700)]
Add target method for converting thread handle to thread_info struct pointer
This patch adds a target method named `to_thread_handle_to_thread_info'.
It is intended to map a thread library specific thread handle (such as
pthread_t for the pthread library) to the corresponding GDB internal
thread_info struct (pointer).
An implementation is provided for Linux pthreads; see linux-thread-db.c.
gdb/ChangeLog:
* target.h (struct target_ops): Add to_thread_handle_to_thread_info.
(target_thread_handle_to_thread_info): Declare.
* target.c (target_thread_handle_to_thread_info): New function.
* target-delegates.c: Regenerate.
* gdbthread.h (find_thread_by_handle): Declare.
* thread.c (find_thread_by_handle): New function.
* linux-thread-db.c (thread_db_thread_handle_to_thread_info): New
function.
(init_thread_db_ops): Register thread_db_thread_handle_to_thread_info.
Pedro Alves [Thu, 21 Sep 2017 15:52:33 +0000 (16:52 +0100)]
gdbserver: Remove traces of ancient Hc handling
Back in commit
f0db101d9897 ("gdbserver: don't pick a random thread if
the current thread dies"), a couple years ago, the last references to
set_desired_thread(0) [select the Hc thread] were removed, and all the
remaining calls to set_desired_thread pass '1', meaning general
thread. This means we can simplify set_desired_thread.
gdb/gdbserver/ChangeLog:
2017-09-21 Pedro Alves <palves@redhat.com>
* server.c (gdb_read_memory, handle_status, process_serial_event)
(handle_serial_event, handle_target_event): Adjust to
set_desired_thread prototype change.
* target.c (set_desired_thread): Remove 'use_general' parameter
and adjust.
* target.h (set_desired_thread): Remove 'use_general' parameter.
Andreas Arnez [Thu, 21 Sep 2017 15:45:18 +0000 (17:45 +0200)]
S/390: Fix Elf note swap s390_gs_bc vs. s390_gs_cb
Fix two typos that resulted in swapping the BFD names for the core note
register sections NT_S390_GS_CB and NT_S390_GS_BC.
bfd/ChangeLog:
* elf.c (elfcore_grok_note): For the cases NT_S390_GS_CB and
NT_S390_GS_BC, correct the previously swapped invocations of
elfcore_grok_s390_gs_bc and elfcore_grok_s390_gs_cb.
Alan Modra [Thu, 21 Sep 2017 00:24:04 +0000 (09:54 +0930)]
Reduce excessive .eh_frame alignment for powerpc
PowerPC64 .cfi directives use DW_EH_PE_sdata4 encoding for .eh_frame,
so there is no real reason why .eh_frame should be 8 byte aligned.
gas/
* config/tc-ppc.h (EH_FRAME_ALIGNMENT): Define.
ld/
* testsuite/ld-powerpc/tlsopt5.wf: Update for reduced alignment.
Simon Marchi [Thu, 21 Sep 2017 13:19:40 +0000 (15:19 +0200)]
linux-waitpid: Get rid of format string warning
Clang gives this warning:
/home/emaisin/src/binutils-gdb/gdb/gdbserver/../nat/linux-waitpid.c:45:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf (stderr, format, args);
^~~~~~
Get rid of it by adding ATTRIBUTE_PRINTF.
gdb/ChangeLog:
* nat/linux-waitpid.c (linux_debug): Add ATTRIBUTE_PRINTF.
Simon Marchi [Thu, 21 Sep 2017 12:09:33 +0000 (14:09 +0200)]
microblaze-tdep: Add ATTRIBUTE_PRINTF to microblaze_debug
I am getting this warning with clang:
/home/emaisin/src/binutils-gdb/gdb/microblaze-tdep.c:94:28: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vprintf_unfiltered (fmt, args);
^~~
Adding ATTRIBUTE_PRINTF to microblaze_debug gets rid of it. Strangely,
gcc doesn't warn about non-literal format strings when calling vprintf
(or a vprintf-style function, like vprintf_unfiltered). I filed this
gcc bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82206
gdb/ChangeLog:
* microblaze-tdep.c (microblaze_debug): Add ATTRIBUTE_PRINTF.
Yao Qi [Thu, 21 Sep 2017 08:19:23 +0000 (09:19 +0100)]
Fix aarch64-freebsd build failure
I happen to see that fbsd-tdep.o is missing for target aarch64-freebsd,
and it causes the build failure,
aarch64-fbsd-tdep.o: In function `aarch64_fbsd_init_abi(gdbarch_info, gdbarch*)':
binutils-gdb/gdb/aarch64-fbsd-tdep.c:186: undefined reference to `fbsd_init_abi(gdbarch_info, gdbarch*)'
binutils-gdb/gdb/aarch64-fbsd-tdep.c:189: undefined reference to `svr4_lp64_fetch_link_map_offsets()'
binutils-gdb/gdb/aarch64-fbsd-tdep.c:189: undefined reference to `set_solib_svr4_fetch_link_map_offsets(gdbarch*, link_map_offsets* (*)())'
This patch fixed it.
gdb:
2017-09-21 Yao Qi <yao.qi@linaro.org>
* configure.tgt (aarch64*-*-freebsd*): Add fbsd-tdep.o solib-svr4.o
to gdb_target_obs.
Nick Clifton [Thu, 21 Sep 2017 08:04:43 +0000 (09:04 +0100)]
oops - changelog entry omitted from previous delta
Yao Qi [Thu, 21 Sep 2017 08:02:25 +0000 (09:02 +0100)]
[SIM, ARM] Fix build failure
This patch fixes the build failure by using disassembler to get
disassemble function pointer, and do the disassembly, because
print_insn_little_arm is no longer visible outside opcodes/
binutils-gdb/sim/arm/wrapper.c:98:10: error: implicit declaration of function 'print_insn_little_arm' [-Werror=implicit-function-declaration]
size = print_insn_little_arm (0, & info);
^
sim/arm:
2017-09-21 Yao Qi <yao.qi@linaro.org>
* wrapper.c (print_insn): Use disassembler instead of
print_insn_little_arm.
Tom Tromey [Tue, 22 Aug 2017 03:51:11 +0000 (21:51 -0600)]
Change counted_command_line to a shared_ptr
This changes counted_command_line to be a typedef for std::shared_ptr
and removes the associated cleanups. In the long run I believe that
cmd_list_element should also be changed to use a shared_ptr.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* breakpoint.c (struct counted_command_line): Remove.
(breakpoint_commands): Update.
(alloc_counted_command_line, incref_counted_command_line)
(decref_counted_command_line, do_cleanup_counted_command_line)
(make_cleanup_decref_counted_command_line): Remove.
(breakpoint_set_commands, commands_command_1, ~bpstats, bpstats)
(bpstat_clear_actions, bpstat_do_actions_1, watchpoint_check)
(bpstat_stop_status, print_one_breakpoint_location, ~breakpoint)
(save_breakpoints): Update.
* breakpoint.h (counted_command_line): Now a typedef to
shared_ptr.
(struct breakpoint) <commands>: Now a counted_command_line.
(struct bpstats) <command>: Likewise.
Tom Tromey [Tue, 22 Aug 2017 03:37:45 +0000 (21:37 -0600)]
Use function_view in a couple of places in breakpoint.c
This changes iterate_over_related_breakpoints and
map_breakpoint_numbers to take a function_view. Then, it simplifies
the callers by using lambdas. This then allows the removal of some
bookkeeping types.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* breakpoint.c (struct commands_info, do_map_commands_command):
Remove.
(commands_command_1): Update.
(iterate_over_related_breakpoints): Take a function_view.
(do_delete_breakpoint, do_map_delete_breakpoint): Remove.
(delete_command): Update.
(map_breakpoint_numbers): Take a function_view.
(do_disable_breakpoint, do_map_delete_breakpoint): Remove.
(disable_command): Update.
(do_enable_breakpoint, do_map_enable_breakpoint): Remove.
(enable_command): Update.
(struct disp_data, do_enable_breakpoint_disp)
(do_map_enable_once_breakpoint, do_map_enable_count_breakpoint)
(do_map_enable_delete_breakpoint): Remove.
(enable_once_command, enable_count_command, enable_delete_command)
(delete_trace_variable_command): Update.
Tom Tromey [Tue, 22 Aug 2017 03:08:59 +0000 (21:08 -0600)]
Allocate bpstats with new
This changes struct bpstats to be allocated with new and freed with
delete, adding constructors and a destructor in the process. This
allows the removal of one cleanup and clears the way for more to
follow.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* breakpoint.c (~bpstats): Rename from bpstat_free. Update.
(bpstat_clear): Use delete.
(bpstats): New constructors.
(bpstat_copy, bpstat_stop_status): Use new.
(dprintf_after_condition_true): Update.
* breakpoint.h (bpstats::bpstats): Add constructors.
(bpstats::~bpstats): Add destructor.
GDB Administrator [Thu, 21 Sep 2017 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 20 Sep 2017 23:34:41 +0000 (00:34 +0100)]
eval.c:evaluate_subexp_standard: Use RAII to avoid leaks
While working on the no-debug-info debugging improvements series, I
noticed these bare xfree calls, which lead to leaks if
evaluate_subexp_standard throws.
Fix that by reworking make_params as a RAII class. Ends up
eliminating a couple heap allocations too.
gdb/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* eval.c (make_params): Delete, refactored as ...
(class fake_method): ... this new type's ctor.
(fake_method::~fake_method): New.
(evaluate_subexp_standard): Use 'fake_method'.
Teresa Johnson [Wed, 20 Sep 2017 22:43:37 +0000 (15:43 -0700)]
Check for export dynamic symbol options when doing symbol resolution in plugins.
2017-09-20 Teresa Johnson <tejohnson@google.com>
* plugin.cc (is_visible_from_outside): Check for export dynamic symbol
option and list.
* testsuite/Makefile.am (plugin_test_12): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/export_dynamic_plugin.cc: New test source.
* testsuite/plugin_test_12.sh: New test script.
Tom Tromey [Wed, 20 Sep 2017 03:56:36 +0000 (21:56 -0600)]
Remove make_cleanup_restore_target_terminal
This removes make_cleanup_restore_target_terminal and generally
C++-ifies target terminal handling. It changes all target_terminal_*
functions to be static members of a new target_terminal class and
changes the cleanup to be a scoped_* class.
make_cleanup_override_quit_handler is also removed in favor of simply
using scoped_restore.
Note that there are some files in this patch that I could not compile.
Considering that some of the rewrites were automated, and that none of
these files involed cleanups, I feel that this is relatively safe.
Regression tested by the buildbot.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* windows-nat.c (get_windows_debug_event, windows_wait)
(do_initial_windows_stuff, windows_attach): Update.
* utils.c (vwarning, internal_vproblem): Update.
(ui_unregister_input_event_handler_cleanup)
(prepare_to_handle_input): Remove.
(class scoped_input_handler): New.
(defaulted_query, prompt_for_continue): Update.
* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
Update.
* top.c (undo_terminal_modifications_before_exit): Update.
* target/target.h (target_terminal_init, target_terminal_inferior)
(target_terminal_ours): Don't declare.
(class target_terminal): New.
* target.h (target_terminal_is_inferior, target_terminal_is_ours)
(target_terminal_ours_for_output)
(make_cleanup_restore_target_terminal): Don't declare.
(target_terminal_info): Remove.
* target.c (enum terminal_state, terminal_state): Remove.
(target_terminal::terminal_state): Define.
(target_terminal::init): Rename from target_terminal_init.
(target_terminal::inferior): Rename from
target_terminal_inferior.
(target_terminal::ours): Rename from target_terminal_ours.
(target_terminal::ours_for_output): Rename from
target_terminal_ours_for_output.
(target_terminal::info): New method.
(cleanup_restore_target_terminal)
(make_cleanup_restore_target_terminal): Remove.
* solib.c (handle_solib_event): Update.
* remote.c (remote_serial_quit_handler): Update.
(remote_terminal_inferior, remote_wait_as): Update.
* record-full.c (record_full_wait_1): Update.
* nto-procfs.c (procfs_create_inferior): Update.
* nat/fork-inferior.c (startup_inferior): Update.
* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
(mi_inferior_exit, mi_inferior_removed, mi_traceframe_changed)
(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
(mi_breakpoint_created, mi_breakpoint_deleted)
(mi_breakpoint_modified, mi_on_resume, mi_solib_loaded)
(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
(mi_user_selected_context_changed, report_initial_inferior):
Update.
* linux-nat.c (linux_nat_attach, linux_nat_terminal_ours)
(linux_nat_terminal_inferior): Update.
* infrun.c (follow_fork_inferior)
(handle_vfork_child_exec_or_exit, do_target_resume)
(check_curr_ui_sync_execution_done, handle_inferior_event_1)
(handle_signal_stop, maybe_remove_breakpoints, normal_stop):
Update.
* inflow.c (child_terminal_init, info_terminal_command): Update.
* infcmd.c (post_create_inferior, continue_1, prepare_one_step)
(attach_command): Update.
* infcall.c (call_thread_fsm_should_stop): Update.
* gnu-nat.c (gnu_attach): Update.
* extension.c (struct active_ext_lang_state)
(restore_active_ext_lang): Update.
* exceptions.c (print_flush): Update.
* event-top.c (async_enable_stdin, default_quit_handler): Update.
(struct quit_handler_cleanup_data, restore_quit_handler)
(restore_quit_handler_dtor, make_cleanup_override_quit_handler):
Remove.
* cp-support.c (gdb_demangle): Update.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, handle_jit_event)
(disable_breakpoints_in_unloaded_shlib): Update.
* annotate.c (annotate_breakpoints_invalid)
(annotate_frames_invalid): Update.
gdb/gdbserver/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* target.c (target_terminal::terminal_state): Define.
(target_terminal::init): Rename from target_terminal_init.
(target_terminal::inferior): Rename from
target_terminal_inferior.
(target_terminal::ours): Rename from target_terminal_ours.
(target_terminal::ours_for_output, target_terminal::info): New.
Tom Tromey [Tue, 12 Sep 2017 20:14:33 +0000 (14:14 -0600)]
Overload catch_command_errors
This changes catch_command_errors_const to be an overload of
catch_command_errors, which may mildly help future constification
efforts.
Tested by rebuilding.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* main.c (catch_command_errors): Rename from
catch_command_errors_const.
(captured_main_1): Update.
Pedro Alves [Wed, 20 Sep 2017 15:12:54 +0000 (16:12 +0100)]
Make "list ambiguous" show symbol names too
Currently, with an ambiguous "list first,last", we get:
(gdb) list bar,main
Specified first line 'bar' is ambiguous:
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98
This commit makes gdb's output above a bit clearer by printing the
symbol name as well:
(gdb) list bar,main
Specified first line 'bar' is ambiguous:
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
And while at it, makes gdb print the symbol name when actually listing
multiple locations too. I.e., before (with "set listsize 2"):
(gdb) list bar
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97
96
97 int bar (A) { return 11; }
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98
97 int bar (A) { return 11; }
98 int bar (B) { return 22; }
After:
(gdb) list bar
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
96
97 int bar (A) { return 11; }
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
97 int bar (A) { return 11; }
98 int bar (B) { return 22; }
Currently, the result of decoding a linespec loses information about
the original symbol that was found. All we end up with is an address.
This makes it difficult to find the original symbol again to get at
its print name. Fix that by storing a pointer to the symbol in the
sal. We already store the symtab and obj_section, so it feels like a
natural progression to me. This avoids having to do any extra symbol
lookup too.
gdb/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (list_command): Use print_sal_location.
(print_sal_location): New function.
(ambiguous_line_spec): Use print_sal_location.
* linespec.c (symbol_to_sal): Record the symbol in the sal.
* symtab.c (find_function_start_sal): Likewise.
* symtab.h (symtab_and_line::symbol): New field.
gdb/testsuite/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect
symbol names in gdb's output.
* gdb.cp/overload.exp ("list all overloads"): Likewise.
Pedro Alves [Wed, 20 Sep 2017 15:12:54 +0000 (16:12 +0100)]
Fix "list ambiguous_variable"
The "list" command allows specifying the name of variables as
argument, not just functions, so that users can type "list
a_global_variable".
That support is a broken when it comes to ambiguous locations though.
If there's more than one such global variable in the program, e.g.,
static globals in different compilation units, GDB ends up listing the
source of the first variable it finds, only.
linespec.c does find both symbol and minsym locations for all the
globals. The problem is that it ends up merging all the resulting
sals into one, because they all have address, zero. I.e., all sals
end up with sal.pc == 0, so maybe_add_address returns false for all
but the first.
The zero addresses appear because:
- in the minsyms case, linespec.c:minsym_found incorrectly treats all
minsyms as if they were function/text symbols. In list mode we can
end up with data symbols there, and we shouldn't be using
find_pc_sect_line on data symbols.
- in the debug symbols case, symbol_to_sal misses recording an address
(sal.pc) for non-block, non-label symbols.
gdb/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* linespec.c (minsym_found): Handle non-text minsyms.
(symbol_to_sal): Record a sal.pc for non-block, non-label symbols.
gdb/testsuite/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* gdb.base/list-ambiguous.exp (test_list_ambiguous_function):
Rename to ...
(test_list_ambiguous_symbol): ... this and add a symbol name
parameter. Adjust.
(test_list_ambiguous_function): Reimplement on top of
test_list_ambiguous_symbol and also test listing ambiguous
variables.
* gdb.base/list-ambiguous0.c (ambiguous): Rename to ...
(ambiguous_fun): ... this.
(ambiguous_var): New.
* gdb.base/list-ambiguous1.c (ambiguous): Rename to ...
(ambiguous_fun): ... this.
(ambiguous_var): New.
Walfred Tedeschi [Wed, 20 Sep 2017 13:24:47 +0000 (15:24 +0200)]
[OBV] amd64-features-makefile: add missing backslash.
In an old commit the backslash of was missing in the rule for creating the
i386-avx-mpx-avx512-pku.dat file. No need to regenerate the files, this
was done by another commit from Yao.
2017-09-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* features/Makefile (i386-avx-mpx-avx512-pku.dat): Add backslash.
Walfred Tedeschi [Wed, 20 Sep 2017 12:47:04 +0000 (14:47 +0200)]
add ChangeLog from previous commit
Walfred Tedeschi [Wed, 20 Sep 2017 11:42:21 +0000 (13:42 +0200)]
gdb - avx512: tests were failing due to missing memory aligment.
Test was running on a fault during code execution. Analysis have shown
that the wrong instruction had been used. An instruction that takes
not alligned memory is more appropriated for the task.
ChangeLog:
2017-09-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/testesuite/ChangeLog:
* gdb.arch/i386-avx512.c (move_zmm_data_to_reg): Use
vmovups instead vmovaps.
(move_zmm_data_to_memory): Use vmovups instead vmovaps.
Change-Id: I4a95560861ef1792ed6ce86578fdd726162863f1
Alan Modra [Tue, 19 Sep 2017 23:47:56 +0000 (09:17 +0930)]
[GOLD] PowerPC function address in non-PIC
ppc32, like many targets, defines the address of a function as the PLT
call stub code for functions referenced but not defined in a non-PIC
executable. ppc32 gold, unlike other targets, inherits the ppc64
multiple stub capability for dealing with very large binaries where
one set of stubs can't be reached from all code locations. This means
there can be multiple choices of address for a function, which might
cause function pointer comparison failures. So for ppc32, make
non-branch references always use the first stub group.
(PowerPC64 ELFv1 is always PIC so doesn't need to define the address
of an external function as the PLT stub. PowerPC64 ELFv2 needs a
special set of global entry stubs to serve as the address of external
functions, so it too is not affected by this bug.)
* powerpc.cc (Target_powerpc::Branch_info::make_stub): Put
stubs for ppc32 non-branch relocs in first stub table.
(Target_powerpc::Relocate::relocate): Resolve similarly.
GDB Administrator [Wed, 20 Sep 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Mon, 11 Sep 2017 21:57:37 +0000 (14:57 -0700)]
Add a 'starti' command.
This works like 'start' but it stops at the first instruction rather
than the first line in main(). This is useful if one wants to single
step through runtime linker startup.
While here, introduce a RUN_ARGS_HELP macro for shared help text
between run, start, and starti. This includes expanding the help for
start and starti to include details from run's help text.
gdb/ChangeLog:
* NEWS (Changes since GDB 8.0): Add starti.
* infcmd.c (enum run_break): New.
(run_command_1): Queue pending event for RUN_STOP_AT_FIRST_INSN
case.
(run_command): Use enum run_how.
(start_command): Likewise.
(starti_command): New function.
(RUN_ARGS_HELP): New macro.
(_initialize_infcmd): Use RUN_ARGS_HELP for run and start
commands. Add starti command.
gdb/doc/ChangeLog:
* gdb.texinfo (Starting your Program): Add description of
starti command. Mention starti command as an alternative for
debugging the elaboration phase.
gdb/testsuite/ChangeLog:
* gdb.base/starti.c: New file.
* gdb.base/starti.exp: New file.
* lib/gdb.exp (gdb_starti_cmd): New procedure.
Maciej W. Rozycki [Tue, 19 Sep 2017 14:20:41 +0000 (15:20 +0100)]
MIPS/LD: Add OpenBSD/mips64 support
Complement commit
26eebcf553d7 ("Update OpenBSD/mips64 support"),
<https://sourceware.org/ml/binutils/2005-04/msg00382.html>, which added
OpenBSD/mips64 support to GAS, and also add it to LD, avoiding a build
failure at the configuration stage, like:
*** ld does not support target mips64-unknown-openbsd
*** see ld/configure.tgt for supported targets
make[1]: *** [configure-ld] Error 1
As per OS support only include n64 MIPS emulations, and use the
traditional ones, matching the choice already made with the addition of
GAS support.
ld/
* configure.tgt <mips64el-*-openbsd*, mips64-*-openbsd*>: New
targets.
Yao Qi [Tue, 19 Sep 2017 09:18:57 +0000 (10:18 +0100)]
Remove one explicit rule for monitor.o
gdb/monitor.c was removed by 40e0b27 (Delete the remaining ROM monitor
targets).
gdb:
2017-09-19 Yao Qi <yao.qi@linaro.org>
* Makefile.in (monitor.o): Remove the rule.
Yao Qi [Tue, 19 Sep 2017 09:10:03 +0000 (10:10 +0100)]
Use DISABLE_COPY_AND_ASSIGN
We have many classes that copy cotr and assignment operator are deleted,
so this patch replaces these existing mechanical code with macro
DISABLE_COPY_AND_ASSIGN.
gdb:
2017-09-19 Yao Qi <yao.qi@linaro.org>
* annotate.h (struct annotate_arg_emitter): Use
DISABLE_COPY_AND_ASSIGN.
* common/refcounted-object.h (refcounted_object): Likewise.
* completer.h (struct completion_result): Likewise.
* dwarf2read.c (struct dwarf2_per_objfile): Likewise.
* filename-seen-cache.h (filename_seen_cache): Likewise.
* gdbcore.h (thread_section_name): Likewise.
* gdb_regex.h (compiled_regex): Likewise.
* gdbthread.h (scoped_restore_current_thread): Likewise.
* inferior.h (scoped_restore_current_inferior): Likewise.
* jit.c (jit_reader): Likewise.
* linespec.h (struct linespec_result): Likewise.
* mi/mi-parse.h (struct mi_parse): Likewise.
* nat/fork-inferior.c (execv_argv): Likewise.
* progspace.h (scoped_restore_current_program_space): Likewise.
* python/python-internal.h (class gdbpy_enter): Likewise.
* regcache.h (regcache): Likewise.
* target-descriptions.c (struct tdesc_reg): Likewise.
(struct tdesc_type): Likewise.
(struct tdesc_feature): Likewise.
* ui-out.h (ui_out_emit_type): Likewise.
Alan Modra [Tue, 19 Sep 2017 03:52:49 +0000 (13:22 +0930)]
PowerPC64 stubs don't match calculated size
After the PR 21411 fix, the linker generated .eh_frame for ppc64 glink
can be edited by the generic code. The sequence of events goes
something like:
1) Some object file adds .eh_frame aligned to 8, making the output
.eh_frame aligned to at least 8, so linker generated .eh_frame FDE
is padded to an 8 byte boundary.
2) All .eh_frame past the glink .eh_frame is garbage collected.
3) Generic code detects that last FDE (the glink .eh_frame) doesn't
need to be padded to an 8 byte boundary, reducing size from 88 to
84.
4) elf64-ppc.c check fails.
PR 21441
* elf64-ppc.c (ppc64_elf_build_stubs): Don't check glink_eh_frame
size.
Alan Modra [Tue, 19 Sep 2017 02:29:30 +0000 (11:59 +0930)]
PR22150, ld keeps a version reference for gc'd symbols
elf_gc_sweep_symbol should run after verdefs are calculated, since
the verdef code creates symbols for the versions. However,
elf_gc_sweep_symbol needs to run before verrefs so as to not emit
useless verrefs for symbols that are gc'd.
I've also removed a _bfd_elf_link_renumber_dynsyms calls added by
Maciej after I fussed about it when reviewing. On further examination
the call appears to be unnecessary. Looking at renumber_dynsyms also
made me realize that the test to exclude .gnu.version has been wrong
since 2016-04-26 (git commit
d5486c4372), so fix that too.
PR 22150
* elflink.c (bfd_elf_size_dynamic_sections): Garbage collect
symbols before calculating verrefs. Don't renumber dynsyms
after gc. Exclude .gnu.version when zero or one dynsym.
Localize some vars and reindent.
Alan Modra [Tue, 19 Sep 2017 02:15:51 +0000 (11:45 +0930)]
[GOLD, PowerPC] Add --no-stub-group-multi
The trouble with stubs per output section is that ppc32 uses a plt
stub as the address of a global function. This needs to be unique,
otherwise we'll get multiple addresses for a function.
Obviously this is only a partial solution, since ppc32 will get
multiple stubs when code is larger than 33M. A proper fix will
involve selecting a unique stub to use for non-branch relocs.
* options.h (stub-group-multi): Default to true. Add
--no-stub-group-multi.
GDB Administrator [Tue, 19 Sep 2017 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 18 Sep 2017 20:05:25 +0000 (13:05 -0700)]
Check error return from bfd_canonicalize_dynamic_reloc
Since bfd_canonicalize_dynamic_reloc returns -1 on error, check it in
_bfd_x86_elf_get_synthetic_symtab.
PR ld/22148
* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Check error
return from bfd_canonicalize_dynamic_reloc.
Simon Marchi [Mon, 18 Sep 2017 11:09:20 +0000 (13:09 +0200)]
dwarf2expr: Remove unused abort_expression label in execute_stack_op
The label abort_expression is unused, so remove it.
gdb/ChangeLog:
* dwarf2expr.c (dwarf_expr_context::execute_stack_op): Remove
label abort_expression.
Nick Clifton [Mon, 18 Sep 2017 08:21:38 +0000 (09:21 +0100)]
[PATCH] Sync libiberty/ & include/ with GCC - addendum: update elfcpp/dwarf.h with the new DW_CFA_DUP macro.
From the original email:
Note this brings in the interface files for libcc1/G++ as well, which
we will be needing in GDB soon anyway. That commit renamed a method
in the C interface and that required a small update to GDB's compile/
code, which I've included that in this patch to keep the tree
building.
From the follow up email:
That breaks gold:
g++ -DHAVE_CONFIG_H -I. -I../../binutils/gold -I../../binutils/gold -I../../binutils/gold/../include -I../../binutils/gold/../elfcpp -DLOCALEDIR="\"/usr/share/locale\"" -DBINDIR="\"/usr/bin\"" -DTOOLBINDIR="\"/usr/x86_64-linux/bin\"" -DTOOLLIBDIR="\"/usr/x86_64-linux/lib\"" -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=dwarf_reader.o -O2 -g -MT dwarf_reader.o -MD -MP -MF .deps/dwarf_reader.Tpo -c -o dwarf_reader.o ../../binutils/gold/dwarf_reader.cc
In file included from ../../binutils/gold/../elfcpp/dwarf.h:83:0,
from ../../binutils/gold/dwarf_reader.cc:30:
../../binutils/gold/../include/dwarf2.def:781:1: error: expected ?}? before ?DW_CFA_DUP?
DW_CFA_DUP (DW_CFA_AARCH64_negate_ra_state, 0x2d)
GDB Administrator [Mon, 18 Sep 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 17 Sep 2017 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 16 Sep 2017 12:22:11 +0000 (14:22 +0200)]
Refactor handle_qxfer_libraries and friends to use std::string
Using std::string in handle_qxfer_libraries and friends allow to
simplify the code. We don't have to manually free the buffer, and we
don't have to pre-compute the required space.
gdb/gdbserver/ChangeLog:
* server.c (accumulate_file_name_length): Remove.
(emit_dll_description): Adjust to std::string change.
(handle_qxfer_libraries): Use std::string to hold document.
Simon Marchi [Sat, 16 Sep 2017 12:19:31 +0000 (14:19 +0200)]
Make xml_escape_text return an std::string
This is a simple replacement, it allows removing some manual free'ing in
the callers.
gdb/ChangeLog:
* common/buffer.c (buffer_xml_printf): Adjust.
* common/xml-utils.c (xml_escape_text): Change return type to
std::string, update code accordingly.
* common/xml-utils.h (xml_escape_text): Change return type to
std::string.
* rs6000-aix-tdep.c (rs6000_aix_shared_library_to_xml): Adjust.
* windows-tdep.c (windows_xfer_shared_library): Adjust.
* unittests/xml-utils-selftests.c (test_xml_escape_text):
Adjust.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_qxfer_libraries_svr4): Adjust to change of
return type of xml_escape_text.
* server.c (emit_dll_description): Likewise.
Simon Marchi [Sat, 16 Sep 2017 12:16:27 +0000 (14:16 +0200)]
Add unit test for xml_escape_text
The following patch modifies xml_escape_text, so I took the opportunity
to write a unit test for it.
gdb/ChangeLog:
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add new source file.
(SUBDIR_UNITTESTS_OBS): Add new object file.
* unittests/xml-utils-selftests.c: New file.
Simon Marchi [Sat, 16 Sep 2017 12:06:03 +0000 (14:06 +0200)]
Add selftests run filtering
With the growing number of selftests, I think it would be useful to be
able to run only a subset of the tests. This patch associates a name to
each registered selftest. It then allows doing something like:
(gdb) maintenance selftest aarch64
Running self-tests.
Running selftest aarch64-analyze-prologue.
Running selftest aarch64-process-record.
Ran 2 unit tests, 0 failed
or with gdbserver:
./gdbserver --selftest=aarch64
In both cases, only the tests that contain "aarch64" in their name are
ran. To help validate that the tests you want to run were actually ran,
it also prints a message with the test name before running each test.
Right now, all the arch-dependent tests are registered as a single test
of the selftests. To be able to filter those too, I made them
"first-class citizen" selftests. The selftest type is an interface,
with different implementations for "simple selftests" and "arch
selftests". The run_tests function simply iterates on that an invokes
operator() on each test.
I changed the tests data structure from a vector to a map, because
- it allows iterating in a stable (alphabetical) order
- it allows to easily verify if a test with a given name has been
registered, to avoid duplicates
There's also a new command "maintenance info selftests" that lists the
registered selftests.
gdb/ChangeLog:
* common/selftest.h (selftest): New struct/interface.
(register_test): Add name parameter, add new overload.
(run_tests): Add filter parameter.
(for_each_selftest_ftype): New typedef.
(for_each_selftest): New declaration.
* common/selftest.c (tests): Change type to
map<string, unique_ptr<selftest>>.
(simple_selftest): New struct.
(register_test): New function.
(register_test): Add name parameter and use it.
(run_tests): Add filter parameter and use it. Add prints.
Adjust to vector -> map change.
* aarch64-tdep.c (_initialize_aarch64_tdep): Add names when
registering selftests.
* arm-tdep.c (_initialize_arm_tdep): Likewise.
* disasm-selftests.c (_initialize_disasm_selftests): Likewise.
* dwarf2-frame.c (_initialize_dwarf2_frame): Likewise.
* dwarf2loc.c (_initialize_dwarf2loc): Likewise.
* findvar.c (_initialize_findvar): Likewise.
* gdbarch-selftests.c (_initialize_gdbarch_selftests): Likewise.
* maint.c (maintenance_selftest): Update call to run_tests.
(maintenance_info_selftests): New function.
(_initialize_maint_cmds): Register "maintenance info selftests"
command. Update "maintenance selftest" doc.
* regcache.c (_initialize_regcache): Add names when registering
selftests.
* rust-exp.y (_initialize_rust_exp): Likewise.
* selftest-arch.c (gdbarch_selftest): New struct.
(gdbarch_tests): Remove.
(register_test_foreach_arch): Add name parameter. Call
register_test.
(tests_with_arch): Remove, move most content to
gdbarch_selftest::operator().
(_initialize_selftests_foreach_arch): Remove.
* selftest-arch.h (register_test_foreach_arch): Add name
parameter.
(run_tests_with_arch): New declaration.
* utils-selftests.c (_initialize_utils_selftests): Add names
when registering selftests.
* utils.c (_initialize_utils): Likewise.
* unittests/array-view-selftests.c
(_initialize_array_view_selftests): Likewise.
* unittests/environ-selftests.c (_initialize_environ_selftests):
Likewise.
* unittests/function-view-selftests.c
(_initialize_function_view_selftests): Likewise.
* unittests/offset-type-selftests.c
(_initialize_offset_type_selftests): Likewise.
* unittests/optional-selftests.c
(_initialize_optional_selftests): Likewise.
* unittests/scoped_restore-selftests.c
(_initialize_scoped_restore_selftests): Likewise.
* NEWS: Document "maintenance selftest" and "maint info
selftests".
gdb/gdbserver/ChangeLog:
* server.c (captured_main): Accept argument for --selftest.
Update run_tests call.
* linux-x86-tdesc-selftest.c (initialize_low_tdesc): Add names
when registering selftests.
gdb/doc/ChangeLog:
* gdb.texinfo (Maintenance Commands): Document filter parameter
of "maint selftest". Document "maint info selftests" command.
Simon Marchi [Sat, 16 Sep 2017 11:45:56 +0000 (13:45 +0200)]
mi_load_progress: Restore current_uiout using a scoped_restore
Simply use a scoped_restore instead of manually saving and restoring
current_uiout.
gdb/ChangeLog:
* mi/mi-main.c (mi_load_progress): Restore current_uiout using a
scoped_restore.
Simon Marchi [Sat, 16 Sep 2017 11:45:55 +0000 (13:45 +0200)]
mi_load_progress: Use unique_ptr to manage ui_out lifetime
In mi_load_progress, we xfree a ui_out object. Because ui_out is not
trivially destructible, it should be freed with delete. This patch
makes use of a unique_ptr to do it.
gdb/ChangeLog:
* mi/mi-main.c (mi_load_progress): Make uiout variable
a unique_ptr.
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 0ee2605..0359dc1
100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2325,7 +2325,6
@@ mi_load_progress (const char *section_name, static char
*previous_sect_name = NULL; int new_section; struct ui_out *saved_uiout;
- struct ui_out *uiout; struct mi_interp *mi = (struct mi_interp *)
current_interpreter ();
/* This function is called through deprecated_show_load_progress
@@ -2333,17 +2332,19 @@ mi_load_progress (const char *section_name,
of this function. */
saved_uiout = current_uiout;
+ std::unique_ptr<ui_out> uiout;
+
if (current_interp_named_p (INTERP_MI)
|| current_interp_named_p (INTERP_MI2))
- current_uiout = mi_out_new (2);
+ uiout.reset (mi_out_new (2));
else if (current_interp_named_p (INTERP_MI1))
- current_uiout = mi_out_new (1);
+ uiout.reset (mi_out_new (1));
else if (current_interp_named_p (INTERP_MI3))
- current_uiout = mi_out_new (3);
+ uiout.reset (mi_out_new (3));
else
return;
- uiout = current_uiout;
+ current_uiout = uiout.get ();
new_section = (previous_sect_name ?
strcmp (previous_sect_name, section_name) : 1);
@@ -2356,12 +2357,12 @@ mi_load_progress (const char *section_name,
fputs_unfiltered (current_token, mi->raw_stdout);
fputs_unfiltered ("+download", mi->raw_stdout);
{
- ui_out_emit_tuple tuple_emitter (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout.get (), NULL);
uiout->field_string ("section", section_name);
uiout->field_int ("section-size", total_section);
uiout->field_int ("total-size", grand_total);
}
- mi_out_put (uiout, mi->raw_stdout);
+ mi_out_put (uiout.get (), mi->raw_stdout);
fputs_unfiltered ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
@@ -2374,19 +2375,18 @@ mi_load_progress (const char *section_name,
fputs_unfiltered (current_token, mi->raw_stdout);
fputs_unfiltered ("+download", mi->raw_stdout);
{
- ui_out_emit_tuple tuple_emitter (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout.get (), NULL);
uiout->field_string ("section", section_name);
uiout->field_int ("section-sent", sent_so_far);
uiout->field_int ("section-size", total_section);
uiout->field_int ("total-sent", total_sent);
uiout->field_int ("total-size", grand_total);
}
- mi_out_put (uiout, mi->raw_stdout);
+ mi_out_put (uiout.get (), mi->raw_stdout);
fputs_unfiltered ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
- xfree (uiout);
current_uiout = saved_uiout;
}
Sergio Durigan Junior [Sun, 10 Sep 2017 16:17:18 +0000 (12:17 -0400)]
Use std::vector on tdesc->reg_defs (gdbserver/tdesc.h)
This is a followup patch to the build breakage fix on AArch64. While
doing the fix, I found it better to convert tdesc->reg_defs (on
gdbserver/tdesc.h) from using VEC to using std::vector. This makes
the code easier to read and maintain, and also is one more step
towards the C++fication.
Regtested on BuildBot.
2017-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* regcache.c (get_thread_regcache): Update code to use "std::vector"
instead of "VEC" for "target_desc.reg_defs".
(regcache_cpy): Likewise.
(registers_to_string): Likewise.
(registers_from_string): Likewise.
(find_regno): Likewise.
(supply_regblock): Likewise.
(regcache_raw_read_unsigned): Likewise.
* tdesc.c (init_target_desc): Likewise.
(tdesc_create_reg): Likewise.
* tdesc.h: Remove declaration of "tdesc_reg_p". Include <vector>.
(struct target_desc) <reg_defs>: Convert to "std::vector".
(target_desc): Do not initialize "reg_defs".
(~target_desc): Update code to use "std::vector" instead of "VEC"
for "target_desc.reg_defs".
(operator==): Likewise.
GDB Administrator [Sat, 16 Sep 2017 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Fri, 15 Sep 2017 16:40:33 +0000 (17:40 +0100)]
Sync libiberty/ & include/ with GCC
Note this brings in the interface files for libcc1/G++ as well, which
we will be needing in GDB soon anyway. That commit renamed a method
in the C interface and that required a small update to GDB's compile/
code, which I've included that in this patch to keep the tree
building.
include/ChangeLog:
2017-09-15 Pedro Alves <palves@redhat.com>
* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
* dwarf2.h (DW_CFA_DUP): New define.
2017-08-21 Richard Biener <rguenther@suse.de>
* simple-object.h (simple_object_copy_lto_debug_sections): New
function.
2017-05-18 Martin Liska <mliska@suse.cz>
* ansidecl.h: Define CONSTEXPR macro.
2017-05-24 Nathan Sidwell <nathan@acm.org>
* libiberty.h (ASTRDUP): Adjust cast to avoid warning.
2017-01-30 Alexandre Oliva <aoliva@redhat.com>
Introduce C++ support in libcc1.
* gcc-c-fe.def (int_type_v0): Rename from...
(int_type): ... this. Introduce new version.
(float_type_v0): Rename from...
(float_type): ... this. Introduce new version.
(char_type): New.
* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
(gcc_type_array): Move...
* gcc-interface.h: ... here.
* gcc-cp-fe.def: New.
* gcc-cp-interface.h: New.
2016-04-29 Oleg Endo <olegendo@gcc.gnu.org>
* longlong.h (umul_ppmm): Remove SHMEDIA checks.
(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.
2017-09-15 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
* dwarf2.h (DW_CFA_DUP): New define.
2017-08-21 Richard Biener <rguenther@suse.de>
* simple-object.h (simple_object_copy_lto_debug_sections): New
function.
2017-05-18 Martin Liska <mliska@suse.cz>
* ansidecl.h: Define CONSTEXPR macro.
2017-05-24 Nathan Sidwell <nathan@acm.org>
* libiberty.h (ASTRDUP): Adjust cast to avoid warning.
2017-01-30 Alexandre Oliva <aoliva@redhat.com>
Introduce C++ support in libcc1.
* gcc-c-fe.def (int_type_v0): Rename from...
(int_type): ... this. Introduce new version.
(float_type_v0): Rename from...
(float_type): ... this. Introduce new version.
(char_type): New.
* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
(gcc_type_array): Move...
* gcc-interface.h: ... here.
* gcc-cp-fe.def: New.
* gcc-cp-interface.h: New.
2016-04-29 Oleg Endo <olegendo@gcc.gnu.org>
* longlong.h (umul_ppmm): Remove SHMEDIA checks.
(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.
libiberty/ChangeLog:
2017-09-15 Nathan Sidwell <nathan@acm.org>
PR demangler/82195
* cp-demangle.c (d_name): Add 'toplevel' parm. Pass to ...
(d_local_name): ... here. Parse trailing function args on nested
local_name.
(d_encoding, d_special_name, d_class_enum_type): Adjust d_name calls.
* testsuite/demangle-expected: Add tests.
2017-09-15 Richard Biener <rguenther@suse.de>
PR lto/81968
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Iterate marking dependent sections necessary.
2017-09-15 Nathan Sidwell <nathan@acm.org>
* cp-demangle.c (is_fnqual_component_type): Reimplement using
FNQUAL_COMPONENT_CASE.
(d_encoding): Hold bare_function_type in local var.
(d_local_name): Build name in both cases and build result once.
Collapse switch-if to single conditional.
(d_local_name):
* testsuite/demangle-expected: Realign blank lines with tests.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarfnames.c (DW_CFA_DUP): New define.
gdb/ChangeLog:
2017-09-15 Pedro Alves <palves@redhat.com>
* compile/compile-c-types.c (convert_enum, convert_int)
(convert_float): Adjust to refer to int_type_v0 and float_type_v0.
Simon Marchi [Fri, 15 Sep 2017 16:02:51 +0000 (18:02 +0200)]
gdbserver: Remove thread_to_gdb_id
As explained in the previous patch, the gdb_id concept is no longer
relevant. The function thread_to_gdb_id is trivial, it returns the
thread's ptid. Remove it and replace its usage with ptid_of.
The changes in nto-low.c and lynx-low.c are fairly straightforward, but
I was not able to build test them.
gdb/gdbserver/ChangeLog:
* inferiors.h (thread_to_gdb_id): Remove.
* inferiors.c (thread_to_gdb_id): Remove.
* server.c (handle_qxfer_threads_worker, handle_query): Adjust.
* lynx-low.c (lynx_resume, lynx_wait_1, lynx_fetch_registers,
lynx_store_registers, lynx_read_memory, lynx_write_memory):
Likewise.
* nto-low.c (nto_fetch_registers, nto_store_registers,
nto_stopped_by_watchpoint, nto_stopped_data_address): Likewise.
Simon Marchi [Fri, 15 Sep 2017 16:02:51 +0000 (18:02 +0200)]
gdbserver: Remove gdb_id_to_thread_id
From what I understand, this function is not doing anything useful as of
today.
Here's the result of my archeological research:
- The field thread_info::gdb_id was added in
a06660f7 Use LWP IDs for thread IDs in gdbserver
There was problem when using a 32-bits gdb with a 64-bits gdbserver.
For some reason that I don't fully understand, the thread ids
exchanged between gdb and gdbserver could overflow a 32 bits data
type. My guess is that they were the thread address (e.g. the
0x7ffff7f20b40 in "Thread 0x7ffff7f20b40 (LWP 1058)" today). This
patch changed that so gdb/gdbserver would talk in terms of the OS
assigned numerical id (as shown in ps). It therefore added a way to
convert between this gdb_id (the numerical id) and the thread id (the
address).
-
95954743cb Implement the multiprocess extensions, and add linux
multiprocess supportNon-stop mode support.
This patch made gdbserver deal with threads using their numerical ids
and not the address-like id. Starting from there, the gdb_id <->
thread id conversion was not needed anymore, since the remote protocol
and gdbserver were using the same kind of ids again. The gdb_id field
in the thread_info structure was also unused starting there.
-
d50171e4 Teach linux gdbserver to step-over-breakpoints.
This patch moved the thread_info structure around, and got rid of the
gdb_id field (which was unused).
Looking at the implementation of gdb_id_to_thread_id, it is not doing
anything useful. It is looking up a thread by ptid using
find_thread_ptid, which basically loops over all threads looking at
their entry.id field. If a thread with that ptid is found, it returns
its entry.id field. So it will always return the same thing as it input
(with the exception of if no thread exist with that ptid, then it will
return null_ptid).
gdb/gdbserver/ChangeLog:
* inferiors.h (gdb_id_to_thread_id): Remove.
* inferiors.c (gdb_id_to_thread_id): Remove.
* server.c (process_serial_event): Adjust to gdb_id_to_thread_id
removal. Move pid declaration closer to where it's used.
Simon Marchi [Fri, 15 Sep 2017 15:59:37 +0000 (17:59 +0200)]
gdbserver: Move detach code to its own function
The code required to handle the 'D' packet is non trivial, so move it
out to its own function.
The moved out code is identical, except for the call to strtol and some
breaks that became returns.
Tested manually, and by running gdb.base/*detach*.exp with
native-gdbserver and native-extended-gdbserver.
gdb/gdbserver/ChangeLog:
* server.c (handle_detach): New function.
(process_serial_event): Move code out, call handle_detach.
Simon Marchi [Fri, 15 Sep 2017 15:59:36 +0000 (17:59 +0200)]
Deduplicate require_running macros and move them up
I find it very confusing to define the require_running in the middle of
the file, and re-define it to something else later in the middle of the
same file. I think it would be better if those macros had different
names so that we know exactly what they do.
gdb/gdbserver/ChangeLog:
* server.c (require_running): Rename to ...
(require_running_or_return): ... this ...
(require_running_or_break): ... and this.
(handle_query, process_serial_event): Adjust.
Nick Clifton [Fri, 15 Sep 2017 15:18:20 +0000 (16:18 +0100)]
Add -l option to src-release script.
Since we are updating src-release.sh I thought I would check in this
small patch. It adds the option to create lzip compressed tarballs
via the -l command line option.
* src-release.sh (LZIPPROG): New define. Provides the name of the
lzip program.
(do_lz): New function. Compresses a tarball using the lzip
program.
(do_compress): Add support for lzip compression.
(usage): Mention -l option.
(build_release): Support -l option to invoke lzip compression.
Simon Marchi [Fri, 15 Sep 2017 14:41:35 +0000 (16:41 +0200)]
linux-low: Remove unused variables
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_set_resume_request): Remove unused
variables.
Simon Marchi [Fri, 15 Sep 2017 14:41:34 +0000 (16:41 +0200)]
dwarf2read: Replace copy_string usages with savestring
copy_string does the exact same thing as savestring, so replace the
usages of the former with the latter.
gdb/ChangeLog:
* dwarf2read.c (copy_string): Remove.
(parse_macro_definition): Replace copy_string with savestring.
Simon Marchi [Fri, 15 Sep 2017 12:53:07 +0000 (14:53 +0200)]
gdbserver: Remove duplicate functions to find any thread of process
We have about 6 functions/callbacks to find_inferior meant to find a
thread that belongs to a given pid. Remove all but
find_any_thread_of_pid and replace their uses with
find_any_thread_of_pid.
gdb/gdbserver/ChangeLog:
* server.c (first_thread_of): Remove.
(process_serial_event): Replace usage of first_thread_of with
find_any_thread_of_pid.
* tracepoint.c (same_process_p): Remove.
(gdb_agent_about_to_close): Replace usage of same_process_p with
find_any_thread_of_pid.
* linux-x86-low.c (same_process_callback): Remove.
(x86_arch_setup_process_callback): Replace usage of
same_process_callback with find_any_thread_of_pid.
* thread-db.c (any_thread_of): Remove.
(switch_to_process): Replace usage of any_thread_of with
find_any_thread_of_pid.
* inferiors.c (thread_pid_matches_callback): Remove.
(find_thread_process): Adjust to use find_any_thread_of_pid.
Yao Qi [Fri, 15 Sep 2017 12:05:39 +0000 (13:05 +0100)]
Fix x86 build failures
Christophe Lyon told me that GDB build failed on i386-linux with
--enable-64-bit-bfd=yes, so I audit the gdb/configure.tgt again. I
find that i386-darwin has the same issue too. Additionally, GDB
for solaris target fails to build too. This patch fixes all of them.
gdb:
2017-09-15 Yao Qi <yao.qi@linaro.org>
* configure.tgt (i[34567]86-*-darwin*): Append amd64.o to
gdb_target_obs.
(i[34567]86-*-solaris2.1[0-9]* | x86_64-*-solaris2.1[0-9]*):
Likewise.
(i[34567]86-*-linux*): Likewise.
Alan Modra [Fri, 15 Sep 2017 10:38:02 +0000 (20:08 +0930)]
PR22118, Incorrectly-capitalized regexp
PR 22118
* testsuite/ld-aarch64/erratum843419.d: Correct regexp.
Alan Modra [Fri, 15 Sep 2017 05:03:58 +0000 (14:33 +0930)]
Enable/disable various dirs in src-release.sh
gold needs to be enabled for a binutils release, but it's rather odd
to do so for gas, gdb or sim. This patch passes various --enable and
--disable options depending on the directories being released.
* src-release.sh (do_proto_toplev): Revert last patch. Enable or
disable binutils, gas, gdb, gold, gprof, ld, libdecnumber, readline,
and sim depending on $tool and $support_files. Echo configure line.
Alan Modra [Fri, 15 Sep 2017 00:52:13 +0000 (10:22 +0930)]
Error when 32-bit ar tries to handle 4G or larger files
We used to silently truncate the size returned by stat() to 32 bits.
While it is possible to make binutils handle a 64-bit off_t on a
32-bit host, to me the effort needed doesn't seem worth the benefit.
Instead, error if we truncate the size. I've written the test the way
I have to avoid a signed/unsigned warning.
PR 22116
* archive.c (bfd_ar_hdr_from_filesystem): Detect when status.st_size
overflows bfd_size_type.
GDB Administrator [Fri, 15 Sep 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 14 Sep 2017 20:36:57 +0000 (22:36 +0200)]
Make dwarf_expr_context::stack an std::vector
Replace the manually managed array with a vector. It is mostly
straightforward, except maybe one thing in execute_stack_op, in the
handling of DW_OP_fbreg. When the code stumbles on that opcode while
evaluating an expression, it needs to evaluate a subexpression to find
where the fb reg has been saved. Rather than creating a new context, it
reuses the current context. It saves the size of the stack before and
restores the stack to that size after.
I think we can do a little bit better by saving the current stack
locally and installing a new empty stack. This way, if the
subexpression is malformed and underflows, we'll get an exception.
Before, it would have overwritten the top elements of the top-level
expression. The evaluation of the top-level expression would have then
resumed with the same stack size, but possibly some corrupted elements.
gdb/ChangeLog:
* dwarf2expr.h (dwarf_stack_value): Add constructor.
(dwarf_expr_context) <~dwarf_expr_context>: Define as default.
<stack>: Change type to std::vector.
<stack_len, stack_allocated>: Remove.
<grow_stack>: Remove.
* dwarf2expr.c (dwarf_expr_context::dwarf_expr_context): Adjust.
(dwarf_expr_context::~dwarf_expr_context): Remove.
(dwarf_expr_context::grow_stack): Remove.
(dwarf_expr_context::push): Adjust.
(dwarf_expr_context::pop): Adjust.
(dwarf_expr_context::fetch): Adjust.
(dwarf_expr_context::fetch_in_stack_memory): Adjust.
(dwarf_expr_context::stack_empty_p): Adjust.
(dwarf_expr_context::execute_stack_op): Adjust.
H.J. Lu [Thu, 14 Sep 2017 19:45:18 +0000 (12:45 -0700)]
globalaudit.rd: Allow additional bits in DT_FLAGS_1
With -PIE on x86-64, we get
0x000000006ffffffb (FLAGS_1) Flags: GLOBAUDIT PIE
We should allow additional bits in DT_FLAGS_1.
PR ld/22139
* testsuite/ld-elf/globalaudit.rd: Allow additional bits in
DT_FLAGS_1.
H.J. Lu [Thu, 14 Sep 2017 18:41:58 +0000 (11:41 -0700)]
x86: Cache section contents and relocations
bfd/
PR ld/22135
* elf32-i386.c (elf_i386_convert_load_reloc): Add an argument
to indicate if conversion is performed.
(elf_i386_check_relocs): Cache section contents and relocations
if conversion is performed.
* elf64-x86-64.c (elf_x86_64_check_relocs): Cache section
contents and relocations if conversion is performed.
ld/
PR ld/22135
* testsuite/ld-i386/i386.exp: Run pr22135.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr22135.d: New file.
* testsuite/ld-i386/pr22135.s: Likewise.
* testsuite/ld-x86-64/pr22135.d: Likewise.
* testsuite/ld-x86-64/pr22135.s: Likewise.
Pedro Alves [Thu, 14 Sep 2017 17:09:42 +0000 (18:09 +0100)]
gdb.base/nodebug.exp: Rename called functions
I'm seeing these failures on my system:
FAIL: gdb.base/nodebug.exp: p (double) mult (2.0, 3.0)
FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2.0f, 3.0f)
FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2, 3)
The problem is simply that GDB is finding a symbol named "mult" from
glibc's debug info:
(gdb) ptype mult
type = enum expression_operator {var, num, lnot, mult, divide, module, plus, minus, less_than, greater_than, less_or_equal, greater_or_equal, equal, not_equal, land, lor, qmop}
(gdb) info types expression_operator
All types matching regular expression "expression_operator":
File plural-exp.h:
enum expression_operator;
Fix this by unloading symbols from shared libraries.
gdb/testsuite/ChangeLog:
2017-09-14 Pedro Alves <palves@redhat.com>
* gdb.base/nodebug.exp (nodebug_runto): New procedure.
(top level): Use it instead of runto.
Simon Marchi [Thu, 14 Sep 2017 14:54:37 +0000 (16:54 +0200)]
Make dwarf_expr_context::stack_empty_p return a bool
gdb/ChangeLog:
* dwarf2expr.h (dwarf_expr_context) <stack_empty_p>: Change
return type to bool.
* dwarf2expr.c (dwarf_expr_context::stack_empty_p): Likewise.
Simon Marchi [Thu, 14 Sep 2017 14:13:33 +0000 (16:13 +0200)]
Make dwarf_stack_value::in_stack_memory a bool
Replace int with bool, because that's what it is.
gdb/ChangeLog:
* dwarf2expr.h (dwarf_expr_piece) <v.mem.in_stack_memory>:
Change type to bool.
(dwarf_stack_value) <in_stack_memory>: Likewise.
(dwarf_expr_context) <push_address>: Change parameter type to
bool.
<fetch_in_stack_memory>: Change return type to bool.
<push>: Change parameter type to bool.
* dwarf2expr.c (dwarf_expr_context::push): Change parameter type
to bool.
(dwarf_expr_context::push_address): Likewise.
(dwarf_expr_context::fetch_in_stack_memory): Change return type
to bool.
(dwarf_expr_context::execute_stack_op): Adjust.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Adjust.
Simon Marchi [Thu, 14 Sep 2017 13:57:01 +0000 (15:57 +0200)]
Make dwarf_expr_piece::pieces an std::vector
Change the manually managed array dwarf_expr_piece::piece with an
std::vector. After passing the pieces array to allocate_piece_closure,
dwarf2_evaluate_loc_desc_full doesn't need that data anymore. We can
therefore move the content of the vector to avoid copying it.
Reg-tested on the buildbot.
gdb/ChangeLog:
* dwarf2expr.h (struct dwarf_expr_piece): Move up.
(struct dwarf_expr_context) <n_pieces>: Remove.
<pieces>: Change type to std::vector.
* dwarf2expr.c (dwarf_expr_context::dwarf_expr_context): Adjust.
(dwarf_expr_context::~dwarf_expr_context): Don't manually free
pieces.
(dwarf_expr_context::add_piece): Adjust.
* dwarf2loc.c (struct piece_closure): Initialize fields.
<n_pieces>: Remove.
<pieces>: Change type to std::vector.
(allocate_piece_closure): Adjust, change parameter to
std::vector rvalue and std::move it to piece_closure.
(rw_pieced_value): Adjust.
(check_pieced_synthetic_pointer): Adjust.
(indirect_synthetic_pointer): Adjust.
(coerce_pieced_ref): Adjust.
(free_pieced_value_closure): Adjust. Use delete to free
piece_closure.
(dwarf2_evaluate_loc_desc_full): Adjust. std::move ctx.pieces
to allocate_piece_closure.
(dwarf2_loc_desc_get_symbol_read_needs): Adjust.
Nick Clifton [Thu, 14 Sep 2017 10:15:55 +0000 (11:15 +0100)]
Fix address violation when parsing a corrupt PE binary.
PR binutils/22113
* peXXigen.c (pe_print_idata): Extend check for HintName vector
entries.
matt rice [Wed, 13 Sep 2017 16:46:22 +0000 (09:46 -0700)]
Add enable-gold and enable-ld to src-release
So that the tarball picks up gold bison output.
* src-release.sh (do_proto_toplev): Enable gold during release process.
Alan Modra [Thu, 14 Sep 2017 00:49:31 +0000 (10:19 +0930)]
PR22127, as segfaults assembling invalid .reloc
"sec" gets set to NULL on errors in the offset expression. This patch
disables part of the reloc expression processing that needs "sec"
valid. I didn't disable the entire reloc expression handling so that
errors in the reloc expression are reported even when the offset
expression has an error.
PR 22127
* write.c (resolve_reloc_expr_symbols): Don't segfault when
sec has been set to NULL.
GDB Administrator [Thu, 14 Sep 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 13 Sep 2017 11:25:14 +0000 (04:25 -0700)]
elfxx-x86.h: Fix a typo in comments
* elfxx-x86.h: Fix a typo in comments.
GDB Administrator [Wed, 13 Sep 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 12 Sep 2017 12:15:23 +0000 (14:15 +0200)]
probe: Replace VEC(probe_ops_cp) with std::vector
This patch replaces the usage of VEC to store pointers to probe_ops with
an std::vector. The sole usage of that vector type is one global
variable that holds the ops for the various kinds of probes, so this is
pretty straightforward (no allocation/deallocation issues).
gdb/ChangeLog:
* probe.h (probe_ops_cp): Remove typedef.
(DEF_VEC_P (probe_ops_cp)): Remove.
(all_probe_ops): Change type to std::vector.
* probe.c (info_probes_for_ops): Adjust to vector change.
(probe_linespec_to_ops): Likewise.
(all_probe_ops): Change type to std::vector.
(_initialize_probe): Adjust to vector change.
* dtrace-probe.c (_initialize_dtrace_probe): Likewise.
* elfread.c (elf_get_probes): Likewise.
* stap-probe.c (_initialize_stap_probe): Likewise.
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.