There were two copies of earmelf_fuchsia.c dependencies.
* Makefile.am (earmelfb_fuchsia.c): Rename rule from earmelf_fuchsia.c.
* Makefile.in: Regenerate.
One spot in gdb uses a cleanup to free a splay tree. This patch
introduces a unique_ptr specialization for this case.
ChangeLog
2017-10-09 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (free_splay_tree): Remove.
(list_available_thread_groups): Use splay_tree_up.
* common/gdb_splay_tree.h: New file.
The do_nothing function in mi-main.c is used as a splay tree
key-deleting function; but NULL serves the same purpose and is used
elsewhere in gdb. This patch removes the unneeded function.
ChangeLog
2017-10-09 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (do_nothing): Remove.
(list_available_thread_groups): Update.
Since ELF linker may cache internal symbol table in init_reloc_cookie,
we should check if it is cached, before free it.
* elf-m10300.c (mn10300_elf_check_relocs): Don't free cached
isymbuf.
Don't create the .interp section with "ld --no-dynamic-linker". This
fixed:
FAIL: PR ld/20828 forcibly exported symbol version without section GC
FAIL: PR ld/20828 forcibly exported symbol version with section GC
FAIL: readelf version information
* elf32-bfin.c (bfin_size_dynamic_sections): Don't create the
.interp section with "ld --no-dynamic-linker".
The gdb.multi/multi-arch-exec.exp testcase currently tests execing
from -m64 to -m32, but does not test the other direction. For
thoroughness, this commit fixes that. Without the fix in the previous
commit for example ("Multi-arch exec, more register reading
avoidance"), on x86_64 we would get different symptoms depending on
"execing direction". Vis:
Continuing.
Truncated register 50 in remote 'g' packet
Truncated register 50 in remote 'g' packet
(gdb) FAIL: gdb.multi/multi-arch-exec.exp: first_arch=1: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture
Vs:
Continuing.
Remote 'g' packet reply is too long (expected 440 bytes, got 816 bytes): daffffffffffffff0000[snip]
Remote 'g' packet reply is too long (expected 440 bytes, got 816 bytes): daffffffffffffff0000[snip]
(gdb) FAIL: gdb.multi/multi-arch-exec.exp: first_arch=2: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture
gdb/testsuite/ChangeLog:
2017-10-09 Pedro Alves <palves@redhat.com>
Test both arch1=>arch2 and arch2=>arch1.
* gdb.multi/multi-arch-exec.exp (exec1, srcfile1, binfile1, exec2)
(srcfile2, binfile2, march1, march2): Remove globals. Largely
factored out to...
(append_arch1_options, append_arch2_options, append_arch_options)
(build_executables): New procedures.
(do_test): New 'first_arch' parameter. Use it to define 'from_exec'
local.
(top level): Add new 'first_arch' testing axis.
As mentioned in commit bf93d7ba99 ("Add thread after updating
gdbarch when exec'ing"), 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.
There's still (at least) one case where we still read registers
post-exec with the pre-exec architecture. That's when infrun decides
it needs to switch context to the exec'ing thread. I.e., if the exec
event is processed at a time when the current thread is not already
the exec'ing thread, then we get (with the test added by this commit):
continue
Continuing.
Truncated register 50 in remote 'g' packet
Truncated register 50 in remote 'g' packet
(gdb) FAIL: gdb.multi/multi-arch-exec.exp: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture
The fix is to avoid reading registers when switching context in this
case.
(I'd be nice to get rid of the constant stop_pc reading when switching
threads, but that'd be a deeper change.)
gdb/ChangeLog:
2017-10-09 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event_1) <TARGET_WAITKIND_EXECD>: Skip
reading registers when switching context.
gdb/testsuite/ChangeLog:
2017-10-09 Pedro Alves <palves@redhat.com>
* gdb.multi/multi-arch-exec.c: Include <pthread.h> and <assert.h>.
(barrier): New.
(thread_start, all_started): New functions.
(main): Spawn new thread and wait until it is scheduled.
* gdb.multi/multi-arch-exec.exp: Build $srcfile1 with the pthreads
option.
(do_test): Add 'selected_thread' parameter. Run to all_started
instead of main. Explicitly set the breakpoint at main. Switch
to the SELECTED_THREAD thread.
(top level): Test handling the exec event with either the main
thread or the second thread selected.
FreeBSD architectures are either ILP32 or LP64 resulting in two
different layouts for siginfo_t. Previously, the 'bits_per_word'
member of bfd_arch_info was used to determine the layout to use for a
given FreeBSD architecture. However, mipsn32 architectures inherit
from a 64-bit mips architecture where bits_per_word is 64. As a
result, $_siginfo was not properly extracted from FreeBSD/mipsn32 core
dumps. Fix this by using gdbarch_long_bit instead of 'bits_per_word'
to determine if a FreeBSD architecture is ILP32 or LP64.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_siginfo_size): Use gdbarch_long_bit.
(fbsd_convert_siginfo): Likewise.
* fbsd-tdep.c (fbsd_core_xfer_siginfo): Likewise.
GDB currently doesn't build with Guile 2.2 (see PR 21104). If one has
both Guile 2.2 and 2.0 installed, GDB will pick up Guile 2.2 first and
fail building. Until somebody does the work of adapting the GDB code to
Guile 2.2, we should not try using it. This patch therefore removes it
from configure.
gdb/ChangeLog:
* configure.ac (try_guile_versions): Remove guile-2.2.
* configure: Regenerate.
prno, tpei, and irbm are missing in the optable.
gas/ChangeLog:
2017-10-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* testsuite/gas/s390/zarch-arch12.d (prno, tpei, irbm): New
instructions added.
* testsuite/gas/s390/zarch-arch12.s: Likewise.
* testsuite/gas/s390/zarch-z13.d: Rename ppno to prno.
opcodes/ChangeLog:
2017-10-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-opc.txt (prno, tpei, irbm): New instructions added.
The recent POP adjusted a few of the instruction formats. This patch
adjusts our optable accordingly. No user visible change - hopefully.
opcodes/ChangeLog:
2017-10-09 Heiko Carstens <heiko.carstens@de.ibm.com>
* s390-opc.c (INSTR_SI_RD): New macro.
(INSTR_S_RD): Adjust example instruction.
* s390-opc.txt (lpsw, ssm, ts): Change S_RD instruction format to
SI_RD.
Commit f38307f5 changed COMPILE.post and POSTCOMPILE to remove
$(basename) from the dependency file name computation. However, it
did not update the `-include' at the end of the Makefile.in; this in
effect disabled automatic dependency tracking.
This patch restores the $(basename) wrapper so that the dependency
files are named "file.Po" rather than "file.o.Po".
I also tested the non-gcc3 dependency mode, which pointed out that
this case hadn't been working since the switch to C++. This is also
fixed in this patch.
Tested by rebuilding.
ChangeLog
2017-10-09 Tom Tromey <tom@tromey.com>
* Makefile.in (COMPILE.post, POSTCOMPILE): Restore $(basename).
(COMPILE.pre): Use $(CXX).
Use the type system instead of callers needing to know how the
returned string's memory is supposed to be managed.
gdb/ChangeLog:
2017-10-09 Pedro Alves <palves@redhat.com>
* cp-support.c (cp_remove_params): Return a gdb::unique_xmalloc_ptr.
Use bool.
(overload_list_add_symbol): Adjust to use gdb::unique_xmalloc_ptr.
* cp-support.h (cp_remove_params): Now returns a
gdb::unique_xmalloc_ptr.
* dwarf2read.c (find_slot_in_mapped_hash): Now returns bool.
Adjust to cp_remove_params returning a gdb::unique_xmalloc_ptr.
* psymtab.c (psymtab_search_name): Adjust to cp_remove_params
returning a gdb::unique_xmalloc_ptr.
(lookup_partial_symbol): Adjust to use gdb::unique_xmalloc_ptr.
* stack.c (find_frame_funname): Adjust to cp_remove_params
returning a gdb::unique_xmalloc_ptr.
Fix a typo introduced in commit c56e7c4390 ("Make ctxobj.exp and
print-file-var.exp work on all platforms.").
This doesn't really affect the outcome of the testcase. I only
noticed the typo because I stepped through the program manually.
To avoid such problems if the test is extended, this moves the STOP
marker until after the program self-validates the values. With the
typo in place, this alone would have resulted in a test FAIL. I.e.,
it'd have caught the typo.
gdb/testsuite/ChangeLog:
2017-10-09 Pedro Alves <palves@redhat.com>
* gdb.base/print-file-var-main.c: Fix get_version_2 value check
logic. Move STOP marker after the value checks.
* gdb.base/print-file-var.exp (continue to STOP marker): Tighten
regexp.
Don't allow '~' as the first character in symbol name in linker script.
PR ld/22267
* ldlex.l (SYMBOLNAMECHAR1) New.
(DEFSYMEXP): Replace FILENAMECHAR1 with SYMBOLNAMECHAR1.
(EXPRESSION): Likewise.
* testsuite/ld-scripts/expr.exp: Run pr22267.
* testsuite/ld-scripts/pr22267.d: New file.
* testsuite/ld-scripts/pr22267.s: Likewise.
* testsuite/ld-scripts/pr22267.t: Likewise.
This removes a number of cleanups from dwarf2read.c in a
straightforward way.
Note that some places in dwarf2read create dangling cleanups. I don't
believe any of the changes in this patch interact with those spots.
Regression tested by the buildbot.
gdb/ChangeLog
2017-10-08 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_get_dwz_file): Use
gdb::unique_xmalloc_ptr.
(find_slot_in_mapped_hash): Likewise.
(dwarf2_physname): Likewise.
(create_dwo_unit_in_dwp_v1): Use std::string.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_cutu): Likewise.
(inherit_abstract_dies): Use std::vector.
(read_array_type): Likewise.
(dwarf_decode_macros): Remove unused declaration.
(unsigned_int_compar): Remove.
(dwarf2_build_psymtabs_hard): Use scoped_restore.
(psymtabs_addrmap_cleanup): Remove.
Currently frame_prepare_for_sniffer returns a cleanup. This patch
changes it to return void, and exposes frame_cleanup_after_sniffer to
the caller.
Normally I would write an RAII class for this sort of thing; but
because there was just a single caller of frame_prepare_for_sniffer,
and because this caller is already using try/catch, I thought it
seemed ok to require explicit calls in this instance.
Regression tested by the buildbot.
gdb/ChangeLog
2017-10-08 Tom Tromey <tom@tromey.com>
* frame-unwind.c (frame_unwind_try_unwinder): Update.
* frame.h (frame_cleanup_after_sniffer): Declare.
(frame_prepare_for_sniffer): Return void.
* frame.c (frame_cleanup_after_sniffer): No longer static. Change
type of argument.
(frame_prepare_for_sniffer): Return void.
This removes make_cleanup_value_free, in favor of a unique_ptr
specialization.
Regression tested by the buildbot.
gdb/ChangeLog
2017-10-08 Tom Tromey <tom@tromey.com>
* utils.h (make_cleanup_value_free): Remove.
* utils.c (do_value_free, struct cleanup): Remove.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full) <DWARF_VALUE_STACK>:
Use gdb_value_up.
* value.h (struct value_deleter): New.
(gdb_value_up): New typedef.
This changes search_symbols to return a std::vector, replacing the
previous linked list approach. This allows the removal of some
cleanups, as well as the use of std::sort and std::unique, saving some
code and extra allocations in sort_search_symbols_remove_dups.
Regression tested by the buildbot.
gdb/ChangeLog
2017-10-08 Tom Tromey <tom@tromey.com>
* symtab.c (free_search_symbols, do_free_search_symbols_cleanup)
(make_cleanup_free_search_symbols): Remove.
(search_symbols): Return std::vector.
(symbol_search::compare_search_syms): Now member of
symbol_search. Change arguments.
(sort_search_symbols_remove_dups): Change arguments. Rewrite.
(symtab_symbol_info, rbreak_command): Update.
* symtab.h (struct symbol_search) <next>: Remove.
Add constructors.
(symbol_search::operator<): New function.
(symbol_search::operator==): New function.
(search_symbols): Remove std::vector.
(free_search_symbols, make_cleanup_free_search_symbols): Remove.
(symbol_search::compare_search_syms): Declare.
Dump dynamic relocation info to the map file when generating dynamic
relocation in read-only section relocations if -Map is used.
* elf32-sh.c (readonly_dynrelocs): Dump dynamic relocation
in read-only section with minfo.
(sh_elf_size_dynamic_sections): Likewise.
Dump dynamic relocation info to the map file when generating dynamic
relocation in read-only section relocations if -Map is used.
* elfxx-sparc.c (readonly_dynrelocs): Dump dynamic relocation
in read-only section with minfo.
(_bfd_sparc_elf_size_dynamic_sections): Likewise.
Replace has_got_reloc and has_non_got_reloc in elf_x86_link_hash_entry
with zero_undefweak:
Bit 0: Symbol has no GOT nor PLT relocations.
Bit 1: Symbol has non-GOT/non-PLT relocations in text sections.
zero_undefweak is initialized to 1 and undefined weak symbol should be
resolved to 0 if zero_undefweak > 0.
* elf32-i386.c (elf_i386_check_relocs): Replace has_got_reloc
and has_non_got_reloc with zero_undefweak.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_hash_newfunc): Initialize
zero_undefweak to 1.
(_bfd_x86_elf_copy_indirect_symbol): Replace has_got_reloc and
has_non_got_reloc with zero_undefweak.
* elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace
has_got_reloc and has_non_got_reloc with zero_undefweak.
(elf_x86_link_hash_entry): Likewise.
Add a new ELF backend method to grok FreeBSD NT_PRSTATUS core dump
notes. Define a method for MIPS N32 to override the default
elfcore_grok_freebsd_prstatus that accounts for additional padding
between pr_pid and pr_reg that is not present in other 32-bit FreeBSD
platforms.
* elf-bfd.h (struct elf_backend_data): Add
`elf_backend_grok_freebsd_prstatus'.
* elf.c (elfcore_grok_freebsd_note): Call
`elf_backend_grok_freebsd_prstatus' to handle NT_PRSTATUS if
present.
* elfn32-mips.c (elf_n32_mips_grok_freebsd_prstatus): New
function.
(elf_backend_grok_freebsd_prstatus): Define.
* elfxx-target.h (elf_backend_grok_freebsd_prstatus): Define.
(elfNN_bed): Initialize `elf_backend_grok_freebsd_prstatus'.
This patch moves aarch64-insn.o to arch/aarch64-insn.o. Then, all
arch/*.c are built to arch/*.o, so we don't need a Makefile rule to build
*.o from arch/*.c. This patch removes it too.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_64_TARGET_OBS): Replace aarch64-insn.o with
arch/aarch64-insn.o.
Remove one rule.
* configure.tgt: Replace aarch64-insn.o with arch/aarch64-insn.o.
It is tested by building GDB for some targets, arm-elf, arm-netbsd,
arm-linux, and aarch64-linux.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_TARGET_OBS): Replace arm.o, arm-get-next-pcs.o,
and arm-linux.o with arch/arm.o, arch/arm-get-next-pcs.o and
arch/arm-linux.o respectively.
* configure.tgt: Likewise.
This patch changes the build that arch/i386.c is built to arch/i386.o,
instead of i386.o.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_TARGET_OBS): Rename i386.o to arch/i386.o.
* configure.tgt (i386_tobjs): Replace i386.o with arch/i386.o.
I see a build error when building GDB under msys+mingw gcc 32bit:
g++ -x c++ -std=gnu++11 -g -O2 -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wno-format -Werror -DGDBSERVER -c -o win32-low.o -MT win32-low.o -MMD -MP -MF .deps/win32-low.Tpo ../../../binutils-gdb/gdb/gdbserver/win32-low.c
../../../binutils-gdb/gdb/gdbserver/win32-low.c: In function 'BOOL create_process(const char*, char*, DWORD, PROCESS_INFORMATION*)':
../../../binutils-gdb/gdb/gdbserver/win32-low.c:566:48: error: 'get_inferior_cwd' was not declared in this scope
const char *inferior_cwd = get_inferior_cwd ();
^
make[4]: *** [win32-low.o] Error 1
It can be fixed by simply including the right header file.
gdb/gdbserver/ChangeLog:
2017-10-06 Yuanhui Zhang <asmwarrior@gmail.com>
* win32-low.c: Include "common-inferior.h".
Nowadays, there are much duplications in configure.tgt to update
gdb_target_obs, some cpu specific object files are added to gdb_target_obs
to some different target triplets of the same cpu. The same problem
exists for os specific object files too. It is fragile to update them,
and build with all targets enabled doesn't find the problem.
This patch splits the gdb_target_obs update to three steps, cpu steps, os
steps, and the rest.
I tested this patch by build gdb for each different target triplets
respectively,
aarch64-elf aarch64-rtems aarch64-freebsd aarch64-linux alpha-elf
alpha-linux alpha-netbsd alpha-openbsd arm-elf arm-wince-pe arm-linux
arm-netbsd arm-symbianelf avr cris-elf frv-elf h8300-elf i386-elf
i386-darwin i386-dicos i386-freebsd i386-netbsdelf i386-openbsd
i386-nto i386-solaris i386-linux i386-gnu i386-cygwin i386-mingw32
i386-go32 ia64-linux-gnu ia64-vms lm32-elf m32c-elf m32r-elf m32r-linux
m68hc11-elf m68k-elf m68k-linux m68k-netbsd m68k-openbsd m88k-openbsd
mep-elf microblaze-xilinx-elf microblaze-linux-gnu mips-elf moxie-elf
ms1-elf nios2-elf nios2-linux-gnu hppa-elf hppa-linux hppa-netbsd
hppa-openbsd powerpc-eabi powerpc-freebsd powerpc-netbsd powerpc-openbsd
powerpc-linux powerpc-lynx178 rl78-elf rx-elf s390-linux-gnu score-elf
sh-elf sh-linux sh-openbsd sh64-elf sh64-linux sh64-openbsd sparc64-linux
sparc-linux sparc-freebsd sparc64-freebsd sparc-netbsd sparc64-netbsd
sparc-openbsd sparc64-openbsd spu-elf tic6x-elf tic6x-uclinux v850-elf
vax-netbsd vax-openbsd x86_64-linux-gnu x86_64-darwin x86_64-dicos
x86_64-elf x86_64-freebsd x86_64-mingw32 x86_64-netbsd x86_64-openbsd
x86_64-rtems xstormy16-elf xtensa-elf xtensa-linux
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* configure.tgt (i386_tobjs): New variable.
(amd64_tobjs): New variable.
Set $cpu_obs and $os_obs.
Nowadays, GDB build tree is almost flat, but source tree isn't. We
have arch/ nat/ target/ common/ cli/ mi/ tui/ python/ guile/ directories.
We need to some rules in Makefile for source files in different source
directories, like,
# Rules for compiling .c files in the various source subdirectories.
%.o: ${srcdir}/arch/%.c
$(COMPILE) $<
$(POSTCOMPILE)
%.o: ${srcdir}/nat/%.c
$(COMPILE) $<
$(POSTCOMPILE)
so we should take care of some special case that files' base name is the
same, like,
# Specify an explicit rule for gdb/common/agent.c, to avoid a clash with the
# object file generate by gdb/agent.c.
common-agent.o: $(srcdir)/common/agent.c
$(COMPILE) $(srcdir)/common/agent.c
$(POSTCOMPILE)
As we add more and more files in different directories, it becomes tricky
to name files, because we need take this into account.
This patch takes the first step toward "Replicate src dir in build dir",
that is, we create arch/ directory in buildtree, and put amd64.o there
as an example. Dependency tracking is updated for files with directory
name. Currently, when we build amd64.o,
"-c -o amd64.o -MT amd64.o -MMD -MP -MF .deps/amd64.Tpo"
with this patch applied, it becomes,
"-c -o arch/amd64.o -MT arch/amd64.o -MMD -MP -MF arch/.deps/amd64.o.Tpo"
"make clean" removes the object files, and "make distclean" removes .deps
additionally. configure file create .deps directory in each of
CONFIG_SRC_SUBDIR, and pass it to Makefile.in, so that "make clean" and
"make distclean" can remove stuffs there.
If people agree with this change, I'll add more directories to
CONFIG_SRC_SUBDIR.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (CONFIG_SRC_SUBDIR): New.
(ALL_64_TARGET_OBS): Replace amd64.o with arch/amd64.o.
(clean): Remove object files and dependency files.
(distclean): Remove the directory.
* configure.ac: Invoke AC_CONFIG_COMMANDS.
* configure: Re-generated.
* configure.tgt: Replace amd64.o with arch/amd64.o.
gdb/ChangeLog:
2017-10-05 Jose E. Marchesi <jose.marchesi@oracle.com>
PR build/22188
* arm-tdep.c (arm_decode_misc_memhint_neon): Fix decoding of CPS
and SETEND.
Add VERIFY_COPY_RELOC to verify that symbol supports copy relocation.
* elfxx-x86.h (VERIFY_COPY_RELOC): New.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
Add VERIFY_PLT_ENTRY to verify that symbol has an entry in the procedure
linkage table.
* elfxx-x86.h (VERIFY_PLT_ENTRY): New.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.