When a Windows program is terminated by a fatal exception, its exit
code is the value of that exception, as defined by the various
EXCEPTION_* symbols in the Windows API headers. This commit emulates
WTERMSIG etc. by translating the fatal exception codes to more-or-less
equivalent Posix signals.
gdb/ChangeLog:
2020-01-06 Eli Zaretskii <eliz@gnu.org>
Pedro Alves <palves@redhat.com>
* Makefile.in (COMMON_SFILES): Add gdbsupport/gdb_wait.c.
* windows-tdep.c: New enumeration of WINDOWS_SIG* signals.
(windows_gdb_signal_to_target): New function, uses the above
enumeration to convert GDB internal signal codes to equivalent
Windows codes.
(windows_init_abi): Call set_gdbarch_gdb_signal_to_target.
* windows-nat.c: Include "gdb_wait.h".
(get_windows_debug_event): Extract the fatal exception from the
exit status and convert to the equivalent Posix signal number.
* cli/cli-cmds.c (exit_status_set_internal_vars): Account for the
possibility that WTERMSIG returns GDB_SIGNAL_UNKNOWN.
* gdbsupport/gdb_wait.c: New file, implements
windows_status_to_termsig.
* gdbsupport/gdb_wait.h (WIFEXITED, WIFSIGNALED, WEXITSTATUS)
(WTERMSIG) [__MINGW32__]: Separate definitions for MinGW.
gdb/gdbserver/ChangeLog:
2020-01-06 Eli Zaretskii <eliz@gnu.org>
Pedro Alves <palves@redhat.com>
* win32-low.c (get_child_debug_event): Extract the fatal exception
from the exit status and convert to the equivalent Posix signal
number.
(win32_wait): Allow TARGET_WAITKIND_SIGNALLED status as well.
* Makefile.in (OBS, SFILES): Add gdb_wait.[co].
Since 1993-11-05 git commit c188b0bec3, bfd_check_format has failed
if any of the target object_p functions returns false with any error
but bfd_error_wrong_format. That's just weird. There is really no
reason why coff_real_object_p should be fixed to only return that
error instead of numerous other possible errors. Even an out of
memory condition for one target doesn't necessarily mean other targets
can't match, assuming the failing target nicely returns all memory it
might have used.
* format.c (bfd_check_format_matches): Ignore bfd_error on target
match failures. Don't init to bfd_error_wrong_format before
calling _bfd_check_format.
BFD is not supposed to exit or abort on anything the user can do.
* vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
status rather than exiting on stack overflow or underflow.
(_bfd_vms_slurp_etir): Adjust to suit.
There are probably a lot more of these still here.
cpu/
* m32c.cpu (f-dsp-8-u16, f-dsp-8-s16): Rearrange to mask any sign
bits before shifting rather than masking after shifting.
(f-dsp-16-u16, f-dsp-16-s16, f-dsp-32-u16, f-dsp-32-s16): Likewise.
(f-dsp-40-u16, f-dsp-40-s16, f-dsp-48-u16, f-dsp-48-s16): Likewise.
(f-dsp-64-u16, f-dsp-8-s24): Likewise.
(f-bitbase32-16-s19-unprefixed): Avoid signed left shift.
opcodes/
* m32c-ibld.c: Regenerate.
Fixes lots of places the fuzzers are going to find, and the one they
already hit.
* mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
command. Check name offset is within command.
(bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
(bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
(bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
(bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
(bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
(bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
(bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
(bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
(bfd_mach_o_read_note, bfd_mach_o_read_build_version),
(bfd_mach_o_read_segment): Similarly.
(bfd_mach_o_read_thread): Properly bound check thread struct.
Don't repeat checks on second loop.
(bfd_mach_o_read_command): Fail on invalid command length.
PR 25344
* z80-dis.c (suffix): Don't use a local struct buffer copy.
Peek at next byte to prevent recursion on repeated prefix bytes.
Ensure uninitialised "mybuf" is not accessed.
(print_insn_z80): Don't zero n_fetch and n_used here,..
(print_insn_z80_buf): ..do it here instead.
When calling tui_add_win_to_layout, use tui_set_layout not show_layout
so that window focus is correctly updated. If the focus is not
correctly maintained then GDB can be crashed like this:
start
tui enable
layout asm
list SOME_FUNCTION
At this point GDB will have "popped up" the source window to
display SOME_FUNCTION. Previously no window would have focus at this
point, and so if the user now does 'focus next' or 'focus prev', then
GDB would crash.
Calling tui_set_layout ensures that focus is correctly calculated as
the source window is "popped up", and this fixes the issue.
gdb/ChangeLog:
* tui/tui-layout.c (tui_add_win_to_layout): Use tui_set_layout not
show_layout.
gdb/testsuite/ChangeLog:
* gdb.tui/list.exp: Test 'focus next' after 'list main'.
Change-Id: Id0b13f99b0e889261efedfd0adabe82020202f44
While investigating some SVE code, i noticed the use of two spu bfd variables.
This looks like an oversight, as the "id" field is available for non-spu
architectures as well, even though its primary use was the Cell BE
architecture.
gdb/ChangeLog:
2020-01-05 Luis Machado <luis.machado@linaro.org>
* aarch64-linux-nat.c
(aarch64_linux_nat_target::thread_architecture): Use bfd_arch_aarch64
and bfd_mach_aarch64.
This commit fixes a compilation warning when compiling libctf
on MinGW:
libctf/ctf-dump.c:118:8: warning: implicit declaration of function
'asprintf'; did you mean 'vasprintf'? [-Wimplicit-function-declaration]
if (asprintf (&bit, " %lx: [slice 0x%x:0x%x]",
^~~~~~~~
vasprintf
MinGW doesn't provide that function, so we depend on the one provided
by libiberty. However, the declaration is guarded by HAVE_DECL_ASPRINTF,
which we do not have in libctf's config.h.
libctf/ChangeLog:
PR binutils/25155:
* configure.ac: Add AC_CHECK_DECLS([asprintf]).
* configure, config.h.in: Regenerate.
It's a little tricky. We can release any memory back when we have a
match failure, but after a match success which we might want to
preserve for later use the high water mark must change to that of the
matched bfd.
* format.c (bfd_check_format_matches): Add preserve_match.
Save initial bfd state in "preserve", matched bfd state in
"preserve_match". Save just the first match. Release
bfd_alloc memory. Restore and finish preserved state as
appropriate on all function exit paths.
object_p functions cannot allocate memory by malloc and not free it
before returning. Even a successful target match may not be the best
match. If a match isn't used then those malloc'd blocks won't be
freed.
* coffgen.c (coff_real_object_p): Free malloc'd memory on target
match too.
While handling the comments of Tom related to
[RFC] Have an option to tell GDB to detect and possibly handle mismatched exec-files.
https://sourceware.org/ml/gdb-patches/2019-12/msg00621.html
I saw that GDB warnings are produced ignoring the given styles.
This patch:
* ensures that style markups are properly handled by "warning".
* changes 'set/show data-directory' so that file style is used
in warnings and in 'show message'
* changes all other messages in top.c to use file style when appropriate.
* Uses the above data-directory changes in gdb.base/style.exp
2020-01-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* ui-file.c (stdio_file::can_emit_style_escape)
(tee_file::can_emit_style_escape): Ensure style is used also on
gdb_stderr when gdb_stderr is a tty supporting styling, similarly
to gdb_stdout.
* main.c (set_gdb_data_directory): Use file style to output the
warning that the given pathname is not a directory.
* top.c (show_history_filename, gdb_safe_append_history)
(show_gdb_datadir): Use file style.
2020-01-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/style.exp: Test that warnings are styled.
gdb/ChangeLog:
2020-01-03 Hannes Domani <ssbssa@yahoo.de>
* solib-target.c (struct lm_info_target):
Change offsets to be a unique_xmalloc_ptr.
(solib_target_relocate_section_addresses): Update.
PR 25307
(bfd_pef_parse_function_stubs): Correct the test that ensures that
there is enough data remaining in the code buffer before
attempting to read a function stub.
ld/PR25316
* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
on binary inputs ld/PR25316.
(is_ia64_elf): new helper to filter on ia64 objects.
According to the specification these permit the Q bit to control the
vector length operated on, and hence this bit should not already be set
in the opcode table entries (it rather needs setting dynamically). Note
how the test case output did also not match its input. Besides
correcting the test case also extend it to cover both forms.
While reading some code i noticed we're still referencing Cell BE in a couple
parts. This patch removes those.
v2: Update comment in gdb/target.h.
gdb/ChangeLog:
2020-01-02 Luis Machado <luis.machado@linaro.org>
* proc-service.c (get_ps_regcache): Remove reference to obsolete
Cell BE architecture.
* target.h (struct target_ops) <thread_architecture>: Likewise.
Change-Id: I7a9ccc603b00db22a6275bc5ab69e1417148cb72
PR 25224
bfd * Makefile.am: Add z80-elf target support.
* configure.ac: Likewise.
* targets.c: Likewise.
* config.bfd: Add z80-elf target support and new arches: ez80 and z180.
* elf32-z80.c: New file.
* archures.c: Add new z80 architectures: eZ80 and Z180.
* coffcode.h: Likewise.
* cpu-z80.c: Likewise.
* bfd-in2.h: Likewise plus additional Z80 relocations.
* coff-z80.c: Add new relocations for Z80 target and local label check.
gas * config/tc-z80.c: Add new architectures: Z180 and eZ80. Add support
for assembler code generated by SDCC. Add new relocation types. Add
z80-elf target support.
* config/tc-z80.h: Add z80-elf target support. Enable dollar local
labels. Local labels starts from ".L".
* testsuite/gas/all/fwdexp.d: Fix failure due to symbol conflict.
* testsuite/gas/all/fwdexp.s: Likewise.
* testsuite/gas/z80/suffix.d: Fix failure on ELF target.
* testsuite/gas/z80/z80.exp: Add new tests
* testsuite/gas/z80/dollar.d: New file.
* testsuite/gas/z80/dollar.s: New file.
* testsuite/gas/z80/ez80_adl_all.d: New file.
* testsuite/gas/z80/ez80_adl_all.s: New file.
* testsuite/gas/z80/ez80_adl_suf.d: New file.
* testsuite/gas/z80/ez80_isuf.s: New file.
* testsuite/gas/z80/ez80_z80_all.d: New file.
* testsuite/gas/z80/ez80_z80_all.s: New file.
* testsuite/gas/z80/ez80_z80_suf.d: New file.
* testsuite/gas/z80/r800_extra.d: New file.
* testsuite/gas/z80/r800_extra.s: New file.
* testsuite/gas/z80/r800_ii8.d: New file.
* testsuite/gas/z80/r800_z80_doc.d: New file.
* testsuite/gas/z80/z180.d: New file.
* testsuite/gas/z80/z180.s: New file.
* testsuite/gas/z80/z180_z80_doc.d: New file.
* testsuite/gas/z80/z80_doc.d: New file.
* testsuite/gas/z80/z80_doc.s: New file.
* testsuite/gas/z80/z80_ii8.d: New file.
* testsuite/gas/z80/z80_ii8.s: New file.
* testsuite/gas/z80/z80_in_f_c.d: New file.
* testsuite/gas/z80/z80_in_f_c.s: New file.
* testsuite/gas/z80/z80_op_ii_ld.d: New file.
* testsuite/gas/z80/z80_op_ii_ld.s: New file.
* testsuite/gas/z80/z80_out_c_0.d: New file.
* testsuite/gas/z80/z80_out_c_0.s: New file.
* testsuite/gas/z80/z80_reloc.d: New file.
* testsuite/gas/z80/z80_reloc.s: New file.
* testsuite/gas/z80/z80_sli.d: New file.
* testsuite/gas/z80/z80_sli.s: New file.
ld * Makefile.am: Add new target z80-elf
* configure.tgt: Likewise.
* emultempl/z80.em: Add support for eZ80 and Z180 architectures.
* emulparams/elf32z80.sh: New file.
* emultempl/z80elf.em: Likewise.
* testsuite/ld-z80/arch_ez80_adl.d: Likewise.
* testsuite/ld-z80/arch_ez80_z80.d: Likewise.
* testsuite/ld-z80/arch_r800.d: Likewise.
* testsuite/ld-z80/arch_z180.d: Likewise.
* testsuite/ld-z80/arch_z80.d: Likewise.
* testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise.
* testsuite/ld-z80/comb_arch_z180.d: Likewise.
* testsuite/ld-z80/labels.s: Likewise.
* testsuite/ld-z80/relocs.s: Likewise.
* testsuite/ld-z80/relocs_b_ez80.d: Likewise.
* testsuite/ld-z80/relocs_b_z80.d: Likewise.
* testsuite/ld-z80/relocs_f_z80.d: Likewise.
* testsuite/ld-z80/z80.exp: Likewise.
opcodes * z80-dis.c: Add support for eZ80 and Z80 instructions.
This fixes PR 25210 by specifying the the correct ELF class for AArch64 stubs.
After doing this the stub section starts behaving like a normal object file
loaded from disk. That is SEC_LINKER_CREATED causes us to have to write the
section manually.
This flag was added as a fix for PR 24753. I believe that
fix to still be correct as linker created sections don't have a size on disk
and it fixes the Arm bootstrap regression. But in this case specifying the
correct section class also makes the stub section not be considered by
compress.c.
So I'm partially revert this change so that we don't have to manage the section
manually as implied by SEC_LINKER_CREATED.
bfd/ChangeLog:
PR 25210
PR 24753
* elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class.
ld/ChangeLog:
PR 25210
PR 24753
* emultempl/aarch64elf.em (elf${ELFSIZE}_aarch64_add_stub_section):
Remove SEC_LINKER_CREATED.
* testsuite/ld-aarch64/aarch64-elf.exp: Add erratum835769-843419.
* testsuite/ld-aarch64/erratum835769-843419.d: New test.
The variable INSTALL_PROGRAM_ENV sets up STRIPPROG for the cross-compiler.
If this is not done, the host 'strip' is used, and fails:
/bin/sh /c/src/repos/binutils-gdb.git/install-sh -c -s gdb.exe \
/gdb/gdb64-git/bin/$transformed_name.exe
strip.exe:C:/gdb/gdb64-git/bin/_inst.33599_: file format not recognized
With this change, it's fine:
STRIPPROG='x86_64-w64-mingw32-strip' \
/bin/sh /c/src/repos/binutils-gdb.git/install-sh -c -s gdb.exe \
/gdb/gdb64-git/bin/$transformed_name.exe
gdb/ChangeLog:
2020-01-01 Hannes Domani <ssbssa@yahoo.de>
* Makefile.in: Use INSTALL_PROGRAM_ENV.
gdb/gdbserver/ChangeLog:
2020-01-01 Hannes Domani <ssbssa@yahoo.de>
* Makefile.in: Use INSTALL_PROGRAM_ENV.
These are files that need to be updated by hand, because the copyright.py
script isn't able to handle them automatically.
gdb/ChangeLog:
* gdbarch.sh: Update copyright year range of generated files.
gdb/doc/ChangeLog:
* gdb.texinfo, refcard.tex: Update copyright year range.